diff options
Diffstat (limited to 'drivers/scsi/qlogicpti.c')
-rw-r--r-- | drivers/scsi/qlogicpti.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 7a2e7986b038..65455ab1f3b9 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c | |||
@@ -871,11 +871,12 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, | |||
871 | struct scatterlist *sg, *s; | 871 | struct scatterlist *sg, *s; |
872 | int i, n; | 872 | int i, n; |
873 | 873 | ||
874 | if (Cmnd->use_sg) { | 874 | if (scsi_bufflen(Cmnd)) { |
875 | int sg_count; | 875 | int sg_count; |
876 | 876 | ||
877 | sg = (struct scatterlist *) Cmnd->request_buffer; | 877 | sg = scsi_sglist(Cmnd); |
878 | sg_count = sbus_map_sg(qpti->sdev, sg, Cmnd->use_sg, Cmnd->sc_data_direction); | 878 | sg_count = sbus_map_sg(qpti->sdev, sg, scsi_sg_count(Cmnd), |
879 | Cmnd->sc_data_direction); | ||
879 | 880 | ||
880 | ds = cmd->dataseg; | 881 | ds = cmd->dataseg; |
881 | cmd->segment_cnt = sg_count; | 882 | cmd->segment_cnt = sg_count; |
@@ -914,16 +915,6 @@ static inline int load_cmd(struct scsi_cmnd *Cmnd, struct Command_Entry *cmd, | |||
914 | } | 915 | } |
915 | sg_count -= n; | 916 | sg_count -= n; |
916 | } | 917 | } |
917 | } else if (Cmnd->request_bufflen) { | ||
918 | Cmnd->SCp.ptr = (char *)(unsigned long) | ||
919 | sbus_map_single(qpti->sdev, | ||
920 | Cmnd->request_buffer, | ||
921 | Cmnd->request_bufflen, | ||
922 | Cmnd->sc_data_direction); | ||
923 | |||
924 | cmd->dataseg[0].d_base = (u32) ((unsigned long)Cmnd->SCp.ptr); | ||
925 | cmd->dataseg[0].d_count = Cmnd->request_bufflen; | ||
926 | cmd->segment_cnt = 1; | ||
927 | } else { | 918 | } else { |
928 | cmd->dataseg[0].d_base = 0; | 919 | cmd->dataseg[0].d_base = 0; |
929 | cmd->dataseg[0].d_count = 0; | 920 | cmd->dataseg[0].d_count = 0; |
@@ -1151,7 +1142,7 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) | |||
1151 | 1142 | ||
1152 | if (sts->state_flags & SF_GOT_SENSE) | 1143 | if (sts->state_flags & SF_GOT_SENSE) |
1153 | memcpy(Cmnd->sense_buffer, sts->req_sense_data, | 1144 | memcpy(Cmnd->sense_buffer, sts->req_sense_data, |
1154 | sizeof(Cmnd->sense_buffer)); | 1145 | SCSI_SENSE_BUFFERSIZE); |
1155 | 1146 | ||
1156 | if (sts->hdr.entry_type == ENTRY_STATUS) | 1147 | if (sts->hdr.entry_type == ENTRY_STATUS) |
1157 | Cmnd->result = | 1148 | Cmnd->result = |
@@ -1159,17 +1150,11 @@ static struct scsi_cmnd *qlogicpti_intr_handler(struct qlogicpti *qpti) | |||
1159 | else | 1150 | else |
1160 | Cmnd->result = DID_ERROR << 16; | 1151 | Cmnd->result = DID_ERROR << 16; |
1161 | 1152 | ||
1162 | if (Cmnd->use_sg) { | 1153 | if (scsi_bufflen(Cmnd)) |
1163 | sbus_unmap_sg(qpti->sdev, | 1154 | sbus_unmap_sg(qpti->sdev, |
1164 | (struct scatterlist *)Cmnd->request_buffer, | 1155 | scsi_sglist(Cmnd), scsi_sg_count(Cmnd), |
1165 | Cmnd->use_sg, | ||
1166 | Cmnd->sc_data_direction); | 1156 | Cmnd->sc_data_direction); |
1167 | } else if (Cmnd->request_bufflen) { | 1157 | |
1168 | sbus_unmap_single(qpti->sdev, | ||
1169 | (__u32)((unsigned long)Cmnd->SCp.ptr), | ||
1170 | Cmnd->request_bufflen, | ||
1171 | Cmnd->sc_data_direction); | ||
1172 | } | ||
1173 | qpti->cmd_count[Cmnd->device->id]--; | 1158 | qpti->cmd_count[Cmnd->device->id]--; |
1174 | sbus_writew(out_ptr, qpti->qregs + MBOX5); | 1159 | sbus_writew(out_ptr, qpti->qregs + MBOX5); |
1175 | Cmnd->host_scribble = (unsigned char *) done_queue; | 1160 | Cmnd->host_scribble = (unsigned char *) done_queue; |