Lines Matching full:scb

378 	scb_t	*scb;  in megaraid_queue_lck()  local
385 * Allocate and build a SCB request in megaraid_queue_lck()
387 * allocate scb. We will return non-zero status in that case. in megaraid_queue_lck()
388 * NOTE: scb can be null even though certain commands completed in megaraid_queue_lck()
394 scb = mega_build_cmd(adapter, scmd, &busy); in megaraid_queue_lck()
395 if (!scb) in megaraid_queue_lck()
398 scb->state |= SCB_PENDQ; in megaraid_queue_lck()
399 list_add_tail(&scb->list, &adapter->pending_list); in megaraid_queue_lck()
422 * Allocate a SCB structure. This is the central structure for controller in DEF_SCSI_QCMD()
429 scb_t *scb; in DEF_SCSI_QCMD() local
434 scb = list_entry(head->next, scb_t, list); in DEF_SCSI_QCMD()
438 scb->state = SCB_ACTIVE; in DEF_SCSI_QCMD()
439 scb->cmd = cmd; in DEF_SCSI_QCMD()
440 scb->dma_type = MEGA_DMA_TYPE_NONE; in DEF_SCSI_QCMD()
442 return scb; in DEF_SCSI_QCMD()
524 scb_t *scb; in mega_build_cmd() local
642 if(!(scb = mega_allocate_scb(adapter, cmd))) { in mega_build_cmd()
647 scb->raw_mbox[0] = MEGA_CLUSTER_CMD; in mega_build_cmd()
648 scb->raw_mbox[2] = MEGA_RESERVATION_STATUS; in mega_build_cmd()
649 scb->raw_mbox[3] = ldrv_num; in mega_build_cmd()
651 scb->dma_direction = DMA_NONE; in mega_build_cmd()
653 return scb; in mega_build_cmd()
689 /* Allocate a SCB and initialize passthru */ in mega_build_cmd()
690 if(!(scb = mega_allocate_scb(adapter, cmd))) { in mega_build_cmd()
694 pthru = scb->pthru; in mega_build_cmd()
696 mbox = (mbox_t *)scb->raw_mbox; in mega_build_cmd()
697 memset(mbox, 0, sizeof(scb->raw_mbox)); in mega_build_cmd()
715 scb->dma_direction = DMA_FROM_DEVICE; in mega_build_cmd()
717 pthru->numsgelements = mega_build_sglist(adapter, scb, in mega_build_cmd()
720 mbox->m_out.xferaddr = scb->pthru_dma_addr; in mega_build_cmd()
722 return scb; in mega_build_cmd()
731 /* Allocate a SCB and initialize mailbox */ in mega_build_cmd()
732 if(!(scb = mega_allocate_scb(adapter, cmd))) { in mega_build_cmd()
736 mbox = (mbox_t *)scb->raw_mbox; in mega_build_cmd()
738 memset(mbox, 0, sizeof(scb->raw_mbox)); in mega_build_cmd()
845 scb->dma_direction = DMA_FROM_DEVICE; in mega_build_cmd()
848 scb->dma_direction = DMA_TO_DEVICE; in mega_build_cmd()
852 mbox->m_out.numsgelements = mega_build_sglist(adapter, scb, in mega_build_cmd()
855 return scb; in mega_build_cmd()
871 /* Allocate a SCB and initialize mailbox */ in mega_build_cmd()
872 if(!(scb = mega_allocate_scb(adapter, cmd))) { in mega_build_cmd()
877 scb->raw_mbox[0] = MEGA_CLUSTER_CMD; in mega_build_cmd()
878 scb->raw_mbox[2] = ( *cmd->cmnd == RESERVE ) ? in mega_build_cmd()
881 scb->raw_mbox[3] = ldrv_num; in mega_build_cmd()
883 scb->dma_direction = DMA_NONE; in mega_build_cmd()
885 return scb; in mega_build_cmd()
899 /* Allocate a SCB and initialize passthru */ in mega_build_cmd()
900 if(!(scb = mega_allocate_scb(adapter, cmd))) { in mega_build_cmd()
905 mbox = (mbox_t *)scb->raw_mbox; in mega_build_cmd()
906 memset(mbox, 0, sizeof(scb->raw_mbox)); in mega_build_cmd()
910 mega_prepare_extpassthru(adapter, scb, cmd, in mega_build_cmd()
915 mbox->m_out.xferaddr = scb->epthru_dma_addr; in mega_build_cmd()
920 pthru = mega_prepare_passthru(adapter, scb, cmd, in mega_build_cmd()
931 mbox->m_out.xferaddr = scb->pthru_dma_addr; in mega_build_cmd()
934 return scb; in mega_build_cmd()
943 * @scb: our scsi control block
951 mega_prepare_passthru(adapter_t *adapter, scb_t *scb, struct scsi_cmnd *cmd, in mega_prepare_passthru() argument
956 pthru = scb->pthru; in mega_prepare_passthru()
977 scb->dma_direction = DMA_BIDIRECTIONAL; in mega_prepare_passthru()
995 pthru->numsgelements = mega_build_sglist(adapter, scb, in mega_prepare_passthru()
1006 * @scb: our scsi control block
1015 mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb, in mega_prepare_extpassthru() argument
1021 epthru = scb->epthru; in mega_prepare_extpassthru()
1041 scb->dma_direction = DMA_BIDIRECTIONAL; in mega_prepare_extpassthru()
1058 epthru->numsgelements = mega_build_sglist(adapter, scb, in mega_prepare_extpassthru()
1069 scb_t *scb; in __mega_runpendq() local
1075 scb = list_entry(pos, scb_t, list); in __mega_runpendq()
1077 if( !(scb->state & SCB_ISSUED) ) { in __mega_runpendq()
1079 if( issue_scb(adapter, scb) != 0 ) in __mega_runpendq()
1091 * @scb: scsi control block
1094 * busy. We also take the scb from the pending list if the mailbox is
1098 issue_scb(adapter_t *adapter, scb_t *scb) in issue_scb() argument
1114 memcpy((char *)&mbox->m_out, (char *)scb->raw_mbox, in issue_scb()
1117 mbox->m_out.cmdid = scb->idx; /* Set cmdid */ in issue_scb()
1143 scb->state |= SCB_ISSUED; in issue_scb()
1174 * Issue a scb in synchronous and non-interrupt mode
1422 scb_t *scb; in mega_cmd_done() local
1429 * and free the scb. in mega_cmd_done()
1443 scb = &adapter->int_scb; in mega_cmd_done()
1444 cmd = scb->cmd; in mega_cmd_done()
1446 list_del_init(&scb->list); in mega_cmd_done()
1447 scb->state = SCB_FREE; in mega_cmd_done()
1452 scb = &adapter->scb_list[cmdid]; in mega_cmd_done()
1457 if( !(scb->state & SCB_ISSUED) || scb->cmd == NULL ) { in mega_cmd_done()
1459 "Id %d, scb->state:%x, scsi cmd:%p\n", in mega_cmd_done()
1460 cmdid, scb->state, scb->cmd); in mega_cmd_done()
1468 if( scb->state & SCB_ABORT ) { in mega_cmd_done()
1472 scb->idx); in mega_cmd_done()
1474 scb->cmd->result = (DID_ABORT << 16); in mega_cmd_done()
1476 list_add_tail(SCSI_LIST(scb->cmd), in mega_cmd_done()
1479 mega_free_scb(adapter, scb); in mega_cmd_done()
1487 if( scb->state & SCB_RESET ) { in mega_cmd_done()
1491 scb->idx); in mega_cmd_done()
1493 scb->cmd->result = (DID_RESET << 16); in mega_cmd_done()
1495 list_add_tail(SCSI_LIST(scb->cmd), in mega_cmd_done()
1498 mega_free_scb (adapter, scb); in mega_cmd_done()
1503 cmd = scb->cmd; in mega_cmd_done()
1504 pthru = scb->pthru; in mega_cmd_done()
1505 epthru = scb->epthru; in mega_cmd_done()
1506 mbox = (mbox_t *)scb->raw_mbox; in mega_cmd_done()
1632 mega_free_scb(adapter, scb); in mega_cmd_done()
1658 * Free a SCB structure
1659 * Note: We assume the scsi commands associated with this scb is not free yet.
1662 mega_free_scb(adapter_t *adapter, scb_t *scb) in mega_free_scb() argument
1664 switch( scb->dma_type ) { in mega_free_scb()
1670 scsi_dma_unmap(scb->cmd); in mega_free_scb()
1679 list_del_init(&scb->list); in mega_free_scb()
1681 /* Link the scb back into free list */ in mega_free_scb()
1682 scb->state = SCB_FREE; in mega_free_scb()
1683 scb->cmd = NULL; in mega_free_scb()
1685 list_add(&scb->list, &adapter->free_list); in mega_free_scb()
1709 mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len) in mega_build_sglist() argument
1716 cmd = scb->cmd; in mega_build_sglist()
1725 scb->dma_type = MEGA_SGLIST; in mega_build_sglist()
1733 scb->dma_h_bulkdata = sg_dma_address(sg); in mega_build_sglist()
1734 *buf = (u32)scb->dma_h_bulkdata; in mega_build_sglist()
1741 scb->sgl64[idx].address = sg_dma_address(sg); in mega_build_sglist()
1742 *len += scb->sgl64[idx].length = sg_dma_len(sg); in mega_build_sglist()
1744 scb->sgl[idx].address = sg_dma_address(sg); in mega_build_sglist()
1745 *len += scb->sgl[idx].length = sg_dma_len(sg); in mega_build_sglist()
1750 *buf = scb->sgl_dma_addr; in mega_build_sglist()
1800 scb_t *scb; in mega_free_sgl() local
1805 scb = &adapter->scb_list[i]; in mega_free_sgl()
1807 if( scb->sgl64 ) { in mega_free_sgl()
1810 scb->sgl64, scb->sgl_dma_addr); in mega_free_sgl()
1812 scb->sgl64 = NULL; in mega_free_sgl()
1815 if( scb->pthru ) { in mega_free_sgl()
1817 sizeof(mega_passthru), scb->pthru, in mega_free_sgl()
1818 scb->pthru_dma_addr); in mega_free_sgl()
1820 scb->pthru = NULL; in mega_free_sgl()
1823 if( scb->epthru ) { in mega_free_sgl()
1826 scb->epthru, scb->epthru_dma_addr); in mega_free_sgl()
1828 scb->epthru = NULL; in mega_free_sgl()
1926 scb_t *scb; in megaraid_abort_and_reset() local
1941 scb = list_entry(pos, scb_t, list); in megaraid_abort_and_reset()
1943 if (!cmd || scb->cmd == cmd) { /* Found command */ in megaraid_abort_and_reset()
1945 scb->state |= aor; in megaraid_abort_and_reset()
1953 if( scb->state & SCB_ISSUED ) { in megaraid_abort_and_reset()
1958 scb->idx); in megaraid_abort_and_reset()
1969 scb->idx); in megaraid_abort_and_reset()
1970 mega_free_scb(adapter, scb); in megaraid_abort_and_reset()
2848 * Allocate memory for the various pointers in the scb structures:
2855 scb_t *scb; in mega_init_scb() local
2860 scb = &adapter->scb_list[i]; in mega_init_scb()
2862 scb->sgl64 = NULL; in mega_init_scb()
2863 scb->sgl = NULL; in mega_init_scb()
2864 scb->pthru = NULL; in mega_init_scb()
2865 scb->epthru = NULL; in mega_init_scb()
2870 scb = &adapter->scb_list[i]; in mega_init_scb()
2872 scb->idx = i; in mega_init_scb()
2874 scb->sgl64 = dma_alloc_coherent(&adapter->dev->dev, in mega_init_scb()
2876 &scb->sgl_dma_addr, GFP_KERNEL); in mega_init_scb()
2878 scb->sgl = (mega_sglist *)scb->sgl64; in mega_init_scb()
2880 if( !scb->sgl ) { in mega_init_scb()
2886 scb->pthru = dma_alloc_coherent(&adapter->dev->dev, in mega_init_scb()
2888 &scb->pthru_dma_addr, GFP_KERNEL); in mega_init_scb()
2890 if( !scb->pthru ) { in mega_init_scb()
2896 scb->epthru = dma_alloc_coherent(&adapter->dev->dev, in mega_init_scb()
2898 &scb->epthru_dma_addr, GFP_KERNEL); in mega_init_scb()
2900 if( !scb->epthru ) { in mega_init_scb()
2908 scb->dma_type = MEGA_DMA_TYPE_NONE; in mega_init_scb()
2915 scb->state = SCB_FREE; in mega_init_scb()
2916 scb->cmd = NULL; in mega_init_scb()
2917 list_add(&scb->list, &adapter->free_list); in mega_init_scb()
3766 scb_t *scb; in mega_del_logdrv() local
3794 scb = list_entry(pos, scb_t, list); in mega_del_logdrv()
3795 if (scb->pthru->logdrv < 0x80 ) in mega_del_logdrv()
3796 scb->pthru->logdrv += 0x80; in mega_del_logdrv()
4047 scb_t *scb; in mega_internal_command() local
4057 scb = &adapter->int_scb; in mega_internal_command()
4058 memset(scb, 0, sizeof(scb_t)); in mega_internal_command()
4060 scb->idx = CMDID_INT_CMDS; in mega_internal_command()
4061 scb->state |= SCB_ACTIVE | SCB_PENDQ; in mega_internal_command()
4063 memcpy(scb->raw_mbox, mc, sizeof(megacmd_t)); in mega_internal_command()
4069 scb->pthru = pthru; in mega_internal_command()
4072 list_add_tail(&scb->list, &adapter->pending_list); in mega_internal_command()