diff options
Diffstat (limited to 'arch/x86_64/kernel/mpparse.c')
-rw-r--r-- | arch/x86_64/kernel/mpparse.c | 238 |
1 files changed, 58 insertions, 180 deletions
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c index a1ab4197f8a1..20e88f4b564b 100644 --- a/arch/x86_64/kernel/mpparse.c +++ b/arch/x86_64/kernel/mpparse.c | |||
@@ -41,8 +41,7 @@ int acpi_found_madt; | |||
41 | * Various Linux-internal data structures created from the | 41 | * Various Linux-internal data structures created from the |
42 | * MP-table. | 42 | * MP-table. |
43 | */ | 43 | */ |
44 | unsigned char apic_version [MAX_APICS]; | 44 | DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES); |
45 | unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; | ||
46 | int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; | 45 | int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; |
47 | 46 | ||
48 | static int mp_current_pci_id = 0; | 47 | static int mp_current_pci_id = 0; |
@@ -56,7 +55,6 @@ struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; | |||
56 | int mp_irq_entries; | 55 | int mp_irq_entries; |
57 | 56 | ||
58 | int nr_ioapics; | 57 | int nr_ioapics; |
59 | int pic_mode; | ||
60 | unsigned long mp_lapic_addr = 0; | 58 | unsigned long mp_lapic_addr = 0; |
61 | 59 | ||
62 | 60 | ||
@@ -71,19 +69,6 @@ unsigned disabled_cpus __initdata; | |||
71 | /* Bitmask of physically existing CPUs */ | 69 | /* Bitmask of physically existing CPUs */ |
72 | physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE; | 70 | physid_mask_t phys_cpu_present_map = PHYSID_MASK_NONE; |
73 | 71 | ||
74 | /* ACPI MADT entry parsing functions */ | ||
75 | #ifdef CONFIG_ACPI | ||
76 | extern struct acpi_boot_flags acpi_boot; | ||
77 | #ifdef CONFIG_X86_LOCAL_APIC | ||
78 | extern int acpi_parse_lapic (acpi_table_entry_header *header); | ||
79 | extern int acpi_parse_lapic_addr_ovr (acpi_table_entry_header *header); | ||
80 | extern int acpi_parse_lapic_nmi (acpi_table_entry_header *header); | ||
81 | #endif /*CONFIG_X86_LOCAL_APIC*/ | ||
82 | #ifdef CONFIG_X86_IO_APIC | ||
83 | extern int acpi_parse_ioapic (acpi_table_entry_header *header); | ||
84 | #endif /*CONFIG_X86_IO_APIC*/ | ||
85 | #endif /*CONFIG_ACPI*/ | ||
86 | |||
87 | u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; | 72 | u8 bios_cpu_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; |
88 | 73 | ||
89 | 74 | ||
@@ -108,24 +93,20 @@ static int __init mpf_checksum(unsigned char *mp, int len) | |||
108 | static void __cpuinit MP_processor_info (struct mpc_config_processor *m) | 93 | static void __cpuinit MP_processor_info (struct mpc_config_processor *m) |
109 | { | 94 | { |
110 | int cpu; | 95 | int cpu; |
111 | unsigned char ver; | ||
112 | cpumask_t tmp_map; | 96 | cpumask_t tmp_map; |
97 | char *bootup_cpu = ""; | ||
113 | 98 | ||
114 | if (!(m->mpc_cpuflag & CPU_ENABLED)) { | 99 | if (!(m->mpc_cpuflag & CPU_ENABLED)) { |
115 | disabled_cpus++; | 100 | disabled_cpus++; |
116 | return; | 101 | return; |
117 | } | 102 | } |
118 | |||
119 | printk(KERN_INFO "Processor #%d %d:%d APIC version %d\n", | ||
120 | m->mpc_apicid, | ||
121 | (m->mpc_cpufeature & CPU_FAMILY_MASK)>>8, | ||
122 | (m->mpc_cpufeature & CPU_MODEL_MASK)>>4, | ||
123 | m->mpc_apicver); | ||
124 | |||
125 | if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { | 103 | if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { |
126 | Dprintk(" Bootup CPU\n"); | 104 | bootup_cpu = " (Bootup-CPU)"; |
127 | boot_cpu_id = m->mpc_apicid; | 105 | boot_cpu_id = m->mpc_apicid; |
128 | } | 106 | } |
107 | |||
108 | printk(KERN_INFO "Processor #%d%s\n", m->mpc_apicid, bootup_cpu); | ||
109 | |||
129 | if (num_processors >= NR_CPUS) { | 110 | if (num_processors >= NR_CPUS) { |
130 | printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." | 111 | printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." |
131 | " Processor ignored.\n", NR_CPUS); | 112 | " Processor ignored.\n", NR_CPUS); |
@@ -136,24 +117,7 @@ static void __cpuinit MP_processor_info (struct mpc_config_processor *m) | |||
136 | cpus_complement(tmp_map, cpu_present_map); | 117 | cpus_complement(tmp_map, cpu_present_map); |
137 | cpu = first_cpu(tmp_map); | 118 | cpu = first_cpu(tmp_map); |
138 | 119 | ||
139 | #if MAX_APICS < 255 | ||
140 | if ((int)m->mpc_apicid > MAX_APICS) { | ||
141 | printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", | ||
142 | m->mpc_apicid, MAX_APICS); | ||
143 | return; | ||
144 | } | ||
145 | #endif | ||
146 | ver = m->mpc_apicver; | ||
147 | |||
148 | physid_set(m->mpc_apicid, phys_cpu_present_map); | 120 | physid_set(m->mpc_apicid, phys_cpu_present_map); |
149 | /* | ||
150 | * Validate version | ||
151 | */ | ||
152 | if (ver == 0x0) { | ||
153 | printk(KERN_ERR "BIOS bug, APIC version is 0 for CPU#%d! fixing up to 0x10. (tell your hw vendor)\n", m->mpc_apicid); | ||
154 | ver = 0x10; | ||
155 | } | ||
156 | apic_version[m->mpc_apicid] = ver; | ||
157 | if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { | 121 | if (m->mpc_cpuflag & CPU_BOOTPROCESSOR) { |
158 | /* | 122 | /* |
159 | * bios_cpu_apicid is required to have processors listed | 123 | * bios_cpu_apicid is required to have processors listed |
@@ -178,15 +142,11 @@ static void __init MP_bus_info (struct mpc_config_bus *m) | |||
178 | Dprintk("Bus #%d is %s\n", m->mpc_busid, str); | 142 | Dprintk("Bus #%d is %s\n", m->mpc_busid, str); |
179 | 143 | ||
180 | if (strncmp(str, "ISA", 3) == 0) { | 144 | if (strncmp(str, "ISA", 3) == 0) { |
181 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; | 145 | set_bit(m->mpc_busid, mp_bus_not_pci); |
182 | } else if (strncmp(str, "EISA", 4) == 0) { | ||
183 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_EISA; | ||
184 | } else if (strncmp(str, "PCI", 3) == 0) { | 146 | } else if (strncmp(str, "PCI", 3) == 0) { |
185 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; | 147 | clear_bit(m->mpc_busid, mp_bus_not_pci); |
186 | mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id; | 148 | mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id; |
187 | mp_current_pci_id++; | 149 | mp_current_pci_id++; |
188 | } else if (strncmp(str, "MCA", 3) == 0) { | ||
189 | mp_bus_id_to_type[m->mpc_busid] = MP_BUS_MCA; | ||
190 | } else { | 150 | } else { |
191 | printk(KERN_ERR "Unknown bustype %s\n", str); | 151 | printk(KERN_ERR "Unknown bustype %s\n", str); |
192 | } | 152 | } |
@@ -197,8 +157,8 @@ static void __init MP_ioapic_info (struct mpc_config_ioapic *m) | |||
197 | if (!(m->mpc_flags & MPC_APIC_USABLE)) | 157 | if (!(m->mpc_flags & MPC_APIC_USABLE)) |
198 | return; | 158 | return; |
199 | 159 | ||
200 | printk("I/O APIC #%d Version %d at 0x%X.\n", | 160 | printk("I/O APIC #%d at 0x%X.\n", |
201 | m->mpc_apicid, m->mpc_apicver, m->mpc_apicaddr); | 161 | m->mpc_apicid, m->mpc_apicaddr); |
202 | if (nr_ioapics >= MAX_IO_APICS) { | 162 | if (nr_ioapics >= MAX_IO_APICS) { |
203 | printk(KERN_ERR "Max # of I/O APICs (%d) exceeded (found %d).\n", | 163 | printk(KERN_ERR "Max # of I/O APICs (%d) exceeded (found %d).\n", |
204 | MAX_IO_APICS, nr_ioapics); | 164 | MAX_IO_APICS, nr_ioapics); |
@@ -232,19 +192,6 @@ static void __init MP_lintsrc_info (struct mpc_config_lintsrc *m) | |||
232 | m->mpc_irqtype, m->mpc_irqflag & 3, | 192 | m->mpc_irqtype, m->mpc_irqflag & 3, |
233 | (m->mpc_irqflag >> 2) &3, m->mpc_srcbusid, | 193 | (m->mpc_irqflag >> 2) &3, m->mpc_srcbusid, |
234 | m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); | 194 | m->mpc_srcbusirq, m->mpc_destapic, m->mpc_destapiclint); |
235 | /* | ||
236 | * Well it seems all SMP boards in existence | ||
237 | * use ExtINT/LVT1 == LINT0 and | ||
238 | * NMI/LVT2 == LINT1 - the following check | ||
239 | * will show us if this assumptions is false. | ||
240 | * Until then we do not have to add baggage. | ||
241 | */ | ||
242 | if ((m->mpc_irqtype == mp_ExtINT) && | ||
243 | (m->mpc_destapiclint != 0)) | ||
244 | BUG(); | ||
245 | if ((m->mpc_irqtype == mp_NMI) && | ||
246 | (m->mpc_destapiclint != 1)) | ||
247 | BUG(); | ||
248 | } | 195 | } |
249 | 196 | ||
250 | /* | 197 | /* |
@@ -258,7 +205,7 @@ static int __init smp_read_mpc(struct mp_config_table *mpc) | |||
258 | unsigned char *mpt=((unsigned char *)mpc)+count; | 205 | unsigned char *mpt=((unsigned char *)mpc)+count; |
259 | 206 | ||
260 | if (memcmp(mpc->mpc_signature,MPC_SIGNATURE,4)) { | 207 | if (memcmp(mpc->mpc_signature,MPC_SIGNATURE,4)) { |
261 | printk("SMP mptable: bad signature [%c%c%c%c]!\n", | 208 | printk("MPTABLE: bad signature [%c%c%c%c]!\n", |
262 | mpc->mpc_signature[0], | 209 | mpc->mpc_signature[0], |
263 | mpc->mpc_signature[1], | 210 | mpc->mpc_signature[1], |
264 | mpc->mpc_signature[2], | 211 | mpc->mpc_signature[2], |
@@ -266,31 +213,31 @@ static int __init smp_read_mpc(struct mp_config_table *mpc) | |||
266 | return 0; | 213 | return 0; |
267 | } | 214 | } |
268 | if (mpf_checksum((unsigned char *)mpc,mpc->mpc_length)) { | 215 | if (mpf_checksum((unsigned char *)mpc,mpc->mpc_length)) { |
269 | printk("SMP mptable: checksum error!\n"); | 216 | printk("MPTABLE: checksum error!\n"); |
270 | return 0; | 217 | return 0; |
271 | } | 218 | } |
272 | if (mpc->mpc_spec!=0x01 && mpc->mpc_spec!=0x04) { | 219 | if (mpc->mpc_spec!=0x01 && mpc->mpc_spec!=0x04) { |
273 | printk(KERN_ERR "SMP mptable: bad table version (%d)!!\n", | 220 | printk(KERN_ERR "MPTABLE: bad table version (%d)!!\n", |
274 | mpc->mpc_spec); | 221 | mpc->mpc_spec); |
275 | return 0; | 222 | return 0; |
276 | } | 223 | } |
277 | if (!mpc->mpc_lapic) { | 224 | if (!mpc->mpc_lapic) { |
278 | printk(KERN_ERR "SMP mptable: null local APIC address!\n"); | 225 | printk(KERN_ERR "MPTABLE: null local APIC address!\n"); |
279 | return 0; | 226 | return 0; |
280 | } | 227 | } |
281 | memcpy(str,mpc->mpc_oem,8); | 228 | memcpy(str,mpc->mpc_oem,8); |
282 | str[8]=0; | 229 | str[8] = 0; |
283 | printk(KERN_INFO "OEM ID: %s ",str); | 230 | printk(KERN_INFO "MPTABLE: OEM ID: %s ",str); |
284 | 231 | ||
285 | memcpy(str,mpc->mpc_productid,12); | 232 | memcpy(str,mpc->mpc_productid,12); |
286 | str[12]=0; | 233 | str[12] = 0; |
287 | printk("Product ID: %s ",str); | 234 | printk("MPTABLE: Product ID: %s ",str); |
288 | 235 | ||
289 | printk("APIC at: 0x%X\n",mpc->mpc_lapic); | 236 | printk("MPTABLE: APIC at: 0x%X\n",mpc->mpc_lapic); |
290 | 237 | ||
291 | /* save the local APIC address, it might be non-default */ | 238 | /* save the local APIC address, it might be non-default */ |
292 | if (!acpi_lapic) | 239 | if (!acpi_lapic) |
293 | mp_lapic_addr = mpc->mpc_lapic; | 240 | mp_lapic_addr = mpc->mpc_lapic; |
294 | 241 | ||
295 | /* | 242 | /* |
296 | * Now process the configuration blocks. | 243 | * Now process the configuration blocks. |
@@ -302,7 +249,7 @@ static int __init smp_read_mpc(struct mp_config_table *mpc) | |||
302 | struct mpc_config_processor *m= | 249 | struct mpc_config_processor *m= |
303 | (struct mpc_config_processor *)mpt; | 250 | (struct mpc_config_processor *)mpt; |
304 | if (!acpi_lapic) | 251 | if (!acpi_lapic) |
305 | MP_processor_info(m); | 252 | MP_processor_info(m); |
306 | mpt += sizeof(*m); | 253 | mpt += sizeof(*m); |
307 | count += sizeof(*m); | 254 | count += sizeof(*m); |
308 | break; | 255 | break; |
@@ -321,8 +268,8 @@ static int __init smp_read_mpc(struct mp_config_table *mpc) | |||
321 | struct mpc_config_ioapic *m= | 268 | struct mpc_config_ioapic *m= |
322 | (struct mpc_config_ioapic *)mpt; | 269 | (struct mpc_config_ioapic *)mpt; |
323 | MP_ioapic_info(m); | 270 | MP_ioapic_info(m); |
324 | mpt+=sizeof(*m); | 271 | mpt += sizeof(*m); |
325 | count+=sizeof(*m); | 272 | count += sizeof(*m); |
326 | break; | 273 | break; |
327 | } | 274 | } |
328 | case MP_INTSRC: | 275 | case MP_INTSRC: |
@@ -331,8 +278,8 @@ static int __init smp_read_mpc(struct mp_config_table *mpc) | |||
331 | (struct mpc_config_intsrc *)mpt; | 278 | (struct mpc_config_intsrc *)mpt; |
332 | 279 | ||
333 | MP_intsrc_info(m); | 280 | MP_intsrc_info(m); |
334 | mpt+=sizeof(*m); | 281 | mpt += sizeof(*m); |
335 | count+=sizeof(*m); | 282 | count += sizeof(*m); |
336 | break; | 283 | break; |
337 | } | 284 | } |
338 | case MP_LINTSRC: | 285 | case MP_LINTSRC: |
@@ -340,15 +287,15 @@ static int __init smp_read_mpc(struct mp_config_table *mpc) | |||
340 | struct mpc_config_lintsrc *m= | 287 | struct mpc_config_lintsrc *m= |
341 | (struct mpc_config_lintsrc *)mpt; | 288 | (struct mpc_config_lintsrc *)mpt; |
342 | MP_lintsrc_info(m); | 289 | MP_lintsrc_info(m); |
343 | mpt+=sizeof(*m); | 290 | mpt += sizeof(*m); |
344 | count+=sizeof(*m); | 291 | count += sizeof(*m); |
345 | break; | 292 | break; |
346 | } | 293 | } |
347 | } | 294 | } |
348 | } | 295 | } |
349 | clustered_apic_check(); | 296 | clustered_apic_check(); |
350 | if (!num_processors) | 297 | if (!num_processors) |
351 | printk(KERN_ERR "SMP mptable: no processors registered!\n"); | 298 | printk(KERN_ERR "MPTABLE: no processors registered!\n"); |
352 | return num_processors; | 299 | return num_processors; |
353 | } | 300 | } |
354 | 301 | ||
@@ -444,13 +391,10 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) | |||
444 | * 2 CPUs, numbered 0 & 1. | 391 | * 2 CPUs, numbered 0 & 1. |
445 | */ | 392 | */ |
446 | processor.mpc_type = MP_PROCESSOR; | 393 | processor.mpc_type = MP_PROCESSOR; |
447 | /* Either an integrated APIC or a discrete 82489DX. */ | 394 | processor.mpc_apicver = 0; |
448 | processor.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; | ||
449 | processor.mpc_cpuflag = CPU_ENABLED; | 395 | processor.mpc_cpuflag = CPU_ENABLED; |
450 | processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | | 396 | processor.mpc_cpufeature = 0; |
451 | (boot_cpu_data.x86_model << 4) | | 397 | processor.mpc_featureflag = 0; |
452 | boot_cpu_data.x86_mask; | ||
453 | processor.mpc_featureflag = boot_cpu_data.x86_capability[0]; | ||
454 | processor.mpc_reserved[0] = 0; | 398 | processor.mpc_reserved[0] = 0; |
455 | processor.mpc_reserved[1] = 0; | 399 | processor.mpc_reserved[1] = 0; |
456 | for (i = 0; i < 2; i++) { | 400 | for (i = 0; i < 2; i++) { |
@@ -469,14 +413,6 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) | |||
469 | case 5: | 413 | case 5: |
470 | memcpy(bus.mpc_bustype, "ISA ", 6); | 414 | memcpy(bus.mpc_bustype, "ISA ", 6); |
471 | break; | 415 | break; |
472 | case 2: | ||
473 | case 6: | ||
474 | case 3: | ||
475 | memcpy(bus.mpc_bustype, "EISA ", 6); | ||
476 | break; | ||
477 | case 4: | ||
478 | case 7: | ||
479 | memcpy(bus.mpc_bustype, "MCA ", 6); | ||
480 | } | 416 | } |
481 | MP_bus_info(&bus); | 417 | MP_bus_info(&bus); |
482 | if (mpc_default_type > 4) { | 418 | if (mpc_default_type > 4) { |
@@ -487,7 +423,7 @@ static inline void __init construct_default_ISA_mptable(int mpc_default_type) | |||
487 | 423 | ||
488 | ioapic.mpc_type = MP_IOAPIC; | 424 | ioapic.mpc_type = MP_IOAPIC; |
489 | ioapic.mpc_apicid = 2; | 425 | ioapic.mpc_apicid = 2; |
490 | ioapic.mpc_apicver = mpc_default_type > 4 ? 0x10 : 0x01; | 426 | ioapic.mpc_apicver = 0; |
491 | ioapic.mpc_flags = MPC_APIC_USABLE; | 427 | ioapic.mpc_flags = MPC_APIC_USABLE; |
492 | ioapic.mpc_apicaddr = 0xFEC00000; | 428 | ioapic.mpc_apicaddr = 0xFEC00000; |
493 | MP_ioapic_info(&ioapic); | 429 | MP_ioapic_info(&ioapic); |
@@ -530,13 +466,6 @@ void __init get_smp_config (void) | |||
530 | printk(KERN_INFO "Using ACPI for processor (LAPIC) configuration information\n"); | 466 | printk(KERN_INFO "Using ACPI for processor (LAPIC) configuration information\n"); |
531 | 467 | ||
532 | printk("Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification); | 468 | printk("Intel MultiProcessor Specification v1.%d\n", mpf->mpf_specification); |
533 | if (mpf->mpf_feature2 & (1<<7)) { | ||
534 | printk(KERN_INFO " IMCR and PIC compatibility mode.\n"); | ||
535 | pic_mode = 1; | ||
536 | } else { | ||
537 | printk(KERN_INFO " Virtual Wire compatibility mode.\n"); | ||
538 | pic_mode = 0; | ||
539 | } | ||
540 | 469 | ||
541 | /* | 470 | /* |
542 | * Now see if we need to read further. | 471 | * Now see if we need to read further. |
@@ -616,7 +545,7 @@ static int __init smp_scan_config (unsigned long base, unsigned long length) | |||
616 | return 0; | 545 | return 0; |
617 | } | 546 | } |
618 | 547 | ||
619 | void __init find_intel_smp (void) | 548 | void __init find_smp_config(void) |
620 | { | 549 | { |
621 | unsigned int address; | 550 | unsigned int address; |
622 | 551 | ||
@@ -633,9 +562,7 @@ void __init find_intel_smp (void) | |||
633 | smp_scan_config(0xF0000,0x10000)) | 562 | smp_scan_config(0xF0000,0x10000)) |
634 | return; | 563 | return; |
635 | /* | 564 | /* |
636 | * If it is an SMP machine we should know now, unless the | 565 | * If it is an SMP machine we should know now. |
637 | * configuration is in an EISA/MCA bus machine with an | ||
638 | * extended bios data area. | ||
639 | * | 566 | * |
640 | * there is a real-mode segmented pointer pointing to the | 567 | * there is a real-mode segmented pointer pointing to the |
641 | * 4K EBDA area at 0x40E, calculate and scan it here. | 568 | * 4K EBDA area at 0x40E, calculate and scan it here. |
@@ -656,69 +583,41 @@ void __init find_intel_smp (void) | |||
656 | printk(KERN_INFO "No mptable found.\n"); | 583 | printk(KERN_INFO "No mptable found.\n"); |
657 | } | 584 | } |
658 | 585 | ||
659 | /* | ||
660 | * - Intel MP Configuration Table | ||
661 | */ | ||
662 | void __init find_smp_config (void) | ||
663 | { | ||
664 | #ifdef CONFIG_X86_LOCAL_APIC | ||
665 | find_intel_smp(); | ||
666 | #endif | ||
667 | } | ||
668 | |||
669 | |||
670 | /* -------------------------------------------------------------------------- | 586 | /* -------------------------------------------------------------------------- |
671 | ACPI-based MP Configuration | 587 | ACPI-based MP Configuration |
672 | -------------------------------------------------------------------------- */ | 588 | -------------------------------------------------------------------------- */ |
673 | 589 | ||
674 | #ifdef CONFIG_ACPI | 590 | #ifdef CONFIG_ACPI |
675 | 591 | ||
676 | void __init mp_register_lapic_address ( | 592 | void __init mp_register_lapic_address(u64 address) |
677 | u64 address) | ||
678 | { | 593 | { |
679 | mp_lapic_addr = (unsigned long) address; | 594 | mp_lapic_addr = (unsigned long) address; |
680 | |||
681 | set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); | 595 | set_fixmap_nocache(FIX_APIC_BASE, mp_lapic_addr); |
682 | |||
683 | if (boot_cpu_id == -1U) | 596 | if (boot_cpu_id == -1U) |
684 | boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); | 597 | boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); |
685 | |||
686 | Dprintk("Boot CPU = %d\n", boot_cpu_physical_apicid); | ||
687 | } | 598 | } |
688 | 599 | ||
689 | 600 | void __cpuinit mp_register_lapic (u8 id, u8 enabled) | |
690 | void __cpuinit mp_register_lapic ( | ||
691 | u8 id, | ||
692 | u8 enabled) | ||
693 | { | 601 | { |
694 | struct mpc_config_processor processor; | 602 | struct mpc_config_processor processor; |
695 | int boot_cpu = 0; | 603 | int boot_cpu = 0; |
696 | 604 | ||
697 | if (id >= MAX_APICS) { | 605 | if (id == boot_cpu_id) |
698 | printk(KERN_WARNING "Processor #%d invalid (max %d)\n", | ||
699 | id, MAX_APICS); | ||
700 | return; | ||
701 | } | ||
702 | |||
703 | if (id == boot_cpu_physical_apicid) | ||
704 | boot_cpu = 1; | 606 | boot_cpu = 1; |
705 | 607 | ||
706 | processor.mpc_type = MP_PROCESSOR; | 608 | processor.mpc_type = MP_PROCESSOR; |
707 | processor.mpc_apicid = id; | 609 | processor.mpc_apicid = id; |
708 | processor.mpc_apicver = GET_APIC_VERSION(apic_read(APIC_LVR)); | 610 | processor.mpc_apicver = 0; |
709 | processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0); | 611 | processor.mpc_cpuflag = (enabled ? CPU_ENABLED : 0); |
710 | processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0); | 612 | processor.mpc_cpuflag |= (boot_cpu ? CPU_BOOTPROCESSOR : 0); |
711 | processor.mpc_cpufeature = (boot_cpu_data.x86 << 8) | | 613 | processor.mpc_cpufeature = 0; |
712 | (boot_cpu_data.x86_model << 4) | boot_cpu_data.x86_mask; | 614 | processor.mpc_featureflag = 0; |
713 | processor.mpc_featureflag = boot_cpu_data.x86_capability[0]; | ||
714 | processor.mpc_reserved[0] = 0; | 615 | processor.mpc_reserved[0] = 0; |
715 | processor.mpc_reserved[1] = 0; | 616 | processor.mpc_reserved[1] = 0; |
716 | 617 | ||
717 | MP_processor_info(&processor); | 618 | MP_processor_info(&processor); |
718 | } | 619 | } |
719 | 620 | ||
720 | #ifdef CONFIG_X86_IO_APIC | ||
721 | |||
722 | #define MP_ISA_BUS 0 | 621 | #define MP_ISA_BUS 0 |
723 | #define MP_MAX_IOAPIC_PIN 127 | 622 | #define MP_MAX_IOAPIC_PIN 127 |
724 | 623 | ||
@@ -729,11 +628,9 @@ static struct mp_ioapic_routing { | |||
729 | u32 pin_programmed[4]; | 628 | u32 pin_programmed[4]; |
730 | } mp_ioapic_routing[MAX_IO_APICS]; | 629 | } mp_ioapic_routing[MAX_IO_APICS]; |
731 | 630 | ||
732 | 631 | static int mp_find_ioapic(int gsi) | |
733 | static int mp_find_ioapic ( | ||
734 | int gsi) | ||
735 | { | 632 | { |
736 | int i = 0; | 633 | int i = 0; |
737 | 634 | ||
738 | /* Find the IOAPIC that manages this GSI. */ | 635 | /* Find the IOAPIC that manages this GSI. */ |
739 | for (i = 0; i < nr_ioapics; i++) { | 636 | for (i = 0; i < nr_ioapics; i++) { |
@@ -743,17 +640,12 @@ static int mp_find_ioapic ( | |||
743 | } | 640 | } |
744 | 641 | ||
745 | printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); | 642 | printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); |
746 | |||
747 | return -1; | 643 | return -1; |
748 | } | 644 | } |
749 | |||
750 | 645 | ||
751 | void __init mp_register_ioapic ( | 646 | void __init mp_register_ioapic(u8 id, u32 address, u32 gsi_base) |
752 | u8 id, | ||
753 | u32 address, | ||
754 | u32 gsi_base) | ||
755 | { | 647 | { |
756 | int idx = 0; | 648 | int idx = 0; |
757 | 649 | ||
758 | if (nr_ioapics >= MAX_IO_APICS) { | 650 | if (nr_ioapics >= MAX_IO_APICS) { |
759 | printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " | 651 | printk(KERN_ERR "ERROR: Max # of I/O APICs (%d) exceeded " |
@@ -774,7 +666,7 @@ void __init mp_register_ioapic ( | |||
774 | 666 | ||
775 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); | 667 | set_fixmap_nocache(FIX_IO_APIC_BASE_0 + idx, address); |
776 | mp_ioapics[idx].mpc_apicid = id; | 668 | mp_ioapics[idx].mpc_apicid = id; |
777 | mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); | 669 | mp_ioapics[idx].mpc_apicver = 0; |
778 | 670 | ||
779 | /* | 671 | /* |
780 | * Build basic IRQ lookup table to facilitate gsi->io_apic lookups | 672 | * Build basic IRQ lookup table to facilitate gsi->io_apic lookups |
@@ -785,21 +677,15 @@ void __init mp_register_ioapic ( | |||
785 | mp_ioapic_routing[idx].gsi_end = gsi_base + | 677 | mp_ioapic_routing[idx].gsi_end = gsi_base + |
786 | io_apic_get_redir_entries(idx); | 678 | io_apic_get_redir_entries(idx); |
787 | 679 | ||
788 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, version %d, address 0x%x, " | 680 | printk(KERN_INFO "IOAPIC[%d]: apic_id %d, address 0x%x, " |
789 | "GSI %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, | 681 | "GSI %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, |
790 | mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, | 682 | mp_ioapics[idx].mpc_apicaddr, |
791 | mp_ioapic_routing[idx].gsi_start, | 683 | mp_ioapic_routing[idx].gsi_start, |
792 | mp_ioapic_routing[idx].gsi_end); | 684 | mp_ioapic_routing[idx].gsi_end); |
793 | |||
794 | return; | ||
795 | } | 685 | } |
796 | 686 | ||
797 | 687 | void __init | |
798 | void __init mp_override_legacy_irq ( | 688 | mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) |
799 | u8 bus_irq, | ||
800 | u8 polarity, | ||
801 | u8 trigger, | ||
802 | u32 gsi) | ||
803 | { | 689 | { |
804 | struct mpc_config_intsrc intsrc; | 690 | struct mpc_config_intsrc intsrc; |
805 | int ioapic = -1; | 691 | int ioapic = -1; |
@@ -837,22 +723,18 @@ void __init mp_override_legacy_irq ( | |||
837 | mp_irqs[mp_irq_entries] = intsrc; | 723 | mp_irqs[mp_irq_entries] = intsrc; |
838 | if (++mp_irq_entries == MAX_IRQ_SOURCES) | 724 | if (++mp_irq_entries == MAX_IRQ_SOURCES) |
839 | panic("Max # of irq sources exceeded!\n"); | 725 | panic("Max # of irq sources exceeded!\n"); |
840 | |||
841 | return; | ||
842 | } | 726 | } |
843 | 727 | ||
844 | 728 | void __init mp_config_acpi_legacy_irqs(void) | |
845 | void __init mp_config_acpi_legacy_irqs (void) | ||
846 | { | 729 | { |
847 | struct mpc_config_intsrc intsrc; | 730 | struct mpc_config_intsrc intsrc; |
848 | int i = 0; | 731 | int i = 0; |
849 | int ioapic = -1; | 732 | int ioapic = -1; |
850 | 733 | ||
851 | /* | 734 | /* |
852 | * Fabricate the legacy ISA bus (bus #31). | 735 | * Fabricate the legacy ISA bus (bus #31). |
853 | */ | 736 | */ |
854 | mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA; | 737 | set_bit(MP_ISA_BUS, mp_bus_not_pci); |
855 | Dprintk("Bus #%d is ISA\n", MP_ISA_BUS); | ||
856 | 738 | ||
857 | /* | 739 | /* |
858 | * Locate the IOAPIC that manages the ISA IRQs (0-15). | 740 | * Locate the IOAPIC that manages the ISA IRQs (0-15). |
@@ -905,24 +787,22 @@ void __init mp_config_acpi_legacy_irqs (void) | |||
905 | if (++mp_irq_entries == MAX_IRQ_SOURCES) | 787 | if (++mp_irq_entries == MAX_IRQ_SOURCES) |
906 | panic("Max # of irq sources exceeded!\n"); | 788 | panic("Max # of irq sources exceeded!\n"); |
907 | } | 789 | } |
908 | |||
909 | return; | ||
910 | } | 790 | } |
911 | 791 | ||
912 | #define MAX_GSI_NUM 4096 | 792 | #define MAX_GSI_NUM 4096 |
913 | 793 | ||
914 | int mp_register_gsi(u32 gsi, int triggering, int polarity) | 794 | int mp_register_gsi(u32 gsi, int triggering, int polarity) |
915 | { | 795 | { |
916 | int ioapic = -1; | 796 | int ioapic = -1; |
917 | int ioapic_pin = 0; | 797 | int ioapic_pin = 0; |
918 | int idx, bit = 0; | 798 | int idx, bit = 0; |
919 | static int pci_irq = 16; | 799 | static int pci_irq = 16; |
920 | /* | 800 | /* |
921 | * Mapping between Global System Interrupts, which | 801 | * Mapping between Global System Interrupts, which |
922 | * represent all possible interrupts, to the IRQs | 802 | * represent all possible interrupts, to the IRQs |
923 | * assigned to actual devices. | 803 | * assigned to actual devices. |
924 | */ | 804 | */ |
925 | static int gsi_to_irq[MAX_GSI_NUM]; | 805 | static int gsi_to_irq[MAX_GSI_NUM]; |
926 | 806 | ||
927 | if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) | 807 | if (acpi_irq_model != ACPI_IRQ_MODEL_IOAPIC) |
928 | return gsi; | 808 | return gsi; |
@@ -996,6 +876,4 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity) | |||
996 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); | 876 | polarity == ACPI_ACTIVE_HIGH ? 0 : 1); |
997 | return gsi; | 877 | return gsi; |
998 | } | 878 | } |
999 | |||
1000 | #endif /*CONFIG_X86_IO_APIC*/ | ||
1001 | #endif /*CONFIG_ACPI*/ | 879 | #endif /*CONFIG_ACPI*/ |