mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Andrew Morton <akpm@osdl.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/14] kexec: apic-virtwire-on-shutdown.i386.patch
Date: 20 Aug 2004 11:59:36 -0600	[thread overview]
Message-ID: <m1vffd667r.fsf@ebiederm.dsl.xmission.com> (raw)


Restore the local apic to virtual wire mode on reboot.

diff -uNr linux-2.6.8.1-mm2-i8259-sysfs.x86_64/arch/i386/kernel/apic.c linux-2.6.8.1-mm2-apic-virtwire-on-shutdown.i386/arch/i386/kernel/apic.c
--- linux-2.6.8.1-mm2-i8259-sysfs.x86_64/arch/i386/kernel/apic.c	Fri Aug 20 09:56:25 2004
+++ linux-2.6.8.1-mm2-apic-virtwire-on-shutdown.i386/arch/i386/kernel/apic.c	Fri Aug 20 10:26:22 2004
@@ -202,6 +202,36 @@
 		outb(0x70, 0x22);
 		outb(0x00, 0x23);
 	}
+	else {
+		/* Go back to Virtual Wire compatibility mode */
+		unsigned long value;
+
+		/* For the spurious interrupt use vector F, and enable it */
+		value = apic_read(APIC_SPIV);
+		value &= ~APIC_VECTOR_MASK;
+		value |= APIC_SPIV_APIC_ENABLED;
+		value |= 0xf;
+		apic_write_around(APIC_SPIV, value);
+
+		/* For LVT0 make it edge triggered, active high, external and enabled */
+		value = apic_read(APIC_LVT0);
+		value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
+			APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
+			APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED );
+		value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
+		value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXINT);
+		apic_write_around(APIC_LVT0, value);
+
+		/* For LVT1 make it edge triggered, active high, nmi and enabled */
+		value = apic_read(APIC_LVT1);
+		value &= ~(
+			APIC_MODE_MASK | APIC_SEND_PENDING |
+			APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
+			APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
+		value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
+		value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI);
+		apic_write_around(APIC_LVT1, value);
+	}
 }
 
 void disable_local_APIC(void)
diff -uNr linux-2.6.8.1-mm2-i8259-sysfs.x86_64/include/asm-i386/apicdef.h linux-2.6.8.1-mm2-apic-virtwire-on-shutdown.i386/include/asm-i386/apicdef.h
--- linux-2.6.8.1-mm2-i8259-sysfs.x86_64/include/asm-i386/apicdef.h	Wed Mar 10 19:55:28 2004
+++ linux-2.6.8.1-mm2-apic-virtwire-on-shutdown.i386/include/asm-i386/apicdef.h	Fri Aug 20 10:26:22 2004
@@ -86,6 +86,7 @@
 #define			APIC_LVT_REMOTE_IRR		(1<<14)
 #define			APIC_INPUT_POLARITY		(1<<13)
 #define			APIC_SEND_PENDING		(1<<12)
+#define			APIC_MODE_MASK			0x700
 #define			GET_APIC_DELIVERY_MODE(x)	(((x)>>8)&0x7)
 #define			SET_APIC_DELIVERY_MODE(x,y)	(((x)&~0x700)|((y)<<8))
 #define				APIC_MODE_FIXED		0x0

             reply	other threads:[~2004-08-20 18:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-20 17:59 Eric W. Biederman [this message]
2004-08-23 12:12 ` Maciej W. Rozycki
2004-08-23 13:33   ` Eric W. Biederman
2004-08-25 19:22     ` Maciej W. Rozycki
2004-08-26  0:52       ` Eric W. Biederman
2004-08-30 12:43         ` Maciej W. Rozycki
2004-08-30 18:02           ` Eric W. Biederman

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=m1vffd667r.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome