Lines Matching refs:ccb
315 struct st_ccb *ccb; member
404 struct req_msg *req, struct st_ccb *ccb) in stex_map_sg() argument
412 cmd = ccb->cmd; in stex_map_sg()
418 ccb->sg_count = nseg; in stex_map_sg()
436 struct req_msg *req, struct st_ccb *ccb) in stex_ss_map_sg() argument
444 cmd = ccb->cmd; in stex_ss_map_sg()
450 ccb->sg_count = nseg; in stex_ss_map_sg()
468 static void stex_controller_info(struct st_hba *hba, struct st_ccb *ccb) in stex_controller_info() argument
474 scsi_sg_copy_to_buffer(ccb->cmd, p, count); in stex_controller_info()
492 scsi_sg_copy_from_buffer(ccb->cmd, p, count); in stex_controller_info()
500 hba->ccb[tag].req = req; in stex_send_cmd()
517 hba->ccb[tag].req = req; in stex_ss_send_cmd()
520 cmd = hba->ccb[tag].cmd; in stex_ss_send_cmd()
527 addr += (hba->ccb[tag].sg_count+4)/11; in stex_ss_send_cmd()
663 hba->ccb[tag].cmd = cmd; in stex_queuecommand_lck()
664 hba->ccb[tag].sense_bufflen = SCSI_SENSE_BUFFERSIZE; in stex_queuecommand_lck()
665 hba->ccb[tag].sense_buffer = cmd->sense_buffer; in stex_queuecommand_lck()
667 if (!hba->map_sg(hba, req, &hba->ccb[tag])) { in stex_queuecommand_lck()
668 hba->ccb[tag].sg_count = 0; in stex_queuecommand_lck()
678 static void stex_scsi_done(struct st_ccb *ccb) in DEF_SCSI_QCMD()
680 struct scsi_cmnd *cmd = ccb->cmd; in DEF_SCSI_QCMD()
683 if (ccb->srb_status == SRB_STATUS_SUCCESS || ccb->srb_status == 0) { in DEF_SCSI_QCMD()
684 result = ccb->scsi_status; in DEF_SCSI_QCMD()
685 switch (ccb->scsi_status) { in DEF_SCSI_QCMD()
700 else if (ccb->srb_status & SRB_SEE_SENSE) in DEF_SCSI_QCMD()
702 else switch (ccb->srb_status) { in DEF_SCSI_QCMD()
720 static void stex_copy_data(struct st_ccb *ccb, in stex_copy_data() argument
724 if (ccb->sense_buffer != NULL) in stex_copy_data()
725 memcpy(ccb->sense_buffer, resp->variable, in stex_copy_data()
726 min(variable, ccb->sense_bufflen)); in stex_copy_data()
730 if (ccb->cmd == NULL) in stex_copy_data()
732 scsi_sg_copy_from_buffer(ccb->cmd, resp->variable, variable); in stex_copy_data()
736 struct st_ccb *ccb, struct status_msg *resp) in stex_check_cmd() argument
738 if (ccb->cmd->cmnd[0] == MGT_CMD && in stex_check_cmd()
740 scsi_set_resid(ccb->cmd, scsi_bufflen(ccb->cmd) - in stex_check_cmd()
748 struct st_ccb *ccb; in stex_mu_intr() local
788 ccb = &hba->ccb[tag]; in stex_mu_intr()
789 if (unlikely(hba->wait_ccb == ccb)) in stex_mu_intr()
791 if (unlikely(ccb->req == NULL)) { in stex_mu_intr()
805 stex_copy_data(ccb, resp, size); in stex_mu_intr()
808 ccb->req = NULL; in stex_mu_intr()
809 ccb->srb_status = resp->srb_status; in stex_mu_intr()
810 ccb->scsi_status = resp->scsi_status; in stex_mu_intr()
812 if (likely(ccb->cmd != NULL)) { in stex_mu_intr()
814 stex_check_cmd(hba, ccb, resp); in stex_mu_intr()
816 if (unlikely(ccb->cmd->cmnd[0] == PASSTHRU_CMD && in stex_mu_intr()
817 ccb->cmd->cmnd[1] == PASSTHRU_GET_ADAPTER)) in stex_mu_intr()
818 stex_controller_info(hba, ccb); in stex_mu_intr()
820 scsi_dma_unmap(ccb->cmd); in stex_mu_intr()
821 stex_scsi_done(ccb); in stex_mu_intr()
823 ccb->req_type = 0; in stex_mu_intr()
862 struct st_ccb *ccb; in stex_ss_mu_intr() local
893 ccb = &hba->ccb[tag]; in stex_ss_mu_intr()
894 if (unlikely(hba->wait_ccb == ccb)) in stex_ss_mu_intr()
896 if (unlikely(ccb->req == NULL)) { in stex_ss_mu_intr()
902 ccb->req = NULL; in stex_ss_mu_intr()
904 ccb->srb_status = SRB_STATUS_SUCCESS; in stex_ss_mu_intr()
905 ccb->scsi_status = SAM_STAT_GOOD; in stex_ss_mu_intr()
907 ccb->srb_status = resp->srb_status; in stex_ss_mu_intr()
908 ccb->scsi_status = resp->scsi_status; in stex_ss_mu_intr()
918 stex_copy_data(ccb, resp, size); in stex_ss_mu_intr()
920 if (likely(ccb->cmd != NULL)) in stex_ss_mu_intr()
921 stex_check_cmd(hba, ccb, resp); in stex_ss_mu_intr()
924 if (likely(ccb->cmd != NULL)) { in stex_ss_mu_intr()
925 scsi_dma_unmap(ccb->cmd); in stex_ss_mu_intr()
926 stex_scsi_done(ccb); in stex_ss_mu_intr()
928 ccb->req_type = 0; in stex_ss_mu_intr()
1145 hba->ccb[tag].req && hba->ccb[tag].cmd == cmd) in stex_abort()
1146 hba->wait_ccb = &hba->ccb[tag]; in stex_abort()
1262 struct st_ccb *ccb; in stex_do_reset() local
1301 ccb = &hba->ccb[tag]; in stex_do_reset()
1302 if (ccb->req == NULL) in stex_do_reset()
1304 ccb->req = NULL; in stex_do_reset()
1305 if (ccb->cmd) { in stex_do_reset()
1306 scsi_dma_unmap(ccb->cmd); in stex_do_reset()
1307 ccb->cmd->result = DID_RESET << 16; in stex_do_reset()
1308 ccb->cmd->scsi_done(ccb->cmd); in stex_do_reset()
1309 ccb->cmd = NULL; in stex_do_reset()
1596 hba->ccb = kcalloc(ci->rq_count, sizeof(struct st_ccb), GFP_KERNEL); in stex_probe()
1597 if (!hba->ccb) { in stex_probe()
1672 kfree(hba->ccb); in stex_probe()
1715 hba->ccb[tag].cmd = NULL; in stex_hba_stop()
1716 hba->ccb[tag].sg_count = 0; in stex_hba_stop()
1717 hba->ccb[tag].sense_bufflen = 0; in stex_hba_stop()
1718 hba->ccb[tag].sense_buffer = NULL; in stex_hba_stop()
1719 hba->ccb[tag].req_type = PASSTHRU_REQ_TYPE; in stex_hba_stop()
1725 while (hba->ccb[tag].req_type & PASSTHRU_REQ_TYPE) { in stex_hba_stop()
1727 hba->ccb[tag].req_type = 0; in stex_hba_stop()
1744 kfree(hba->ccb); in stex_hba_free()