Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / x86 / kernel / setup.c
index c3a606c..32bd87c 100644 (file)
 #endif
 #include <asm/mce.h>
 #include <asm/alternative.h>
+#include <asm/prom.h>
 
 /*
  * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
@@ -293,30 +294,11 @@ static void __init init_gbpages(void)
        else
                direct_gbpages = 0;
 }
-
-static void __init cleanup_highmap_brk_end(void)
-{
-       pud_t *pud;
-       pmd_t *pmd;
-
-       mmu_cr4_features = read_cr4();
-
-       /*
-        * _brk_end cannot change anymore, but it and _end may be
-        * located on different 2M pages. cleanup_highmap(), however,
-        * can only consider _end when it runs, so destroy any
-        * mappings beyond _brk_end here.
-        */
-       pud = pud_offset(pgd_offset_k(_brk_end), _brk_end);
-       pmd = pmd_offset(pud, _brk_end - 1);
-       while (++pmd <= pmd_offset(pud, (unsigned long)_end - 1))
-               pmd_clear(pmd);
-}
 #else
 static inline void init_gbpages(void)
 {
 }
-static inline void cleanup_highmap_brk_end(void)
+static void __init cleanup_highmap(void)
 {
 }
 #endif
@@ -329,8 +311,6 @@ static void __init reserve_brk(void)
        /* Mark brk area as locked down and no longer taking any
           new allocations */
        _brk_start = 0;
-
-       cleanup_highmap_brk_end();
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -453,16 +433,30 @@ static void __init parse_setup_data(void)
                return;
        pa_data = boot_params.hdr.setup_data;
        while (pa_data) {
-               data = early_memremap(pa_data, PAGE_SIZE);
+               u32 data_len, map_len;
+
+               map_len = max(PAGE_SIZE - (pa_data & ~PAGE_MASK),
+                             (u64)sizeof(struct setup_data));
+               data = early_memremap(pa_data, map_len);
+               data_len = data->len + sizeof(struct setup_data);
+               if (data_len > map_len) {
+                       early_iounmap(data, map_len);
+                       data = early_memremap(pa_data, data_len);
+                       map_len = data_len;
+               }
+
                switch (data->type) {
                case SETUP_E820_EXT:
-                       parse_e820_ext(data, pa_data);
+                       parse_e820_ext(data);
+                       break;
+               case SETUP_DTB:
+                       add_dtb(pa_data);
                        break;
                default:
                        break;
                }
                pa_data = data->next;
-               early_iounmap(data, PAGE_SIZE);
+               early_iounmap(data, map_len);
        }
 }
 
@@ -935,6 +929,8 @@ void __init setup_arch(char **cmdline_p)
         */
        reserve_brk();
 
+       cleanup_highmap();
+
        memblock.current_limit = get_max_mapped();
        memblock_x86_fill();
 
@@ -948,15 +944,8 @@ void __init setup_arch(char **cmdline_p)
        printk(KERN_DEBUG "initial memory mapped : 0 - %08lx\n",
                        max_pfn_mapped<<PAGE_SHIFT);
 
-       reserve_trampoline_memory();
+       setup_trampolines();
 
-#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 */
@@ -1030,8 +1019,8 @@ void __init setup_arch(char **cmdline_p)
         * Read APIC and some other early information from ACPI tables.
         */
        acpi_boot_init();
-
        sfi_init();
+       x86_dtb_init();
 
        /*
         * get boot-time SMP configuration:
@@ -1065,6 +1054,8 @@ void __init setup_arch(char **cmdline_p)
 #endif
        x86_init.oem.banner();
 
+       x86_init.timers.wallclock_init();
+
        mcheck_init();
 
        local_irq_save(flags);