* Mikael Pettersson : PM converted to driver model.
*/
- #include <linux/init.h>
-
- #include <linux/mm.h>
- #include <linux/delay.h>
- #include <linux/bootmem.h>
- #include <linux/interrupt.h>
- #include <linux/mc146818rtc.h>
#include <linux/kernel_stat.h>
- #include <linux/sysdev.h>
- #include <linux/ioport.h>
- #include <linux/cpu.h>
- #include <linux/clockchips.h>
+ #include <linux/mc146818rtc.h>
#include <linux/acpi_pmtmr.h>
+ #include <linux/clockchips.h>
+ #include <linux/interrupt.h>
+ #include <linux/bootmem.h>
+ #include <linux/ftrace.h>
+ #include <linux/ioport.h>
#include <linux/module.h>
- #include <linux/dmi.h>
+ #include <linux/sysdev.h>
+ #include <linux/delay.h>
+ #include <linux/timex.h>
#include <linux/dmar.h>
- #include <linux/ftrace.h>
- #include <linux/smp.h>
+ #include <linux/init.h>
+ #include <linux/cpu.h>
+ #include <linux/dmi.h>
#include <linux/nmi.h>
- #include <linux/timex.h>
+ #include <linux/smp.h>
+ #include <linux/mm.h>
- #include <asm/atomic.h>
- #include <asm/mtrr.h>
- #include <asm/mpspec.h>
- #include <asm/desc.h>
+#include <asm/perf_counter.h>
#include <asm/arch_hooks.h>
- #include <asm/hpet.h>
#include <asm/pgalloc.h>
+ #include <asm/genapic.h>
+ #include <asm/atomic.h>
+ #include <asm/mpspec.h>
#include <asm/i8253.h>
- #include <asm/idle.h>
+ #include <asm/i8259.h>
#include <asm/proto.h>
#include <asm/apic.h>
- #include <asm/i8259.h>
+ #include <asm/desc.h>
+ #include <asm/hpet.h>
+ #include <asm/idle.h>
+ #include <asm/mtrr.h>
#include <asm/smp.h>
- #include <mach_apic.h>
- #include <mach_apicdef.h>
- #include <mach_ipi.h>
+ unsigned int num_processors;
+
+ unsigned disabled_cpus __cpuinitdata;
+
+ /* Processor that is doing the boot up */
+ unsigned int boot_cpu_physical_apicid = -1U;
/*
- * Sanity check
+ * The highest APIC ID seen during enumeration.
+ *
+ * This determines the messaging protocol we can use: if all APIC IDs
+ * are in the 0 ... 7 range, then we can use logical addressing which
+ * has some performance advantages (better broadcasting).
+ *
+ * If there's an APIC ID above 8, we use physical addressing.
*/
- #if ((SPURIOUS_APIC_VECTOR & 0x0F) != 0x0F)
- # error SPURIOUS_APIC_VECTOR definition error
- #endif
+ unsigned int max_physical_apicid;
+
+ /*
+ * Bitmask of physically existing CPUs:
+ */
+ physid_mask_t phys_cpu_present_map;
+
+ /*
+ * Map cpu index to physical APIC ID
+ */
+ DEFINE_EARLY_PER_CPU(u16, x86_cpu_to_apicid, BAD_APICID);
+ DEFINE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid, BAD_APICID);
+ EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid);
+ EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
#ifdef CONFIG_X86_32
/*
/* IPI vectors for APIC spurious and error interrupts */
alloc_intr_gate(SPURIOUS_APIC_VECTOR, spurious_interrupt);
alloc_intr_gate(ERROR_APIC_VECTOR, error_interrupt);
-#endif
+# ifdef CONFIG_PERF_COUNTERS
+ alloc_intr_gate(LOCAL_PERF_VECTOR, perf_counter_interrupt);
+# endif
-#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86_MCE_P4THERMAL)
+# ifdef CONFIG_X86_MCE_P4THERMAL
/* thermal monitor LVT interrupt */
alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
+# endif
#endif
+}
+
+/* Overridden in paravirt.c */
+void init_IRQ(void) __attribute__((weak, alias("native_init_IRQ")));
+
+void __init native_init_IRQ(void)
+{
+ int i;
+
+ /* all the set up before the call gates are initialised */
+ pre_intr_init_hook();
+
+ apic_intr_init();
+
+ /*
+ * Cover the whole vector space, no vector can escape
+ * us. (some of these will be overridden and become
+ * 'special' SMP interrupts)
+ */
+ for (i = 0; i < (NR_VECTORS - FIRST_EXTERNAL_VECTOR); i++) {
+ int vector = FIRST_EXTERNAL_VECTOR + i;
+ /* SYSCALL_VECTOR was reserved in trap_init. */
+ if (!test_bit(vector, used_vectors))
+ set_intr_gate(vector, interrupt[i]);
+ }
+ if (!acpi_ioapic)
+ setup_irq(2, &irq2);
+
/* setup after call gates are initialised (usually add in
* the architecture specific gates)
*/