diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2007-05-25 13:03:36 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-27 22:42:56 -0400 |
commit | 22c1a6600af920f4fef6d5cc51a8f04b58e9db83 (patch) | |
tree | 1b12d980b7ff02de788e2a72683b16b42c9ea9e3 /drivers/scsi/aic7xxx_old.c | |
parent | 85289f2efa108d1586a86d0c426ffc9d641bbdc2 (diff) |
[SCSI] aic7xxx_old: 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: Doug Ledford <dledford@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aic7xxx_old.c')
-rw-r--r-- | drivers/scsi/aic7xxx_old.c | 55 |
1 files changed, 14 insertions, 41 deletions
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c index a988d5abf702..f5e3c6b27c70 100644 --- a/drivers/scsi/aic7xxx_old.c +++ b/drivers/scsi/aic7xxx_old.c | |||
@@ -2690,17 +2690,8 @@ aic7xxx_done(struct aic7xxx_host *p, struct aic7xxx_scb *scb) | |||
2690 | struct aic7xxx_scb *scbp; | 2690 | struct aic7xxx_scb *scbp; |
2691 | unsigned char queue_depth; | 2691 | unsigned char queue_depth; |
2692 | 2692 | ||
2693 | if (cmd->use_sg > 1) | 2693 | scsi_dma_unmap(cmd); |
2694 | { | ||
2695 | struct scatterlist *sg; | ||
2696 | 2694 | ||
2697 | sg = (struct scatterlist *)cmd->request_buffer; | ||
2698 | pci_unmap_sg(p->pdev, sg, cmd->use_sg, cmd->sc_data_direction); | ||
2699 | } | ||
2700 | else if (cmd->request_bufflen) | ||
2701 | pci_unmap_single(p->pdev, aic7xxx_mapping(cmd), | ||
2702 | cmd->request_bufflen, | ||
2703 | cmd->sc_data_direction); | ||
2704 | if (scb->flags & SCB_SENSE) | 2695 | if (scb->flags & SCB_SENSE) |
2705 | { | 2696 | { |
2706 | pci_unmap_single(p->pdev, | 2697 | pci_unmap_single(p->pdev, |
@@ -3869,7 +3860,7 @@ aic7xxx_calculate_residual (struct aic7xxx_host *p, struct aic7xxx_scb *scb) | |||
3869 | * the mid layer didn't check residual data counts to see if the | 3860 | * the mid layer didn't check residual data counts to see if the |
3870 | * command needs retried. | 3861 | * command needs retried. |
3871 | */ | 3862 | */ |
3872 | cmd->resid = scb->sg_length - actual; | 3863 | scsi_set_resid(cmd, scb->sg_length - actual); |
3873 | aic7xxx_status(cmd) = hscb->target_status; | 3864 | aic7xxx_status(cmd) = hscb->target_status; |
3874 | } | 3865 | } |
3875 | } | 3866 | } |
@@ -10137,6 +10128,7 @@ static void aic7xxx_buildscb(struct aic7xxx_host *p, struct scsi_cmnd *cmd, | |||
10137 | struct scsi_device *sdptr = cmd->device; | 10128 | struct scsi_device *sdptr = cmd->device; |
10138 | unsigned char tindex = TARGET_INDEX(cmd); | 10129 | unsigned char tindex = TARGET_INDEX(cmd); |
10139 | struct request *req = cmd->request; | 10130 | struct request *req = cmd->request; |
10131 | int use_sg; | ||
10140 | 10132 | ||
10141 | mask = (0x01 << tindex); | 10133 | mask = (0x01 << tindex); |
10142 | hscb = scb->hscb; | 10134 | hscb = scb->hscb; |
@@ -10209,8 +10201,10 @@ static void aic7xxx_buildscb(struct aic7xxx_host *p, struct scsi_cmnd *cmd, | |||
10209 | memcpy(scb->cmnd, cmd->cmnd, cmd->cmd_len); | 10201 | memcpy(scb->cmnd, cmd->cmnd, cmd->cmd_len); |
10210 | hscb->SCSI_cmd_pointer = cpu_to_le32(SCB_DMA_ADDR(scb, scb->cmnd)); | 10202 | hscb->SCSI_cmd_pointer = cpu_to_le32(SCB_DMA_ADDR(scb, scb->cmnd)); |
10211 | 10203 | ||
10212 | if (cmd->use_sg) | 10204 | use_sg = scsi_dma_map(cmd); |
10213 | { | 10205 | BUG_ON(use_sg < 0); |
10206 | |||
10207 | if (use_sg) { | ||
10214 | struct scatterlist *sg; /* Must be mid-level SCSI code scatterlist */ | 10208 | struct scatterlist *sg; /* Must be mid-level SCSI code scatterlist */ |
10215 | 10209 | ||
10216 | /* | 10210 | /* |
@@ -10219,11 +10213,11 @@ static void aic7xxx_buildscb(struct aic7xxx_host *p, struct scsi_cmnd *cmd, | |||
10219 | * differences and the kernel SG list uses virtual addresses where | 10213 | * differences and the kernel SG list uses virtual addresses where |
10220 | * we need physical addresses. | 10214 | * we need physical addresses. |
10221 | */ | 10215 | */ |
10222 | int i, use_sg; | 10216 | int i; |
10223 | 10217 | ||
10224 | sg = (struct scatterlist *)cmd->request_buffer; | ||
10225 | scb->sg_length = 0; | 10218 | scb->sg_length = 0; |
10226 | use_sg = pci_map_sg(p->pdev, sg, cmd->use_sg, cmd->sc_data_direction); | 10219 | |
10220 | |||
10227 | /* | 10221 | /* |
10228 | * Copy the segments into the SG array. NOTE!!! - We used to | 10222 | * Copy the segments into the SG array. NOTE!!! - We used to |
10229 | * have the first entry both in the data_pointer area and the first | 10223 | * have the first entry both in the data_pointer area and the first |
@@ -10231,10 +10225,9 @@ static void aic7xxx_buildscb(struct aic7xxx_host *p, struct scsi_cmnd *cmd, | |||
10231 | * entry in both places, but now we download the address of | 10225 | * entry in both places, but now we download the address of |
10232 | * scb->sg_list[1] instead of 0 to the sg pointer in the hscb. | 10226 | * scb->sg_list[1] instead of 0 to the sg pointer in the hscb. |
10233 | */ | 10227 | */ |
10234 | for (i = 0; i < use_sg; i++) | 10228 | scsi_for_each_sg(cmd, sg, use_sg, i) { |
10235 | { | 10229 | unsigned int len = sg_dma_len(sg); |
10236 | unsigned int len = sg_dma_len(sg+i); | 10230 | scb->sg_list[i].address = cpu_to_le32(sg_dma_address(sg)); |
10237 | scb->sg_list[i].address = cpu_to_le32(sg_dma_address(sg+i)); | ||
10238 | scb->sg_list[i].length = cpu_to_le32(len); | 10231 | scb->sg_list[i].length = cpu_to_le32(len); |
10239 | scb->sg_length += len; | 10232 | scb->sg_length += len; |
10240 | } | 10233 | } |
@@ -10244,33 +10237,13 @@ static void aic7xxx_buildscb(struct aic7xxx_host *p, struct scsi_cmnd *cmd, | |||
10244 | scb->sg_count = i; | 10237 | scb->sg_count = i; |
10245 | hscb->SG_segment_count = i; | 10238 | hscb->SG_segment_count = i; |
10246 | hscb->SG_list_pointer = cpu_to_le32(SCB_DMA_ADDR(scb, &scb->sg_list[1])); | 10239 | hscb->SG_list_pointer = cpu_to_le32(SCB_DMA_ADDR(scb, &scb->sg_list[1])); |
10247 | } | 10240 | } else { |
10248 | else | ||
10249 | { | ||
10250 | if (cmd->request_bufflen) | ||
10251 | { | ||
10252 | unsigned int address = pci_map_single(p->pdev, cmd->request_buffer, | ||
10253 | cmd->request_bufflen, | ||
10254 | cmd->sc_data_direction); | ||
10255 | aic7xxx_mapping(cmd) = address; | ||
10256 | scb->sg_list[0].address = cpu_to_le32(address); | ||
10257 | scb->sg_list[0].length = cpu_to_le32(cmd->request_bufflen); | ||
10258 | scb->sg_count = 1; | ||
10259 | scb->sg_length = cmd->request_bufflen; | ||
10260 | hscb->SG_segment_count = 1; | ||
10261 | hscb->SG_list_pointer = cpu_to_le32(SCB_DMA_ADDR(scb, &scb->sg_list[0])); | ||
10262 | hscb->data_count = scb->sg_list[0].length; | ||
10263 | hscb->data_pointer = scb->sg_list[0].address; | ||
10264 | } | ||
10265 | else | ||
10266 | { | ||
10267 | scb->sg_count = 0; | 10241 | scb->sg_count = 0; |
10268 | scb->sg_length = 0; | 10242 | scb->sg_length = 0; |
10269 | hscb->SG_segment_count = 0; | 10243 | hscb->SG_segment_count = 0; |
10270 | hscb->SG_list_pointer = 0; | 10244 | hscb->SG_list_pointer = 0; |
10271 | hscb->data_count = 0; | 10245 | hscb->data_count = 0; |
10272 | hscb->data_pointer = 0; | 10246 | hscb->data_pointer = 0; |
10273 | } | ||
10274 | } | 10247 | } |
10275 | } | 10248 | } |
10276 | 10249 | ||