Lines Matching refs:ccb

162 	struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer;  in blogic_init_ccbs()  local
165 ccb->allocgrp_head = blkp; in blogic_init_ccbs()
166 ccb->allocgrp_size = blk_size; in blogic_init_ccbs()
168 ccb->status = BLOGIC_CCB_FREE; in blogic_init_ccbs()
169 ccb->adapter = adapter; in blogic_init_ccbs()
170 ccb->dma_handle = (u32) blkp + offset; in blogic_init_ccbs()
172 ccb->callback = blogic_qcompleted_ccb; in blogic_init_ccbs()
173 ccb->base_addr = adapter->fpinfo.base_addr; in blogic_init_ccbs()
175 ccb->next = adapter->free_ccbs; in blogic_init_ccbs()
176 ccb->next_all = adapter->all_ccbs; in blogic_init_ccbs()
177 adapter->free_ccbs = ccb; in blogic_init_ccbs()
178 adapter->all_ccbs = ccb; in blogic_init_ccbs()
180 ccb++; in blogic_init_ccbs()
216 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL; in blogic_destroy_ccbs() local
219 while ((ccb = next_ccb) != NULL) { in blogic_destroy_ccbs()
220 next_ccb = ccb->next_all; in blogic_destroy_ccbs()
221 if (ccb->allocgrp_head) { in blogic_destroy_ccbs()
226 lastccb = ccb; in blogic_destroy_ccbs()
280 struct blogic_ccb *ccb; in blogic_alloc_ccb() local
281 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
282 if (ccb != NULL) { in blogic_alloc_ccb()
283 ccb->serial = ++serial; in blogic_alloc_ccb()
284 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
285 ccb->next = NULL; in blogic_alloc_ccb()
289 return ccb; in blogic_alloc_ccb()
292 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
293 if (ccb == NULL) in blogic_alloc_ccb()
295 ccb->serial = ++serial; in blogic_alloc_ccb()
296 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
297 ccb->next = NULL; in blogic_alloc_ccb()
298 return ccb; in blogic_alloc_ccb()
308 static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap) in blogic_dealloc_ccb() argument
310 struct blogic_adapter *adapter = ccb->adapter; in blogic_dealloc_ccb()
312 if (ccb->command != NULL) in blogic_dealloc_ccb()
313 scsi_dma_unmap(ccb->command); in blogic_dealloc_ccb()
315 dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata, in blogic_dealloc_ccb()
316 ccb->sense_datalen, DMA_FROM_DEVICE); in blogic_dealloc_ccb()
318 ccb->command = NULL; in blogic_dealloc_ccb()
319 ccb->status = BLOGIC_CCB_FREE; in blogic_dealloc_ccb()
320 ccb->next = adapter->free_ccbs; in blogic_dealloc_ccb()
321 adapter->free_ccbs = ccb; in blogic_dealloc_ccb()
2595 static void blogic_qcompleted_ccb(struct blogic_ccb *ccb) in blogic_qcompleted_ccb() argument
2597 struct blogic_adapter *adapter = ccb->adapter; in blogic_qcompleted_ccb()
2599 ccb->status = BLOGIC_CCB_COMPLETE; in blogic_qcompleted_ccb()
2600 ccb->next = NULL; in blogic_qcompleted_ccb()
2602 adapter->firstccb = ccb; in blogic_qcompleted_ccb()
2603 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2605 adapter->lastccb->next = ccb; in blogic_qcompleted_ccb()
2606 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2608 adapter->active_cmds[ccb->tgt_id]--; in blogic_qcompleted_ccb()
2702 struct blogic_ccb *ccb = in blogic_scan_inbox() local
2703 (struct blogic_ccb *) bus_to_virt(next_inbox->ccb); in blogic_scan_inbox()
2705 if (ccb->status == BLOGIC_CCB_ACTIVE || in blogic_scan_inbox()
2706 ccb->status == BLOGIC_CCB_RESET) { in blogic_scan_inbox()
2711 ccb->comp_code = comp_code; in blogic_scan_inbox()
2712 blogic_qcompleted_ccb(ccb); in blogic_scan_inbox()
2720 …blogic_warn("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", adapter, ccb->serial, ccb->stat… in blogic_scan_inbox()
2744 struct blogic_ccb *ccb = adapter->firstccb; in blogic_process_ccbs() local
2745 struct scsi_cmnd *command = ccb->command; in blogic_process_ccbs()
2746 adapter->firstccb = ccb->next; in blogic_process_ccbs()
2752 if (ccb->opcode == BLOGIC_BDR) { in blogic_process_ccbs()
2753 int tgt_id = ccb->tgt_id; in blogic_process_ccbs()
2755 …blogic_warn("Bus Device Reset CCB #%ld to Target " "%d Completed\n", adapter, ccb->serial, tgt_id); in blogic_process_ccbs()
2763 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2787 for (ccb = adapter->all_ccbs; ccb != NULL; in blogic_process_ccbs()
2788 ccb = ccb->next_all) in blogic_process_ccbs()
2789 if (ccb->status == BLOGIC_CCB_RESET && in blogic_process_ccbs()
2790 ccb->tgt_id == tgt_id) { in blogic_process_ccbs()
2791 command = ccb->command; in blogic_process_ccbs()
2792 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2804 switch (ccb->comp_code) { in blogic_process_ccbs()
2808 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2811 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2813 adapter->tgt_flags[ccb->tgt_id] in blogic_process_ccbs()
2819 adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2820 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done); in blogic_process_ccbs()
2825 ccb->adapter_status, ccb->tgt_status); in blogic_process_ccbs()
2826 if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) { in blogic_process_ccbs()
2827 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2832 …us %02X " "Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter… in blogic_process_ccbs()
2834 for (i = 0; i < ccb->cdblen; i++) in blogic_process_ccbs()
2835 blogic_notice(" %02X", adapter, ccb->cdb[i]); in blogic_process_ccbs()
2838 for (i = 0; i < ccb->sense_datalen; i++) in blogic_process_ccbs()
2850 if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 && in blogic_process_ccbs()
2851 ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) { in blogic_process_ccbs()
2853 &adapter->tgt_flags[ccb->tgt_id]; in blogic_process_ccbs()
2863 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2966 enum blogic_action action, struct blogic_ccb *ccb) in blogic_write_outbox() argument
2972 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_write_outbox()
2979 next_outbox->ccb = ccb->dma_handle; in blogic_write_outbox()
2986 adapter->active_cmds[ccb->tgt_id]++; in blogic_write_outbox()
2987 if (ccb->opcode != BLOGIC_BDR) in blogic_write_outbox()
2988 adapter->tgt_stats[ccb->tgt_id].cmds_tried++; in blogic_write_outbox()
3034 struct blogic_ccb *ccb; in blogic_qcmd_lck() local
3055 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3056 if (ccb == NULL) { in blogic_qcmd_lck()
3060 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3061 if (ccb == NULL) { in blogic_qcmd_lck()
3077 ccb->opcode = BLOGIC_INITIATOR_CCB_SG; in blogic_qcmd_lck()
3078 ccb->datalen = count * sizeof(struct blogic_sg_seg); in blogic_qcmd_lck()
3080 ccb->data = (void *)((unsigned int) ccb->dma_handle + in blogic_qcmd_lck()
3081 ((unsigned long) &ccb->sglist - in blogic_qcmd_lck()
3082 (unsigned long) ccb)); in blogic_qcmd_lck()
3084 ccb->data = ccb->sglist; in blogic_qcmd_lck()
3087 ccb->sglist[i].segbytes = sg_dma_len(sg); in blogic_qcmd_lck()
3088 ccb->sglist[i].segdata = sg_dma_address(sg); in blogic_qcmd_lck()
3091 ccb->opcode = BLOGIC_INITIATOR_CCB; in blogic_qcmd_lck()
3092 ccb->datalen = buflen; in blogic_qcmd_lck()
3093 ccb->data = 0; in blogic_qcmd_lck()
3099 ccb->datadir = BLOGIC_DATAIN_CHECKED; in blogic_qcmd_lck()
3106 ccb->datadir = BLOGIC_DATAOUT_CHECKED; in blogic_qcmd_lck()
3112 ccb->datadir = BLOGIC_UNCHECKED_TX; in blogic_qcmd_lck()
3115 ccb->cdblen = cdblen; in blogic_qcmd_lck()
3116 ccb->adapter_status = 0; in blogic_qcmd_lck()
3117 ccb->tgt_status = 0; in blogic_qcmd_lck()
3118 ccb->tgt_id = tgt_id; in blogic_qcmd_lck()
3119 ccb->lun = lun; in blogic_qcmd_lck()
3120 ccb->tag_enable = false; in blogic_qcmd_lck()
3121 ccb->legacytag_enable = false; in blogic_qcmd_lck()
3172 ccb->tag_enable = true; in blogic_qcmd_lck()
3173 ccb->queuetag = queuetag; in blogic_qcmd_lck()
3175 ccb->legacytag_enable = true; in blogic_qcmd_lck()
3176 ccb->legacy_tag = queuetag; in blogic_qcmd_lck()
3179 memcpy(ccb->cdb, cdb, cdblen); in blogic_qcmd_lck()
3180 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE; in blogic_qcmd_lck()
3181 ccb->command = command; in blogic_qcmd_lck()
3183 command->sense_buffer, ccb->sense_datalen, in blogic_qcmd_lck()
3188 blogic_dealloc_ccb(ccb, 0); in blogic_qcmd_lck()
3191 ccb->sensedata = sense_buf; in blogic_qcmd_lck()
3204 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) { in blogic_qcmd_lck()
3210 ccb)) { in blogic_qcmd_lck()
3212 blogic_dealloc_ccb(ccb, 1); in blogic_qcmd_lck()
3222 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_qcmd_lck()
3225 FlashPoint_StartCCB(adapter->cardhandle, ccb); in blogic_qcmd_lck()
3231 if (ccb->status == BLOGIC_CCB_COMPLETE) in blogic_qcmd_lck()
3250 struct blogic_ccb *ccb; in DEF_SCSI_QCMD()
3257 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) in DEF_SCSI_QCMD()
3258 if (ccb->command == command) in DEF_SCSI_QCMD()
3260 if (ccb == NULL) { in DEF_SCSI_QCMD()
3263 } else if (ccb->status == BLOGIC_CCB_COMPLETE) { in DEF_SCSI_QCMD()
3266 } else if (ccb->status == BLOGIC_CCB_RESET) { in DEF_SCSI_QCMD()
3285 …blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->ser… in DEF_SCSI_QCMD()
3288 ccb)) { in DEF_SCSI_QCMD()
3290 adapter, ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3294 …blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->seria… in DEF_SCSI_QCMD()
3303 ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3305 FlashPoint_AbortCCB(adapter->cardhandle, ccb); in DEF_SCSI_QCMD()
3311 if (ccb->status == BLOGIC_CCB_COMPLETE) in DEF_SCSI_QCMD()
3326 struct blogic_ccb *ccb; local
3344 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3345 if (ccb->status == BLOGIC_CCB_ACTIVE)
3346 blogic_dealloc_ccb(ccb, 1);