summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Lord <liml@rtr.ca>2009-02-01 16:50:32 -0500
committerJeff Garzik <jgarzik@redhat.com>2009-03-24 22:02:38 -0400
commit32cd11a61007511ddb38783deec8bb1aa6735789 (patch)
treeda18d4cd46a627c060a390ab40a8b6f2972fc2a0
parent95db505125fb7bc624b7c3b6747bbeaebbffc2e4 (diff)
downloadlinux-3.10-32cd11a61007511ddb38783deec8bb1aa6735789.tar.gz
linux-3.10-32cd11a61007511ddb38783deec8bb1aa6735789.tar.bz2
linux-3.10-32cd11a61007511ddb38783deec8bb1aa6735789.zip
sata_mv: mv_fill_sg fixes v2
Fix mv_fill_sg() to zero out the reserved word (required for ATAPI), and to include a memory barrier. This may also help with problems reported by Jens on the PPC platform. Signed-off-by: Mark Lord <mlord@pobox.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-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 181f0212741..9c8ea2c1116 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)
u32 offset = addr & 0xffff;
u32 len = sg_len;
- if ((offset + sg_len > 0x10000))
+ if (offset + len > 0x10000)
len = 0x10000 - offset;
mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
mv_sg->flags_size = cpu_to_le32(len & 0xffff);
+ mv_sg->reserved = 0;
sg_len -= len;
addr += len;
@@ -1381,6 +1382,7 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
if (likely(last_sg))
last_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
+ mb(); /* ensure data structure is visible to the chipset */
}
static void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)