public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: mingo@elte.hu, hpa@zytor.com, tglx@linutronix.de
Cc: xemul@openvz.org, yhlu.kernel@gmail.com,
	linux-kernel@vger.kernel.org, macro@linux-mips.org,
	andi@firstfloor.org, Cyrill Gorcunov <gorcunov@openvz.org>
Subject: [rfc 2/4] x86: apic - introduce imcr_ helpers
Date: Sun, 12 Apr 2009 20:47:40 +0400	[thread overview]
Message-ID: <20090412165058.535921550@openvz.org> (raw)
In-Reply-To: 20090412164738.967602112@openvz.org

[-- Attachment #1: x86-apic-imcr --]
[-- Type: text/plain, Size: 1801 bytes --]

Impact: cleanup

Distinguish port writting magic into helpers with comments.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/apic/apic.c |   29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/apic/apic.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/apic/apic.c
+++ linux-2.6.git/arch/x86/kernel/apic/apic.c
@@ -99,6 +99,29 @@ early_param("lapic", parse_lapic);
 /* Local APIC was disabled by the BIOS and enabled by the kernel */
 static int enabled_via_apicbase;
 
+/*
+ * Handle interrupt mode configuration register (IMCR).
+ * This register controls whether the interrupt signals
+ * that reach the BSP come from the master PIC or from the
+ * local APIC. Before entering Symmetric I/O Mode, either
+ * the BIOS or the operating system must switch out of
+ * PIC Mode by changing the IMCR.
+ */
+static inline imcr_pic_to_apic(void)
+{
+	/* select IMCR register */
+	outb(0x70, 0x22);
+	/* NMI and 8259 INTR go through APIC */
+	outb(0x01, 0x23);
+}
+
+static inline imcr_apic_to_pic(void)
+{
+	/* select IMCR register */
+	outb(0x70, 0x22);
+	/* NMI and 8259 INTR go directly to BSP */
+	outb(0x00, 0x23);
+}
 #endif
 
 #ifdef CONFIG_X86_64
@@ -1737,8 +1760,7 @@ void __init connect_bsp_APIC(void)
 		 */
 		apic_printk(APIC_VERBOSE, "leaving PIC mode, "
 				"enabling APIC mode.\n");
-		outb(0x70, 0x22);
-		outb(0x01, 0x23);
+		imcr_pic_to_apic();
 	}
 #endif
 	if (apic->enable_apic_mode)
@@ -1766,8 +1788,7 @@ void disconnect_bsp_APIC(int virt_wire_s
 		 */
 		apic_printk(APIC_VERBOSE, "disabling APIC mode, "
 				"entering PIC mode.\n");
-		outb(0x70, 0x22);
-		outb(0x00, 0x23);
+		imcr_apic_to_pic();
 		return;
 	}
 #endif


  parent reply	other threads:[~2009-04-12 16:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-12 16:47 [rfc 0/4] x86 - apic dummy ops with cleanups Cyrill Gorcunov
2009-04-12 16:47 ` [rfc 1/4] x86: irq.c - tiny cleanup Cyrill Gorcunov
2009-04-12 17:25   ` Ingo Molnar
2009-04-12 17:53     ` Cyrill Gorcunov
2009-04-12 17:57   ` [tip:x86/apic] " tip-bot for Cyrill Gorcunov
2009-04-12 16:47 ` Cyrill Gorcunov [this message]
2009-04-12 17:57   ` [tip:x86/apic] x86: apic - introduce imcr_ helpers tip-bot for Cyrill Gorcunov
2009-04-12 16:47 ` [rfc 3/4] x86: apic - introduce dummy apic operations Cyrill Gorcunov
2009-04-12 17:57   ` [tip:x86/apic] " tip-bot for Cyrill Gorcunov
2009-04-12 16:47 ` [rfc 4/4] x86: smp.c - align smp_ops assignments Cyrill Gorcunov
2009-04-12 17:58   ` [tip:x86/apic] " tip-bot for Cyrill Gorcunov
2009-04-12 17:24 ` [rfc 0/4] x86 - apic dummy ops with cleanups Ingo Molnar
2009-04-12 18:00   ` Cyrill Gorcunov
2009-04-12 18:02     ` Ingo Molnar
2009-04-12 18:12       ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090412165058.535921550@openvz.org \
    --to=gorcunov@openvz.org \
    --cc=andi@firstfloor.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=macro@linux-mips.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=xemul@openvz.org \
    --cc=yhlu.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox