aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/setup.c')
-rw-r--r--arch/x86/kernel/setup.c197
1 files changed, 152 insertions, 45 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 6a8811a69324..a0d26237d7cf 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,25 @@
112#define ARCH_SETUP 112#define ARCH_SETUP
113#endif 113#endif
114 114
115RESERVE_BRK(dmi_alloc, 65536);
116
117unsigned int boot_cpu_id __read_mostly;
118
119static __initdata unsigned long _brk_start = (unsigned long)__brk_base;
120unsigned long _brk_end = (unsigned long)__brk_base;
121
122#ifdef CONFIG_X86_64
123int default_cpu_present_to_apicid(int mps_cpu)
124{
125 return __default_cpu_present_to_apicid(mps_cpu);
126}
127
128int default_check_phys_apicid_present(int boot_cpu_physical_apicid)
129{
130 return __default_check_phys_apicid_present(boot_cpu_physical_apicid);
131}
132#endif
133
115#ifndef CONFIG_DEBUG_BOOT_PARAMS 134#ifndef CONFIG_DEBUG_BOOT_PARAMS
116struct boot_params __initdata boot_params; 135struct boot_params __initdata boot_params;
117#else 136#else
@@ -144,12 +163,6 @@ static struct resource bss_resource = {
144 163
145 164
146#ifdef CONFIG_X86_32 165#ifdef CONFIG_X86_32
147/* This value is set up by the early boot code to point to the value
148 immediately after the boot time page tables. It contains a *physical*
149 address, and must not be in the .bss segment! */
150unsigned long init_pg_tables_start __initdata = ~0UL;
151unsigned long init_pg_tables_end __initdata = ~0UL;
152
153static struct resource video_ram_resource = { 166static struct resource video_ram_resource = {
154 .name = "Video RAM area", 167 .name = "Video RAM area",
155 .start = 0xa0000, 168 .start = 0xa0000,
@@ -188,7 +201,9 @@ struct ist_info ist_info;
188#endif 201#endif
189 202
190#else 203#else
191struct cpuinfo_x86 boot_cpu_data __read_mostly; 204struct cpuinfo_x86 boot_cpu_data __read_mostly = {
205 .x86_phys_bits = MAX_PHYSMEM_BITS,
206};
192EXPORT_SYMBOL(boot_cpu_data); 207EXPORT_SYMBOL(boot_cpu_data);
193#endif 208#endif
194 209
@@ -203,12 +218,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE;
203int bootloader_type; 218int bootloader_type;
204 219
205/* 220/*
206 * Early DMI memory
207 */
208int dmi_alloc_index;
209char dmi_alloc_data[DMI_MAX_DATA];
210
211/*
212 * Setup options 221 * Setup options
213 */ 222 */
214struct screen_info screen_info; 223struct screen_info screen_info;
@@ -253,6 +262,35 @@ static inline void copy_edd(void)
253} 262}
254#endif 263#endif
255 264
265void * __init extend_brk(size_t size, size_t align)
266{
267 size_t mask = align - 1;
268 void *ret;
269
270 BUG_ON(_brk_start == 0);
271 BUG_ON(align & mask);
272
273 _brk_end = (_brk_end + mask) & ~mask;
274 BUG_ON((char *)(_brk_end + size) > __brk_limit);
275
276 ret = (void *)_brk_end;
277 _brk_end += size;
278
279 memset(ret, 0, size);
280
281 return ret;
282}
283
284static void __init reserve_brk(void)
285{
286 if (_brk_end > _brk_start)
287 reserve_early(__pa(_brk_start), __pa(_brk_end), "BRK");
288
289 /* Mark brk area as locked down and no longer taking any
290 new allocations */
291 _brk_start = 0;
292}
293
256#ifdef CONFIG_BLK_DEV_INITRD 294#ifdef CONFIG_BLK_DEV_INITRD
257 295
258#ifdef CONFIG_X86_32 296#ifdef CONFIG_X86_32
@@ -586,20 +624,7 @@ static int __init setup_elfcorehdr(char *arg)
586early_param("elfcorehdr", setup_elfcorehdr); 624early_param("elfcorehdr", setup_elfcorehdr);
587#endif 625#endif
588 626
589static int __init default_update_genapic(void) 627static 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
600static struct x86_quirks default_x86_quirks __initdata = {
601 .update_genapic = default_update_genapic,
602};
603 628
604struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; 629struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
605 630
@@ -656,7 +681,6 @@ void __init setup_arch(char **cmdline_p)
656#ifdef CONFIG_X86_32 681#ifdef CONFIG_X86_32
657 memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data)); 682 memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
658 visws_early_detect(); 683 visws_early_detect();
659 pre_setup_arch_hook();
660#else 684#else
661 printk(KERN_INFO "Command line: %s\n", boot_command_line); 685 printk(KERN_INFO "Command line: %s\n", boot_command_line);
662#endif 686#endif
@@ -715,11 +739,7 @@ void __init setup_arch(char **cmdline_p)
715 init_mm.start_code = (unsigned long) _text; 739 init_mm.start_code = (unsigned long) _text;
716 init_mm.end_code = (unsigned long) _etext; 740 init_mm.end_code = (unsigned long) _etext;
717 init_mm.end_data = (unsigned long) _edata; 741 init_mm.end_data = (unsigned long) _edata;
718#ifdef CONFIG_X86_32 742 init_mm.brk = _brk_end;
719 init_mm.brk = init_pg_tables_end + PAGE_OFFSET;
720#else
721 init_mm.brk = (unsigned long) &_end;
722#endif
723 743
724 code_resource.start = virt_to_phys(_text); 744 code_resource.start = virt_to_phys(_text);
725 code_resource.end = virt_to_phys(_etext)-1; 745 code_resource.end = virt_to_phys(_etext)-1;
@@ -824,8 +844,7 @@ void __init setup_arch(char **cmdline_p)
824#else 844#else
825 num_physpages = max_pfn; 845 num_physpages = max_pfn;
826 846
827 if (cpu_has_x2apic) 847 check_x2apic();
828 check_x2apic();
829 848
830 /* How many end-of-memory variables you have, grandma! */ 849 /* How many end-of-memory variables you have, grandma! */
831 /* need this before calling reserve_initrd */ 850 /* need this before calling reserve_initrd */
@@ -841,6 +860,8 @@ void __init setup_arch(char **cmdline_p)
841 setup_bios_corruption_check(); 860 setup_bios_corruption_check();
842#endif 861#endif
843 862
863 reserve_brk();
864
844 /* max_pfn_mapped is updated here */ 865 /* max_pfn_mapped is updated here */
845 max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT); 866 max_low_pfn_mapped = init_memory_mapping(0, max_low_pfn<<PAGE_SHIFT);
846 max_pfn_mapped = max_low_pfn_mapped; 867 max_pfn_mapped = max_low_pfn_mapped;
@@ -865,9 +886,7 @@ void __init setup_arch(char **cmdline_p)
865 886
866 reserve_initrd(); 887 reserve_initrd();
867 888
868#ifdef CONFIG_X86_64
869 vsmp_init(); 889 vsmp_init();
870#endif
871 890
872 io_delay_init(); 891 io_delay_init();
873 892
@@ -893,12 +912,11 @@ void __init setup_arch(char **cmdline_p)
893 */ 912 */
894 acpi_reserve_bootmem(); 913 acpi_reserve_bootmem();
895#endif 914#endif
896#ifdef CONFIG_X86_FIND_SMP_CONFIG
897 /* 915 /*
898 * Find and reserve possible boot-time SMP configuration: 916 * Find and reserve possible boot-time SMP configuration:
899 */ 917 */
900 find_smp_config(); 918 find_smp_config();
901#endif 919
902 reserve_crashkernel(); 920 reserve_crashkernel();
903 921
904#ifdef CONFIG_X86_64 922#ifdef CONFIG_X86_64
@@ -925,9 +943,7 @@ void __init setup_arch(char **cmdline_p)
925 map_vsyscall(); 943 map_vsyscall();
926#endif 944#endif
927 945
928#ifdef CONFIG_X86_GENERICARCH
929 generic_apic_probe(); 946 generic_apic_probe();
930#endif
931 947
932 early_quirks(); 948 early_quirks();
933 949
@@ -978,4 +994,95 @@ void __init setup_arch(char **cmdline_p)
978#endif 994#endif
979} 995}
980 996
997#ifdef CONFIG_X86_32
998
999/**
1000 * x86_quirk_pre_intr_init - initialisation prior to setting up interrupt vectors
1001 *
1002 * Description:
1003 * Perform any necessary interrupt initialisation prior to setting up
1004 * the "ordinary" interrupt call gates. For legacy reasons, the ISA
1005 * interrupts should be initialised here if the machine emulates a PC
1006 * in any way.
1007 **/
1008void __init x86_quirk_pre_intr_init(void)
1009{
1010 if (x86_quirks->arch_pre_intr_init) {
1011 if (x86_quirks->arch_pre_intr_init())
1012 return;
1013 }
1014 init_ISA_irqs();
1015}
981 1016
1017/**
1018 * x86_quirk_intr_init - post gate setup interrupt initialisation
1019 *
1020 * Description:
1021 * Fill in any interrupts that may have been left out by the general
1022 * init_IRQ() routine. interrupts having to do with the machine rather
1023 * than the devices on the I/O bus (like APIC interrupts in intel MP
1024 * systems) are started here.
1025 **/
1026void __init x86_quirk_intr_init(void)
1027{
1028 if (x86_quirks->arch_intr_init) {
1029 if (x86_quirks->arch_intr_init())
1030 return;
1031 }
1032}
1033
1034/**
1035 * x86_quirk_trap_init - initialise system specific traps
1036 *
1037 * Description:
1038 * Called as the final act of trap_init(). Used in VISWS to initialise
1039 * the various board specific APIC traps.
1040 **/
1041void __init x86_quirk_trap_init(void)
1042{
1043 if (x86_quirks->arch_trap_init) {
1044 if (x86_quirks->arch_trap_init())
1045 return;
1046 }
1047}
1048
1049static struct irqaction irq0 = {
1050 .handler = timer_interrupt,
1051 .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
1052 .mask = CPU_MASK_NONE,
1053 .name = "timer"
1054};
1055
1056/**
1057 * x86_quirk_pre_time_init - do any specific initialisations before.
1058 *
1059 **/
1060void __init x86_quirk_pre_time_init(void)
1061{
1062 if (x86_quirks->arch_pre_time_init)
1063 x86_quirks->arch_pre_time_init();
1064}
1065
1066/**
1067 * x86_quirk_time_init - do any specific initialisations for the system timer.
1068 *
1069 * Description:
1070 * Must plug the system timer interrupt source at HZ into the IRQ listed
1071 * in irq_vectors.h:TIMER_IRQ
1072 **/
1073void __init x86_quirk_time_init(void)
1074{
1075 if (x86_quirks->arch_time_init) {
1076 /*
1077 * A nonzero return code does not mean failure, it means
1078 * that the architecture quirk does not want any
1079 * generic (timer) setup to be performed after this:
1080 */
1081 if (x86_quirks->arch_time_init())
1082 return;
1083 }
1084
1085 irq0.mask = cpumask_of_cpu(0);
1086 setup_irq(0, &irq0);
1087}
1088#endif /* CONFIG_X86_32 */