aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/apic.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-09-26 04:52:30 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 04:52:30 -0400
commita8fcf1a24a16e1c735c795d99773b5dcefb71518 (patch)
treec1edcfe3b21dcee6d5f25a4461607a3dd785419c /arch/x86_64/kernel/apic.c
parente50991343488edf25d58820be1684322808c763c (diff)
[PATCH] Remove obsolete PIC mode
PIC mode is an outdated way to drive the APICs that was used on some early MP boards. It is not supported in the ACPI model. It is unlikely to be ever configured by any x86-64 system Remove it thus. Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64/kernel/apic.c')
-rw-r--r--arch/x86_64/kernel/apic.c92
1 files changed, 29 insertions, 63 deletions
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 78c43b1a3064..20a76f209629 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -136,72 +136,40 @@ void clear_local_APIC(void)
136 apic_read(APIC_ESR); 136 apic_read(APIC_ESR);
137} 137}
138 138
139void __init connect_bsp_APIC(void)
140{
141 if (pic_mode) {
142 /*
143 * Do not trust the local APIC being empty at bootup.
144 */
145 clear_local_APIC();
146 /*
147 * PIC mode, enable APIC mode in the IMCR, i.e.
148 * connect BSP's local APIC to INT and NMI lines.
149 */
150 apic_printk(APIC_VERBOSE, "leaving PIC mode, enabling APIC mode.\n");
151 outb(0x70, 0x22);
152 outb(0x01, 0x23);
153 }
154}
155
156void disconnect_bsp_APIC(int virt_wire_setup) 139void disconnect_bsp_APIC(int virt_wire_setup)
157{ 140{
158 if (pic_mode) { 141 /* Go back to Virtual Wire compatibility mode */
159 /* 142 unsigned long value;
160 * Put the board back into PIC mode (has an effect
161 * only on certain older boards). Note that APIC
162 * interrupts, including IPIs, won't work beyond
163 * this point! The only exception are INIT IPIs.
164 */
165 apic_printk(APIC_QUIET, "disabling APIC mode, entering PIC mode.\n");
166 outb(0x70, 0x22);
167 outb(0x00, 0x23);
168 }
169 else {
170 /* Go back to Virtual Wire compatibility mode */
171 unsigned long value;
172
173 /* For the spurious interrupt use vector F, and enable it */
174 value = apic_read(APIC_SPIV);
175 value &= ~APIC_VECTOR_MASK;
176 value |= APIC_SPIV_APIC_ENABLED;
177 value |= 0xf;
178 apic_write(APIC_SPIV, value);
179
180 if (!virt_wire_setup) {
181 /* For LVT0 make it edge triggered, active high, external and enabled */
182 value = apic_read(APIC_LVT0);
183 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
184 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
185 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED );
186 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
187 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT);
188 apic_write(APIC_LVT0, value);
189 }
190 else {
191 /* Disable LVT0 */
192 apic_write(APIC_LVT0, APIC_LVT_MASKED);
193 }
194 143
195 /* For LVT1 make it edge triggered, active high, nmi and enabled */ 144 /* For the spurious interrupt use vector F, and enable it */
196 value = apic_read(APIC_LVT1); 145 value = apic_read(APIC_SPIV);
197 value &= ~( 146 value &= ~APIC_VECTOR_MASK;
198 APIC_MODE_MASK | APIC_SEND_PENDING | 147 value |= APIC_SPIV_APIC_ENABLED;
148 value |= 0xf;
149 apic_write(APIC_SPIV, value);
150
151 if (!virt_wire_setup) {
152 /* For LVT0 make it edge triggered, active high, external and enabled */
153 value = apic_read(APIC_LVT0);
154 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
199 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR | 155 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
200 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); 156 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED );
201 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 157 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
202 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); 158 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT);
203 apic_write(APIC_LVT1, value); 159 apic_write(APIC_LVT0, value);
160 } else {
161 /* Disable LVT0 */
162 apic_write(APIC_LVT0, APIC_LVT_MASKED);
204 } 163 }
164
165 /* For LVT1 make it edge triggered, active high, nmi and enabled */
166 value = apic_read(APIC_LVT1);
167 value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING |
168 APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
169 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
170 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
171 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI);
172 apic_write(APIC_LVT1, value);
205} 173}
206 174
207void disable_local_APIC(void) 175void disable_local_APIC(void)
@@ -418,7 +386,7 @@ void __cpuinit setup_local_APIC (void)
418 * TODO: set up through-local-APIC from through-I/O-APIC? --macro 386 * TODO: set up through-local-APIC from through-I/O-APIC? --macro
419 */ 387 */
420 value = apic_read(APIC_LVT0) & APIC_LVT_MASKED; 388 value = apic_read(APIC_LVT0) & APIC_LVT_MASKED;
421 if (!smp_processor_id() && (pic_mode || !value)) { 389 if (!smp_processor_id() && !value) {
422 value = APIC_DM_EXTINT; 390 value = APIC_DM_EXTINT;
423 apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", smp_processor_id()); 391 apic_printk(APIC_VERBOSE, "enabled ExtINT on CPU#%d\n", smp_processor_id());
424 } else { 392 } else {
@@ -1096,8 +1064,6 @@ int __init APIC_init_uniprocessor (void)
1096 1064
1097 verify_local_APIC(); 1065 verify_local_APIC();
1098 1066
1099 connect_bsp_APIC();
1100
1101 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); 1067 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
1102 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id)); 1068 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id));
1103 1069