[uniata]
authorAleksey Bragin <aleksey@reactos.org>
Mon, 2 Nov 2009 20:12:19 +0000 (20:12 +0000)
committerAleksey Bragin <aleksey@reactos.org>
Mon, 2 Nov 2009 20:12:19 +0000 (20:12 +0000)
- Don't wait so long for drive reset. Reapplying r26470 by Dmitriy Gorbachev.

svn path=/trunk/; revision=43920

reactos/drivers/storage/ide/uniata/id_ata.cpp

index b3f8eb1..4f8571b 100644 (file)
@@ -679,7 +679,7 @@ AtapiSoftReset(
     )
 {
     //ULONG c = chan->lChannel;
-    ULONG i;
+    ULONG i = 1000 * 1000;
     UCHAR dma_status = 0;
     KdPrint2((PRINT_PREFIX "AtapiSoftReset:\n"));
     UCHAR statusByte2;
@@ -689,8 +689,10 @@ AtapiSoftReset(
     SelectDrive(chan, DeviceNumber);
     AtapiStallExecution(10000);
     AtapiWritePort1(chan, IDX_IO1_o_Command, IDE_COMMAND_ATAPI_RESET);
-    for (i = 0; i < 1000; i++) {
-        AtapiStallExecution(999);
+    while ((AtapiReadPort1(chan, IDX_IO1_i_Status) & IDE_STATUS_BUSY) &&
+           i--)
+    {
+        AtapiStallExecution(30);
     }
     SelectDrive(chan, DeviceNumber);
     WaitOnBusy(chan);