1700efc1bSEric W. Biederman /* 2700efc1bSEric W. Biederman * linux/arch/i386/kernel/head32.c -- prepare to run common code 3700efc1bSEric W. Biederman * 4700efc1bSEric W. Biederman * Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE 5700efc1bSEric W. Biederman * Copyright (C) 2007 Eric Biederman <ebiederm@xmission.com> 6700efc1bSEric W. Biederman */ 7700efc1bSEric W. Biederman 8700efc1bSEric W. Biederman #include <linux/init.h> 9700efc1bSEric W. Biederman #include <linux/start_kernel.h> 10c967da6aSYinghai Lu #include <linux/mm.h> 11700efc1bSEric W. Biederman 12a4c81cf6SYinghai Lu #include <asm/setup.h> 13a4c81cf6SYinghai Lu #include <asm/sections.h> 14a4c81cf6SYinghai Lu #include <asm/e820.h> 15816c25e7SThomas Gleixner #include <asm/page.h> 163e1e9002SRafael J. Wysocki #include <asm/trampoline.h> 17de934103SThomas Gleixner #include <asm/apic.h> 18de934103SThomas Gleixner #include <asm/io_apic.h> 1947a3d5daSThomas Gleixner #include <asm/bios_ebda.h> 2047a3d5daSThomas Gleixner 2147a3d5daSThomas Gleixner static void __init i386_default_early_setup(void) 2247a3d5daSThomas Gleixner { 2347a3d5daSThomas Gleixner /* Initilize 32bit specific setup functions */ 2447a3d5daSThomas Gleixner x86_init.resources.probe_roms = probe_roms; 2547a3d5daSThomas Gleixner x86_init.resources.reserve_resources = i386_reserve_resources; 2647a3d5daSThomas Gleixner x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc; 2747a3d5daSThomas Gleixner 2847a3d5daSThomas Gleixner reserve_ebda_region(); 2947a3d5daSThomas Gleixner } 30a4c81cf6SYinghai Lu 31700efc1bSEric W. Biederman void __init i386_start_kernel(void) 32700efc1bSEric W. Biederman { 33db8f77c8SYinghai Lu #ifdef CONFIG_X86_TRAMPOLINE 34db8f77c8SYinghai Lu /* 35db8f77c8SYinghai Lu * But first pinch a few for the stack/trampoline stuff 36db8f77c8SYinghai Lu * FIXME: Don't need the extra page at 4K, but need to fix 37db8f77c8SYinghai Lu * trampoline before removing it. (see the GDT stuff) 38db8f77c8SYinghai Lu */ 39db8f77c8SYinghai Lu reserve_early_overlap_ok(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, 40db8f77c8SYinghai Lu "EX TRAMPOLINE"); 41db8f77c8SYinghai Lu #endif 42db8f77c8SYinghai Lu 4393dbda7cSJeremy Fitzhardinge reserve_early(__pa_symbol(&_text), __pa_symbol(&__bss_stop), "TEXT DATA BSS"); 44a4c81cf6SYinghai Lu 45a4c81cf6SYinghai Lu #ifdef CONFIG_BLK_DEV_INITRD 46a4c81cf6SYinghai Lu /* Reserve INITRD */ 47a4c81cf6SYinghai Lu if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { 48c967da6aSYinghai Lu /* Assume only end is not page aligned */ 49a4c81cf6SYinghai Lu u64 ramdisk_image = boot_params.hdr.ramdisk_image; 50a4c81cf6SYinghai Lu u64 ramdisk_size = boot_params.hdr.ramdisk_size; 51c967da6aSYinghai Lu u64 ramdisk_end = PAGE_ALIGN(ramdisk_image + ramdisk_size); 52a4c81cf6SYinghai Lu reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); 53a4c81cf6SYinghai Lu } 54a4c81cf6SYinghai Lu #endif 55f7cf5a5bSThomas Gleixner 5647a3d5daSThomas Gleixner /* Call the subarch specific early setup function */ 5747a3d5daSThomas Gleixner switch (boot_params.hdr.hardware_subarch) { 583f4110a4SThomas Gleixner case X86_SUBARCH_MRST: 593f4110a4SThomas Gleixner x86_mrst_early_setup(); 603f4110a4SThomas Gleixner break; 6147a3d5daSThomas Gleixner default: 6247a3d5daSThomas Gleixner i386_default_early_setup(); 6347a3d5daSThomas Gleixner break; 6447a3d5daSThomas Gleixner } 65a4c81cf6SYinghai Lu 66a4c81cf6SYinghai Lu /* 67a4c81cf6SYinghai Lu * At this point everything still needed from the boot loader 68a4c81cf6SYinghai Lu * or BIOS or kernel text should be early reserved or marked not 69a4c81cf6SYinghai Lu * RAM in e820. All other memory is free game. 70a4c81cf6SYinghai Lu */ 71a4c81cf6SYinghai Lu 72700efc1bSEric W. Biederman start_kernel(); 73700efc1bSEric W. Biederman } 74