mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Ignore junk data from ATA and ATAPI devices.
svn path=/trunk/; revision=5751
This commit is contained in:
parent
c8ca03fbbf
commit
b8eace220f
1 changed files with 21 additions and 18 deletions
|
@ -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.43 2003/08/04 08:32:48 hbirr Exp $
|
||||
/* $Id: atapi.c,v 1.44 2003/08/22 13:50:39 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS ATAPI miniport driver
|
||||
|
@ -902,14 +902,14 @@ AtapiInterrupt(IN PVOID DeviceExtension)
|
|||
PSCSI_REQUEST_BLOCK Srb;
|
||||
ULONG CommandPortBase;
|
||||
ULONG ControlPortBase;
|
||||
|
||||
UCHAR DeviceStatus;
|
||||
BOOLEAN IsLastBlock;
|
||||
BOOLEAN IsAtapi;
|
||||
ULONG Retries;
|
||||
PUCHAR TargetAddress;
|
||||
ULONG TransferSize;
|
||||
ULONG tmpTransferSize;
|
||||
ULONG JunkSize;
|
||||
USHORT Junk;
|
||||
|
||||
DPRINT("AtapiInterrupt() called!\n");
|
||||
|
||||
|
@ -980,11 +980,16 @@ AtapiInterrupt(IN PVOID DeviceExtension)
|
|||
|
||||
if (DevExt->DataTransferLength <= TransferSize)
|
||||
{
|
||||
if (IsAtapi)
|
||||
{
|
||||
tmpTransferSize = TransferSize - DevExt->DataTransferLength;
|
||||
JunkSize = TransferSize - DevExt->DataTransferLength;
|
||||
TransferSize = DevExt->DataTransferLength;
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (JunkSize > 0)
|
||||
{
|
||||
DPRINT1("Junk data: %lu bytes\n", JunkSize);
|
||||
}
|
||||
TransferSize = DevExt->DataTransferLength;
|
||||
#endif
|
||||
|
||||
DevExt->DataTransferLength = 0;
|
||||
IsLastBlock = TRUE;
|
||||
}
|
||||
|
@ -1021,17 +1026,15 @@ AtapiInterrupt(IN PVOID DeviceExtension)
|
|||
/* check DRQ */
|
||||
if (IsLastBlock)
|
||||
{
|
||||
if (IsAtapi)
|
||||
{
|
||||
USHORT u;
|
||||
while (tmpTransferSize > 0)
|
||||
{
|
||||
IDEReadBlock(CommandPortBase,
|
||||
&u,
|
||||
2);
|
||||
tmpTransferSize -= 2;
|
||||
}
|
||||
/* Read remaining junk from device */
|
||||
while (JunkSize > 0)
|
||||
{
|
||||
IDEReadBlock(CommandPortBase,
|
||||
&Junk,
|
||||
2);
|
||||
JunkSize -= 2;
|
||||
}
|
||||
|
||||
for (Retries = 0; Retries < IDE_MAX_BUSY_RETRIES &&
|
||||
(IDEReadStatus(CommandPortBase) & IDE_SR_BUSY);
|
||||
Retries++)
|
||||
|
@ -1101,7 +1104,7 @@ AtapiInterrupt(IN PVOID DeviceExtension)
|
|||
else
|
||||
{
|
||||
DPRINT("Unspecified transfer direction!\n");
|
||||
Srb->SrbStatus = SRB_STATUS_SUCCESS; // SRB_STATUS_ERROR;
|
||||
Srb->SrbStatus = SRB_STATUS_SUCCESS;
|
||||
IsLastBlock = TRUE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue