Lines Matching full:scb

950 	scb_t			*scb;  in megaraid_alloc_cmd_packets()  local
1008 * Allocate memory for the base list of scb. Later allocate memory for in megaraid_alloc_cmd_packets()
1010 * scb to the allocated components in megaraid_alloc_cmd_packets()
1011 * NOTE: The code to allocate SCB will be duplicated in all the LLD in megaraid_alloc_cmd_packets()
1032 // Adjust the scb pointers and link in the free pool in megaraid_alloc_cmd_packets()
1038 scb = adapter->kscb_list + i; in megaraid_alloc_cmd_packets()
1065 scb->ccb = (caddr_t)ccb; in megaraid_alloc_cmd_packets()
1066 scb->gp = 0; in megaraid_alloc_cmd_packets()
1068 scb->sno = i; // command index in megaraid_alloc_cmd_packets()
1070 scb->scp = NULL; in megaraid_alloc_cmd_packets()
1071 scb->state = SCB_FREE; in megaraid_alloc_cmd_packets()
1072 scb->dma_direction = DMA_NONE; in megaraid_alloc_cmd_packets()
1073 scb->dma_type = MRAID_DMA_NONE; in megaraid_alloc_cmd_packets()
1074 scb->dev_channel = -1; in megaraid_alloc_cmd_packets()
1075 scb->dev_target = -1; in megaraid_alloc_cmd_packets()
1077 // put scb in the free pool in megaraid_alloc_cmd_packets()
1078 list_add_tail(&scb->list, &adapter->kscb_pool); in megaraid_alloc_cmd_packets()
1263 * megaraid_alloc_scb - detach and return a scb from the free list
1267 * Return the scb from the head of the free list. %NULL if there are none
1274 scb_t *scb = NULL; in megaraid_alloc_scb() local
1277 // detach scb from free pool in megaraid_alloc_scb()
1285 scb = list_entry(head->next, scb_t, list); in megaraid_alloc_scb()
1286 list_del_init(&scb->list); in megaraid_alloc_scb()
1290 scb->state = SCB_ACTIVE; in megaraid_alloc_scb()
1291 scb->scp = scp; in megaraid_alloc_scb()
1292 scb->dma_type = MRAID_DMA_NONE; in megaraid_alloc_scb()
1294 return scb; in megaraid_alloc_scb()
1299 * megaraid_dealloc_scb - return the scb to the free pool
1301 * @scb : scb to be freed
1303 * Return the scb back to the free list of scbs. The caller must 'flush' the
1304 * SCB before calling us. E.g., performing pci_unamp and/or pci_sync etc.
1305 * NOTE NOTE: Make sure the scb is not on any list before calling this
1309 megaraid_dealloc_scb(adapter_t *adapter, scb_t *scb) in megaraid_dealloc_scb() argument
1313 // put scb in the free pool in megaraid_dealloc_scb()
1314 scb->state = SCB_FREE; in megaraid_dealloc_scb()
1315 scb->scp = NULL; in megaraid_dealloc_scb()
1318 list_add(&scb->list, &adapter->kscb_pool); in megaraid_dealloc_scb()
1329 * @scb : scsi control block
1334 megaraid_mbox_mksgl(adapter_t *adapter, scb_t *scb) in megaraid_mbox_mksgl() argument
1343 scp = scb->scp; in megaraid_mbox_mksgl()
1344 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_mksgl()
1353 scb->dma_type = MRAID_DMA_WSG; in megaraid_mbox_mksgl()
1368 * @scb : command to be issued
1373 mbox_post_cmd(adapter_t *adapter, scb_t *scb) in mbox_post_cmd() argument
1383 ccb = (mbox_ccb_t *)scb->ccb; in mbox_post_cmd()
1411 mbox->cmdid = scb->sno; in mbox_post_cmd()
1439 scb_t *scb; in megaraid_queue_command_lck() local
1447 * Allocate and build a SCB request in megaraid_queue_command_lck()
1449 * not allocate scb. We will return non-zero status in that case. in megaraid_queue_command_lck()
1450 * NOTE: scb can be null even though certain commands completed in megaraid_queue_command_lck()
1455 scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy); in megaraid_queue_command_lck()
1456 if (!scb) { // command already completed in megaraid_queue_command_lck()
1461 megaraid_mbox_runpendq(adapter, scb); in megaraid_queue_command_lck()
1489 scb_t *scb; in DEF_SCSI_QCMD() local
1516 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1522 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1523 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1524 scb->dev_target = target; in DEF_SCSI_QCMD()
1525 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1535 return scb; in DEF_SCSI_QCMD()
1598 /* Allocate a SCB and initialize passthru */ in DEF_SCSI_QCMD()
1599 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1605 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1606 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1607 scb->dev_target = target; in DEF_SCSI_QCMD()
1621 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1626 scb); in DEF_SCSI_QCMD()
1632 return scb; in DEF_SCSI_QCMD()
1642 * Allocate a SCB and initialize mailbox in DEF_SCSI_QCMD()
1644 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1649 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1650 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1651 scb->dev_target = target; in DEF_SCSI_QCMD()
1710 megaraid_dealloc_scb(adapter, scb); in DEF_SCSI_QCMD()
1716 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1721 scb); in DEF_SCSI_QCMD()
1725 return scb; in DEF_SCSI_QCMD()
1738 * Allocate a SCB and initialize mailbox in DEF_SCSI_QCMD()
1740 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1746 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1747 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1748 scb->dev_target = target; in DEF_SCSI_QCMD()
1754 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1756 return scb; in DEF_SCSI_QCMD()
1807 // Allocate a SCB and initialize passthru in DEF_SCSI_QCMD()
1808 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1814 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1815 scb->dev_channel = channel; in DEF_SCSI_QCMD()
1816 scb->dev_target = target; in DEF_SCSI_QCMD()
1817 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1825 megaraid_mbox_prepare_epthru(adapter, scb, scp); in DEF_SCSI_QCMD()
1834 megaraid_mbox_prepare_pthru(adapter, scb, scp); in DEF_SCSI_QCMD()
1840 return scb; in DEF_SCSI_QCMD()
1850 * @scb_q : SCB to be queued in the pending list
1853 * post to the controller. The SCB can be a null pointer, which would indicate
1854 * no SCB to be queue, just try to execute the ones in the pending list.
1858 * next SCB is at the head now.
1863 scb_t *scb; in megaraid_mbox_runpendq() local
1883 scb = list_entry(adapter->pend_list.next, scb_t, list); in megaraid_mbox_runpendq()
1885 // remove the scb from the pending list and try to in megaraid_mbox_runpendq()
1889 list_del_init(&scb->list); in megaraid_mbox_runpendq()
1893 // if mailbox was busy, return SCB back to pending in megaraid_mbox_runpendq()
1897 scb->state = SCB_ISSUED; in megaraid_mbox_runpendq()
1899 if (mbox_post_cmd(adapter, scb) != 0) { in megaraid_mbox_runpendq()
1903 scb->state = SCB_PENDQ; in megaraid_mbox_runpendq()
1905 list_add(&scb->list, &adapter->pend_list); in megaraid_mbox_runpendq()
1926 * @scb : scsi control block
1932 megaraid_mbox_prepare_pthru(adapter_t *adapter, scb_t *scb, in megaraid_mbox_prepare_pthru() argument
1940 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_prepare_pthru()
1942 channel = scb->dev_channel; in megaraid_mbox_prepare_pthru()
1943 target = scb->dev_target; in megaraid_mbox_prepare_pthru()
1960 pthru->numsge = megaraid_mbox_mksgl(adapter, scb); in megaraid_mbox_prepare_pthru()
1974 * @scb : scsi control block
1981 megaraid_mbox_prepare_epthru(adapter_t *adapter, scb_t *scb, in megaraid_mbox_prepare_epthru() argument
1989 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_prepare_epthru()
1991 channel = scb->dev_channel; in megaraid_mbox_prepare_epthru()
1992 target = scb->dev_target; in megaraid_mbox_prepare_epthru()
2009 epthru->numsge = megaraid_mbox_mksgl(adapter, scb); in megaraid_mbox_prepare_epthru()
2034 scb_t *scb; in megaraid_ack_sequence() local
2095 // Get SCB associated with this command id in megaraid_ack_sequence()
2098 scb = adapter->uscb_list + (completed[i] - in megaraid_ack_sequence()
2103 scb = adapter->kscb_list + completed[i]; in megaraid_ack_sequence()
2106 scb->status = mbox->status; in megaraid_ack_sequence()
2107 list_add_tail(&scb->list, &clist); in megaraid_ack_sequence()
2174 scb_t *scb; in megaraid_mbox_dpc() local
2204 list_for_each_entry_safe(scb, tmp, &clist, list) { in megaraid_mbox_dpc()
2206 status = scb->status; in megaraid_mbox_dpc()
2207 scp = scb->scp; in megaraid_mbox_dpc()
2208 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_dpc()
2214 if (scb->state != SCB_ISSUED) { in megaraid_mbox_dpc()
2217 scb->sno, scb->state, scp)); in megaraid_mbox_dpc()
2223 if (scb->sno >= MBOX_MAX_SCSI_CMDS) { in megaraid_mbox_dpc()
2224 scb->state = SCB_FREE; in megaraid_mbox_dpc()
2225 scb->status = status; in megaraid_mbox_dpc()
2228 list_del_init(&scb->list); in megaraid_mbox_dpc()
2230 kioc = (uioc_t *)scb->gp; in megaraid_mbox_dpc()
2233 megaraid_mbox_mm_done(adapter, scb); in megaraid_mbox_dpc()
2239 if (scb->state & SCB_ABORT) { in megaraid_mbox_dpc()
2242 scb->sno)); in megaraid_mbox_dpc()
2255 && IS_RAID_CH(raid_dev, scb->dev_channel)) { in megaraid_mbox_dpc()
2268 pdev_index = (scb->dev_channel * 16) + in megaraid_mbox_dpc()
2269 scb->dev_target; in megaraid_mbox_dpc()
2349 megaraid_mbox_display_scb(adapter, scb); in megaraid_mbox_dpc()
2355 list_del_init(&scb->list); in megaraid_mbox_dpc()
2358 megaraid_dealloc_scb(adapter, scb); in megaraid_mbox_dpc()
2380 scb_t *scb; in megaraid_abort_handler() local
2406 scb = NULL; in megaraid_abort_handler()
2408 list_for_each_entry_safe(scb, tmp, &adapter->completed_list, list) { in megaraid_abort_handler()
2410 if (scb->scp == scp) { // Found command in megaraid_abort_handler()
2412 list_del_init(&scb->list); // from completed list in megaraid_abort_handler()
2416 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2421 megaraid_dealloc_scb(adapter, scb); in megaraid_abort_handler()
2436 list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { in megaraid_abort_handler()
2438 if (scb->scp == scp) { // Found command in megaraid_abort_handler()
2440 list_del_init(&scb->list); // from pending list in megaraid_abort_handler()
2442 ASSERT(!(scb->state & SCB_ISSUED)); in megaraid_abort_handler()
2446 scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2451 megaraid_dealloc_scb(adapter, scb); in megaraid_abort_handler()
2463 // owned by the firmware. The only way to locate the FW scb is to in megaraid_abort_handler()
2464 // traverse through the list of all SCB, since driver does not in megaraid_abort_handler()
2469 scb = adapter->kscb_list + i; in megaraid_abort_handler()
2471 if (scb->scp == scp) { in megaraid_abort_handler()
2475 if (!(scb->state & SCB_ISSUED)) { in megaraid_abort_handler()
2478 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2484 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2517 scb_t *scb; in megaraid_reset_handler() local
2543 list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { in megaraid_reset_handler()
2544 list_del_init(&scb->list); // from pending list in megaraid_reset_handler()
2546 if (scb->sno >= MBOX_MAX_SCSI_CMDS) { in megaraid_reset_handler()
2549 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_reset_handler()
2551 scb->status = -1; in megaraid_reset_handler()
2553 kioc = (uioc_t *)scb->gp; in megaraid_reset_handler()
2556 megaraid_mbox_mm_done(adapter, scb); in megaraid_reset_handler()
2558 if (scb->scp == scp) { // Found command in megaraid_reset_handler()
2561 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_reset_handler()
2565 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_reset_handler()
2568 scb->scp->result = (DID_RESET << 16); in megaraid_reset_handler()
2569 scb->scp->scsi_done(scb->scp); in megaraid_reset_handler()
2571 megaraid_dealloc_scb(adapter, scb); in megaraid_reset_handler()
2661 * Issue a scb in synchronous and non-interrupt mode for mailbox based
2790 * Issue a scb in synchronous and non-interrupt mode for mailbox based
3294 * megaraid_mbox_display_scb - display SCB information, mostly debug purposes
3296 * @scb : SCB to be displayed
3298 * Diplay information about the given SCB iff the current debug level is
3302 megaraid_mbox_display_scb(adapter_t *adapter, scb_t *scb) in megaraid_mbox_display_scb() argument
3311 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_display_scb()
3312 scp = scb->scp; in megaraid_mbox_display_scb()
3318 "megaraid mailbox: status:%#x cmd:%#x id:%#x ", scb->status, in megaraid_mbox_display_scb()
3319 mbox->cmd, scb->sno)); in megaraid_mbox_display_scb()
3396 scb_t *scb; in megaraid_cmm_register() local
3401 // Allocate memory for the base list of scb for management module. in megaraid_cmm_register()
3426 scb = adapter->uscb_list + i; in megaraid_cmm_register()
3429 scb->ccb = (caddr_t)ccb; in megaraid_cmm_register()
3434 scb->gp = 0; in megaraid_cmm_register()
3438 scb->sno = i + MBOX_MAX_SCSI_CMDS; in megaraid_cmm_register()
3440 scb->scp = NULL; in megaraid_cmm_register()
3441 scb->state = SCB_FREE; in megaraid_cmm_register()
3442 scb->dma_direction = DMA_NONE; in megaraid_cmm_register()
3443 scb->dma_type = MRAID_DMA_NONE; in megaraid_cmm_register()
3444 scb->dev_channel = -1; in megaraid_cmm_register()
3445 scb->dev_target = -1; in megaraid_cmm_register()
3447 // put scb in the free pool in megaraid_cmm_register()
3448 list_add_tail(&scb->list, &adapter->uscb_pool); in megaraid_cmm_register()
3556 scb_t *scb; in megaraid_mbox_mm_command() local
3560 // detach one scb from free pool in megaraid_mbox_mm_command()
3573 scb = list_entry(head->next, scb_t, list); in megaraid_mbox_mm_command()
3574 list_del_init(&scb->list); in megaraid_mbox_mm_command()
3578 scb->state = SCB_ACTIVE; in megaraid_mbox_mm_command()
3579 scb->dma_type = MRAID_DMA_NONE; in megaraid_mbox_mm_command()
3580 scb->dma_direction = DMA_NONE; in megaraid_mbox_mm_command()
3582 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_mm_command()
3588 scb->gp = (unsigned long)kioc; in megaraid_mbox_mm_command()
3602 scb->status = -1; in megaraid_mbox_mm_command()
3604 megaraid_mbox_mm_done(adapter, scb); in megaraid_mbox_mm_command()
3609 INIT_LIST_HEAD(&scb->list); in megaraid_mbox_mm_command()
3611 scb->state = SCB_ISSUED; in megaraid_mbox_mm_command()
3612 if (mbox_post_cmd(adapter, scb) != 0) { in megaraid_mbox_mm_command()
3619 scb->status = -1; in megaraid_mbox_mm_command()
3621 megaraid_mbox_mm_done(adapter, scb); in megaraid_mbox_mm_command()
3630 megaraid_mbox_runpendq(adapter, scb); in megaraid_mbox_mm_command()
3669 * @scb : completed command
3675 megaraid_mbox_mm_done(adapter_t *adapter, scb_t *scb) in megaraid_mbox_mm_done() argument
3682 kioc = (uioc_t *)scb->gp; in megaraid_mbox_mm_done()
3684 mbox64->mbox32.status = scb->status; in megaraid_mbox_mm_done()
3688 // put scb in the free pool in megaraid_mbox_mm_done()
3689 scb->state = SCB_FREE; in megaraid_mbox_mm_done()
3690 scb->scp = NULL; in megaraid_mbox_mm_done()
3694 list_add(&scb->list, &adapter->uscb_pool); in megaraid_mbox_mm_done()