mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed drive identification bug.
svn path=/trunk/; revision=2548
This commit is contained in:
parent
148e40a24e
commit
56275af6c3
1 changed files with 21 additions and 8 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ide.c,v 1.49 2001/11/03 16:34:58 ekohl Exp $
|
/* $Id: ide.c,v 1.50 2002/01/24 10:04:50 ekohl Exp $
|
||||||
*
|
*
|
||||||
* IDE.C - IDE Disk driver
|
* IDE.C - IDE Disk driver
|
||||||
* written by Rex Jolliff
|
* written by Rex Jolliff
|
||||||
|
@ -817,7 +817,7 @@ IDEGetDriveIdentification(IN int CommandPort,
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Get the Drive Identify block from drive or die */
|
/* Get the Drive Identify block from drive or die */
|
||||||
if (IDEPolledRead(CommandPort, 0, 0, 0, 0, 0, (DriveNum ? IDE_DH_DRV1 : 0),
|
if (IDEPolledRead(CommandPort, 0, 1, 0, 0, 0, (DriveNum ? IDE_DH_DRV1 : 0),
|
||||||
IDE_CMD_IDENT_DRV, (BYTE *)DrvParms) != 0)
|
IDE_CMD_IDENT_DRV, (BYTE *)DrvParms) != 0)
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
@ -1129,6 +1129,8 @@ IDEPolledRead(IN WORD Address,
|
||||||
{
|
{
|
||||||
BYTE Status;
|
BYTE Status;
|
||||||
int RetryCount;
|
int RetryCount;
|
||||||
|
BOOLEAN ReadJunk = FALSE;
|
||||||
|
ULONG SectorCount = 0;
|
||||||
|
|
||||||
/* Wait for STATUS.BUSY and STATUS.DRQ to clear */
|
/* Wait for STATUS.BUSY and STATUS.DRQ to clear */
|
||||||
for (RetryCount = 0; RetryCount < IDE_MAX_BUSY_RETRIES; RetryCount++)
|
for (RetryCount = 0; RetryCount < IDE_MAX_BUSY_RETRIES; RetryCount++)
|
||||||
|
@ -1196,8 +1198,6 @@ IDEPolledRead(IN WORD Address,
|
||||||
IDEWriteCommand(Address, Command);
|
IDEWriteCommand(Address, Command);
|
||||||
KeStallExecutionProcessor(50);
|
KeStallExecutionProcessor(50);
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
/* wait for DRQ or error */
|
/* wait for DRQ or error */
|
||||||
for (RetryCount = 0; RetryCount < IDE_MAX_POLL_RETRIES; RetryCount++)
|
for (RetryCount = 0; RetryCount < IDE_MAX_POLL_RETRIES; RetryCount++)
|
||||||
{
|
{
|
||||||
|
@ -1224,9 +1224,20 @@ IDEPolledRead(IN WORD Address,
|
||||||
return IDE_ER_ABRT;
|
return IDE_ER_ABRT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
/* Read data into buffer */
|
/* Read data into buffer */
|
||||||
|
if (ReadJunk == TRUE)
|
||||||
|
{
|
||||||
|
UCHAR JunkBuffer[IDE_SECTOR_BUF_SZ];
|
||||||
|
IDEReadBlock(Address, JunkBuffer, IDE_SECTOR_BUF_SZ);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
IDEReadBlock(Address, Buffer, IDE_SECTOR_BUF_SZ);
|
IDEReadBlock(Address, Buffer, IDE_SECTOR_BUF_SZ);
|
||||||
Buffer += IDE_SECTOR_BUF_SZ;
|
Buffer += IDE_SECTOR_BUF_SZ;
|
||||||
|
}
|
||||||
|
SectorCount++;
|
||||||
|
|
||||||
/* Check for more sectors to read */
|
/* Check for more sectors to read */
|
||||||
for (RetryCount = 0; RetryCount < IDE_MAX_BUSY_RETRIES; RetryCount++)
|
for (RetryCount = 0; RetryCount < IDE_MAX_BUSY_RETRIES; RetryCount++)
|
||||||
|
@ -1240,6 +1251,8 @@ IDEPolledRead(IN WORD Address,
|
||||||
}
|
}
|
||||||
if (Status & IDE_SR_DRQ)
|
if (Status & IDE_SR_DRQ)
|
||||||
{
|
{
|
||||||
|
if (SectorCount >= SectorCnt)
|
||||||
|
ReadJunk = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue