From 4e2f492dc0ea2b9c593a62d42d8e5f67a0ef115e Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Fri, 13 Dec 2002 19:35:12 +0000 Subject: [PATCH] Fixed data overrun upon read commands. svn path=/trunk/; revision=3873 --- reactos/drivers/storage/atapi/atapi.c | 22 +++++++++++----------- reactos/drivers/storage/atapi/atapi.h | 4 ++++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/reactos/drivers/storage/atapi/atapi.c b/reactos/drivers/storage/atapi/atapi.c index f8285c66e55..6fc5a5b6794 100644 --- a/reactos/drivers/storage/atapi/atapi.c +++ b/reactos/drivers/storage/atapi/atapi.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: atapi.c,v 1.32 2002/12/10 12:18:33 ekohl Exp $ +/* $Id: atapi.c,v 1.33 2002/12/13 19:35:12 ekohl Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS ATAPI miniport driver @@ -997,10 +997,10 @@ AtapiInterrupt(IN PVOID DeviceExtension) } /* Check for data overrun */ - if (IDEReadStatus(CommandPortBase) & IDE_SR_DRQ) + while (IDEReadStatus(CommandPortBase) & IDE_SR_DRQ) { - /* FIXME: Handle error! */ - DPRINT1("AtapiInterrupt(): data overrun error!"); + DPRINT1("AtapiInterrupt(): reading overrun data!\n"); + IDEReadWord(CommandPortBase); } } @@ -1521,7 +1521,7 @@ AtapiPolledRead(IN ULONG CommandPort, if (Status & IDE_SR_ERR) { IDEWriteDriveControl(ControlPort, 0); - ScsiPortStallExecution(50); + ScsiPortStallExecution(50); IDEReadStatus(CommandPort); return(IDE_ER_ABRT); @@ -1575,9 +1575,9 @@ AtapiPolledRead(IN ULONG CommandPort, { if (Status & IDE_SR_ERR) { - IDEWriteDriveControl(ControlPort, 0); - ScsiPortStallExecution(50); - IDEReadStatus(CommandPort); + IDEWriteDriveControl(ControlPort, 0); + ScsiPortStallExecution(50); + IDEReadStatus(CommandPort); return(IDE_ER_ABRT); } @@ -1597,9 +1597,9 @@ AtapiPolledRead(IN ULONG CommandPort, DPRINT("Read %lu sectors of junk!\n", SectorCount - SectorCnt); } - IDEWriteDriveControl(ControlPort, 0); - ScsiPortStallExecution(50); - IDEReadStatus(CommandPort); + IDEWriteDriveControl(ControlPort, 0); + ScsiPortStallExecution(50); + IDEReadStatus(CommandPort); return(0); } diff --git a/reactos/drivers/storage/atapi/atapi.h b/reactos/drivers/storage/atapi/atapi.h index 7319a4f8741..b1b209dad72 100644 --- a/reactos/drivers/storage/atapi/atapi.h +++ b/reactos/drivers/storage/atapi/atapi.h @@ -116,6 +116,10 @@ extern "C" { (ScsiPortReadPortBufferUlong((PULONG)((Address) + IDE_REG_DATA_PORT), (PULONG)(Buffer), (Count) / 4)) #define IDEWriteBlock32(Address, Buffer, Count) \ (ScsiPortWritePortBufferUlong((PULONG)((Address) + IDE_REG_DATA_PORT), (PULONG)(Buffer), (Count) / 4)) + +#define IDEReadWord(Address) \ + (ScsiPortReadPortUshort((PUSHORT)((Address) + IDE_REG_DATA_PORT))) + // // Access macros for control registers // Each macro takes an address of the control port blank and data