Lines Matching full:scb
953 scb_t *scb; in megaraid_alloc_cmd_packets() local
1011 * Allocate memory for the base list of scb. Later allocate memory for in megaraid_alloc_cmd_packets()
1013 * scb to the allocated components in megaraid_alloc_cmd_packets()
1014 * NOTE: The code to allocate SCB will be duplicated in all the LLD in megaraid_alloc_cmd_packets()
1035 // Adjust the scb pointers and link in the free pool in megaraid_alloc_cmd_packets()
1041 scb = adapter->kscb_list + i; in megaraid_alloc_cmd_packets()
1068 scb->ccb = (caddr_t)ccb; in megaraid_alloc_cmd_packets()
1069 scb->gp = 0; in megaraid_alloc_cmd_packets()
1071 scb->sno = i; // command index in megaraid_alloc_cmd_packets()
1073 scb->scp = NULL; in megaraid_alloc_cmd_packets()
1074 scb->state = SCB_FREE; in megaraid_alloc_cmd_packets()
1075 scb->dma_direction = DMA_NONE; in megaraid_alloc_cmd_packets()
1076 scb->dma_type = MRAID_DMA_NONE; in megaraid_alloc_cmd_packets()
1077 scb->dev_channel = -1; in megaraid_alloc_cmd_packets()
1078 scb->dev_target = -1; in megaraid_alloc_cmd_packets()
1080 // put scb in the free pool in megaraid_alloc_cmd_packets()
1081 list_add_tail(&scb->list, &adapter->kscb_pool); in megaraid_alloc_cmd_packets()
1266 * megaraid_alloc_scb - detach and return a scb from the free list
1270 * Return the scb from the head of the free list. %NULL if there are none
1277 scb_t *scb = NULL; in megaraid_alloc_scb() local
1280 // detach scb from free pool in megaraid_alloc_scb()
1288 scb = list_entry(head->next, scb_t, list); in megaraid_alloc_scb()
1289 list_del_init(&scb->list); in megaraid_alloc_scb()
1293 scb->state = SCB_ACTIVE; in megaraid_alloc_scb()
1294 scb->scp = scp; in megaraid_alloc_scb()
1295 scb->dma_type = MRAID_DMA_NONE; in megaraid_alloc_scb()
1297 return scb; in megaraid_alloc_scb()
1302 * megaraid_dealloc_scb - return the scb to the free pool
1304 * @scb : scb to be freed
1306 * Return the scb back to the free list of scbs. The caller must 'flush' the
1307 * SCB before calling us. E.g., performing pci_unamp and/or pci_sync etc.
1308 * NOTE NOTE: Make sure the scb is not on any list before calling this
1312 megaraid_dealloc_scb(adapter_t *adapter, scb_t *scb) in megaraid_dealloc_scb() argument
1316 // put scb in the free pool in megaraid_dealloc_scb()
1317 scb->state = SCB_FREE; in megaraid_dealloc_scb()
1318 scb->scp = NULL; in megaraid_dealloc_scb()
1321 list_add(&scb->list, &adapter->kscb_pool); in megaraid_dealloc_scb()
1332 * @scb : scsi control block
1337 megaraid_mbox_mksgl(adapter_t *adapter, scb_t *scb) in megaraid_mbox_mksgl() argument
1346 scp = scb->scp; in megaraid_mbox_mksgl()
1347 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_mksgl()
1356 scb->dma_type = MRAID_DMA_WSG; in megaraid_mbox_mksgl()
1371 * @scb : command to be issued
1376 mbox_post_cmd(adapter_t *adapter, scb_t *scb) in mbox_post_cmd() argument
1386 ccb = (mbox_ccb_t *)scb->ccb; in mbox_post_cmd()
1414 mbox->cmdid = scb->sno; in mbox_post_cmd()
1441 scb_t *scb; in megaraid_queue_command_lck() local
1448 * Allocate and build a SCB request in megaraid_queue_command_lck()
1450 * not allocate scb. We will return non-zero status in that case. in megaraid_queue_command_lck()
1451 * NOTE: scb can be null even though certain commands completed in megaraid_queue_command_lck()
1456 scb = megaraid_mbox_build_cmd(adapter, scp, &if_busy); in megaraid_queue_command_lck()
1457 if (!scb) { // command already completed in megaraid_queue_command_lck()
1462 megaraid_mbox_runpendq(adapter, scb); in megaraid_queue_command_lck()
1490 scb_t *scb; in DEF_SCSI_QCMD() local
1517 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1523 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1524 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1525 scb->dev_target = target; in DEF_SCSI_QCMD()
1526 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1536 return scb; in DEF_SCSI_QCMD()
1599 /* Allocate a SCB and initialize passthru */ in DEF_SCSI_QCMD()
1600 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1606 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1607 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1608 scb->dev_target = target; in DEF_SCSI_QCMD()
1622 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1627 scb); in DEF_SCSI_QCMD()
1633 return scb; in DEF_SCSI_QCMD()
1643 * Allocate a SCB and initialize mailbox in DEF_SCSI_QCMD()
1645 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1650 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1651 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1652 scb->dev_target = target; in DEF_SCSI_QCMD()
1711 megaraid_dealloc_scb(adapter, scb); in DEF_SCSI_QCMD()
1717 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1722 scb); in DEF_SCSI_QCMD()
1726 return scb; in DEF_SCSI_QCMD()
1739 * Allocate a SCB and initialize mailbox in DEF_SCSI_QCMD()
1741 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1747 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1748 scb->dev_channel = 0xFF; in DEF_SCSI_QCMD()
1749 scb->dev_target = target; in DEF_SCSI_QCMD()
1755 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1757 return scb; in DEF_SCSI_QCMD()
1808 // Allocate a SCB and initialize passthru in DEF_SCSI_QCMD()
1809 if (!(scb = megaraid_alloc_scb(adapter, scp))) { in DEF_SCSI_QCMD()
1815 ccb = (mbox_ccb_t *)scb->ccb; in DEF_SCSI_QCMD()
1816 scb->dev_channel = channel; in DEF_SCSI_QCMD()
1817 scb->dev_target = target; in DEF_SCSI_QCMD()
1818 scb->dma_direction = scp->sc_data_direction; in DEF_SCSI_QCMD()
1826 megaraid_mbox_prepare_epthru(adapter, scb, scp); in DEF_SCSI_QCMD()
1835 megaraid_mbox_prepare_pthru(adapter, scb, scp); in DEF_SCSI_QCMD()
1841 return scb; in DEF_SCSI_QCMD()
1851 * @scb_q : SCB to be queued in the pending list
1854 * post to the controller. The SCB can be a null pointer, which would indicate
1855 * no SCB to be queue, just try to execute the ones in the pending list.
1859 * next SCB is at the head now.
1864 scb_t *scb; in megaraid_mbox_runpendq() local
1884 scb = list_entry(adapter->pend_list.next, scb_t, list); in megaraid_mbox_runpendq()
1886 // remove the scb from the pending list and try to in megaraid_mbox_runpendq()
1890 list_del_init(&scb->list); in megaraid_mbox_runpendq()
1894 // if mailbox was busy, return SCB back to pending in megaraid_mbox_runpendq()
1898 scb->state = SCB_ISSUED; in megaraid_mbox_runpendq()
1900 if (mbox_post_cmd(adapter, scb) != 0) { in megaraid_mbox_runpendq()
1904 scb->state = SCB_PENDQ; in megaraid_mbox_runpendq()
1906 list_add(&scb->list, &adapter->pend_list); in megaraid_mbox_runpendq()
1927 * @scb : scsi control block
1933 megaraid_mbox_prepare_pthru(adapter_t *adapter, scb_t *scb, in megaraid_mbox_prepare_pthru() argument
1941 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_prepare_pthru()
1943 channel = scb->dev_channel; in megaraid_mbox_prepare_pthru()
1944 target = scb->dev_target; in megaraid_mbox_prepare_pthru()
1961 pthru->numsge = megaraid_mbox_mksgl(adapter, scb); in megaraid_mbox_prepare_pthru()
1975 * @scb : scsi control block
1982 megaraid_mbox_prepare_epthru(adapter_t *adapter, scb_t *scb, in megaraid_mbox_prepare_epthru() argument
1990 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_prepare_epthru()
1992 channel = scb->dev_channel; in megaraid_mbox_prepare_epthru()
1993 target = scb->dev_target; in megaraid_mbox_prepare_epthru()
2010 epthru->numsge = megaraid_mbox_mksgl(adapter, scb); in megaraid_mbox_prepare_epthru()
2035 scb_t *scb; in megaraid_ack_sequence() local
2096 // Get SCB associated with this command id in megaraid_ack_sequence()
2099 scb = adapter->uscb_list + (completed[i] - in megaraid_ack_sequence()
2104 scb = adapter->kscb_list + completed[i]; in megaraid_ack_sequence()
2107 scb->status = mbox->status; in megaraid_ack_sequence()
2108 list_add_tail(&scb->list, &clist); in megaraid_ack_sequence()
2175 scb_t *scb; in megaraid_mbox_dpc() local
2205 list_for_each_entry_safe(scb, tmp, &clist, list) { in megaraid_mbox_dpc()
2207 status = scb->status; in megaraid_mbox_dpc()
2208 scp = scb->scp; in megaraid_mbox_dpc()
2209 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_dpc()
2215 if (scb->state != SCB_ISSUED) { in megaraid_mbox_dpc()
2218 scb->sno, scb->state, scp)); in megaraid_mbox_dpc()
2224 if (scb->sno >= MBOX_MAX_SCSI_CMDS) { in megaraid_mbox_dpc()
2225 scb->state = SCB_FREE; in megaraid_mbox_dpc()
2226 scb->status = status; in megaraid_mbox_dpc()
2229 list_del_init(&scb->list); in megaraid_mbox_dpc()
2231 kioc = (uioc_t *)scb->gp; in megaraid_mbox_dpc()
2234 megaraid_mbox_mm_done(adapter, scb); in megaraid_mbox_dpc()
2240 if (scb->state & SCB_ABORT) { in megaraid_mbox_dpc()
2243 scb->sno)); in megaraid_mbox_dpc()
2256 && IS_RAID_CH(raid_dev, scb->dev_channel)) { in megaraid_mbox_dpc()
2269 pdev_index = (scb->dev_channel * 16) + in megaraid_mbox_dpc()
2270 scb->dev_target; in megaraid_mbox_dpc()
2350 megaraid_mbox_display_scb(adapter, scb); in megaraid_mbox_dpc()
2356 list_del_init(&scb->list); in megaraid_mbox_dpc()
2359 megaraid_dealloc_scb(adapter, scb); in megaraid_mbox_dpc()
2381 scb_t *scb; in megaraid_abort_handler() local
2407 scb = NULL; in megaraid_abort_handler()
2409 list_for_each_entry_safe(scb, tmp, &adapter->completed_list, list) { in megaraid_abort_handler()
2411 if (scb->scp == scp) { // Found command in megaraid_abort_handler()
2413 list_del_init(&scb->list); // from completed list in megaraid_abort_handler()
2417 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2422 megaraid_dealloc_scb(adapter, scb); in megaraid_abort_handler()
2437 list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { in megaraid_abort_handler()
2439 if (scb->scp == scp) { // Found command in megaraid_abort_handler()
2441 list_del_init(&scb->list); // from pending list in megaraid_abort_handler()
2443 ASSERT(!(scb->state & SCB_ISSUED)); in megaraid_abort_handler()
2447 scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2452 megaraid_dealloc_scb(adapter, scb); in megaraid_abort_handler()
2464 // owned by the firmware. The only way to locate the FW scb is to in megaraid_abort_handler()
2465 // traverse through the list of all SCB, since driver does not in megaraid_abort_handler()
2470 scb = adapter->kscb_list + i; in megaraid_abort_handler()
2472 if (scb->scp == scp) { in megaraid_abort_handler()
2476 if (!(scb->state & SCB_ISSUED)) { in megaraid_abort_handler()
2479 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2485 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_abort_handler()
2518 scb_t *scb; in megaraid_reset_handler() local
2544 list_for_each_entry_safe(scb, tmp, &adapter->pend_list, list) { in megaraid_reset_handler()
2545 list_del_init(&scb->list); // from pending list in megaraid_reset_handler()
2547 if (scb->sno >= MBOX_MAX_SCSI_CMDS) { in megaraid_reset_handler()
2550 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_reset_handler()
2552 scb->status = -1; in megaraid_reset_handler()
2554 kioc = (uioc_t *)scb->gp; in megaraid_reset_handler()
2557 megaraid_mbox_mm_done(adapter, scb); in megaraid_reset_handler()
2559 if (scb->scp == scp) { // Found command in megaraid_reset_handler()
2562 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_reset_handler()
2566 scb->sno, scb->dev_channel, scb->dev_target)); in megaraid_reset_handler()
2569 scb->scp->result = (DID_RESET << 16); in megaraid_reset_handler()
2570 scsi_done(scb->scp); in megaraid_reset_handler()
2572 megaraid_dealloc_scb(adapter, scb); in megaraid_reset_handler()
2662 * Issue a scb in synchronous and non-interrupt mode for mailbox based
2791 * Issue a scb in synchronous and non-interrupt mode for mailbox based
3295 * megaraid_mbox_display_scb - display SCB information, mostly debug purposes
3297 * @scb : SCB to be displayed
3299 * Diplay information about the given SCB iff the current debug level is
3303 megaraid_mbox_display_scb(adapter_t *adapter, scb_t *scb) in megaraid_mbox_display_scb() argument
3312 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_display_scb()
3313 scp = scb->scp; in megaraid_mbox_display_scb()
3319 "megaraid mailbox: status:%#x cmd:%#x id:%#x ", scb->status, in megaraid_mbox_display_scb()
3320 mbox->cmd, scb->sno)); in megaraid_mbox_display_scb()
3397 scb_t *scb; in megaraid_cmm_register() local
3402 // Allocate memory for the base list of scb for management module. in megaraid_cmm_register()
3427 scb = adapter->uscb_list + i; in megaraid_cmm_register()
3430 scb->ccb = (caddr_t)ccb; in megaraid_cmm_register()
3435 scb->gp = 0; in megaraid_cmm_register()
3439 scb->sno = i + MBOX_MAX_SCSI_CMDS; in megaraid_cmm_register()
3441 scb->scp = NULL; in megaraid_cmm_register()
3442 scb->state = SCB_FREE; in megaraid_cmm_register()
3443 scb->dma_direction = DMA_NONE; in megaraid_cmm_register()
3444 scb->dma_type = MRAID_DMA_NONE; in megaraid_cmm_register()
3445 scb->dev_channel = -1; in megaraid_cmm_register()
3446 scb->dev_target = -1; in megaraid_cmm_register()
3448 // put scb in the free pool in megaraid_cmm_register()
3449 list_add_tail(&scb->list, &adapter->uscb_pool); in megaraid_cmm_register()
3557 scb_t *scb; in megaraid_mbox_mm_command() local
3561 // detach one scb from free pool in megaraid_mbox_mm_command()
3574 scb = list_entry(head->next, scb_t, list); in megaraid_mbox_mm_command()
3575 list_del_init(&scb->list); in megaraid_mbox_mm_command()
3579 scb->state = SCB_ACTIVE; in megaraid_mbox_mm_command()
3580 scb->dma_type = MRAID_DMA_NONE; in megaraid_mbox_mm_command()
3581 scb->dma_direction = DMA_NONE; in megaraid_mbox_mm_command()
3583 ccb = (mbox_ccb_t *)scb->ccb; in megaraid_mbox_mm_command()
3589 scb->gp = (unsigned long)kioc; in megaraid_mbox_mm_command()
3603 scb->status = -1; in megaraid_mbox_mm_command()
3605 megaraid_mbox_mm_done(adapter, scb); in megaraid_mbox_mm_command()
3610 INIT_LIST_HEAD(&scb->list); in megaraid_mbox_mm_command()
3612 scb->state = SCB_ISSUED; in megaraid_mbox_mm_command()
3613 if (mbox_post_cmd(adapter, scb) != 0) { in megaraid_mbox_mm_command()
3620 scb->status = -1; in megaraid_mbox_mm_command()
3622 megaraid_mbox_mm_done(adapter, scb); in megaraid_mbox_mm_command()
3631 megaraid_mbox_runpendq(adapter, scb); in megaraid_mbox_mm_command()
3670 * @scb : completed command
3676 megaraid_mbox_mm_done(adapter_t *adapter, scb_t *scb) in megaraid_mbox_mm_done() argument
3683 kioc = (uioc_t *)scb->gp; in megaraid_mbox_mm_done()
3685 mbox64->mbox32.status = scb->status; in megaraid_mbox_mm_done()
3689 // put scb in the free pool in megaraid_mbox_mm_done()
3690 scb->state = SCB_FREE; in megaraid_mbox_mm_done()
3691 scb->scp = NULL; in megaraid_mbox_mm_done()
3695 list_add(&scb->list, &adapter->uscb_pool); in megaraid_mbox_mm_done()