diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2007-05-25 13:45:17 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-29 12:22:13 -0400 |
commit | 41ce639a1c50cb936f058f52f99f65740e3f550e (patch) | |
tree | 9b5d31a4a30c616775be63b0d9775d1a210e53dd /drivers/block/cciss_scsi.c | |
parent | fb119935e11b98230f20c500e9f9125ddf0f3a4d (diff) |
[SCSI] cciss: convert to use the data buffer accessors
- remove the unnecessary map_single path.
- convert to use the new accessors for the sg lists and the
parameters.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Mike Miller <Mike.Miller@hp.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/block/cciss_scsi.c')
-rw-r--r-- | drivers/block/cciss_scsi.c | 75 |
1 files changed, 22 insertions, 53 deletions
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c index 90961a8ea895..4aca7ddfdddf 100644 --- a/drivers/block/cciss_scsi.c +++ b/drivers/block/cciss_scsi.c | |||
@@ -555,7 +555,6 @@ complete_scsi_command( CommandList_struct *cp, int timeout, __u32 tag) | |||
555 | { | 555 | { |
556 | struct scsi_cmnd *cmd; | 556 | struct scsi_cmnd *cmd; |
557 | ctlr_info_t *ctlr; | 557 | ctlr_info_t *ctlr; |
558 | u64bit addr64; | ||
559 | ErrorInfo_struct *ei; | 558 | ErrorInfo_struct *ei; |
560 | 559 | ||
561 | ei = cp->err_info; | 560 | ei = cp->err_info; |
@@ -569,20 +568,7 @@ complete_scsi_command( CommandList_struct *cp, int timeout, __u32 tag) | |||
569 | cmd = (struct scsi_cmnd *) cp->scsi_cmd; | 568 | cmd = (struct scsi_cmnd *) cp->scsi_cmd; |
570 | ctlr = hba[cp->ctlr]; | 569 | ctlr = hba[cp->ctlr]; |
571 | 570 | ||
572 | /* undo the DMA mappings */ | 571 | scsi_dma_unmap(cmd); |
573 | |||
574 | if (cmd->use_sg) { | ||
575 | pci_unmap_sg(ctlr->pdev, | ||
576 | cmd->request_buffer, cmd->use_sg, | ||
577 | cmd->sc_data_direction); | ||
578 | } | ||
579 | else if (cmd->request_bufflen) { | ||
580 | addr64.val32.lower = cp->SG[0].Addr.lower; | ||
581 | addr64.val32.upper = cp->SG[0].Addr.upper; | ||
582 | pci_unmap_single(ctlr->pdev, (dma_addr_t) addr64.val, | ||
583 | cmd->request_bufflen, | ||
584 | cmd->sc_data_direction); | ||
585 | } | ||
586 | 572 | ||
587 | cmd->result = (DID_OK << 16); /* host byte */ | 573 | cmd->result = (DID_OK << 16); /* host byte */ |
588 | cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */ | 574 | cmd->result |= (COMMAND_COMPLETE << 8); /* msg byte */ |
@@ -597,7 +583,7 @@ complete_scsi_command( CommandList_struct *cp, int timeout, __u32 tag) | |||
597 | ei->SenseLen > SCSI_SENSE_BUFFERSIZE ? | 583 | ei->SenseLen > SCSI_SENSE_BUFFERSIZE ? |
598 | SCSI_SENSE_BUFFERSIZE : | 584 | SCSI_SENSE_BUFFERSIZE : |
599 | ei->SenseLen); | 585 | ei->SenseLen); |
600 | cmd->resid = ei->ResidualCnt; | 586 | scsi_set_resid(cmd, ei->ResidualCnt); |
601 | 587 | ||
602 | if(ei->CommandStatus != 0) | 588 | if(ei->CommandStatus != 0) |
603 | { /* an error has occurred */ | 589 | { /* an error has occurred */ |
@@ -1204,46 +1190,29 @@ cciss_scatter_gather(struct pci_dev *pdev, | |||
1204 | CommandList_struct *cp, | 1190 | CommandList_struct *cp, |
1205 | struct scsi_cmnd *cmd) | 1191 | struct scsi_cmnd *cmd) |
1206 | { | 1192 | { |
1207 | unsigned int use_sg, nsegs=0, len; | 1193 | unsigned int len; |
1208 | struct scatterlist *scatter = (struct scatterlist *) cmd->request_buffer; | 1194 | struct scatterlist *sg; |
1209 | __u64 addr64; | 1195 | __u64 addr64; |
1210 | 1196 | int use_sg, i; | |
1211 | /* is it just one virtual address? */ | 1197 | |
1212 | if (!cmd->use_sg) { | 1198 | BUG_ON(scsi_sg_count(cmd) > MAXSGENTRIES); |
1213 | if (cmd->request_bufflen) { /* anything to xfer? */ | 1199 | |
1214 | 1200 | use_sg = scsi_dma_map(cmd); | |
1215 | addr64 = (__u64) pci_map_single(pdev, | 1201 | if (use_sg) { /* not too many addrs? */ |
1216 | cmd->request_buffer, | 1202 | scsi_for_each_sg(cmd, sg, use_sg, i) { |
1217 | cmd->request_bufflen, | 1203 | addr64 = (__u64) sg_dma_address(sg); |
1218 | cmd->sc_data_direction); | 1204 | len = sg_dma_len(sg); |
1219 | 1205 | cp->SG[i].Addr.lower = | |
1220 | cp->SG[0].Addr.lower = | 1206 | (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF); |
1221 | (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF); | 1207 | cp->SG[i].Addr.upper = |
1222 | cp->SG[0].Addr.upper = | 1208 | (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF); |
1223 | (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF); | 1209 | cp->SG[i].Len = len; |
1224 | cp->SG[0].Len = cmd->request_bufflen; | 1210 | cp->SG[i].Ext = 0; // we are not chaining |
1225 | nsegs=1; | ||
1226 | } | ||
1227 | } /* else, must be a list of virtual addresses.... */ | ||
1228 | else if (cmd->use_sg <= MAXSGENTRIES) { /* not too many addrs? */ | ||
1229 | |||
1230 | use_sg = pci_map_sg(pdev, cmd->request_buffer, cmd->use_sg, | ||
1231 | cmd->sc_data_direction); | ||
1232 | |||
1233 | for (nsegs=0; nsegs < use_sg; nsegs++) { | ||
1234 | addr64 = (__u64) sg_dma_address(&scatter[nsegs]); | ||
1235 | len = sg_dma_len(&scatter[nsegs]); | ||
1236 | cp->SG[nsegs].Addr.lower = | ||
1237 | (__u32) (addr64 & (__u64) 0x00000000FFFFFFFF); | ||
1238 | cp->SG[nsegs].Addr.upper = | ||
1239 | (__u32) ((addr64 >> 32) & (__u64) 0x00000000FFFFFFFF); | ||
1240 | cp->SG[nsegs].Len = len; | ||
1241 | cp->SG[nsegs].Ext = 0; // we are not chaining | ||
1242 | } | 1211 | } |
1243 | } else BUG(); | 1212 | } |
1244 | 1213 | ||
1245 | cp->Header.SGList = (__u8) nsegs; /* no. SGs contig in this cmd */ | 1214 | cp->Header.SGList = (__u8) use_sg; /* no. SGs contig in this cmd */ |
1246 | cp->Header.SGTotal = (__u16) nsegs; /* total sgs in this cmd list */ | 1215 | cp->Header.SGTotal = (__u16) use_sg; /* total sgs in this cmd list */ |
1247 | return; | 1216 | return; |
1248 | } | 1217 | } |
1249 | 1218 | ||