Skip to contentSkip to conversation

x86, nmi: Define a name for NMI control port

PATCH Superseded Cyrill Gorcunov 3 participants 5 messages Feb 28, 2011 – Mar 1, 2011 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86, nmi: Define a name for NMI control port

Also add a comment anout why we need in-out operations.

---
 arch/x86/include/asm/mach_traps.h |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
arch/x86/include/asm/mach_traps.h +13 -5
Index: linux-2.6.git/arch/x86/include/asm/mach_traps.h
=====================================================================
@@ -8,6 +8,7 @@
 #include <asm/mc146818rtc.h>
 
 #define NMI_REASON_PORT		0x61
+#define NMI_ENABLE_PORT		0x70 /* Real-Time Clock Address Register as well */
 
 #define NMI_REASON_SERR		0x80
 #define NMI_REASON_IOCHK	0x40
@@ -30,12 +31,19 @@ static inline void reassert_nmi(void)
 		old_reg = current_lock_cmos_reg();
 	else
 		lock_cmos(0); /* register doesn't matter here */
-	outb(0x8f, 0x70);
-	inb(0x71);		/* dummy */
-	outb(0x0f, 0x70);
-	inb(0x71);		/* dummy */
+
+	/*
+	 * This will cause the NMI output to transition low
+	 * then high if there are any pending NMI sources. The
+	 * CPU's NMI input logic will then register a new NMI.
+	 */
+	outb(0x8f, NMI_ENABLE_PORT);
+	inb(0x71);	/* dummy */
+	outb(0x0f, NMI_ENABLE_PORT);
+	inb(0x71);	/* dummy */
+
 	if (old_reg >= 0)
-		outb(old_reg, 0x70);
+		outb(old_reg, NMI_ENABLE_PORT);
 	else
 		unlock_cmos();
 }
Signature · 1 line
    Cyrill
#1 lore raw
Quoted 12 lines · Cyrill Gorcunov

Also add a comment anout why we need in-out operations.

---
 arch/x86/include/asm/mach_traps.h |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Index: linux-2.6.git/arch/x86/include/asm/mach_traps.h
=====================================================================

arch/x86/include/asm/mach_traps.h line 11

Quoted 4 lines
arch/x86/include/asm/mach_traps.h +1 -0
@@ -8,6 +8,7 @@
 #include <asm/mc146818rtc.h>
 
 #define NMI_REASON_PORT		0x61
+#define NMI_ENABLE_PORT		0x70 /* Real-Time Clock Address Register as well */

FYI, the patch is whitespace damaged.

Ingo

#2 lore raw

...

Quoted 4 lines

FYI, the patch is whitespace damaged.

Ingo

D0h, sorry. I'll resend at evening.

#3 lore raw
In reply to Ingo Molnar

On 03/01/2011 10:57 AM, Ingo Molnar wrote:
...

Quoted 4 lines

FYI, the patch is whitespace damaged.

Ingo

Ingo, this one should be fine

---
From: Cyrill Gorcunov <[email protected]>
Subject: [PATCH -tip 1/2] x86, nmi: Define a name for NMI control port

Also add a comment anout why we need in-out operations.

---
 arch/x86/include/asm/mach_traps.h |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
arch/x86/include/asm/mach_traps.h +13 -5
Index: linux-2.6.git/arch/x86/include/asm/mach_traps.h
=====================================================================
@@ -8,6 +8,7 @@
 #include <asm/mc146818rtc.h>
 
 #define NMI_REASON_PORT		0x61
+#define NMI_ENABLE_PORT		0x70 /* Real-Time Clock Address Register as well */
 
 #define NMI_REASON_SERR		0x80
 #define NMI_REASON_IOCHK	0x40
@@ -30,12 +31,19 @@ static inline void reassert_nmi(void)
 		old_reg = current_lock_cmos_reg();
 	else
 		lock_cmos(0); /* register doesn't matter here */
-	outb(0x8f, 0x70);
-	inb(0x71);		/* dummy */
-	outb(0x0f, 0x70);
-	inb(0x71);		/* dummy */
+
+	/*
+	 * This will cause the NMI output to transition low
+	 * then high if there are any pending NMI sources. The
+	 * CPU's NMI input logic will then register a new NMI.
+	 */
+	outb(0x8f, NMI_ENABLE_PORT);
+	inb(0x71);	/* dummy */
+	outb(0x0f, NMI_ENABLE_PORT);
+	inb(0x71);	/* dummy */
+
 	if (old_reg >= 0)
-		outb(old_reg, 0x70);
+		outb(old_reg, NMI_ENABLE_PORT);
 	else
 		unlock_cmos();
 }
#4 lore raw
Quoted 9 lines · Cyrill Gorcunov

On 03/01/2011 10:57 AM, Ingo Molnar wrote:
...

Quoted 4 lines

FYI, the patch is whitespace damaged.

Ingo

Ingo, this one should be fine

Crap, for some reason Thunderbird added additional whitespace, really sorry for spamming, drop this patches :(

Signature · 1 line
    Cyrill