// 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++)
{
return FALSE;
}
- // Negate drive reset line
- IDEWriteDriveControl(ControlPort, 0);
-
// Wait for BUSY negation
for (Retries = 0; Retries < IDE_RESET_BUSY_TIMEOUT * 1000; Retries++)
{
IDEReadSectorNum(CommandPort) == 1 &&
IDEReadCylinderLow(CommandPort) == 0 &&
IDEReadCylinderHigh(CommandPort) == 0 &&
- IDEReadDriveHead(CommandPort) == 0;
+ (IDEReadDriveHead(CommandPort) & 0x1F) == 0;
}
// IDECreateDevices
#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