Skip to contentSkip to conversation

x86 reboot: Remove inb_p usage

PATCH Applied Alan Cox 3 participants 4 messages Jan 19, 2008 – Jan 22, 2008 x86

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 x86 reboot: Remove inb_p usage

We are driving a motherboard port so use a 2uS explicit delay at this point.

arch/x86/kernel/reboot.c +4 -2
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc8-mm1/arch/x86/kernel/reboot.c linux-2.6.24-rc8-mm1/arch/x86/kernel/reboot.c
@@ -319,9 +319,11 @@
 {
 	int i;
 
-	for (i = 0; i < 0x10000; i++)
-		if ((inb_p(0x64) & 0x02) == 0)
+	for (i = 0; i < 0x10000; i++) {
+		if ((inb(0x64) & 0x02) == 0)
 			break;
+		udelay(2);
+	}
 }
 
 void machine_emergency_restart(void)
#1 lore raw
Quoted 12 lines · Alan Cox

We are driving a motherboard port so use a 2uS explicit delay at this point.

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.24-rc8-mm1/arch/x86/kernel/reboot.c linux-2.6.24-rc8-mm1/arch/x86/kernel/reboot.c

arch/x86/kernel/reboot.c 2008-01-19 14:53:58.000000000 +0000 renamed from arch/x86/kernel/reboot.c 2008-01-19 14:47:55.000000000 +0000 +0 -0
@@ -319,9 +319,11 @@
 {
        int i;
 

arch/x86/kernel/reboot.c 2008-01-19 14:53:58.000000000 +0000 line 329

Quoted 10 lines
arch/x86/kernel/reboot.c 2008-01-19 14:53:58.000000000 +0000 renamed from arch/x86/kernel/reboot.c 2008-01-19 14:47:55.000000000 +0000 +4 -2
-       for (i = 0; i < 0x10000; i++)
-               if ((inb_p(0x64) & 0x02) == 0)
+       for (i = 0; i < 0x10000; i++) {
+               if ((inb(0x64) & 0x02) == 0)
                        break;
+               udelay(2);
+       }
 }
 
 void machine_emergency_restart(void)

Stupid question from the peanut gallery: If you're going to go through all this, maybe it would be better to define an inline isa_bus_delay(void) { udelay(2); } and use that instead? I can only imagine some poor sod coming along later and wondering why there's a udelay(2) there. OTOH, there is an inb right above it, so <shrug>.

author
#2 lore raw
Quoted 3 lines

Stupid question from the peanut gallery: If you're going to go through all this, maybe it would be better to define an inline isa_bus_delay(void) { udelay(2); } and use that instead? I can only

There are very few places it crops up - in fact that one is the only non pic/pit/cmos example in the core arch code.

Alan

Applied
#3 lore raw
In reply to Alan Cox
Quoted 2 lines · Alan Cox

We are driving a motherboard port so use a 2uS explicit delay at this point.

thanks, applied.

Ingo