diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2007-05-25 13:08:10 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-31 13:25:27 -0400 |
commit | 10803de4c18e8e085573fd7153de3e64d4246af5 (patch) | |
tree | f66d55d5941e8196ec694333a7aec3de5e21af94 | |
parent | 385d70b4e2659ae525a00e46a9f97146949cfc14 (diff) |
[SCSI] dpt_i2o: 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.
Jens Axboe <jens.axboe@oracle.com> did the for_each_sg cleanup.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
ACK. Code inspected. Driver changes NOT unit tested or compile tested.
Acked-by: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/dpt_i2o.c | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c index 8c7d2bbf9b1a..2e2362d787ca 100644 --- a/drivers/scsi/dpt_i2o.c +++ b/drivers/scsi/dpt_i2o.c | |||
@@ -2078,12 +2078,13 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d | |||
2078 | u32 *lenptr; | 2078 | u32 *lenptr; |
2079 | int direction; | 2079 | int direction; |
2080 | int scsidir; | 2080 | int scsidir; |
2081 | int nseg; | ||
2081 | u32 len; | 2082 | u32 len; |
2082 | u32 reqlen; | 2083 | u32 reqlen; |
2083 | s32 rcode; | 2084 | s32 rcode; |
2084 | 2085 | ||
2085 | memset(msg, 0 , sizeof(msg)); | 2086 | memset(msg, 0 , sizeof(msg)); |
2086 | len = cmd->request_bufflen; | 2087 | len = scsi_bufflen(cmd); |
2087 | direction = 0x00000000; | 2088 | direction = 0x00000000; |
2088 | 2089 | ||
2089 | scsidir = 0x00000000; // DATA NO XFER | 2090 | scsidir = 0x00000000; // DATA NO XFER |
@@ -2140,21 +2141,21 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d | |||
2140 | lenptr=mptr++; /* Remember me - fill in when we know */ | 2141 | lenptr=mptr++; /* Remember me - fill in when we know */ |
2141 | reqlen = 14; // SINGLE SGE | 2142 | reqlen = 14; // SINGLE SGE |
2142 | /* Now fill in the SGList and command */ | 2143 | /* Now fill in the SGList and command */ |
2143 | if(cmd->use_sg) { | ||
2144 | struct scatterlist *sg = (struct scatterlist *)cmd->request_buffer; | ||
2145 | int sg_count = pci_map_sg(pHba->pDev, sg, cmd->use_sg, | ||
2146 | cmd->sc_data_direction); | ||
2147 | 2144 | ||
2145 | nseg = scsi_dma_map(cmd); | ||
2146 | BUG_ON(nseg < 0); | ||
2147 | if (nseg) { | ||
2148 | struct scatterlist *sg; | ||
2148 | 2149 | ||
2149 | len = 0; | 2150 | len = 0; |
2150 | for(i = 0 ; i < sg_count; i++) { | 2151 | scsi_for_each_sg(cmd, sg, nseg, i) { |
2151 | *mptr++ = direction|0x10000000|sg_dma_len(sg); | 2152 | *mptr++ = direction|0x10000000|sg_dma_len(sg); |
2152 | len+=sg_dma_len(sg); | 2153 | len+=sg_dma_len(sg); |
2153 | *mptr++ = sg_dma_address(sg); | 2154 | *mptr++ = sg_dma_address(sg); |
2154 | sg++; | 2155 | /* Make this an end of list */ |
2156 | if (i == nseg - 1) | ||
2157 | mptr[-2] = direction|0xD0000000|sg_dma_len(sg); | ||
2155 | } | 2158 | } |
2156 | /* Make this an end of list */ | ||
2157 | mptr[-2] = direction|0xD0000000|sg_dma_len(sg-1); | ||
2158 | reqlen = mptr - msg; | 2159 | reqlen = mptr - msg; |
2159 | *lenptr = len; | 2160 | *lenptr = len; |
2160 | 2161 | ||
@@ -2163,16 +2164,8 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d | |||
2163 | len, cmd->underflow); | 2164 | len, cmd->underflow); |
2164 | } | 2165 | } |
2165 | } else { | 2166 | } else { |
2166 | *lenptr = len = cmd->request_bufflen; | 2167 | *lenptr = len = 0; |
2167 | if(len == 0) { | 2168 | reqlen = 12; |
2168 | reqlen = 12; | ||
2169 | } else { | ||
2170 | *mptr++ = 0xD0000000|direction|cmd->request_bufflen; | ||
2171 | *mptr++ = pci_map_single(pHba->pDev, | ||
2172 | cmd->request_buffer, | ||
2173 | cmd->request_bufflen, | ||
2174 | cmd->sc_data_direction); | ||
2175 | } | ||
2176 | } | 2169 | } |
2177 | 2170 | ||
2178 | /* Stick the headers on */ | 2171 | /* Stick the headers on */ |
@@ -2232,7 +2225,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) | |||
2232 | hba_status = detailed_status >> 8; | 2225 | hba_status = detailed_status >> 8; |
2233 | 2226 | ||
2234 | // calculate resid for sg | 2227 | // calculate resid for sg |
2235 | cmd->resid = cmd->request_bufflen - readl(reply+5); | 2228 | scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+5)); |
2236 | 2229 | ||
2237 | pHba = (adpt_hba*) cmd->device->host->hostdata[0]; | 2230 | pHba = (adpt_hba*) cmd->device->host->hostdata[0]; |
2238 | 2231 | ||