Lines Matching refs:ccb
169 struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer; in blogic_init_ccbs() local
172 ccb->allocgrp_head = blkp; in blogic_init_ccbs()
173 ccb->allocgrp_size = blk_size; in blogic_init_ccbs()
175 ccb->status = BLOGIC_CCB_FREE; in blogic_init_ccbs()
176 ccb->adapter = adapter; in blogic_init_ccbs()
177 ccb->dma_handle = (u32) blkp + offset; in blogic_init_ccbs()
179 ccb->callback = blogic_qcompleted_ccb; in blogic_init_ccbs()
180 ccb->base_addr = adapter->fpinfo.base_addr; in blogic_init_ccbs()
182 ccb->next = adapter->free_ccbs; in blogic_init_ccbs()
183 ccb->next_all = adapter->all_ccbs; in blogic_init_ccbs()
184 adapter->free_ccbs = ccb; in blogic_init_ccbs()
185 adapter->all_ccbs = ccb; in blogic_init_ccbs()
187 ccb++; in blogic_init_ccbs()
223 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL; in blogic_destroy_ccbs() local
226 while ((ccb = next_ccb) != NULL) { in blogic_destroy_ccbs()
227 next_ccb = ccb->next_all; in blogic_destroy_ccbs()
228 if (ccb->allocgrp_head) { in blogic_destroy_ccbs()
233 lastccb = ccb; in blogic_destroy_ccbs()
286 struct blogic_ccb *ccb; in blogic_alloc_ccb() local
287 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
288 if (ccb != NULL) { in blogic_alloc_ccb()
289 ccb->serial = ++serial; in blogic_alloc_ccb()
290 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
291 ccb->next = NULL; in blogic_alloc_ccb()
295 return ccb; in blogic_alloc_ccb()
298 ccb = adapter->free_ccbs; in blogic_alloc_ccb()
299 if (ccb == NULL) in blogic_alloc_ccb()
301 ccb->serial = ++serial; in blogic_alloc_ccb()
302 adapter->free_ccbs = ccb->next; in blogic_alloc_ccb()
303 ccb->next = NULL; in blogic_alloc_ccb()
304 return ccb; in blogic_alloc_ccb()
314 static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap) in blogic_dealloc_ccb() argument
316 struct blogic_adapter *adapter = ccb->adapter; in blogic_dealloc_ccb()
318 if (ccb->command != NULL) in blogic_dealloc_ccb()
319 scsi_dma_unmap(ccb->command); in blogic_dealloc_ccb()
321 pci_unmap_single(adapter->pci_device, ccb->sensedata, in blogic_dealloc_ccb()
322 ccb->sense_datalen, PCI_DMA_FROMDEVICE); in blogic_dealloc_ccb()
324 ccb->command = NULL; in blogic_dealloc_ccb()
325 ccb->status = BLOGIC_CCB_FREE; in blogic_dealloc_ccb()
326 ccb->next = adapter->free_ccbs; in blogic_dealloc_ccb()
327 adapter->free_ccbs = ccb; in blogic_dealloc_ccb()
2600 static void blogic_qcompleted_ccb(struct blogic_ccb *ccb) in blogic_qcompleted_ccb() argument
2602 struct blogic_adapter *adapter = ccb->adapter; in blogic_qcompleted_ccb()
2604 ccb->status = BLOGIC_CCB_COMPLETE; in blogic_qcompleted_ccb()
2605 ccb->next = NULL; in blogic_qcompleted_ccb()
2607 adapter->firstccb = ccb; in blogic_qcompleted_ccb()
2608 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2610 adapter->lastccb->next = ccb; in blogic_qcompleted_ccb()
2611 adapter->lastccb = ccb; in blogic_qcompleted_ccb()
2613 adapter->active_cmds[ccb->tgt_id]--; in blogic_qcompleted_ccb()
2706 struct blogic_ccb *ccb = in blogic_scan_inbox() local
2707 (struct blogic_ccb *) bus_to_virt(next_inbox->ccb); in blogic_scan_inbox()
2709 if (ccb->status == BLOGIC_CCB_ACTIVE || in blogic_scan_inbox()
2710 ccb->status == BLOGIC_CCB_RESET) { in blogic_scan_inbox()
2715 ccb->comp_code = comp_code; in blogic_scan_inbox()
2716 blogic_qcompleted_ccb(ccb); in blogic_scan_inbox()
2724 …blogic_warn("Illegal CCB #%ld status %d in " "Incoming Mailbox\n", adapter, ccb->serial, ccb->stat… in blogic_scan_inbox()
2748 struct blogic_ccb *ccb = adapter->firstccb; in blogic_process_ccbs() local
2749 struct scsi_cmnd *command = ccb->command; in blogic_process_ccbs()
2750 adapter->firstccb = ccb->next; in blogic_process_ccbs()
2756 if (ccb->opcode == BLOGIC_BDR) { in blogic_process_ccbs()
2757 int tgt_id = ccb->tgt_id; in blogic_process_ccbs()
2759 …blogic_warn("Bus Device Reset CCB #%ld to Target " "%d Completed\n", adapter, ccb->serial, tgt_id); in blogic_process_ccbs()
2767 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2791 for (ccb = adapter->all_ccbs; ccb != NULL; in blogic_process_ccbs()
2792 ccb = ccb->next_all) in blogic_process_ccbs()
2793 if (ccb->status == BLOGIC_CCB_RESET && in blogic_process_ccbs()
2794 ccb->tgt_id == tgt_id) { in blogic_process_ccbs()
2795 command = ccb->command; in blogic_process_ccbs()
2796 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2808 switch (ccb->comp_code) { in blogic_process_ccbs()
2812 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2815 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2817 adapter->tgt_flags[ccb->tgt_id] in blogic_process_ccbs()
2823 adapter, ccb->serial, ccb->tgt_id); in blogic_process_ccbs()
2824 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done); in blogic_process_ccbs()
2829 ccb->adapter_status, ccb->tgt_status); in blogic_process_ccbs()
2830 if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) { in blogic_process_ccbs()
2831 adapter->tgt_stats[ccb->tgt_id] in blogic_process_ccbs()
2836 …us %02X " "Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter… in blogic_process_ccbs()
2838 for (i = 0; i < ccb->cdblen; i++) in blogic_process_ccbs()
2839 blogic_notice(" %02X", adapter, ccb->cdb[i]); in blogic_process_ccbs()
2842 for (i = 0; i < ccb->sense_datalen; i++) in blogic_process_ccbs()
2854 if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 && in blogic_process_ccbs()
2855 ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) { in blogic_process_ccbs()
2857 &adapter->tgt_flags[ccb->tgt_id]; in blogic_process_ccbs()
2867 blogic_dealloc_ccb(ccb, 1); in blogic_process_ccbs()
2970 enum blogic_action action, struct blogic_ccb *ccb) in blogic_write_outbox() argument
2976 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_write_outbox()
2983 next_outbox->ccb = ccb->dma_handle; in blogic_write_outbox()
2990 adapter->active_cmds[ccb->tgt_id]++; in blogic_write_outbox()
2991 if (ccb->opcode != BLOGIC_BDR) in blogic_write_outbox()
2992 adapter->tgt_stats[ccb->tgt_id].cmds_tried++; in blogic_write_outbox()
3038 struct blogic_ccb *ccb; in blogic_qcmd_lck() local
3059 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3060 if (ccb == NULL) { in blogic_qcmd_lck()
3064 ccb = blogic_alloc_ccb(adapter); in blogic_qcmd_lck()
3065 if (ccb == NULL) { in blogic_qcmd_lck()
3081 ccb->opcode = BLOGIC_INITIATOR_CCB_SG; in blogic_qcmd_lck()
3082 ccb->datalen = count * sizeof(struct blogic_sg_seg); in blogic_qcmd_lck()
3084 ccb->data = (void *)((unsigned int) ccb->dma_handle + in blogic_qcmd_lck()
3085 ((unsigned long) &ccb->sglist - in blogic_qcmd_lck()
3086 (unsigned long) ccb)); in blogic_qcmd_lck()
3088 ccb->data = ccb->sglist; in blogic_qcmd_lck()
3091 ccb->sglist[i].segbytes = sg_dma_len(sg); in blogic_qcmd_lck()
3092 ccb->sglist[i].segdata = sg_dma_address(sg); in blogic_qcmd_lck()
3095 ccb->opcode = BLOGIC_INITIATOR_CCB; in blogic_qcmd_lck()
3096 ccb->datalen = buflen; in blogic_qcmd_lck()
3097 ccb->data = 0; in blogic_qcmd_lck()
3103 ccb->datadir = BLOGIC_DATAIN_CHECKED; in blogic_qcmd_lck()
3110 ccb->datadir = BLOGIC_DATAOUT_CHECKED; in blogic_qcmd_lck()
3116 ccb->datadir = BLOGIC_UNCHECKED_TX; in blogic_qcmd_lck()
3119 ccb->cdblen = cdblen; in blogic_qcmd_lck()
3120 ccb->adapter_status = 0; in blogic_qcmd_lck()
3121 ccb->tgt_status = 0; in blogic_qcmd_lck()
3122 ccb->tgt_id = tgt_id; in blogic_qcmd_lck()
3123 ccb->lun = lun; in blogic_qcmd_lck()
3124 ccb->tag_enable = false; in blogic_qcmd_lck()
3125 ccb->legacytag_enable = false; in blogic_qcmd_lck()
3176 ccb->tag_enable = true; in blogic_qcmd_lck()
3177 ccb->queuetag = queuetag; in blogic_qcmd_lck()
3179 ccb->legacytag_enable = true; in blogic_qcmd_lck()
3180 ccb->legacy_tag = queuetag; in blogic_qcmd_lck()
3183 memcpy(ccb->cdb, cdb, cdblen); in blogic_qcmd_lck()
3184 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE; in blogic_qcmd_lck()
3185 ccb->command = command; in blogic_qcmd_lck()
3187 command->sense_buffer, ccb->sense_datalen, in blogic_qcmd_lck()
3192 blogic_dealloc_ccb(ccb, 0); in blogic_qcmd_lck()
3195 ccb->sensedata = sense_buf; in blogic_qcmd_lck()
3208 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) { in blogic_qcmd_lck()
3214 ccb)) { in blogic_qcmd_lck()
3216 blogic_dealloc_ccb(ccb, 1); in blogic_qcmd_lck()
3226 ccb->status = BLOGIC_CCB_ACTIVE; in blogic_qcmd_lck()
3229 FlashPoint_StartCCB(adapter->cardhandle, ccb); in blogic_qcmd_lck()
3235 if (ccb->status == BLOGIC_CCB_COMPLETE) in blogic_qcmd_lck()
3254 struct blogic_ccb *ccb; in DEF_SCSI_QCMD()
3261 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all) in DEF_SCSI_QCMD()
3262 if (ccb->command == command) in DEF_SCSI_QCMD()
3264 if (ccb == NULL) { in DEF_SCSI_QCMD()
3267 } else if (ccb->status == BLOGIC_CCB_COMPLETE) { in DEF_SCSI_QCMD()
3270 } else if (ccb->status == BLOGIC_CCB_RESET) { in DEF_SCSI_QCMD()
3289 …blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->ser… in DEF_SCSI_QCMD()
3292 ccb)) { in DEF_SCSI_QCMD()
3294 adapter, ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3298 …blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->seria… in DEF_SCSI_QCMD()
3307 ccb->serial, tgt_id); in DEF_SCSI_QCMD()
3309 FlashPoint_AbortCCB(adapter->cardhandle, ccb); in DEF_SCSI_QCMD()
3315 if (ccb->status == BLOGIC_CCB_COMPLETE) in DEF_SCSI_QCMD()
3330 struct blogic_ccb *ccb; local
3348 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3349 if (ccb->status == BLOGIC_CCB_ACTIVE)
3350 blogic_dealloc_ccb(ccb, 1);