linux-mips
[Top] [All Lists]

[PATCH] tx4939ide: Do not use zero count PRD entry

To: linux-ide@vger.kernel.org
Subject: [PATCH] tx4939ide: Do not use zero count PRD entry
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Thu, 25 Dec 2008 23:32:37 +0900
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>, sshtylyov@ru.mvista.com, linux-mips@linux-mips.org, stable <stable@kernel.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
This fixes data corruption on some heavy load.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: stable <stable@kernel.org>
---
 drivers/ide/tx4939ide.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/ide/tx4939ide.c b/drivers/ide/tx4939ide.c
index bafb7d1..30d0d25 100644
--- a/drivers/ide/tx4939ide.c
+++ b/drivers/ide/tx4939ide.c
@@ -259,6 +259,12 @@ static int tx4939ide_build_dmatable(ide_drive_t *drive, 
struct request *rq)
                        bcount = 0x10000 - (cur_addr & 0xffff);
                        if (bcount > cur_len)
                                bcount = cur_len;
+                       /*
+                        * This workaround for zero count seems required.
+                        * (standard ide_build_dmatable do it too)
+                        */
+                       if ((bcount & 0xffff) == 0x0000)
+                               bcount = 0x8000;
                        *table++ = bcount & 0xffff;
                        *table++ = cur_addr;
                        cur_addr += bcount;
-- 
1.5.6.3


<Prev in Thread] Current Thread [Next in Thread>