Lines Matching refs:ccb
163 struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer; in blogic_init_ccbs() local
166 ccb->allocgrp_head = blkp; in blogic_init_ccbs()
167 ccb->allocgrp_size = blk_size; in blogic_init_ccbs()
169 ccb->status = BLOGIC_CCB_FREE; in blogic_init_ccbs()
170 ccb->adapter = adapter; in blogic_init_ccbs()
171 ccb->dma_handle = (u32) blkp + offset; in blogic_init_ccbs()
173 ccb->callback = blogic_qcompleted_ccb; in blogic_init_ccbs()
174 ccb->base_addr = adapter->fpinfo.base_addr; in blogic_init_ccbs()
176 ccb->next = adapter->free_ccbs; in blogic_init_ccbs()
177 ccb->next_all = adapter->all_ccbs; in blogic_init_ccbs()
178 adapter->free_ccbs = ccb; in blogic_init_ccbs()
179 adapter->all_ccbs = ccb; in blogic_init_ccbs()
181 ccb++; in blogic_init_ccbs()
217 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL; in blogic_destroy_ccbs() local
220 while ((ccb = next_ccb) != NULL) { in blogic_destroy_ccbs()
221 next_ccb = ccb->next_all; in blogic_destroy_ccbs()
222 if (ccb->allocgrp_head) { in blogic_destroy_ccbs()
227 lastccb = ccb; in blogic_destroy_ccbs()
281 struct blogic_ccb *ccb; in blogic_alloc_ccb() local
282 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
283 if (ccb != NULL) { in blogic_alloc_ccb()
284 ccb->serial = ++serial; in blogic_alloc_ccb()
285 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
286 ccb->next = NULL; in blogic_alloc_ccb()
290 return ccb; in blogic_alloc_ccb()
293 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
294 if (ccb == NULL) in blogic_alloc_ccb()
296 ccb->serial = ++serial; in blogic_alloc_ccb()
297 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
298 ccb->next = NULL; in blogic_alloc_ccb()
299 return ccb; in blogic_alloc_ccb()
309 static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap) in blogic_dealloc_ccb() argument
311 struct blogic_adapter *adapter = ccb->adapter; in blogic_dealloc_ccb()
313 if (ccb->command != NULL) in blogic_dealloc_ccb()
314 scsi_dma_unmap(ccb->command); in blogic_dealloc_ccb()
316 dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata, in blogic_dealloc_ccb()
317 ccb->sense_datalen, DMA_FROM_DEVICE); in blogic_dealloc_ccb()
319 ccb->command = NULL; in blogic_dealloc_ccb()
320 ccb->status = BLOGIC_CCB_FREE; in blogic_dealloc_ccb()
321 ccb->next = adapter->free_ccbs; in blogic_dealloc_ccb()
322 adapter->free_ccbs = ccb; in blogic_dealloc_ccb()
2596 static void blogic_qcompleted_ccb(struct blogic_ccb *ccb) in blogic_qcompleted_ccb() argument
2598 struct blogic_adapter *adapter = ccb->adapter; in blogic_qcompleted_ccb()
2600 ccb->status = BLOGIC_CCB_COMPLETE; in blogic_qcompleted_ccb()
2601 ccb->next = NULL; in blogic_qcompleted_ccb()
2603 adapter->firstccb = ccb; in blogic_qcompleted_ccb()
2604 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2606 adapter->lastccb->next = ccb; in blogic_qcompleted_ccb()
2607 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2609 adapter->active_cmds[ccb->tgt_id]--; in blogic_qcompleted_ccb()
2703 struct blogic_ccb *ccb = in blogic_scan_inbox() local
2704 (struct blogic_ccb *) bus_to_virt(next_inbox->ccb); in blogic_scan_inbox()
2706 if (ccb->status == BLOGIC_CCB_ACTIVE || in blogic_scan_inbox()
2707 ccb->status == BLOGIC_CCB_RESET) { in blogic_scan_inbox()
2712 ccb->comp_code = comp_code; in blogic_scan_inbox()
2713 blogic_qcompleted_ccb(ccb); in blogic_scan_inbox()
2721 …blogic_warn("Illegal CCB #%ld status %d in Incoming Mailbox\n", adapter, ccb->serial, ccb->status); in blogic_scan_inbox()
2745 struct blogic_ccb *ccb = adapter->firstccb; in blogic_process_ccbs() local
2746 struct scsi_cmnd *command = ccb->command; in blogic_process_ccbs()
2747 adapter->firstccb = ccb->next; in blogic_process_ccbs()
2753 if (ccb->opcode == BLOGIC_BDR) { in blogic_process_ccbs()
2754 int tgt_id = ccb->tgt_id; in blogic_process_ccbs()
2756 blogic_warn("Bus Device Reset CCB #%ld to Target %d Completed\n", adapter, ccb->serial, tgt_id); in blogic_process_ccbs()
2764 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2788 for (ccb = adapter->all_ccbs; ccb != NULL; in blogic_process_ccbs()
2789 ccb = ccb->next_all) in blogic_process_ccbs()
2790 if (ccb->status == BLOGIC_CCB_RESET && in blogic_process_ccbs()
2791 ccb->tgt_id == tgt_id) { in blogic_process_ccbs()
2792 command = ccb->command; in blogic_process_ccbs()
2793 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2805 switch (ccb->comp_code) { in blogic_process_ccbs()
2809 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2812 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2814 adapter->tgt_flags[ccb->tgt_id] in blogic_process_ccbs()
2820 adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2821 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done); in blogic_process_ccbs()
2826 ccb->adapter_status, ccb->tgt_status); in blogic_process_ccbs()
2827 if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) { in blogic_process_ccbs()
2828 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2833 …tatus %02X Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter… in blogic_process_ccbs()
2835 for (i = 0; i < ccb->cdblen; i++) in blogic_process_ccbs()
2836 blogic_notice(" %02X", adapter, ccb->cdb[i]); in blogic_process_ccbs()
2839 for (i = 0; i < ccb->sense_datalen; i++) in blogic_process_ccbs()
2851 if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 && in blogic_process_ccbs()
2852 ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) { in blogic_process_ccbs()
2854 &adapter->tgt_flags[ccb->tgt_id]; in blogic_process_ccbs()
2864 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2967 enum blogic_action action, struct blogic_ccb *ccb) in blogic_write_outbox() argument
2973 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_write_outbox()
2980 next_outbox->ccb = ccb->dma_handle; in blogic_write_outbox()
2987 adapter->active_cmds[ccb->tgt_id]++; in blogic_write_outbox()
2988 if (ccb->opcode != BLOGIC_BDR) in blogic_write_outbox()
2989 adapter->tgt_stats[ccb->tgt_id].cmds_tried++; in blogic_write_outbox()
3035 struct blogic_ccb *ccb; in blogic_qcmd_lck() local
3056 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3057 if (ccb == NULL) { in blogic_qcmd_lck()
3061 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3062 if (ccb == NULL) { in blogic_qcmd_lck()
3078 ccb->opcode = BLOGIC_INITIATOR_CCB_SG; in blogic_qcmd_lck()
3079 ccb->datalen = count * sizeof(struct blogic_sg_seg); in blogic_qcmd_lck()
3081 ccb->data = (unsigned int) ccb->dma_handle + in blogic_qcmd_lck()
3082 ((unsigned long) &ccb->sglist - in blogic_qcmd_lck()
3083 (unsigned long) ccb); in blogic_qcmd_lck()
3085 ccb->data = virt_to_32bit_virt(ccb->sglist); in blogic_qcmd_lck()
3088 ccb->sglist[i].segbytes = sg_dma_len(sg); in blogic_qcmd_lck()
3089 ccb->sglist[i].segdata = sg_dma_address(sg); in blogic_qcmd_lck()
3092 ccb->opcode = BLOGIC_INITIATOR_CCB; in blogic_qcmd_lck()
3093 ccb->datalen = buflen; in blogic_qcmd_lck()
3094 ccb->data = 0; in blogic_qcmd_lck()
3100 ccb->datadir = BLOGIC_DATAIN_CHECKED; in blogic_qcmd_lck()
3107 ccb->datadir = BLOGIC_DATAOUT_CHECKED; in blogic_qcmd_lck()
3113 ccb->datadir = BLOGIC_UNCHECKED_TX; in blogic_qcmd_lck()
3116 ccb->cdblen = cdblen; in blogic_qcmd_lck()
3117 ccb->adapter_status = 0; in blogic_qcmd_lck()
3118 ccb->tgt_status = 0; in blogic_qcmd_lck()
3119 ccb->tgt_id = tgt_id; in blogic_qcmd_lck()
3120 ccb->lun = lun; in blogic_qcmd_lck()
3121 ccb->tag_enable = false; in blogic_qcmd_lck()
3122 ccb->legacytag_enable = false; in blogic_qcmd_lck()
3173 ccb->tag_enable = true; in blogic_qcmd_lck()
3174 ccb->queuetag = queuetag; in blogic_qcmd_lck()
3176 ccb->legacytag_enable = true; in blogic_qcmd_lck()
3177 ccb->legacy_tag = queuetag; in blogic_qcmd_lck()
3180 memcpy(ccb->cdb, cdb, cdblen); in blogic_qcmd_lck()
3181 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE; in blogic_qcmd_lck()
3182 ccb->command = command; in blogic_qcmd_lck()
3184 command->sense_buffer, ccb->sense_datalen, in blogic_qcmd_lck()
3189 blogic_dealloc_ccb(ccb, 0); in blogic_qcmd_lck()
3192 ccb->sensedata = sense_buf; in blogic_qcmd_lck()
3205 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) { in blogic_qcmd_lck()
3211 ccb)) { in blogic_qcmd_lck()
3213 blogic_dealloc_ccb(ccb, 1); in blogic_qcmd_lck()
3223 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_qcmd_lck()
3226 FlashPoint_StartCCB(adapter->cardhandle, ccb); in blogic_qcmd_lck()
3232 if (ccb->status == BLOGIC_CCB_COMPLETE) in blogic_qcmd_lck()
3251 struct blogic_ccb *ccb; in DEF_SCSI_QCMD()
3258 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) in DEF_SCSI_QCMD()
3259 if (ccb->command == command) in DEF_SCSI_QCMD()
3261 if (ccb == NULL) { in DEF_SCSI_QCMD()
3264 } else if (ccb->status == BLOGIC_CCB_COMPLETE) { in DEF_SCSI_QCMD()
3267 } else if (ccb->status == BLOGIC_CCB_RESET) { in DEF_SCSI_QCMD()
3286 …blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->ser… in DEF_SCSI_QCMD()
3289 ccb)) { in DEF_SCSI_QCMD()
3291 adapter, ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3295 …blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->seria… in DEF_SCSI_QCMD()
3304 ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3306 FlashPoint_AbortCCB(adapter->cardhandle, ccb); in DEF_SCSI_QCMD()
3312 if (ccb->status == BLOGIC_CCB_COMPLETE) in DEF_SCSI_QCMD()
3327 struct blogic_ccb *ccb; local
3345 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3346 if (ccb->status == BLOGIC_CCB_ACTIVE)
3347 blogic_dealloc_ccb(ccb, 1);