提交 10803de4 编写于 作者: F FUJITA Tomonori 提交者: James Bottomley

[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: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

ACK. Code inspected. Driver changes NOT unit tested or compile tested.
Acked-by: N"Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 385d70b4
...@@ -2078,12 +2078,13 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d ...@@ -2078,12 +2078,13 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
u32 *lenptr; u32 *lenptr;
int direction; int direction;
int scsidir; int scsidir;
int nseg;
u32 len; u32 len;
u32 reqlen; u32 reqlen;
s32 rcode; s32 rcode;
memset(msg, 0 , sizeof(msg)); memset(msg, 0 , sizeof(msg));
len = cmd->request_bufflen; len = scsi_bufflen(cmd);
direction = 0x00000000; direction = 0x00000000;
scsidir = 0x00000000; // DATA NO XFER 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,21 +2141,21 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
lenptr=mptr++; /* Remember me - fill in when we know */ lenptr=mptr++; /* Remember me - fill in when we know */
reqlen = 14; // SINGLE SGE reqlen = 14; // SINGLE SGE
/* Now fill in the SGList and command */ /* Now fill in the SGList and command */
if(cmd->use_sg) {
struct scatterlist *sg = (struct scatterlist *)cmd->request_buffer;
int sg_count = pci_map_sg(pHba->pDev, sg, cmd->use_sg,
cmd->sc_data_direction);
nseg = scsi_dma_map(cmd);
BUG_ON(nseg < 0);
if (nseg) {
struct scatterlist *sg;
len = 0; len = 0;
for(i = 0 ; i < sg_count; i++) { scsi_for_each_sg(cmd, sg, nseg, i) {
*mptr++ = direction|0x10000000|sg_dma_len(sg); *mptr++ = direction|0x10000000|sg_dma_len(sg);
len+=sg_dma_len(sg); len+=sg_dma_len(sg);
*mptr++ = sg_dma_address(sg); *mptr++ = sg_dma_address(sg);
sg++; /* Make this an end of list */
if (i == nseg - 1)
mptr[-2] = direction|0xD0000000|sg_dma_len(sg);
} }
/* Make this an end of list */
mptr[-2] = direction|0xD0000000|sg_dma_len(sg-1);
reqlen = mptr - msg; reqlen = mptr - msg;
*lenptr = len; *lenptr = len;
...@@ -2163,16 +2164,8 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d ...@@ -2163,16 +2164,8 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
len, cmd->underflow); len, cmd->underflow);
} }
} else { } else {
*lenptr = len = cmd->request_bufflen; *lenptr = len = 0;
if(len == 0) { reqlen = 12;
reqlen = 12;
} else {
*mptr++ = 0xD0000000|direction|cmd->request_bufflen;
*mptr++ = pci_map_single(pHba->pDev,
cmd->request_buffer,
cmd->request_bufflen,
cmd->sc_data_direction);
}
} }
/* Stick the headers on */ /* Stick the headers on */
...@@ -2232,7 +2225,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd) ...@@ -2232,7 +2225,7 @@ static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
hba_status = detailed_status >> 8; hba_status = detailed_status >> 8;
// calculate resid for sg // calculate resid for sg
cmd->resid = cmd->request_bufflen - readl(reply+5); scsi_set_resid(cmd, scsi_bufflen(cmd) - readl(reply+5));
pHba = (adpt_hba*) cmd->device->host->hostdata[0]; pHba = (adpt_hba*) cmd->device->host->hostdata[0];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册