Commit 1d12d98d authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by James Bottomley

[SCSI] dc395x: "fix" virt_addr calculation on AUTO_REQSENSE

The patch below "fixes" calculation of the virt_addr for the AUTO_REQSENSE
case. I put "fixes" in quotes because the real fix would be to completely
remove it, but that's beyond the scope of this patch.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 2b541f8f
...@@ -246,6 +246,7 @@ struct ScsiReqBlk { ...@@ -246,6 +246,7 @@ struct ScsiReqBlk {
* total_xfer_length in xferred. These values are restored in * total_xfer_length in xferred. These values are restored in
* pci_unmap_srb_sense. This is the only place xferred is used. * pci_unmap_srb_sense. This is the only place xferred is used.
*/ */
unsigned char *virt_addr_req; /* Saved virtual address of the request buffer */
u32 xferred; /* Saved copy of total_xfer_length */ u32 xferred; /* Saved copy of total_xfer_length */
u16 state; u16 state;
...@@ -2017,7 +2018,7 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left) ...@@ -2017,7 +2018,7 @@ static void sg_update_list(struct ScsiReqBlk *srb, u32 left)
sg_verify_length(srb); sg_verify_length(srb);
/* we need the corresponding virtual address */ /* we need the corresponding virtual address */
if (!segment) { if (!segment || (srb->flag & AUTO_REQSENSE)) {
srb->virt_addr += xferred; srb->virt_addr += xferred;
return; return;
} }
...@@ -3318,6 +3319,7 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb, ...@@ -3318,6 +3319,7 @@ static void pci_unmap_srb_sense(struct AdapterCtlBlk *acb,
srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].address; srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].address;
srb->segment_x[0].length = srb->segment_x[0].length =
srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].length; srb->segment_x[DC395x_MAX_SG_LISTENTRY - 1].length;
srb->virt_addr = srb->virt_addr_req;
} }
...@@ -3711,6 +3713,8 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb, ...@@ -3711,6 +3713,8 @@ static void request_sense(struct AdapterCtlBlk *acb, struct DeviceCtlBlk *dcb,
srb->xferred = srb->total_xfer_length; srb->xferred = srb->total_xfer_length;
/* srb->segment_x : a one entry of S/G list table */ /* srb->segment_x : a one entry of S/G list table */
srb->total_xfer_length = sizeof(cmd->sense_buffer); srb->total_xfer_length = sizeof(cmd->sense_buffer);
srb->virt_addr_req = srb->virt_addr;
srb->virt_addr = cmd->sense_buffer;
srb->segment_x[0].length = sizeof(cmd->sense_buffer); srb->segment_x[0].length = sizeof(cmd->sense_buffer);
/* Map sense buffer */ /* Map sense buffer */
srb->segment_x[0].address = srb->segment_x[0].address =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment