aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-10-02 21:45:27 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-03 14:41:20 -0400
commit4007b493ee6e4a52c2b618ab8361847fba5bf116 (patch)
treed98d08a9bf2fa308161f99235c15cec40645de49 /drivers/ata/sata_mv.c
parentf778089cb2445dfc6dfd30a7a567925fd8589f1e (diff)
libata: fix for sata_mv >64KB DMA segments
Fix bug in sata_mv for cases where the IOMMU layer has merged SG entries to larger than 64KB. They need to be split up before being sent to the driver. Just for simplicity's sake, split up at 64K boundary instead of 64K size, since that's what the common code does anyway. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 11bf6c7ac122..1a82e22b3efd 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1139,15 +1139,27 @@ static unsigned int mv_fill_sg(struct ata_queued_cmd *qc)
1139 dma_addr_t addr = sg_dma_address(sg); 1139 dma_addr_t addr = sg_dma_address(sg);
1140 u32 sg_len = sg_dma_len(sg); 1140 u32 sg_len = sg_dma_len(sg);
1141 1141
1142 mv_sg->addr = cpu_to_le32(addr & 0xffffffff); 1142 while (sg_len) {
1143 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); 1143 u32 offset = addr & 0xffff;
1144 mv_sg->flags_size = cpu_to_le32(sg_len & 0xffff); 1144 u32 len = sg_len;
1145 1145
1146 if (ata_sg_is_last(sg, qc)) 1146 if ((offset + sg_len > 0x10000))
1147 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); 1147 len = 0x10000 - offset;
1148
1149 mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
1150 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
1151 mv_sg->flags_size = cpu_to_le32(len);
1152
1153 sg_len -= len;
1154 addr += len;
1155
1156 if (!sg_len && ata_sg_is_last(sg, qc))
1157 mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1158
1159 mv_sg++;
1160 n_sg++;
1161 }
1148 1162
1149 mv_sg++;
1150 n_sg++;
1151 } 1163 }
1152 1164
1153 return n_sg; 1165 return n_sg;