]> err.no Git - linux-2.6/blobdiff - arch/x86/kernel/setup_64.c
x86: clean up init_amd()
[linux-2.6] / arch / x86 / kernel / setup_64.c
index b789ec5999233a608f43851d201fb62754287fd1..c94464ab04bafed8a966e3d1e9b9dd965dcee72f 100644 (file)
@@ -56,6 +56,7 @@
 #include <asm/desc.h>
 #include <video/edid.h>
 #include <asm/e820.h>
+#include <asm/mpspec.h>
 #include <asm/dma.h>
 #include <asm/gart.h>
 #include <asm/mpspec.h>
@@ -71,7 +72,6 @@
 #include <asm/topology.h>
 #include <asm/trampoline.h>
 #include <asm/pat.h>
-#include <asm/mmconfig.h>
 
 #include <mach_apic.h>
 #ifdef CONFIG_PARAVIRT
@@ -80,8 +80,6 @@
 #define ARCH_SETUP
 #endif
 
-#include "cpu/cpu.h"
-
 /*
  * Machine setup..
  */
@@ -119,7 +117,7 @@ EXPORT_SYMBOL_GPL(edid_info);
 
 extern int root_mountflags;
 
-char __initdata command_line[COMMAND_LINE_SIZE];
+static char __initdata command_line[COMMAND_LINE_SIZE];
 
 static struct resource standard_io_resources[] = {
        { .name = "dma1", .start = 0x00, .end = 0x1f,
@@ -227,72 +225,21 @@ static inline void copy_edd(void)
 }
 #endif
 
-#ifdef CONFIG_KEXEC
-static void __init reserve_crashkernel(void)
-{
-       unsigned long long total_mem;
-       unsigned long long crash_size, crash_base;
-       int ret;
-
-       total_mem = ((unsigned long long)max_low_pfn - min_low_pfn) << PAGE_SHIFT;
-
-       ret = parse_crashkernel(boot_command_line, total_mem,
-                       &crash_size, &crash_base);
-       if (ret == 0 && crash_size) {
-               if (crash_base <= 0) {
-                       printk(KERN_INFO "crashkernel reservation failed - "
-                                       "you have to specify a base address\n");
-                       return;
-               }
-
-               if (reserve_bootmem(crash_base, crash_size,
-                                       BOOTMEM_EXCLUSIVE) < 0) {
-                       printk(KERN_INFO "crashkernel reservation failed - "
-                                       "memory is in use\n");
-                       return;
-               }
-
-               printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
-                               "for crashkernel (System RAM: %ldMB)\n",
-                               (unsigned long)(crash_size >> 20),
-                               (unsigned long)(crash_base >> 20),
-                               (unsigned long)(total_mem >> 20));
-               crashk_res.start = crash_base;
-               crashk_res.end   = crash_base + crash_size - 1;
-               insert_resource(&iomem_resource, &crashk_res);
-       }
-}
-#else
-static inline void __init reserve_crashkernel(void)
-{}
-#endif
-
 /* Overridden in paravirt.c if CONFIG_PARAVIRT */
 void __attribute__((weak)) __init memory_setup(void)
 {
        machine_specific_memory_setup();
 }
 
-static void __init parse_setup_data(void)
+/* Current gdt points %fs at the "master" per-cpu area: after this,
+ * it's on the real one. */
+void switch_to_new_gdt(void)
 {
-       struct setup_data *data;
-       unsigned long pa_data;
+       struct desc_ptr gdt_descr;
 
-       if (boot_params.hdr.version < 0x0209)
-               return;
-       pa_data = boot_params.hdr.setup_data;
-       while (pa_data) {
-               data = early_ioremap(pa_data, PAGE_SIZE);
-               switch (data->type) {
-               default:
-                       break;
-               }
-#ifndef CONFIG_DEBUG_BOOT_PARAMS
-               free_early(pa_data, pa_data+sizeof(*data)+data->len);
-#endif
-               pa_data = data->next;
-               early_iounmap(data, PAGE_SIZE);
-       }
+       gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id());
+       gdt_descr.size = GDT_SIZE - 1;
+       load_gdt(&gdt_descr);
 }
 
 /*
@@ -319,13 +266,15 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #ifdef CONFIG_EFI
        if (!strncmp((char *)&boot_params.efi_info.efi_loader_signature,
-                    "EL64", 4))
+                    "EL64", 4)) {
                efi_enabled = 1;
+               efi_reserve_early();
+       }
 #endif
 
        ARCH_SETUP
 
-       memory_setup();
+       setup_memory_map();
        copy_edd();
 
        if (!boot_params.hdr.root_flags)
@@ -352,6 +301,11 @@ void __init setup_arch(char **cmdline_p)
 
        parse_early_param();
 
+       if (acpi_mps_check()) {
+               disable_apic = 1;
+               clear_cpu_cap(&boot_cpu_data, X86_FEATURE_APIC);
+       }
+
 #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT
        if (init_ohci1394_dma_early)
                init_ohci1394_dma_on_all_controllers();
@@ -372,9 +326,13 @@ void __init setup_arch(char **cmdline_p)
         * we are rounding upwards:
         */
        end_pfn = e820_end_of_ram();
