2 * linux/arch/i386/kernel/head32.c -- prepare to run common code
4 * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
5 * Copyright (C) 2007 Eric Biederman <ebiederm@xmission.com>
8 #include <linux/init.h>
9 #include <linux/start_kernel.h>
11 #include <linux/memblock.h>
13 #include <asm/setup.h>
14 #include <asm/sections.h>
16 #include <asm/trampoline.h>
18 #include <asm/io_apic.h>
19 #include <asm/tlbflush.h>
21 static void __init i386_default_early_setup(void)
23 /* Initialize 32bit specific setup functions */
24 x86_init.resources.reserve_resources = i386_reserve_resources;
26 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;
28 reserve_ebda_region();
32 void __init i386_start_kernel(void)
35 struct xen_platform_parameters pp;
37 WARN_ON(HYPERVISOR_vm_assist(VMASST_CMD_enable,
38 VMASST_TYPE_4gb_segments));
40 init_mm.pgd = swapper_pg_dir = (pgd_t *)xen_start_info->pt_base;
42 if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0) {
43 hypervisor_virt_start = pp.virt_start;
44 reserve_top_address(0UL - pp.virt_start);
47 BUG_ON(pte_index(hypervisor_virt_start));
50 memblock_reserve(__pa_symbol(&_text),
51 __pa_symbol(&__bss_stop) - __pa_symbol(&_text));
54 #ifdef CONFIG_BLK_DEV_INITRD
56 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
57 /* Assume only end is not page aligned */
58 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
59 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
60 u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size);
61 memblock_reserve(ramdisk_image, ramdisk_end - ramdisk_image);
65 /* Call the subarch specific early setup function */
66 switch (boot_params.hdr.hardware_subarch) {
67 case X86_SUBARCH_MRST:
68 x86_mrst_early_setup();
70 case X86_SUBARCH_CE4100:
71 x86_ce4100_early_setup();
74 i386_default_early_setup();
78 #ifdef CONFIG_BLK_DEV_INITRD
79 BUG_ON(xen_start_info->flags & SIF_MOD_START_PFN);
80 if (xen_start_info->mod_start)
81 xen_initrd_start = __pa(xen_start_info->mod_start);
86 if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE)
87 max_cmdline = COMMAND_LINE_SIZE;
88 memcpy(boot_command_line, xen_start_info->cmd_line, max_cmdline);
89 boot_command_line[max_cmdline-1] = '\0';
92 i386_default_early_setup();
97 * At this point everything still needed from the boot loader
98 * or BIOS or kernel text should be early reserved or marked not
99 * RAM in e820. All other memory is free game.