aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/apic.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2005-06-25 17:57:45 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 19:24:47 -0400
commit208fb93162d51faa69b9774fa7809858d84fd9dc (patch)
tree895115891463d3318677df4c3d76f6eca751eccd /arch/x86_64/kernel/apic.c
parent650927ef8ab1e9b05b77a3f32ca7adcedaae9306 (diff)
[PATCH] kexec: x86_64: restore apic virtual wire mode on shutdown
When coming out of apic mode attempt to set the appropriate apic back into virtual wire mode. This improves on previous versions of this patch by by never setting bot the local apic and the ioapic into veritual wire mode. This code looks at data from the mptable to see if an ioapic has an ExtInt input to make this decision. A future improvement is to figure out which apic or ioapic was in virtual wire mode at boot time and to remember it. That is potentially a more accurate method, of selecting which apic to place in virutal wire mode. Signed-off-by: Eric Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/x86_64/kernel/apic.c')
-rw-r--r--arch/x86_64/kernel/apic.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 2a6c893ccf60..375d369570ca 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -133,7 +133,7 @@ void __init connect_bsp_APIC(void)
133 } 133 }
134} 134}
135 135
136void disconnect_bsp_APIC(void) 136void disconnect_bsp_APIC(int virt_wire_setup)
137{ 137{
138 if (pic_mode) { 138 if (pic_mode) {
139 /* 139 /*
@@ -146,6 +146,42 @@ void disconnect_bsp_APIC(void)
146 outb(0x70, 0x22); 146 outb(0x70, 0x22);
147 outb(0x00, 0x23); 147 outb(0x00, 0x23);
148 } 148 }
149 else {
150 /* Go back to Virtual Wire compatibility mode */
151 unsigned long value;
152
153 /* For the spurious interrupt use vector F, and enable it */
154 value = apic_read(APIC_SPIV);
155 value &= ~APIC_VECTOR_MASK;
156 value |= APIC_SPIV_APIC_ENABLED;
157 value |= 0xf;
158 apic_write_around(APIC_SPIV, value);
159
160 if (!virt_wire_setup) {
161 /* For LVT0 make it edge triggered, active high, external and enabled */
162 value = apic_read(APIC_LVT0);
163 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
164 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
165 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED );
166 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
167 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT);
168 apic_write_around(APIC_LVT0, value);
169 }
170 else {
171 /* Disable LVT0 */
172 apic_write_around(APIC_LVT0, APIC_LVT_MASKED);
173 }
174
175 /* For LVT1 make it edge triggered, active high, nmi and enabled */
176 value = apic_read(APIC_LVT1);
177 value &= ~(
178 APIC_MODE_MASK | APIC_SEND_PENDING |
179 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
180 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
181 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
182 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI);
183 apic_write_around(APIC_LVT1, value);
184 }
149} 185}
150 186
151void disable_local_APIC(void) 187void disable_local_APIC(void)