diff options
Diffstat (limited to 'arch/x86/kernel/setup.c')
| -rw-r--r-- | arch/x86/kernel/setup.c | 143 |
1 files changed, 115 insertions, 28 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 6a8811a69324..f28c56e6bf94 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -74,14 +74,15 @@ | |||
| 74 | #include <asm/e820.h> | 74 | #include <asm/e820.h> |
| 75 | #include <asm/mpspec.h> | 75 | #include <asm/mpspec.h> |
| 76 | #include <asm/setup.h> | 76 | #include <asm/setup.h> |
| 77 | #include <asm/arch_hooks.h> | ||
| 78 | #include <asm/efi.h> | 77 | #include <asm/efi.h> |
| 78 | #include <asm/timer.h> | ||
| 79 | #include <asm/i8259.h> | ||
| 79 | #include <asm/sections.h> | 80 | #include <asm/sections.h> |
| 80 | #include <asm/dmi.h> | 81 | #include <asm/dmi.h> |
| 81 | #include <asm/io_apic.h> | 82 | #include <asm/io_apic.h> |
| 82 | #include <asm/ist.h> | 83 | #include <asm/ist.h> |
| 83 | #include <asm/vmi.h> | 84 | #include <asm/vmi.h> |
| 84 | #include <setup_arch.h> | 85 | #include <asm/setup_arch.h> |
| 85 | #include <asm/bios_ebda.h> | 86 | #include <asm/bios_ebda.h> |
| 86 | #include <asm/cacheflush.h> | 87 | #include <asm/cacheflush.h> |
| 87 | #include <asm/processor.h> | 88 | #include <asm/processor.h> |
| @@ -89,7 +90,7 @@ | |||
| 89 | 90 | ||
| 90 | #include <asm/system.h> | 91 | #include <asm/system.h> |
| 91 | #include <asm/vsyscall.h> | 92 | #include <asm/vsyscall.h> |
| 92 | #include <asm/smp.h> | 93 | #include <asm/cpu.h> |
| 93 | #include <asm/desc.h> | 94 | #include <asm/desc.h> |
| 94 | #include <asm/dma.h> | 95 | #include <asm/dma.h> |
| 95 | #include <asm/iommu.h> | 96 | #include <asm/iommu.h> |
| @@ -97,7 +98,6 @@ | |||
| 97 | #include <asm/mmu_context.h> | 98 | #include <asm/mmu_context.h> |
| 98 | #include <asm/proto.h> | 99 | #include <asm/proto.h> |
| 99 | 100 | ||
| 100 | #include <mach_apic.h> | ||
| 101 | #include <asm/paravirt.h> | 101 | #include <asm/paravirt.h> |
| 102 | #include <asm/hypervisor.h> | 102 | #include <asm/hypervisor.h> |
| 103 | 103 | ||
| @@ -112,6 +112,20 @@ | |||
| 112 | #define ARCH_SETUP | 112 | #define ARCH_SETUP |
| 113 | #endif | 113 | #endif |
| 114 | 114 | ||
| 115 | unsigned int boot_cpu_id __read_mostly; | ||
| 116 | |||
| 117 | #ifdef CONFIG_X86_64 | ||
| 118 | int default_cpu_present_to_apicid(int mps_cpu) | ||
| 119 | { | ||
| 120 | return __default_cpu_present_to_apicid(mps_cpu); | ||
| 121 | } | ||
| 122 | |||
| 123 | int default_check_phys_apicid_present(int boot_cpu_physical_apicid) | ||
| 124 | { | ||
| 125 | return __default_check_phys_apicid_present(boot_cpu_physical_apicid); | ||
| 126 | } | ||
| 127 | #endif | ||
| 128 | |||
| 115 | #ifndef CONFIG_DEBUG_BOOT_PARAMS | 129 | #ifndef CONFIG_DEBUG_BOOT_PARAMS |
| 116 | struct boot_params __initdata boot_params; | 130 | struct boot_params __initdata boot_params; |
| 117 | #else | 131 | #else |
| @@ -188,7 +202,9 @@ struct ist_info ist_info; | |||
| 188 | #endif | 202 | #endif |
| 189 | 203 | ||
| 190 | #else | 204 | #else |
| 191 | struct cpuinfo_x86 boot_cpu_data __read_mostly; | 205 | struct cpuinfo_x86 boot_cpu_data __read_mostly = { |
| 206 | .x86_phys_bits = MAX_PHYSMEM_BITS, | ||
| 207 | }; | ||
| 192 | EXPORT_SYMBOL(boot_cpu_data); | 208 | EXPORT_SYMBOL(boot_cpu_data); |
| 193 | #endif | 209 | #endif |
| 194 | 210 | ||
| @@ -586,20 +602,7 @@ static int __init setup_elfcorehdr(char *arg) | |||
| 586 | early_param("elfcorehdr", setup_elfcorehdr); | 602 | early_param("elfcorehdr", setup_elfcorehdr); |
| 587 | #endif | 603 | #endif |
| 588 | 604 | ||
| 589 | static int __init default_update_genapic(void) | 605 | static struct x86_quirks default_x86_quirks __initdata; |
| 590 | { | ||
| 591 | #ifdef CONFIG_X86_SMP | ||
| 592 | # if defined(CONFIG_X86_GENERICARCH) || defined(CONFIG_X86_64) | ||
| 593 | genapic->wakeup_cpu = wakeup_secondary_cpu_via_init; | ||
| 594 | # endif | ||
| 595 | #endif | ||
| 596 | |||
| 597 | return 0; | ||
| 598 | } | ||
| 599 | |||
| 600 | static struct x86_quirks default_x86_quirks __initdata = { | ||
| 601 | .update_genapic = default_update_genapic, | ||
| 602 | }; | ||
| 603 | 606 | ||
| 604 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; | 607 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; |
| 605 | 608 | ||
| @@ -656,7 +659,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 656 | #ifdef CONFIG_X86_32 | 659 | #ifdef CONFIG_X86_32 |
| 657 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); | 660 | memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); |
| 658 | visws_early_detect(); | 661 | visws_early_detect(); |
| 659 | pre_setup_arch_hook(); | ||
| 660 | #else | 662 | #else |
| 661 | printk(KERN_INFO "Command line: %s\n", boot_command_line); | 663 | printk(KERN_INFO "Command line: %s\n", boot_command_line); |
| 662 | #endif | 664 | #endif |
| @@ -824,8 +826,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 824 | #else | 826 | #else |
| 825 | num_physpages = max_pfn; | 827 | num_physpages = max_pfn; |
| 826 | 828 | ||
| 827 | if (cpu_has_x2apic) | 829 | check_x2apic(); |
| 828 | check_x2apic(); | ||
| 829 | 830 | ||
| 830 | /* How many end-of-memory variables you have, grandma! */ | 831 | /* How many end-of-memory variables you have, grandma! */ |
| 831 | /* need this before calling reserve_initrd */ | 832 | /* need this before calling reserve_initrd */ |
| @@ -865,9 +866,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 865 | 866 | ||
| 866 | reserve_initrd(); | 867 | reserve_initrd(); |
| 867 | 868 | ||
| 868 | #ifdef CONFIG_X86_64 | ||
| 869 | vsmp_init(); | 869 | vsmp_init(); |
| 870 | #endif | ||
| 871 | 870 | ||
| 872 | io_delay_init(); | 871 | io_delay_init(); |
| 873 | 872 | ||
| @@ -893,12 +892,11 @@ void __init setup_arch(char **cmdline_p) | |||
| 893 | */ | 892 | */ |
| 894 | acpi_reserve_bootmem(); | 893 | acpi_reserve_bootmem(); |
| 895 | #endif | 894 | #endif |
| 896 | #ifdef CONFIG_X86_FIND_SMP_CONFIG | ||
| 897 | /* | 895 | /* |
| 898 | * Find and reserve possible boot-time SMP configuration: | 896 | * Find and reserve possible boot-time SMP configuration: |
| 899 | */ | 897 | */ |
| 900 | find_smp_config(); | 898 | find_smp_config(); |
| 901 | #endif | 899 | |
| 902 | reserve_crashkernel(); | 900 | reserve_crashkernel(); |
| 903 | 901 | ||
| 904 | #ifdef CONFIG_X86_64 | 902 | #ifdef CONFIG_X86_64 |
| @@ -925,9 +923,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 925 | map_vsyscall(); | 923 | map_vsyscall(); |
| 926 | #endif | 924 | #endif |
| 927 | 925 | ||
| 928 | #ifdef CONFIG_X86_GENERICARCH | ||
| 929 | generic_apic_probe(); | 926 | generic_apic_probe(); |
| 930 | #endif | ||
| 931 | 927 | ||
| 932 | early_quirks(); | 928 | early_quirks(); |
| 933 | 929 | ||
| @@ -978,4 +974,95 @@ void __init setup_arch(char **cmdline_p) | |||
| 978 | #endif | 974 | #endif |
| 979 | } | 975 | } |
| 980 | 976 | ||
| 977 | #ifdef CONFIG_X86_32 | ||
| 978 | |||
| 979 | /** | ||
| 980 | * x86_quirk_pre_intr_init - initialisation prior to setting up interrupt vectors | ||
| 981 | * | ||
| 982 | * Description: | ||
| 983 | * Perform any necessary interrupt initialisation prior to setting up | ||
| 984 | * the "ordinary" interrupt call gates. For legacy reasons, the ISA | ||
| 985 | * interrupts should be initialised here if the machine emulates a PC | ||
| 986 | * in any way. | ||
| 987 | **/ | ||
| 988 | void __init x86_quirk_pre_intr_init(void) | ||
| 989 | { | ||
| 990 | if (x86_quirks->arch_pre_intr_init) { | ||
| 991 | if (x86_quirks->arch_pre_intr_init()) | ||
| 992 | return; | ||
| 993 | } | ||
| 994 | init_ISA_irqs(); | ||
| 995 | } | ||
| 996 | |||
| 997 | /** | ||
| 998 | * x86_quirk_intr_init - post gate setup interrupt initialisation | ||
| 999 | * | ||
| 1000 | * Description: | ||
| 1001 | * Fill in any interrupts that may have been left out by the general | ||
| 1002 | * init_IRQ() routine. interrupts having to do with the machine rather | ||
| 1003 | * than the devices on the I/O bus (like APIC interrupts in intel MP | ||
| 1004 | * systems) are started here. | ||
| 1005 | **/ | ||
| 1006 | void __init x86_quirk_intr_init(void) | ||
| 1007 | { | ||
| 1008 | if (x86_quirks->arch_intr_init) { | ||
| 1009 | if (x86_quirks->arch_intr_init()) | ||
| 1010 | return; | ||
| 1011 | } | ||
| 1012 | } | ||
| 1013 | |||
| 1014 | /** | ||
| 1015 | * x86_quirk_trap_init - initialise system specific traps | ||
| 1016 | * | ||
| 1017 | * Description: | ||
| 1018 | * Called as the final act of trap_init(). Used in VISWS to initialise | ||
| 1019 | * the various board specific APIC traps. | ||
| 1020 | **/ | ||
| 1021 | void __init x86_quirk_trap_init(void) | ||
| 1022 | { | ||
| 1023 | if (x86_quirks->arch_trap_init) { | ||
| 1024 | if (x86_quirks->arch_trap_init()) | ||
| 1025 | return; | ||
| 1026 | } | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | static struct irqaction irq0 = { | ||
| 1030 | .handler = timer_interrupt, | ||
| 1031 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, | ||
| 1032 | .mask = CPU_MASK_NONE, | ||
| 1033 | .name = "timer" | ||
| 1034 | }; | ||
| 1035 | |||
| 1036 | /** | ||
| 1037 | * x86_quirk_pre_time_init - do any specific initialisations before. | ||
| 1038 | * | ||
| 1039 | **/ | ||
| 1040 | void __init x86_quirk_pre_time_init(void) | ||
| 1041 | { | ||
| 1042 | if (x86_quirks->arch_pre_time_init) | ||
| 1043 | x86_quirks->arch_pre_time_init(); | ||
| 1044 | } | ||
| 981 | 1045 | ||
| 1046 | /** | ||
| 1047 | * x86_quirk_time_init - do any specific initialisations for the system timer. | ||
| 1048 | * | ||
| 1049 | * Description: | ||
| 1050 | * Must plug the system timer interrupt source at HZ into the IRQ listed | ||
| 1051 | * in irq_vectors.h:TIMER_IRQ | ||
| 1052 | **/ | ||
| 1053 | void __init x86_quirk_time_init(void) | ||
| 1054 | { | ||
| 1055 | if (x86_quirks->arch_time_init) { | ||
| 1056 | /* | ||
| 1057 | * A nonzero return code does not mean failure, it means | ||
| 1058 | * that the architecture quirk does not want any | ||
| 1059 | * generic (timer) setup to be performed after this: | ||
| 1060 | */ | ||
| 1061 | if (x86_quirks->arch_time_init()) | ||
| 1062 | return; | ||
| 1063 | } | ||
| 1064 | |||
| 1065 | irq0.mask = cpumask_of_cpu(0); | ||
| 1066 | setup_irq(0, &irq0); | ||
| 1067 | } | ||
| 1068 | #endif /* CONFIG_X86_32 */ | ||
