fixed drive reset bug!
authorEric Kohl <eric.kohl@reactos.org>
Tue, 23 Mar 1999 21:23:50 +0000 (21:23 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Tue, 23 Mar 1999 21:23:50 +0000 (21:23 +0000)
svn path=/trunk/; revision=333

reactos/drivers/dd/ide/ide.c
reactos/drivers/dd/ide/ide.h

index 7fa4c03..17a3809 100644 (file)
@@ -401,6 +401,12 @@ IDEResetController(IN WORD CommandPort,
     //  Assert drive reset line
   IDEWriteDriveControl(ControlPort, IDE_DC_SRST);
 
+    //  Wait for min. 25 microseconds
+  KeStallExecutionProcessor(IDE_RESET_PULSE_LENGTH);
+
+    //  Negate drive reset line
+  IDEWriteDriveControl(ControlPort, 0);
+
     //  Wait for BUSY assertion
   for (Retries = 0; Retries < IDE_MAX_BUSY_RETRIES; Retries++) 
     {
@@ -415,9 +421,6 @@ IDEResetController(IN WORD CommandPort,
       return FALSE;
     }
 
-    //  Negate drive reset line
-  IDEWriteDriveControl(ControlPort, 0);
-
     //  Wait for BUSY negation
   for (Retries = 0; Retries < IDE_RESET_BUSY_TIMEOUT * 1000; Retries++) 
     {
@@ -439,7 +442,7 @@ IDEResetController(IN WORD CommandPort,
           IDEReadSectorNum(CommandPort) == 1 &&
           IDEReadCylinderLow(CommandPort) == 0 &&
           IDEReadCylinderHigh(CommandPort) == 0 &&
-          IDEReadDriveHead(CommandPort) == 0;
+          (IDEReadDriveHead(CommandPort) & 0x1F) == 0;
 }
 
 //    IDECreateDevices
index 185be55..6525884 100644 (file)
@@ -27,6 +27,7 @@ extern "C" {
 #define  IDE_MAX_DRQ_RETRIES       10000
 #define  IDE_MAX_CMD_RETRIES       1
 #define  IDE_CMD_TIMEOUT           5
+#define  IDE_RESET_PULSE_LENGTH    500  /* maybe a little too long */
 #define  IDE_RESET_BUSY_TIMEOUT    31
 #define  IDE_RESET_DRDY_TIMEOUT    120