Merge branch 'tip/tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git...
[safe/jmp/linux-2.6] / arch / x86 / kernel / setup.c
index 6c78868..5d9e40c 100644 (file)
@@ -73,6 +73,7 @@
 
 #include <asm/mtrr.h>
 #include <asm/apic.h>
+#include <asm/trampoline.h>
 #include <asm/e820.h>
 #include <asm/mpspec.h>
 #include <asm/setup.h>
 #include <asm/percpu.h>
 #include <asm/topology.h>
 #include <asm/apicdef.h>
+#include <asm/k8.h>
 #ifdef CONFIG_X86_64
 #include <asm/numa_64.h>
 #endif
+#include <asm/mce.h>
 
 /*
  * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
@@ -247,7 +250,7 @@ EXPORT_SYMBOL(edd);
  *              from boot_params into a safe place.
  *
  */
-static inline void copy_edd(void)
+static inline void __init copy_edd(void)
 {
      memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
            sizeof(edd.mbr_signature));
@@ -256,7 +259,7 @@ static inline void copy_edd(void)
      edd.edd_info_nr = boot_params.eddbuf_entries;
 }
 #else
-static inline void copy_edd(void)
+static inline void __init copy_edd(void)
 {
 }
 #endif
@@ -486,42 +489,11 @@ static void __init reserve_early_setup_data(void)
 
 #ifdef CONFIG_KEXEC
 
-/**
- * Reserve @size bytes of crashkernel memory at any suitable offset.
- *
- * @size: Size of the crashkernel memory to reserve.
- * Returns the base address on success, and -1ULL on failure.
- */
-static
-unsigned long long __init find_and_reserve_crashkernel(unsigned long long size)
-{
-       const unsigned long long alignment = 16<<20;    /* 16M */
-       unsigned long long start = 0LL;
-
-       while (1) {
-               int ret;
-
-               start = find_e820_area(start, ULONG_MAX, size, alignment);
-               if (start == -1ULL)
-                       return start;
-
-               /* try to reserve it */
-               ret = reserve_bootmem_generic(start, size, BOOTMEM_EXCLUSIVE);
-               if (ret >= 0)
-                       return start;
-
-               start += alignment;
-       }
-}
-
 static inline unsigned long long get_total_mem(void)
 {
        unsigned long long total;
 
-       total = max_low_pfn - min_low_pfn;
-#ifdef CONFIG_HIGHMEM
-       total += highend_pfn - highstart_pfn;
-#endif
+       total = max_pfn - min_low_pfn;
 
        return total << PAGE_SHIFT;
 }
@@ -541,21 +513,25 @@ static void __init reserve_crashkernel(void)
 
        /* 0 means: find the address automatically */
        if (crash_base <= 0) {
-               crash_base = find_and_reserve_crashkernel(crash_size);
+               const unsigned long long alignment = 16<<20;    /* 16M */
+
+               crash_base = find_e820_area(alignment, ULONG_MAX, crash_size,
+                                alignment);
                if (crash_base == -1ULL) {
-                       pr_info("crashkernel reservation failed. "
-                               "No suitable area found.\n");
+                       pr_info("crashkernel reservation failed - No suitable area found.\n");
                        return;
                }
        } else {
-               ret = reserve_bootmem_generic(crash_base, crash_size,
-                                       BOOTMEM_EXCLUSIVE);
-               if (ret < 0) {
-                       pr_info("crashkernel reservation failed - "
-                               "memory is in use\n");
+               unsigned long long start;
+
+               start = find_e820_area(crash_base, ULONG_MAX, crash_size,
+                                1<<20);
+               if (start != crash_base) {
+                       pr_info("crashkernel reservation failed - memory is in use.\n");
                        return;
                }
        }
+       reserve_early(crash_base, crash_base + crash_size, "CRASH KERNEL");
 
        printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
                        "for crashkernel (System RAM: %ldMB)\n",
@@ -660,18 +636,33 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
                },
        },
        {
+               .callback = dmi_low_memory_corruption,
+               .ident = "Phoenix/MSC BIOS",
+               .matches = {
+                       DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix/MSC"),
+               },
+       },
        /*
-        * AMI BIOS with low memory corruption was found on Intel DG45ID board.
-        * It hase different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
+        * AMI BIOS with low memory corruption was found on Intel DG45ID and
+        * DG45FC boards.
+        * It has a different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
         * match only DMI_BOARD_NAME and see if there is more bad products
         * with this vendor.
         */
+       {
                .callback = dmi_low_memory_corruption,
                .ident = "AMI BIOS",
                .matches = {
                        DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
                },
        },
+       {
+               .callback = dmi_low_memory_corruption,
+               .ident = "AMI BIOS",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_NAME, "DG45FC"),
+               },
+       },
 #endif
        {}
 };
@@ -691,6 +682,9 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
 
 void __init setup_arch(char **cmdline_p)
 {
+       int acpi = 0;
+       int k8 = 0;
+
 #ifdef CONFIG_X86_32
        memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
        visws_early_detect();
@@ -698,21 +692,6 @@ void __init setup_arch(char **cmdline_p)
        printk(KERN_INFO "Command line: %s\n", boot_command_line);
 #endif
 
-       strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
-       *cmdline_p = command_line;
-
-#ifdef CONFIG_X86_64
-       /*
-        * Must call this twice: Once just to detect whether hardware doesn't
-        * support NX (so that the early EHCI debug console setup can safely
-        * call set_fixmap(), and then again after parsing early parameters to
-        * honor the respective command line option.
-        */
-       check_efer();
-#endif
-
-       parse_early_param();
-
        /* VMI may relocate the fixmap; do this before touching ioremap area */
        vmi_init();
 
@@ -795,9 +774,21 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif
 
-#ifdef CONFIG_X86_64
-       check_efer();
-#endif
+       strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
+       *cmdline_p = command_line;
+
+       /*
+        * x86_configure_nx() is called before parse_early_param() to detect
+        * whether hardware doesn't support NX (so that the early EHCI debug
+        * console setup can safely call set_fixmap()). It may then be called
+        * again from within noexec_setup() during parsing early parameters
+        * to honor the respective command line option.
+        */
+       x86_configure_nx();
+
+       parse_early_param();
+
+       x86_report_nx();
 
        /* Must be before kernel pagetables are setup */
        vmi_activate();
@@ -893,6 +884,20 @@ void __init setup_arch(char **cmdline_p)
 
        reserve_brk();
 
+       /*
+        * Find and reserve possible boot-time SMP configuration:
+        */
+       find_smp_config();
+
+       reserve_trampoline_memory();
+
+#ifdef CONFIG_ACPI_SLEEP
+       /*
+        * Reserve low memory region for sleep support.
+        * even before init_memory_mapping
+        */
+       acpi_reserve_wakeup_memory();
+#endif
        init_gbpages();
 
        /* max_pfn_mapped is updated here */
@@ -919,6 +924,8 @@ void __init setup_arch(char **cmdline_p)
 
        reserve_initrd();
 
+       reserve_crashkernel();
+
        vsmp_init();
 
        io_delay_init();
@@ -934,23 +941,15 @@ void __init setup_arch(char **cmdline_p)
        /*
         * Parse SRAT to discover nodes.
         */
-       acpi_numa_init();
+       acpi = acpi_numa_init();
 #endif
 
-       initmem_init(0, max_pfn);
-
-#ifdef CONFIG_ACPI_SLEEP
-       /*
-        * Reserve low memory region for sleep support.
-        */
-       acpi_reserve_bootmem();
+#ifdef CONFIG_K8_NUMA
+       if (!acpi)
+               k8 = !k8_numa_init(0, max_pfn);
 #endif
-       /*
-        * Find and reserve possible boot-time SMP configuration:
-        */
-       find_smp_config();
 
-       reserve_crashkernel();
+       initmem_init(0, max_pfn, acpi, k8);
 
 #ifdef CONFIG_X86_64
        /*
@@ -1024,6 +1023,8 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif
        x86_init.oem.banner();
+
+       mcheck_init();
 }
 
 #ifdef CONFIG_X86_32