Lines Matching defs:ccb
163 struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer;
166 ccb->allocgrp_head = blkp;
167 ccb->allocgrp_size = blk_size;
169 ccb->status = BLOGIC_CCB_FREE;
170 ccb->adapter = adapter;
171 ccb->dma_handle = (u32) blkp + offset;
173 ccb->callback = blogic_qcompleted_ccb;
174 ccb->base_addr = adapter->fpinfo.base_addr;
176 ccb->next = adapter->free_ccbs;
177 ccb->next_all = adapter->all_ccbs;
178 adapter->free_ccbs = ccb;
179 adapter->all_ccbs = ccb;
181 ccb++;
217 struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL;
220 while ((ccb = next_ccb) != NULL) {
221 next_ccb = ccb->next_all;
222 if (ccb->allocgrp_head) {
227 lastccb = ccb;
281 struct blogic_ccb *ccb;
282 ccb = adapter->free_ccbs;
283 if (ccb != NULL) {
284 ccb->serial = ++serial;
285 adapter->free_ccbs = ccb->next;
286 ccb->next = NULL;
290 return ccb;
293 ccb = adapter->free_ccbs;
294 if (ccb == NULL)
296 ccb->serial = ++serial;
297 adapter->free_ccbs = ccb->next;
298 ccb->next = NULL;
299 return ccb;
309 static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap)
311 struct blogic_adapter *adapter = ccb->adapter;
313 if (ccb->command != NULL)
314 scsi_dma_unmap(ccb->command);
316 dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata,
317 ccb->sense_datalen, DMA_FROM_DEVICE);
319 ccb->command = NULL;
320 ccb->status = BLOGIC_CCB_FREE;
321 ccb->next = adapter->free_ccbs;
322 adapter->free_ccbs = ccb;
2442 static void blogic_qcompleted_ccb(struct blogic_ccb *ccb)
2444 struct blogic_adapter *adapter = ccb->adapter;
2446 ccb->status = BLOGIC_CCB_COMPLETE;
2447 ccb->next = NULL;
2449 adapter->firstccb = ccb;
2450 adapter->lastccb = ccb;
2452 adapter->lastccb->next = ccb;
2453 adapter->lastccb = ccb;
2455 adapter->active_cmds[ccb->tgt_id]--;
2517 * turn the dma address from an inbox into a ccb pointer
2523 struct blogic_ccb *ccb;
2525 for (ccb = adapter->all_ccbs; ccb; ccb = ccb->next_all)
2526 if (inbox->ccb == ccb->dma_handle)
2529 return ccb;
2555 struct blogic_ccb *ccb = blogic_inbox_to_ccb(adapter, next_inbox);
2556 if (!ccb) {
2561 blogic_warn("Could not find CCB for dma address %x\n", adapter, next_inbox->ccb);
2563 if (ccb->status == BLOGIC_CCB_ACTIVE ||
2564 ccb->status == BLOGIC_CCB_RESET) {
2569 ccb->comp_code = comp_code;
2570 blogic_qcompleted_ccb(ccb);
2578 blogic_warn("Illegal CCB #%ld status %d in Incoming Mailbox\n", adapter, ccb->serial, ccb->status);
2602 struct blogic_ccb *ccb = adapter->firstccb;
2603 struct scsi_cmnd *command = ccb->command;
2604 adapter->firstccb = ccb->next;
2610 if (ccb->opcode == BLOGIC_BDR) {
2611 int tgt_id = ccb->tgt_id;
2613 blogic_warn("Bus Device Reset CCB #%ld to Target %d Completed\n", adapter, ccb->serial, tgt_id);
2621 blogic_dealloc_ccb(ccb, 1);
2645 for (ccb = adapter->all_ccbs; ccb != NULL;
2646 ccb = ccb->next_all)
2647 if (ccb->status == BLOGIC_CCB_RESET &&
2648 ccb->tgt_id == tgt_id) {
2649 command = ccb->command;
2650 blogic_dealloc_ccb(ccb, 1);
2662 switch (ccb->comp_code) {
2666 blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id);
2669 adapter->tgt_stats[ccb->tgt_id]
2671 adapter->tgt_flags[ccb->tgt_id]
2677 adapter, ccb->serial, ccb->tgt_id);
2678 blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done);
2683 ccb->adapter_status, ccb->tgt_status);
2684 if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) {
2685 adapter->tgt_stats[ccb->tgt_id]
2690 "Adapter Status %02X Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter_status, ccb->tgt_status);
2692 for (i = 0; i < ccb->cdblen; i++)
2693 blogic_notice(" %02X", adapter, ccb->cdb[i]);
2696 for (i = 0; i < ccb->sense_datalen; i++)
2708 if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 &&
2709 ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) {
2711 &adapter->tgt_flags[ccb->tgt_id];
2721 blogic_dealloc_ccb(ccb, 1);
2824 enum blogic_action action, struct blogic_ccb *ccb)
2830 ccb->status = BLOGIC_CCB_ACTIVE;
2837 next_outbox->ccb = ccb->dma_handle;
2844 adapter->active_cmds[ccb->tgt_id]++;
2845 if (ccb->opcode != BLOGIC_BDR)
2846 adapter->tgt_stats[ccb->tgt_id].cmds_tried++;
2892 struct blogic_ccb *ccb;
2913 ccb = blogic_alloc_ccb(adapter);
2914 if (ccb == NULL) {
2918 ccb = blogic_alloc_ccb(adapter);
2919 if (ccb == NULL) {
2935 ccb->opcode = BLOGIC_INITIATOR_CCB_SG;
2936 ccb->datalen = count * sizeof(struct blogic_sg_seg);
2938 ccb->data = (unsigned int) ccb->dma_handle +
2939 ((unsigned long) &ccb->sglist -
2940 (unsigned long) ccb);
2942 ccb->data = virt_to_32bit_virt(ccb->sglist);
2945 ccb->sglist[i].segbytes = sg_dma_len(sg);
2946 ccb->sglist[i].segdata = sg_dma_address(sg);
2949 ccb->opcode = BLOGIC_INITIATOR_CCB;
2950 ccb->datalen = buflen;
2951 ccb->data = 0;
2957 ccb->datadir = BLOGIC_DATAIN_CHECKED;
2964 ccb->datadir = BLOGIC_DATAOUT_CHECKED;
2970 ccb->datadir = BLOGIC_UNCHECKED_TX;
2973 ccb->cdblen = cdblen;
2974 ccb->adapter_status = 0;
2975 ccb->tgt_status = 0;
2976 ccb->tgt_id = tgt_id;
2977 ccb->lun = lun;
2978 ccb->tag_enable = false;
2979 ccb->legacytag_enable = false;
3030 ccb->tag_enable = true;
3031 ccb->queuetag = queuetag;
3033 ccb->legacytag_enable = true;
3034 ccb->legacy_tag = queuetag;
3037 memcpy(ccb->cdb, cdb, cdblen);
3038 ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
3039 ccb->command = command;
3041 command->sense_buffer, ccb->sense_datalen,
3046 blogic_dealloc_ccb(ccb, 0);
3049 ccb->sensedata = sense_buf;
3061 if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) {
3067 ccb)) {
3069 blogic_dealloc_ccb(ccb, 1);
3079 ccb->status = BLOGIC_CCB_ACTIVE;
3082 FlashPoint_StartCCB(adapter->cardhandle, ccb);
3088 if (ccb->status == BLOGIC_CCB_COMPLETE)
3107 struct blogic_ccb *ccb;
3114 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3115 if (ccb->command == command)
3117 if (ccb == NULL) {
3120 } else if (ccb->status == BLOGIC_CCB_COMPLETE) {
3123 } else if (ccb->status == BLOGIC_CCB_RESET) {
3142 blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->serial, tgt_id);
3145 ccb)) {
3147 adapter, ccb->serial, tgt_id);
3151 blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->serial, tgt_id);
3160 ccb->serial, tgt_id);
3162 FlashPoint_AbortCCB(adapter->cardhandle, ccb);
3168 if (ccb->status == BLOGIC_CCB_COMPLETE)
3183 struct blogic_ccb *ccb;
3201 for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
3202 if (ccb->status == BLOGIC_CCB_ACTIVE)
3203 blogic_dealloc_ccb(ccb, 1);