aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_mv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_mv.c')
-rw-r--r--drivers/ata/sata_mv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 181f02127410..9c8ea2c1116d 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -1364,12 +1364,13 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
1364 u32 offset = addr & 0xffff; 1364 u32 offset = addr & 0xffff;
1365 u32 len = sg_len; 1365 u32 len = sg_len;
1366 1366
1367 if ((offset + sg_len > 0x10000)) 1367 if (offset + len > 0x10000)
1368 len = 0x10000 - offset; 1368 len = 0x10000 - offset;
1369 1369
1370 mv_sg->addr = cpu_to_le32(addr & 0xffffffff); 1370 mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
1371 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16); 1371 mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
1372 mv_sg->flags_size = cpu_to_le32(len & 0xffff); 1372 mv_sg->flags_size = cpu_to_le32(len & 0xffff);
1373 mv_sg->reserved = 0;
1373 1374
1374 sg_len -= len; 1375 sg_len -= len;
1375 addr += len; 1376 addr += len;
@@ -1381,6 +1382,7 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
1381 1382
1382 if (likely(last_sg)) 1383 if (likely(last_sg))
1383 last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); 1384 last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
1385 mb(); /* ensure data structure is visible to the chipset */
1384} 1386}
1385 1387
1386static void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last) 1388static void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)