GIT 7d1d895fd57734a0f8a474b4464b093a693b9bab git+ssh://master.kernel.org/pub/scm/linux/kernel/git/hpa/linux-2.6-x86setup.git commit Author: H. Peter Anvin Date: Mon Jul 23 18:23:47 2007 -0700 lguest: remove use of boot_params macros Remove old-style boot_params macros in lguest. Signed-off-by: H. Peter Anvin commit 249a57ed55b52577a42b801a3cf496d03aa44f59 Author: H. Peter Anvin Date: Wed Jul 18 21:22:10 2007 -0700 [x86] Stop using macros for struct boot_params members Now when struct boot_params is a proper structure, there is no need to use hacky macros to refer to them. Additionally, unify under for both x86 architectures (x86-64 had which was unique to that architecture.) Signed-off-by: H. Peter Anvin commit c5a69f63ac357ca73dca0f0ebc8a06238c235726 Author: H. Peter Anvin Date: Wed Jul 25 11:06:02 2007 -0700 [x86 setup] Make struct apm_bios_info cross-architecture struct apm_bios_info uses "unsigned short" and "unsigned long" to mean u16 and u32 respectively. Correct. Signed-off-by: H. Peter Anvin commit d93157392997e52a11d1d714a33761d54d949ac5 Author: H. Peter Anvin Date: Wed Jul 18 17:19:30 2007 -0700 [x86 setup] Make struct ist_info cross-architecture, and use in setup code Make "struct ist_info" valid on both i386 and x86-64, and use the structure by name in the setup code. Additionally, "Intel SpeedStep IST" is redundant, refer to it as IST consistently. Signed-off-by: H. Peter Anvin commit ad28618a60f15420fa50de13e3d8566c8b536aaf Author: H. Peter Anvin Date: Wed Jul 18 17:16:19 2007 -0700 [x86 setup] Fix typos in struct efi_info Fix missing letters in the structure members of struct efi_info. Signed-off-by: H. Peter Anvin commit 4086bbb2d6a14fd140203e815d0b6a4141642062 Author: H. Peter Anvin Date: Mon Jul 23 15:37:14 2007 -0700 [x86 setup] APM: BX should be zero when disconnecting For APM calls, BX contains the device index, which is zero for the system BIOS. Disconnect requres BX = 0. Signed-off-by: H. Peter Anvin commit 366235c34124102645cb2dd51f6feec058bbdaf9 Author: Mikael Pettersson Date: Tue Jul 24 00:25:59 2007 +0200 [x86 setup] APM detection logic bug fix Starting with kernel 2.6.23-rc1, the i386 APM driver fails on several of my machines with the message: apm: BIOS not found This happens because of a bug in the i386 boot code rewrite from assembler to C. The original assembly code had the following code in its APM BIOS presence test (boot/setup.S): andw $0x02, %cx # Is 32 bit supported? je done_apm_bios # No 32-bit, no (good) APM BIOS That is, the code bails out if bit 2 is zero. In the new C version, this is coded as (boot/apm.c): if (cx & 0x02) /* 32 bits supported? */ return -1; Here we see that the test has been accidentally inverted. The fix is to negate the test. I've verified that this allows the APM driver to work again on my affected machines. Signed-off-by: Mikael Pettersson Signed-off-by: H. Peter Anvin arch/i386/boot/Makefile | 1 + arch/i386/kernel/efi.c | 15 +++++--- arch/i386/kernel/setup.c | 67 ++++++++++++++++++++----------------- arch/i386/mach-default/setup.c | 12 ++++--- arch/i386/mach-visws/setup.c | 2 + arch/i386/mach-voyager/setup.c | 14 ++++---- arch/i386/mm/discontig.c | 5 ++- arch/i386/xen/enlighten.c | 7 ++-- arch/x86_64/kernel/e820.c | 19 +++++++--- arch/x86_64/kernel/early_printk.c | 15 +++----- arch/x86_64/kernel/head64.c | 20 ++--------- arch/x86_64/kernel/setup.c | 51 +++++++++++++++------------- arch/x86_64/kernel/setup64.c | 4 +- drivers/lguest/lguest.c | 6 +++ drivers/video/console/vgacon.c | 2 + include/asm-i386/bootparam.h | 4 ++ include/asm-i386/setup.h | 29 ---------------- include/asm-x86_64/Kbuild | 1 - include/asm-x86_64/bootsetup.h | 40 ---------------------- include/asm-x86_64/setup.h | 13 +++++++ 20 files changed, 143 insertions(+), 184 deletions(-) diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile index 93386a4..0ad10b7 100644 --- a/arch/i386/boot/Makefile +++ b/arch/i386/boot/Makefile @@ -39,6 +39,7 @@ # probed, and video-bios.o should typica setup-y += video-vga.o setup-y += video-vesa.o setup-y += video-bios.o + targets += $(setup-y) hostprogs-y := tools/build diff --git a/arch/i386/kernel/efi.c b/arch/i386/kernel/efi.c index 2452c6f..b42558c 100644 --- a/arch/i386/kernel/efi.c +++ b/arch/i386/kernel/efi.c @@ -331,11 +331,13 @@ void __init efi_init(void) memset(&efi, 0, sizeof(efi) ); memset(&efi_phys, 0, sizeof(efi_phys)); - efi_phys.systab = EFI_SYSTAB; - memmap.phys_map = EFI_MEMMAP; - memmap.nr_map = EFI_MEMMAP_SIZE/EFI_MEMDESC_SIZE; - memmap.desc_version = EFI_MEMDESC_VERSION; - memmap.desc_size = EFI_MEMDESC_SIZE; + efi_phys.systab = + (efi_system_table_t *)boot_params.efi_info.efi_systab; + memmap.phys_map = (void *)boot_params.efi_info.efi_memmap; + memmap.nr_map = boot_params.efi_info.efi_memmap_size/ + boot_params.efi_info.efi_memdesc_size; + memmap.desc_version = boot_params.efi_info.efi_memdesc_version; + memmap.desc_size = boot_params.efi_info.efi_memdesc_size; efi.systab = (efi_system_table_t *) boot_ioremap((unsigned long) efi_phys.systab, @@ -446,7 +448,8 @@ void __init efi_init(void) printk(KERN_ERR PFX "Could not map the runtime service table!\n"); /* Map the EFI memory map for use until paging_init() */ - memmap.map = boot_ioremap((unsigned long) EFI_MEMMAP, EFI_MEMMAP_SIZE); + memmap.map = boot_ioremap(boot_params.efi_info.efi_memmap, + boot_params.efi_info.efi_memmap_size); if (memmap.map == NULL) printk(KERN_ERR PFX "Could not map the EFI memory map!\n"); diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index d474cd6..26189cc 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c @@ -139,10 +139,11 @@ #endif */ static inline void copy_edd(void) { - memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); - memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); - edd.mbr_signature_nr = EDD_MBR_SIG_NR; - edd.edd_info_nr = EDD_NR; + memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, + sizeof(edd.mbr_signature)); + memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); + edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; + edd.edd_info_nr = boot_params.eddbuf_entries; } #else static inline void copy_edd(void) @@ -436,17 +437,20 @@ #ifdef CONFIG_X86_FIND_SMP_CONFIG #endif numa_kva_reserve(); #ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START) { - if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { - reserve_bootmem(INITRD_START, INITRD_SIZE); - initrd_start = INITRD_START + PAGE_OFFSET; - initrd_end = initrd_start+INITRD_SIZE; - } - else { + if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { + unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; + unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; + unsigned long ramdisk_end = ramdisk_image + ramdisk_size; + unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT; + + if (ramdisk_end <= end_of_lowmem) { + reserve_bootmem(ramdisk_image, ramdisk_size); + initrd_start = ramdisk_image + PAGE_OFFSET; + initrd_end = initrd_start+ramdisk_size; + } else { printk(KERN_ERR "initrd extends beyond end of memory " - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - INITRD_START + INITRD_SIZE, - max_low_pfn << PAGE_SHIFT); + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + ramdisk_end, end_of_lowmem); initrd_start = 0; } } @@ -514,28 +518,29 @@ void __init setup_arch(char **cmdline_p) * the system table is valid. If not, then initialize normally. */ #ifdef CONFIG_EFI - if ((LOADER_TYPE == 0x50) && EFI_SYSTAB) + if ((boot_params.hdr.type_of_loader == 0x50) && + boot_params.efi_info.efi_systab) efi_enabled = 1; #endif - ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); - screen_info = SCREEN_INFO; - edid_info = EDID_INFO; - apm_info.bios = APM_BIOS_INFO; - ist_info = IST_INFO; - saved_videomode = VIDEO_MODE; - if( SYS_DESC_TABLE.length != 0 ) { - set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); - machine_id = SYS_DESC_TABLE.table[0]; - machine_submodel_id = SYS_DESC_TABLE.table[1]; - BIOS_revision = SYS_DESC_TABLE.table[2]; + ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); + screen_info = boot_params.screen_info; + edid_info = boot_params.edid_info; + apm_info.bios = boot_params.apm_bios_info; + ist_info = boot_params.ist_info; + saved_videomode = boot_params.hdr.vid_mode; + if( boot_params.sys_desc_table.length != 0 ) { + set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2); + machine_id = boot_params.sys_desc_table.table[0]; + machine_submodel_id = boot_params.sys_desc_table.table[1]; + BIOS_revision = boot_params.sys_desc_table.table[2]; } - bootloader_type = LOADER_TYPE; + bootloader_type = boot_params.hdr.type_of_loader; #ifdef CONFIG_BLK_DEV_RAM - rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; - rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); - rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); + rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; + rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); + rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); #endif ARCH_SETUP if (efi_enabled) @@ -547,7 +552,7 @@ #endif copy_edd(); - if (!MOUNT_ROOT_RDONLY) + if (!boot_params.hdr.root_flags) root_mountflags &= ~MS_RDONLY; init_mm.start_code = (unsigned long) _text; init_mm.end_code = (unsigned long) _etext; diff --git a/arch/i386/mach-default/setup.c b/arch/i386/mach-default/setup.c index 7f635c7..1bd8298 100644 --- a/arch/i386/mach-default/setup.c +++ b/arch/i386/mach-default/setup.c @@ -159,16 +159,18 @@ char * __init machine_specific_memory_se * Otherwise fake a memory map; one section from 0k->640k, * the next section from 1mb->appropriate_mem_k */ - sanitize_e820_map(E820_MAP, &E820_MAP_NR); - if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { + sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries); + if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) + < 0) { unsigned long mem_size; /* compare results from other methods and take the greater */ - if (ALT_MEM_K < EXT_MEM_K) { - mem_size = EXT_MEM_K; + if (boot_params.alt_mem_k + < boot_params.screen_info.ext_mem_k) { + mem_size = boot_params.screen_info.ext_mem_k; who = "BIOS-88"; } else { - mem_size = ALT_MEM_K; + mem_size = boot_params.alt_mem_k; who = "BIOS-e801"; } diff --git a/arch/i386/mach-visws/setup.c b/arch/i386/mach-visws/setup.c index 1f81f10..de4c9db 100644 --- a/arch/i386/mach-visws/setup.c +++ b/arch/i386/mach-visws/setup.c @@ -152,7 +152,7 @@ char * __init machine_specific_memory_se { long long gfx_mem_size = 8 * MB; - mem_size = ALT_MEM_K; + mem_size = boot_params.alt_mem_k; if (!mem_size) { printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n"); diff --git a/arch/i386/mach-voyager/setup.c b/arch/i386/mach-voyager/setup.c index 2b55694..a0ab400 100644 --- a/arch/i386/mach-voyager/setup.c +++ b/arch/i386/mach-voyager/setup.c @@ -83,7 +83,7 @@ char * __init machine_specific_memory_se if(inb(catbase) != VOYAGER_DINO) { printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); - tom = (EXT_MEM_K)<<10; + tom = (boot_params.screen_info.ext_mem_k)<<10; } who = "Voyager-TOM"; add_memory_region(0, 0x9f000, E820_RAM); @@ -104,16 +104,18 @@ char * __init machine_specific_memory_se * Otherwise fake a memory map; one section from 0k->640k, * the next section from 1mb->appropriate_mem_k */ - sanitize_e820_map(E820_MAP, &E820_MAP_NR); - if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { + sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries); + if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) + < 0) { unsigned long mem_size; /* compare results from other methods and take the greater */ - if (ALT_MEM_K < EXT_MEM_K) { - mem_size = EXT_MEM_K; + if (boot_params.alt_mem_k + < boot_params.screen_info.ext_mem_k) { + mem_size = boot_params.screen_info.ext_mem_k; who = "BIOS-88"; } else { - mem_size = ALT_MEM_K; + mem_size = boot_params.alt_mem_k; who = "BIOS-e801"; } diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c index 860e912..b1e4545 100644 --- a/arch/i386/mm/discontig.c +++ b/arch/i386/mm/discontig.c @@ -288,8 +288,9 @@ unsigned long __init setup_memory(void) #ifdef CONFIG_BLK_DEV_INITRD /* Numa kva area is below the initrd */ - if (LOADER_TYPE && INITRD_START) - kva_start_pfn = PFN_DOWN(INITRD_START) - kva_pages; + if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) + kva_start_pfn = PFN_DOWN(boot_params.hdr.ramdisk_image) + - kva_pages; #endif kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1); diff --git a/arch/i386/xen/enlighten.c b/arch/i386/xen/enlighten.c index 9a8c118..d2ea0b4 100644 --- a/arch/i386/xen/enlighten.c +++ b/arch/i386/xen/enlighten.c @@ -1135,9 +1135,10 @@ #endif new_cpu_data.x86_capability[0] = cpuid_edx(1); /* Poke various useful things into boot_params */ - LOADER_TYPE = (9 << 4) | 0; - INITRD_START = xen_start_info->mod_start ? __pa(xen_start_info->mod_start) : 0; - INITRD_SIZE = xen_start_info->mod_len; + boot_params.hdr.type_of_loader = (9 << 4) | 0; + boot_params.hdr.ramdisk_image = xen_start_info->mod_start + ? __pa(xen_start_info->mod_start) : 0; + boot_params.hdr.ramdisk_size = xen_start_info->mod_len; /* Start the world */ start_kernel(); diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c index 0f4d5e2..e422b81 100644 --- a/arch/x86_64/kernel/e820.c +++ b/arch/x86_64/kernel/e820.c @@ -24,7 +24,7 @@ #include #include #include #include -#include +#include #include struct e820map e820; @@ -68,10 +68,15 @@ static inline int bad_addr(unsigned long /* initrd */ #ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START && last >= INITRD_START && - addr < INITRD_START+INITRD_SIZE) { - *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); - return 1; + if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { + unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; + unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; + unsigned long ramdisk_end = ramdisk_image+ramdisk_size; + + if (last >= ramdisk_image && addr < ramdisk_end) { + *addrp = PAGE_ALIGN(ramdisk_end); + return 1; + } } #endif /* kernel code */ @@ -594,8 +599,8 @@ void __init setup_memory_region(void) * Otherwise fake a memory map; one section from 0k->640k, * the next section from 1mb->appropriate_mem_k */ - sanitize_e820_map(E820_MAP, &E820_MAP_NR); - if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) + sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries); + if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) early_panic("Cannot find a valid memory map"); printk(KERN_INFO "BIOS-provided physical RAM map:\n"); e820_print_map("BIOS-e820"); diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c index fd9aff3..b7d6c23 100644 --- a/arch/x86_64/kernel/early_printk.c +++ b/arch/x86_64/kernel/early_printk.c @@ -6,15 +6,10 @@ #include #include #include #include +#include #include /* Simple VGA output */ - -#ifdef __i386__ -#include -#else -#include -#endif #define VGABASE (__ISA_IO_base + 0xb8000) static int max_ypos = 25, max_xpos = 80; @@ -234,10 +229,10 @@ static int __init setup_early_printk(cha early_serial_init(buf); early_console = &early_serial_console; } else if (!strncmp(buf, "vga", 3) - && SCREEN_INFO.orig_video_isVGA == 1) { - max_xpos = SCREEN_INFO.orig_video_cols; - max_ypos = SCREEN_INFO.orig_video_lines; - current_ypos = SCREEN_INFO.orig_y; + && boot_params.screen_info.orig_video_isVGA == 1) { + max_xpos = boot_params.screen_info.orig_video_cols; + max_ypos = boot_params.screen_info.orig_video_lines; + current_ypos = boot_params.screen_info.orig_y; early_console = &early_vga_console; } else if (!strncmp(buf, "simnow", 6)) { simnow_init(buf + 6); diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c index 6c34bdd..3eb5342 100644 --- a/arch/x86_64/kernel/head64.c +++ b/arch/x86_64/kernel/head64.c @@ -14,7 +14,6 @@ #include #include #include #include -#include #include #include #include @@ -36,26 +35,15 @@ static void __init clear_bss(void) (unsigned long) __bss_stop - (unsigned long) __bss_start); } -#define NEW_CL_POINTER 0x228 /* Relative to real mode data */ -#define OLD_CL_MAGIC_ADDR 0x20 -#define OLD_CL_MAGIC 0xA33F -#define OLD_CL_OFFSET 0x22 - static void __init copy_bootdata(char *real_mode_data) { - unsigned long new_data; char * command_line; - memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE); - new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER); - if (!new_data) { - if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) { - return; - } - new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET); + memcpy(&boot_params, real_mode_data, sizeof boot_params); + if (boot_params.hdr.cmd_line_ptr) { + command_line = __va(boot_params.hdr.cmd_line_ptr); + memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); } - command_line = __va(new_data); - memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); } void __init x86_64_start_kernel(char * real_mode_data) diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index af838f6..5b8889e 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c @@ -57,7 +57,6 @@ #include #include #include #include -#include #include #include #include @@ -185,10 +184,11 @@ #endif */ static inline void copy_edd(void) { - memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); - memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); - edd.mbr_signature_nr = EDD_MBR_SIG_NR; - edd.edd_info_nr = EDD_NR; + memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer, + sizeof(edd.mbr_signature)); + memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info)); + edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries; + edd.edd_info_nr = boot_params.eddbuf_entries; } #else static inline void copy_edd(void) @@ -225,21 +225,21 @@ void __init setup_arch(char **cmdline_p) { printk(KERN_INFO "Command line: %s\n", boot_command_line); - ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); - screen_info = SCREEN_INFO; - edid_info = EDID_INFO; - saved_video_mode = SAVED_VIDEO_MODE; - bootloader_type = LOADER_TYPE; + ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev); + screen_info = boot_params.screen_info; + edid_info = boot_params.edid_info; + saved_video_mode = boot_params.hdr.vid_mode; + bootloader_type = boot_params.hdr.type_of_loader; #ifdef CONFIG_BLK_DEV_RAM - rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; - rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); - rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); + rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK; + rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0); + rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0); #endif setup_memory_region(); copy_edd(); - if (!MOUNT_ROOT_RDONLY) + if (!boot_params.hdr.root_flags) root_mountflags &= ~MS_RDONLY; init_mm.start_code = (unsigned long) &_text; init_mm.end_code = (unsigned long) &_etext; @@ -344,17 +344,20 @@ #endif */ find_smp_config(); #ifdef CONFIG_BLK_DEV_INITRD - if (LOADER_TYPE && INITRD_START) { - if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { - reserve_bootmem_generic(INITRD_START, INITRD_SIZE); - initrd_start = INITRD_START + PAGE_OFFSET; - initrd_end = initrd_start+INITRD_SIZE; - } - else { + if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) { + unsigned long ramdisk_image = boot_params.hdr.ramdisk_image; + unsigned long ramdisk_size = boot_params.hdr.ramdisk_size; + unsigned long ramdisk_end = ramdisk_image + ramdisk_size; + unsigned long end_of_mem = end_pfn << PAGE_SHIFT; + + if (ramdisk_end <= end_of_mem) { + reserve_bootmem_generic(ramdisk_image, ramdisk_size); + initrd_start = ramdisk_image + PAGE_OFFSET; + initrd_end = initrd_start+ramdisk_size; + } else { printk(KERN_ERR "initrd extends beyond end of memory " - "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - (unsigned long)(INITRD_START + INITRD_SIZE), - (unsigned long)(end_pfn << PAGE_SHIFT)); + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + ramdisk_end, end_of_mem); initrd_start = 0; } } diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 1200aaa..ba91882 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c @@ -11,7 +11,6 @@ #include #include #include #include -#include #include #include #include @@ -23,8 +22,9 @@ #include #include #include #include +#include -char x86_boot_params[BOOT_PARAM_SIZE] __initdata; +struct boot_params __initdata boot_params; cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c index 1bc1546..5a2c1bd 100644 --- a/drivers/lguest/lguest.c +++ b/drivers/lguest/lguest.c @@ -888,11 +888,17 @@ static __init char *lguest_memory_setup( * before start_kernel() */ atomic_notifier_chain_register(&panic_notifier_list, &paniced); +<<<<<<< HEAD/drivers/lguest/lguest.c /* The Linux bootloader header contains an "e820" memory map: the * Launcher populated the first entry with our memory limit. */ add_memory_region(E820_MAP->addr, E820_MAP->size, E820_MAP->type); /* This string is for the boot messages. */ +======= + add_memory_region(boot_params.e820_map[0].addr, + boot_params.e820_map[0].size, + boot_params.e820_map[0].type); +>>>>>>> /drivers/lguest/lguest.c return "LGUEST"; } diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index d18b73a..904bb24 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c @@ -372,7 +372,7 @@ #else #endif } - /* SCREEN_INFO initialized? */ + /* boot_params.screen_info initialized? */ if ((ORIG_VIDEO_MODE == 0) && (ORIG_VIDEO_LINES == 0) && (ORIG_VIDEO_COLS == 0)) diff --git a/include/asm-i386/bootparam.h b/include/asm-i386/bootparam.h index b91b017..cc86888 100644 --- a/include/asm-i386/bootparam.h +++ b/include/asm-i386/bootparam.h @@ -40,6 +40,10 @@ #define CAN_USE_HEAP 0x80 u8 relocatable_kernel; } __attribute__((packed)); +#define RAMDISK_IMAGE_START_MASK 0x07FF +#define RAMDISK_PROMPT_FLAG 0x8000 +#define RAMDISK_LOAD_FLAG 0x4000 + struct sys_desc_table { u16 length; u8 table[14]; diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h index 7862fe8..7a57ca8 100644 --- a/include/asm-i386/setup.h +++ b/include/asm-i386/setup.h @@ -34,35 +34,6 @@ #include */ extern struct boot_params boot_params; -#define PARAM ((char *)&boot_params) -#define SCREEN_INFO (*(struct screen_info *) (PARAM+0)) -#define EXT_MEM_K (*(unsigned short *) (PARAM+2)) -#define ALT_MEM_K (*(unsigned long *) (PARAM+0x1e0)) -#define E820_MAP_NR (*(char*) (PARAM+E820NR)) -#define E820_MAP ((struct e820entry *) (PARAM+E820MAP)) -#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40)) -#define IST_INFO (*(struct ist_info *) (PARAM+0x60)) -#define SYS_DESC_TABLE (*(struct sys_desc_table *)(PARAM+0xa0)) -#define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4))) -#define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8))) -#define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc))) -#define EFI_MEMMAP ((void *) *((unsigned long *)(PARAM+0x1d0))) -#define EFI_MEMMAP_SIZE (*((unsigned long *) (PARAM+0x1d4))) -#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2)) -#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8)) -#define VIDEO_MODE (*(unsigned short *) (PARAM+0x1FA)) -#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC)) -#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF)) -#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210)) -#define KERNEL_START (*(unsigned long *) (PARAM+0x214)) -#define INITRD_START (*(unsigned long *) (PARAM+0x218)) -#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c)) -#define EDID_INFO (*(struct edid_info *) (PARAM+0x140)) -#define EDD_NR (*(unsigned char *) (PARAM+EDDNR)) -#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF)) -#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) -#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) - /* * Do NOT EVER look at the BIOS memory size location. * It does not work on many machines. diff --git a/include/asm-x86_64/Kbuild b/include/asm-x86_64/Kbuild index 75a2def..f7b452c 100644 --- a/include/asm-x86_64/Kbuild +++ b/include/asm-x86_64/Kbuild @@ -5,7 +5,6 @@ ARCHDEF := defined __x86_64__ ALTARCHDEF := defined __i386__ header-y += boot.h -header-y += bootsetup.h header-y += debugreg.h header-y += ldt.h header-y += msr-index.h diff --git a/include/asm-x86_64/bootsetup.h b/include/asm-x86_64/bootsetup.h deleted file mode 100644 index 7b1c3ad..0000000 --- a/include/asm-x86_64/bootsetup.h +++ /dev/null @@ -1,40 +0,0 @@ - -#ifndef _X86_64_BOOTSETUP_H -#define _X86_64_BOOTSETUP_H 1 - -#define BOOT_PARAM_SIZE 4096 -extern char x86_boot_params[BOOT_PARAM_SIZE]; - -/* - * This is set up by the setup-routine at boot-time - */ -#define PARAM ((unsigned char *)x86_boot_params) -#define SCREEN_INFO (*(struct screen_info *) (PARAM+0)) -#define EXT_MEM_K (*(unsigned short *) (PARAM+2)) -#define ALT_MEM_K (*(unsigned int *) (PARAM+0x1e0)) -#define E820_MAP_NR (*(char*) (PARAM+E820NR)) -#define E820_MAP ((struct e820entry *) (PARAM+E820MAP)) -#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40)) -#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80)) -#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0)) -#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2)) -#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8)) -#define SAVED_VIDEO_MODE (*(unsigned short *) (PARAM+0x1FA)) -#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC)) -#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF)) -#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210)) -#define KERNEL_START (*(unsigned int *) (PARAM+0x214)) -#define INITRD_START (*(unsigned int *) (PARAM+0x218)) -#define INITRD_SIZE (*(unsigned int *) (PARAM+0x21c)) -#define EDID_INFO (*(struct edid_info *) (PARAM+0x140)) -#define EDD_NR (*(unsigned char *) (PARAM+EDDNR)) -#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF)) -#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) -#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) -#define COMMAND_LINE boot_command_line - -#define RAMDISK_IMAGE_START_MASK 0x07FF -#define RAMDISK_PROMPT_FLAG 0x8000 -#define RAMDISK_LOAD_FLAG 0x4000 - -#endif diff --git a/include/asm-x86_64/setup.h b/include/asm-x86_64/setup.h index eaeff73..a04aadc 100644 --- a/include/asm-x86_64/setup.h +++ b/include/asm-x86_64/setup.h @@ -3,4 +3,17 @@ #define _x8664_SETUP_H #define COMMAND_LINE_SIZE 2048 +#ifdef __KERNEL__ + +#ifndef __ASSEMBLY__ +#include + +/* + * This is set up by the setup-routine at boot-time + */ +extern struct boot_params boot_params; + +#endif /* not __ASSEMBLY__ */ +#endif /* __KERNEL__ */ + #endif