diff options
Diffstat (limited to 'arch/x86/kernel/setup.c')
| -rw-r--r-- | arch/x86/kernel/setup.c | 80 |
1 files changed, 44 insertions, 36 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 5b85759e7972..b4158439bf63 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
| @@ -112,8 +112,13 @@ | |||
| 112 | #define ARCH_SETUP | 112 | #define ARCH_SETUP |
| 113 | #endif | 113 | #endif |
| 114 | 114 | ||
| 115 | RESERVE_BRK(dmi_alloc, 65536); | ||
| 116 | |||
| 115 | unsigned int boot_cpu_id __read_mostly; | 117 | unsigned int boot_cpu_id __read_mostly; |
| 116 | 118 | ||
| 119 | static __initdata unsigned long _brk_start = (unsigned long)__brk_base; | ||
| 120 | unsigned long _brk_end = (unsigned long)__brk_base; | ||
| 121 | |||
| 117 | #ifdef CONFIG_X86_64 | 122 | #ifdef CONFIG_X86_64 |
| 118 | int default_cpu_present_to_apicid(int mps_cpu) | 123 | int default_cpu_present_to_apicid(int mps_cpu) |
| 119 | { | 124 | { |
| @@ -158,12 +163,6 @@ static struct resource bss_resource = { | |||
| 158 | 163 | ||
| 159 | 164 | ||
| 160 | #ifdef CONFIG_X86_32 | 165 | #ifdef CONFIG_X86_32 |
| 161 | /* This value is set up by the early boot code to point to the value | ||
| 162 | immediately after the boot time page tables. It contains a *physical* | ||
| 163 | address, and must not be in the .bss segment! */ | ||
| 164 | unsigned long init_pg_tables_start __initdata = ~0UL; | ||
| 165 | unsigned long init_pg_tables_end __initdata = ~0UL; | ||
| 166 | |||
| 167 | static struct resource video_ram_resource = { | 166 | static struct resource video_ram_resource = { |
| 168 | .name = "Video RAM area", | 167 | .name = "Video RAM area", |
| 169 | .start = 0xa0000, | 168 | .start = 0xa0000, |
| @@ -202,7 +201,9 @@ struct ist_info ist_info; | |||
| 202 | #endif | 201 | #endif |
| 203 | 202 | ||
| 204 | #else | 203 | #else |
| 205 | struct cpuinfo_x86 boot_cpu_data __read_mostly; | 204 | struct cpuinfo_x86 boot_cpu_data __read_mostly = { |
| 205 | .x86_phys_bits = MAX_PHYSMEM_BITS, | ||
| 206 | }; | ||
| 206 | EXPORT_SYMBOL(boot_cpu_data); | 207 | EXPORT_SYMBOL(boot_cpu_data); |
| 207 | #endif | 208 | #endif |
| 208 | 209 | ||
| @@ -217,12 +218,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE; | |||
| 217 | int bootloader_type; | 218 | int bootloader_type; |
| 218 | 219 | ||
| 219 | /* | 220 | /* |
| 220 | * Early DMI memory | ||
| 221 | */ | ||
| 222 | int dmi_alloc_index; | ||
| 223 | char dmi_alloc_data[DMI_MAX_DATA]; | ||
| 224 | |||
| 225 | /* | ||
| 226 | * Setup options | 221 | * Setup options |
| 227 | */ | 222 | */ |
| 228 | struct screen_info screen_info; | 223 | struct screen_info screen_info; |
| @@ -267,6 +262,35 @@ static inline void copy_edd(void) | |||
| 267 | } | 262 | } |
| 268 | #endif | 263 | #endif |
| 269 | 264 | ||
| 265 | void * __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 | |||
| 284 | static 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 | |||
| 270 | #ifdef CONFIG_BLK_DEV_INITRD | 294 | #ifdef CONFIG_BLK_DEV_INITRD |
| 271 | 295 | ||
| 272 | #ifdef CONFIG_X86_32 | 296 | #ifdef CONFIG_X86_32 |
| @@ -600,19 +624,7 @@ static int __init setup_elfcorehdr(char *arg) | |||
| 600 | early_param("elfcorehdr", setup_elfcorehdr); | 624 | early_param("elfcorehdr", setup_elfcorehdr); |
| 601 | #endif | 625 | #endif |
| 602 | 626 | ||
| 603 | static int __init default_update_apic(void) | 627 | static struct x86_quirks default_x86_quirks __initdata; |
| 604 | { | ||
| 605 | #ifdef CONFIG_SMP | ||
| 606 | if (!apic->wakeup_cpu) | ||
| 607 | apic->wakeup_cpu = wakeup_secondary_cpu_via_init; | ||
| 608 | #endif | ||
| 609 | |||
| 610 | return 0; | ||
| 611 | } | ||
| 612 | |||
| 613 | static struct x86_quirks default_x86_quirks __initdata = { | ||
| 614 | .update_apic = default_update_apic, | ||
| 615 | }; | ||
| 616 | 628 | ||
| 617 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; | 629 | struct x86_quirks *x86_quirks __initdata = &default_x86_quirks; |
| 618 | 630 | ||
| @@ -727,11 +739,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 727 | init_mm.start_code = (unsigned long) _text; | 739 | init_mm.start_code = (unsigned long) _text; |
| 728 | init_mm.end_code = (unsigned long) _etext; | 740 | init_mm.end_code = (unsigned long) _etext; |
| 729 | init_mm.end_data = (unsigned long) _edata; | 741 | init_mm.end_data = (unsigned long) _edata; |
| 730 | #ifdef CONFIG_X86_32 | 742 | init_mm.brk = _brk_end; |
| 731 | init_mm.brk = init_pg_tables_end + PAGE_OFFSET; | ||
| 732 | #else | ||
| 733 | init_mm.brk = (unsigned long) &_end; | ||
| 734 | #endif | ||
| 735 | 743 | ||
| 736 | code_resource.start = virt_to_phys(_text); | 744 | code_resource.start = virt_to_phys(_text); |
| 737 | code_resource.end = virt_to_phys(_etext)-1; | 745 | code_resource.end = virt_to_phys(_etext)-1; |
| @@ -782,6 +790,9 @@ void __init setup_arch(char **cmdline_p) | |||
| 782 | 790 | ||
| 783 | finish_e820_parsing(); | 791 | finish_e820_parsing(); |
| 784 | 792 | ||
| 793 | if (efi_enabled) | ||
| 794 | efi_init(); | ||
| 795 | |||
| 785 | dmi_scan_machine(); | 796 | dmi_scan_machine(); |
| 786 | 797 | ||
| 787 | dmi_check_system(bad_bios_dmi_table); | 798 | dmi_check_system(bad_bios_dmi_table); |
| @@ -801,8 +812,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 801 | insert_resource(&iomem_resource, &data_resource); | 812 | insert_resource(&iomem_resource, &data_resource); |
| 802 | insert_resource(&iomem_resource, &bss_resource); | 813 | insert_resource(&iomem_resource, &bss_resource); |
| 803 | 814 | ||
| 804 | if (efi_enabled) | ||
| 805 | efi_init(); | ||
| 806 | 815 | ||
| 807 | #ifdef CONFIG_X86_32 | 816 | #ifdef CONFIG_X86_32 |
| 808 | if (ppro_with_ram_bug()) { | 817 | if (ppro_with_ram_bug()) { |
| @@ -851,6 +860,8 @@ void __init setup_arch(char **cmdline_p) | |||
| 851 | setup_bios_corruption_check(); | 860 | setup_bios_corruption_check(); |
| 852 | #endif | 861 | #endif |
| 853 | 862 | ||
| 863 | reserve_brk(); | ||
| 864 | |||
| 854 | /* max_pfn_mapped is updated here */ | 865 | /* max_pfn_mapped is updated here */ |
| 855 | 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); |
| 856 | max_pfn_mapped = max_low_pfn_mapped; | 867 | max_pfn_mapped = max_low_pfn_mapped; |
| @@ -875,9 +886,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 875 | 886 | ||
| 876 | reserve_initrd(); | 887 | reserve_initrd(); |
| 877 | 888 | ||
| 878 | #ifdef CONFIG_X86_64 | ||
| 879 | vsmp_init(); | 889 | vsmp_init(); |
| 880 | #endif | ||
| 881 | 890 | ||
| 882 | io_delay_init(); | 891 | io_delay_init(); |
| 883 | 892 | ||
| @@ -1040,7 +1049,6 @@ void __init x86_quirk_trap_init(void) | |||
| 1040 | static struct irqaction irq0 = { | 1049 | static struct irqaction irq0 = { |
| 1041 | .handler = timer_interrupt, | 1050 | .handler = timer_interrupt, |
| 1042 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, | 1051 | .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, |
| 1043 | .mask = CPU_MASK_NONE, | ||
| 1044 | .name = "timer" | 1052 | .name = "timer" |
| 1045 | }; | 1053 | }; |
| 1046 | 1054 | ||
