summaryrefslogtreecommitdiff
path: root/block/blk-map.c
diff options
context:
space:
mode:
authorRichard Zhu <Richard.Zhu@freescale.com>2015-07-07 15:29:01 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:45:46 +0800
commit789755d1afa4e1a1dc06fccf6be5e8f5460e1d6a (patch)
tree709eef702ad1ec6b8480ac0d0ea51e67f8d703d2 /block/blk-map.c
parent219d54332a09e8d8741c1e1982f5eae56099de85 (diff)
MLK-11444 ata: imx: cmd buf corruption errata bug fix
errata: When a read command returns less data than specified in the PRDs (for example, there are two PRDs for this command, but the device returns a number of bytes which is less than in the first PRD), the second PRD of this command is not read out of the PRD FIFO, causing the next command to use this PRD erroneously. workaround - forces sg_tablesize = 1 - modified the sg_io function in block/scsi_ioctl.c to use a 64k buffer allocated with dma_alloc_coherent during the probe in ahci_imx - In order to fix the scsi/sata hang, when CD_ROM and HDD are accessed simultaneously after the workaround is applied. Do not go to sleep in scsi_eh_handler, when there is host failed. Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
Diffstat (limited to 'block/blk-map.c')
-rw-r--r--block/blk-map.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/block/blk-map.c b/block/blk-map.c
index 3a62e471d81b..774db8d3cced 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -205,6 +205,12 @@ int blk_rq_unmap_user(struct bio *bio)
}
EXPORT_SYMBOL(blk_rq_unmap_user);
+#ifdef CONFIG_AHCI_IMX
+extern void *sg_io_buffer_hack;
+#else
+#define sg_io_buffer_hack NULL
+#endif
+
/**
* blk_rq_map_kern - map kernel data to a request, for passthrough requests
* @q: request queue where request should be inserted
@@ -232,7 +238,14 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf,
if (!len || !kbuf)
return -EINVAL;
- do_copy = !blk_rq_aligned(q, addr, len) || object_is_on_stack(kbuf);
+#ifdef CONFIG_AHCI_IMX
+ if (kbuf == sg_io_buffer_hack)
+ do_copy = 0;
+ else
+#endif
+ do_copy = !blk_rq_aligned(q, addr, len)
+ || object_is_on_stack(kbuf);
+
if (do_copy)
bio = bio_copy_kern(q, kbuf, len, gfp_mask, reading);
else