percpu: generalize embedding first chunk setup helper
[safe/jmp/linux-2.6] / arch / x86 / kernel / head64.c
index b684552..f5b2722 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/string.h>
 #include <linux/percpu.h>
 #include <linux/start_kernel.h>
+#include <linux/io.h>
 
 #include <asm/processor.h>
 #include <asm/proto.h>
@@ -22,6 +23,8 @@
 #include <asm/sections.h>
 #include <asm/kdebug.h>
 #include <asm/e820.h>
+#include <asm/bios_ebda.h>
+#include <asm/trampoline.h>
 
 static void __init zap_identity_mappings(void)
 {
@@ -49,44 +52,6 @@ static void __init copy_bootdata(char *real_mode_data)
        }
 }
 
-#define BIOS_EBDA_SEGMENT 0x40E
-#define BIOS_LOWMEM_KILOBYTES 0x413
-
-/*
- * The BIOS places the EBDA/XBDA at the top of conventional
- * memory, and usually decreases the reported amount of
- * conventional memory (int 0x12) too.
- */
-static __init void reserve_ebda(void)
-{
-       unsigned int lowmem, ebda_addr;
-
-       /* end of low (conventional) memory */
-       lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
-       lowmem <<= 10;
-
-       /* start of EBDA area */
-       ebda_addr = *(unsigned short *)__va(BIOS_EBDA_SEGMENT);
-       ebda_addr <<= 4;
-
-       /* Fixup: bios puts an EBDA in the top 64K segment */
-       /* of conventional memory, but does not adjust lowmem. */
-       if ((lowmem - ebda_addr) <= 0x10000)
-               lowmem = ebda_addr;
-
-       /* Fixup: bios does not report an EBDA at all. */
-       /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
-       if ((ebda_addr == 0) && (lowmem >= 0x9f000))
-               lowmem = 0x9f000;
-
-       /* Paranoia: should never happen, but... */
-       if (lowmem >= 0x100000)
-               lowmem = 0xa0000;
-
-       /* reserve all memory between lowmem and the 1MB mark */
-       reserve_early(lowmem, 0x100000, "BIOS reserved");
-}
-
 void __init x86_64_start_kernel(char * real_mode_data)
 {
        int i;
@@ -103,6 +68,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
        BUILD_BUG_ON(!(MODULES_VADDR > __START_KERNEL));
        BUILD_BUG_ON(!(((MODULES_END - 1) & PGDIR_MASK) ==
                                (__START_KERNEL & PGDIR_MASK)));
+       BUILD_BUG_ON(__fix_to_virt(__end_of_fixed_addresses) <= MODULES_END);
 
        /* clear bss before set_intr_gate with early_idt_handler */
        clear_bss();
@@ -113,7 +79,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
        /* Cleanup the over mapped high alias */
        cleanup_highmap();
 
-       for (i = 0; i < IDT_ENTRIES; i++) {
+       for (i = 0; i < NUM_EXCEPTION_VECTORS; i++) {
 #ifdef CONFIG_EARLY_PRINTK
                set_intr_gate(i, &early_idt_handlers[i]);
 #else
@@ -122,16 +88,21 @@ void __init x86_64_start_kernel(char * real_mode_data)
        }
        load_idt((const struct desc_ptr *)&idt_descr);
 
-       early_printk("Kernel alive\n");
+       if (console_loglevel == 10)
+               early_printk("Kernel alive\n");
 
-       for (i = 0; i < NR_CPUS; i++)
-               cpu_pda(i) = &boot_cpu_pda[i];
+       x86_64_start_reservations(real_mode_data);
+}
 
-       pda_init(0);
+void __init x86_64_start_reservations(char *real_mode_data)
+{
        copy_bootdata(__va(real_mode_data));
 
+       reserve_trampoline_memory();
+
        reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
 
+#ifdef CONFIG_BLK_DEV_INITRD
        /* Reserve INITRD */
        if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
                unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
@@ -139,8 +110,9 @@ void __init x86_64_start_kernel(char * real_mode_data)
                unsigned long ramdisk_end   = ramdisk_image + ramdisk_size;
                reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
        }
+#endif
 
-       reserve_ebda();
+       reserve_ebda_region();
 
        /*
         * At this point everything still needed from the boot loader