+
+       /* pre allocte 4k for mptable mpc */
+       early_reserve_e820_mpc_new();
        /* update e820 for memory not covered by WB MTRRs */
        mtrr_bp_init();
        if (mtrr_trim_uncached_memory(end_pfn)) {
+               remove_all_active_ranges();
                e820_register_active_regions(0, 0, -1UL);
                end_pfn = e820_end_of_ram();
        }
@@ -383,7 +341,7 @@ void __init setup_arch(char **cmdline_p)
 
        check_efer();
 
-       max_pfn_mapped = init_memory_mapping(0, (max_pfn_mapped << PAGE_SHIFT));
+       max_pfn_mapped = init_memory_mapping(0, (end_pfn << PAGE_SHIFT));
        if (efi_enabled)
                efi_init();
 
@@ -397,15 +355,6 @@ void __init setup_arch(char **cmdline_p)
        kvmclock_init();
 #endif
 
-#ifdef CONFIG_SMP
-       /* setup to use the early static init tables during kernel startup */
-       x86_cpu_to_apicid_early_ptr = (void *)x86_cpu_to_apicid_init;
-       x86_bios_cpu_apicid_early_ptr = (void *)x86_bios_cpu_apicid_init;
-#ifdef CONFIG_NUMA
-       x86_cpu_to_node_map_early_ptr = (void *)x86_cpu_to_node_map_init;
-#endif
-#endif
-
 #ifdef CONFIG_ACPI
        /*
         * Initialize the ACPI boot-time table parser (gets the RSDP and SDT).
@@ -444,13 +393,12 @@ void __init setup_arch(char **cmdline_p)
        acpi_reserve_bootmem();
 #endif
 
-       if (efi_enabled)
-               efi_reserve_bootmem();
-
+#ifdef CONFIG_X86_MPPARSE
        /*
        * Find and reserve possible boot-time SMP configuration:
        */
        find_smp_config();
+#endif
 #ifdef CONFIG_BLK_DEV_INITRD
        if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
                unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
@@ -493,11 +441,13 @@ void __init setup_arch(char **cmdline_p)
 
        init_cpu_to_node();
 
+#ifdef CONFIG_X86_MPPARSE
        /*
         * get boot-time SMP configuration:
         */
        if (smp_found_config)
                get_smp_config();
+#endif
        init_apic_mappings();
        ioapic_init_mappings();
 
@@ -507,7 +457,7 @@ void __init setup_arch(char **cmdline_p)
         * We trust e820 completely. No explicit ROM probing in memory.
         */
        e820_reserve_resources();
-       e820_mark_nosave_regions();
+       e820_mark_nosave_regions(end_pfn);
 
        /* request I/O space for devices used on all i[345]86 PCs */
        for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
@@ -523,9 +473,6 @@ void __init setup_arch(char **cmdline_p)
        conswitchp = &dummy_con;
 #endif
 #endif
-
-       /* do this before identify_cpu for boot cpu */
-       check_enable_amd_mmconf_dmi();
 }
 
 struct cpu_dev *cpu_devs[X86_VENDOR_NUM] = {};
@@ -777,6 +724,10 @@ static void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
                cpu_devs[c->x86_vendor]->c_early_init(c);
 
        validate_pat_support(c);
+
+       /* early_param could clear that, but recall get it set again */
+       if (disable_apic)
+               clear_cpu_cap(c, X86_FEATURE_APIC);
 }
 
 /*