https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6dca83baf34e3e958be2…
commit d6dca83baf34e3e958be2effe631ac5bf3ca9990
Author:     Dmitry Borisov <di.sean(a)protonmail.com>
AuthorDate: Sat Mar 20 20:52:04 2021 +0600
Commit:     Dmitry Borisov <di.sean(a)protonmail.com>
CommitDate: Sun Jun 20 19:24:31 2021 +0600
    [ISAPNP] Reduce software delay
---
 drivers/bus/isapnp/hardware.c | 27 +++++++--------------------
 1 file changed, 7 insertions(+), 20 deletions(-)
diff --git a/drivers/bus/isapnp/hardware.c b/drivers/bus/isapnp/hardware.c
index 0b6e200478a..671a198baf6 100644
--- a/drivers/bus/isapnp/hardware.c
+++ b/drivers/bus/isapnp/hardware.c
@@ -292,14 +292,6 @@ ReadMemoryLimit32(
     return ReadDoubleWord(ReadDataPort, ISAPNP_MEMLIMIT32(Index));
 }
-static
-inline
-VOID
-HwDelay(VOID)
-{
-    KeStallExecutionProcessor(1000);
-}
-
 static
 inline
 UCHAR
@@ -320,7 +312,6 @@ SendKey(VOID)
 {
     UCHAR i, Lfsr;
-    HwDelay();
     WriteAddress(0x00);
     WriteAddress(0x00);
@@ -347,7 +338,7 @@ PeekByte(
         if (ReadStatus(ReadDataPort) & 0x01)
             return ReadResourceData(ReadDataPort);
-        HwDelay();
+        KeStallExecutionProcessor(1000);
     }
     return 0xFF;
@@ -1196,20 +1187,19 @@ TryIsolate(
     SendKey();
     ResetCsn();
-    HwDelay();
-    HwDelay();
+    KeStallExecutionProcessor(2000);
     WaitForKey();
     SendKey();
     Wake(0x00);
+    KeStallExecutionProcessor(1000);
     SetReadDataPort(ReadDataPort);
-    HwDelay();
     while (TRUE)
     {
         EnterIsolationState();
-        HwDelay();
+        KeStallExecutionProcessor(1000);
         RtlZeroMemory(&Identifier, sizeof(Identifier));
@@ -1220,9 +1210,9 @@ TryIsolate(
             for (j = 0; j < 8; j++)
             {
                 Data = ReadData(ReadDataPort);
-                HwDelay();
+                KeStallExecutionProcessor(250);
                 Data = ((Data << 8) | ReadData(ReadDataPort));
-                HwDelay();
+                KeStallExecutionProcessor(250);
                 Byte >>= 1;
                 if (Data != 0xFFFF)
@@ -1269,10 +1259,9 @@ TryIsolate(
         Csn++;
         WriteCsn(Csn);
-        HwDelay();
+        KeStallExecutionProcessor(1000);
         Wake(0x00);
-        HwDelay();
     }
     WaitForKey();
@@ -1300,8 +1289,6 @@ DeviceActivation(
     else
         DeactivateDevice(IsaDevice->LDN);
-    HwDelay();
-
     WaitForKey();
 }