Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * x86 SMP booting functions |
| 3 | * |
| 4 | * (c) 1995 Alan Cox, Building #3 <alan@redhat.com> |
| 5 | * (c) 1998, 1999, 2000 Ingo Molnar <mingo@redhat.com> |
| 6 | * |
| 7 | * Much of the core SMP work is based on previous work by Thomas Radke, to |
| 8 | * whom a great many thanks are extended. |
| 9 | * |
| 10 | * Thanks to Intel for making available several different Pentium, |
| 11 | * Pentium Pro and Pentium-II/Xeon MP machines. |
| 12 | * Original development of Linux SMP code supported by Caldera. |
| 13 | * |
| 14 | * This code is released under the GNU General Public License version 2 or |
| 15 | * later. |
| 16 | * |
| 17 | * Fixes |
| 18 | * Felix Koop : NR_CPUS used properly |
| 19 | * Jose Renau : Handle single CPU case. |
| 20 | * Alan Cox : By repeated request 8) - Total BogoMIPS report. |
| 21 | * Greg Wright : Fix for kernel stacks panic. |
| 22 | * Erich Boleyn : MP v1.4 and additional changes. |
| 23 | * Matthias Sattler : Changes for 2.1 kernel map. |
| 24 | * Michel Lespinasse : Changes for 2.1 kernel map. |
| 25 | * Michael Chastain : Change trampoline.S to gnu as. |
| 26 | * Alan Cox : Dumb bug: 'B' step PPro's are fine |
| 27 | * Ingo Molnar : Added APIC timers, based on code |
| 28 | * from Jose Renau |
| 29 | * Ingo Molnar : various cleanups and rewrites |
| 30 | * Tigran Aivazian : fixed "0.00 in /proc/uptime on SMP" bug. |
| 31 | * Maciej W. Rozycki : Bits for genuine 82489DX APICs |
| 32 | * Martin J. Bligh : Added support for multi-quad systems |
| 33 | * Dave Jones : Report invalid combinations of Athlon CPUs. |
| 34 | * Rusty Russell : Hacked into shape for new "hotplug" boot process. */ |
| 35 | |
| 36 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <linux/init.h> |
| 38 | #include <linux/kernel.h> |
| 39 | |
| 40 | #include <linux/mm.h> |
| 41 | #include <linux/sched.h> |
| 42 | #include <linux/kernel_stat.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | #include <linux/bootmem.h> |
Zwane Mwaikambo | f370513 | 2005-06-25 14:54:50 -0700 | [diff] [blame] | 44 | #include <linux/notifier.h> |
| 45 | #include <linux/cpu.h> |
| 46 | #include <linux/percpu.h> |
Ingo Molnar | d04f41e | 2007-03-07 18:12:31 +0100 | [diff] [blame] | 47 | #include <linux/nmi.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | |
| 49 | #include <linux/delay.h> |
| 50 | #include <linux/mc146818rtc.h> |
| 51 | #include <asm/tlbflush.h> |
| 52 | #include <asm/desc.h> |
| 53 | #include <asm/arch_hooks.h> |
Don Zickus | 3e4ff11 | 2006-06-26 13:57:01 +0200 | [diff] [blame] | 54 | #include <asm/nmi.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | |
| 56 | #include <mach_apic.h> |
| 57 | #include <mach_wakecpu.h> |
| 58 | #include <smpboot_hooks.h> |
Zachary Amsden | 7ce0bcf | 2007-02-13 13:26:21 +0100 | [diff] [blame] | 59 | #include <asm/vmi.h> |
Bernhard Kaindl | 2b1f627 | 2007-05-02 19:27:17 +0200 | [diff] [blame] | 60 | #include <asm/mtrr.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
travis@sgi.com | 3b41908 | 2008-01-30 13:33:11 +0100 | [diff] [blame] | 62 | /* which logical CPU number maps to which CPU (physical APIC ID) */ |
Glauber Costa | 5382e89 | 2008-03-03 14:12:57 -0300 | [diff] [blame] | 63 | u16 x86_cpu_to_apicid_init[NR_CPUS] __initdata = |
Mike Travis | 71fff5e | 2007-10-19 20:35:03 +0200 | [diff] [blame] | 64 | { [0 ... NR_CPUS-1] = BAD_APICID }; |
travis@sgi.com | 3b41908 | 2008-01-30 13:33:11 +0100 | [diff] [blame] | 65 | void *x86_cpu_to_apicid_early_ptr; |
Glauber Costa | 5382e89 | 2008-03-03 14:12:57 -0300 | [diff] [blame] | 66 | DEFINE_PER_CPU(u16, x86_cpu_to_apicid) = BAD_APICID; |
Mike Travis | 71fff5e | 2007-10-19 20:35:03 +0200 | [diff] [blame] | 67 | EXPORT_PER_CPU_SYMBOL(x86_cpu_to_apicid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
Glauber de Oliveira Costa | cbe879f | 2008-03-19 14:25:19 -0300 | [diff] [blame] | 69 | u16 x86_bios_cpu_apicid_init[NR_CPUS] __initdata |
| 70 | = { [0 ... NR_CPUS-1] = BAD_APICID }; |
| 71 | void *x86_bios_cpu_apicid_early_ptr; |
| 72 | DEFINE_PER_CPU(u16, x86_bios_cpu_apicid) = BAD_APICID; |
| 73 | EXPORT_PER_CPU_SYMBOL(x86_bios_cpu_apicid); |
| 74 | |
keith mannthey | 3b08606 | 2006-09-29 01:58:46 -0700 | [diff] [blame] | 75 | u8 apicid_2_node[MAX_APICID]; |
| 76 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | /* Where the IO area was mapped on multiquad, always 0 otherwise */ |
| 78 | void *xquad_portio; |
Alexey Dobriyan | 129f694 | 2005-06-23 00:08:33 -0700 | [diff] [blame] | 79 | #ifdef CONFIG_X86_NUMAQ |
| 80 | EXPORT_SYMBOL(xquad_portio); |
| 81 | #endif |