aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-15 20:13:22 -0400
committerH. Peter Anvin <hpa@zytor.com>2007-10-16 20:38:31 -0400
commit30c826451d3e5bbc6e11bba0e7fee5d2f49d9b75 (patch)
tree61abd11d1703673ff21227d42ed4b07d85dd0290
parent2b0460b534f383eca744eb8fff66ec9f57e702b9 (diff)
[x86] remove uses of magic macros for boot_params access
Instead of using magic macros for boot_params access, simply use the boot_params structure. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--arch/x86/boot/Makefile1
-rw-r--r--arch/x86/kernel/e820_64.c19
-rw-r--r--arch/x86/kernel/early_printk.c15
-rw-r--r--arch/x86/kernel/efi_32.c15
-rw-r--r--arch/x86/kernel/head64.c20
-rw-r--r--arch/x86/kernel/setup64.c4
-rw-r--r--arch/x86/kernel/setup_32.c67
-rw-r--r--arch/x86/kernel/setup_64.c51
-rw-r--r--arch/x86/mach-default/setup.c12
-rw-r--r--arch/x86/mach-visws/setup.c2
-rw-r--r--arch/x86/mach-voyager/setup.c14
-rw-r--r--arch/x86/mm/discontig_32.c5
-rw-r--r--arch/x86/xen/enlighten.c7
-rw-r--r--drivers/lguest/lguest.c4
-rw-r--r--drivers/video/console/vgacon.c2
-rw-r--r--include/asm-x86/Kbuild1
-rw-r--r--include/asm-x86/bootparam.h3
-rw-r--r--include/asm-x86/bootsetup.h40
-rw-r--r--include/asm-x86/setup_32.h29
-rw-r--r--include/asm-x86/setup_64.h13
20 files changed, 139 insertions, 185 deletions
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index e8756e5f6b29..89dbf970e058 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -39,6 +39,7 @@ setup-y += printf.o string.o tty.o video.o version.o voyager.o
39setup-y += video-vga.o 39setup-y += video-vga.o
40setup-y += video-vesa.o 40setup-y += video-vesa.o
41setup-y += video-bios.o 41setup-y += video-bios.o
42
42targets += $(setup-y) 43targets += $(setup-y)
43hostprogs-y := tools/build 44hostprogs-y := tools/build
44 45
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 0f4d5e209e9b..e422b8159f69 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -24,7 +24,7 @@
24#include <asm/page.h> 24#include <asm/page.h>
25#include <asm/e820.h> 25#include <asm/e820.h>
26#include <asm/proto.h> 26#include <asm/proto.h>
27#include <asm/bootsetup.h> 27#include <asm/setup.h>
28#include <asm/sections.h> 28#include <asm/sections.h>
29 29
30struct e820map e820; 30struct e820map e820;
@@ -68,10 +68,15 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
68 68
69 /* initrd */ 69 /* initrd */
70#ifdef CONFIG_BLK_DEV_INITRD 70#ifdef CONFIG_BLK_DEV_INITRD
71 if (LOADER_TYPE && INITRD_START && last >= INITRD_START && 71 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
72 addr < INITRD_START+INITRD_SIZE) { 72 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
73 *addrp = PAGE_ALIGN(INITRD_START + INITRD_SIZE); 73 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
74 return 1; 74 unsigned long ramdisk_end = ramdisk_image+ramdisk_size;
75
76 if (last >= ramdisk_image && addr < ramdisk_end) {
77 *addrp = PAGE_ALIGN(ramdisk_end);
78 return 1;
79 }
75 } 80 }
76#endif 81#endif
77 /* kernel code */ 82 /* kernel code */
@@ -594,8 +599,8 @@ void __init setup_memory_region(void)
594 * Otherwise fake a memory map; one section from 0k->640k, 599 * Otherwise fake a memory map; one section from 0k->640k,
595 * the next section from 1mb->appropriate_mem_k 600 * the next section from 1mb->appropriate_mem_k
596 */ 601 */
597 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 602 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
598 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) 603 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0)
599 early_panic("Cannot find a valid memory map"); 604 early_panic("Cannot find a valid memory map");
600 printk(KERN_INFO "BIOS-provided physical RAM map:\n"); 605 printk(KERN_INFO "BIOS-provided physical RAM map:\n");
601 e820_print_map("BIOS-e820"); 606 e820_print_map("BIOS-e820");
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c
index fd9aff3f3890..b7d6c23f2871 100644
--- a/arch/x86/kernel/early_printk.c
+++ b/arch/x86/kernel/early_printk.c
@@ -6,15 +6,10 @@
6#include <asm/io.h> 6#include <asm/io.h>
7#include <asm/processor.h> 7#include <asm/processor.h>
8#include <asm/fcntl.h> 8#include <asm/fcntl.h>
9#include <asm/setup.h>
9#include <xen/hvc-console.h> 10#include <xen/hvc-console.h>
10 11
11/* Simple VGA output */ 12/* Simple VGA output */
12
13#ifdef __i386__
14#include <asm/setup.h>
15#else
16#include <asm/bootsetup.h>
17#endif
18#define VGABASE (__ISA_IO_base + 0xb8000) 13#define VGABASE (__ISA_IO_base + 0xb8000)
19 14
20static int max_ypos = 25, max_xpos = 80; 15static int max_ypos = 25, max_xpos = 80;
@@ -234,10 +229,10 @@ static int __init setup_early_printk(char *buf)
234 early_serial_init(buf); 229 early_serial_init(buf);
235 early_console = &early_serial_console; 230 early_console = &early_serial_console;
236 } else if (!strncmp(buf, "vga", 3) 231 } else if (!strncmp(buf, "vga", 3)
237 && SCREEN_INFO.orig_video_isVGA == 1) { 232 && boot_params.screen_info.orig_video_isVGA == 1) {
238 max_xpos = SCREEN_INFO.orig_video_cols; 233 max_xpos = boot_params.screen_info.orig_video_cols;
239 max_ypos = SCREEN_INFO.orig_video_lines; 234 max_ypos = boot_params.screen_info.orig_video_lines;
240 current_ypos = SCREEN_INFO.orig_y; 235 current_ypos = boot_params.screen_info.orig_y;
241 early_console = &early_vga_console; 236 early_console = &early_vga_console;
242 } else if (!strncmp(buf, "simnow", 6)) { 237 } else if (!strncmp(buf, "simnow", 6)) {
243 simnow_init(buf + 6); 238 simnow_init(buf + 6);
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/kernel/efi_32.c
index 2452c6fbe992..b42558c48e9d 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/kernel/efi_32.c
@@ -331,11 +331,13 @@ void __init efi_init(void)
331 memset(&efi, 0, sizeof(efi) ); 331 memset(&efi, 0, sizeof(efi) );
332 memset(&efi_phys, 0, sizeof(efi_phys)); 332 memset(&efi_phys, 0, sizeof(efi_phys));
333 333
334 efi_phys.systab = EFI_SYSTAB; 334 efi_phys.systab =
335 memmap.phys_map = EFI_MEMMAP; 335 (efi_system_table_t *)boot_params.efi_info.efi_systab;
336 memmap.nr_map = EFI_MEMMAP_SIZE/EFI_MEMDESC_SIZE; 336 memmap.phys_map = (void *)boot_params.efi_info.efi_memmap;
337 memmap.desc_version = EFI_MEMDESC_VERSION; 337 memmap.nr_map = boot_params.efi_info.efi_memmap_size/
338 memmap.desc_size = EFI_MEMDESC_SIZE; 338 boot_params.efi_info.efi_memdesc_size;
339 memmap.desc_version = boot_params.efi_info.efi_memdesc_version;
340 memmap.desc_size = boot_params.efi_info.efi_memdesc_size;
339 341
340 efi.systab = (efi_system_table_t *) 342 efi.systab = (efi_system_table_t *)
341 boot_ioremap((unsigned long) efi_phys.systab, 343 boot_ioremap((unsigned long) efi_phys.systab,
@@ -446,7 +448,8 @@ void __init efi_init(void)
446 printk(KERN_ERR PFX "Could not map the runtime service table!\n"); 448 printk(KERN_ERR PFX "Could not map the runtime service table!\n");
447 449
448 /* Map the EFI memory map for use until paging_init() */ 450 /* Map the EFI memory map for use until paging_init() */
449 memmap.map = boot_ioremap((unsigned long) EFI_MEMMAP, EFI_MEMMAP_SIZE); 451 memmap.map = boot_ioremap(boot_params.efi_info.efi_memmap,
452 boot_params.efi_info.efi_memmap_size);
450 if (memmap.map == NULL) 453 if (memmap.map == NULL)
451 printk(KERN_ERR PFX "Could not map the EFI memory map!\n"); 454 printk(KERN_ERR PFX "Could not map the EFI memory map!\n");
452 455
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 8561f626edad..a7eee0a4751d 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -14,7 +14,6 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/proto.h> 15#include <asm/proto.h>
16#include <asm/smp.h> 16#include <asm/smp.h>
17#include <asm/bootsetup.h>
18#include <asm/setup.h> 17#include <asm/setup.h>
19#include <asm/desc.h> 18#include <asm/desc.h>
20#include <asm/pgtable.h> 19#include <asm/pgtable.h>
@@ -36,26 +35,15 @@ static void __init clear_bss(void)
36 (unsigned long) __bss_stop - (unsigned long) __bss_start); 35 (unsigned long) __bss_stop - (unsigned long) __bss_start);
37} 36}
38 37
39#define NEW_CL_POINTER 0x228 /* Relative to real mode data */
40#define OLD_CL_MAGIC_ADDR 0x20
41#define OLD_CL_MAGIC 0xA33F
42#define OLD_CL_OFFSET 0x22
43
44static void __init copy_bootdata(char *real_mode_data) 38static void __init copy_bootdata(char *real_mode_data)
45{ 39{
46 unsigned long new_data;
47 char * command_line; 40 char * command_line;
48 41
49 memcpy(x86_boot_params, real_mode_data, BOOT_PARAM_SIZE); 42 memcpy(&boot_params, real_mode_data, sizeof boot_params);
50 new_data = *(u32 *) (x86_boot_params + NEW_CL_POINTER); 43 if (boot_params.hdr.cmd_line_ptr) {
51 if (!new_data) { 44 command_line = __va(boot_params.hdr.cmd_line_ptr);
52 if (OLD_CL_MAGIC != *(u16 *)(real_mode_data + OLD_CL_MAGIC_ADDR)) { 45 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
53 return;
54 }
55 new_data = __pa(real_mode_data) + *(u16 *)(real_mode_data + OLD_CL_OFFSET);
56 } 46 }
57 command_line = __va(new_data);
58 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
59} 47}
60 48
61void __init x86_64_start_kernel(char * real_mode_data) 49void __init x86_64_start_kernel(char * real_mode_data)
diff --git a/arch/x86/kernel/setup64.c b/arch/x86/kernel/setup64.c
index 1200aaac403e..ba9188235057 100644
--- a/arch/x86/kernel/setup64.c
+++ b/arch/x86/kernel/setup64.c
@@ -11,7 +11,6 @@
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12#include <linux/bitops.h> 12#include <linux/bitops.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <asm/bootsetup.h>
15#include <asm/pda.h> 14#include <asm/pda.h>
16#include <asm/pgtable.h> 15#include <asm/pgtable.h>
17#include <asm/processor.h> 16#include <asm/processor.h>
@@ -23,8 +22,9 @@
23#include <asm/percpu.h> 22#include <asm/percpu.h>
24#include <asm/proto.h> 23#include <asm/proto.h>
25#include <asm/sections.h> 24#include <asm/sections.h>
25#include <asm/setup.h>
26 26
27char x86_boot_params[BOOT_PARAM_SIZE] __initdata; 27struct boot_params __initdata boot_params;
28 28
29cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; 29cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
30 30
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index c8e1bc38d421..b87a6fd5ba48 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -137,10 +137,11 @@ EXPORT_SYMBOL(edd);
137 */ 137 */
138static inline void copy_edd(void) 138static inline void copy_edd(void)
139{ 139{
140 memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); 140 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
141 memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); 141 sizeof(edd.mbr_signature));
142 edd.mbr_signature_nr = EDD_MBR_SIG_NR; 142 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
143 edd.edd_info_nr = EDD_NR; 143 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
144 edd.edd_info_nr = boot_params.eddbuf_entries;
144} 145}
145#else 146#else
146static inline void copy_edd(void) 147static inline void copy_edd(void)
@@ -434,17 +435,20 @@ void __init setup_bootmem_allocator(void)
434#endif 435#endif
435 numa_kva_reserve(); 436 numa_kva_reserve();
436#ifdef CONFIG_BLK_DEV_INITRD 437#ifdef CONFIG_BLK_DEV_INITRD
437 if (LOADER_TYPE && INITRD_START) { 438 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
438 if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) { 439 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
439 reserve_bootmem(INITRD_START, INITRD_SIZE); 440 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
440 initrd_start = INITRD_START + PAGE_OFFSET; 441 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
441 initrd_end = initrd_start+INITRD_SIZE; 442 unsigned long end_of_lowmem = max_low_pfn << PAGE_SHIFT;
442 } 443
443 else { 444 if (ramdisk_end <= end_of_lowmem) {
445 reserve_bootmem(ramdisk_image, ramdisk_size);
446 initrd_start = ramdisk_image + PAGE_OFFSET;
447 initrd_end = initrd_start+ramdisk_size;
448 } else {
444 printk(KERN_ERR "initrd extends beyond end of memory " 449 printk(KERN_ERR "initrd extends beyond end of memory "
445 "(0x%08lx > 0x%08lx)\ndisabling initrd\n", 450 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
446 INITRD_START + INITRD_SIZE, 451 ramdisk_end, end_of_lowmem);
447 max_low_pfn << PAGE_SHIFT);
448 initrd_start = 0; 452 initrd_start = 0;
449 } 453 }
450 } 454 }
@@ -512,28 +516,29 @@ void __init setup_arch(char **cmdline_p)
512 * the system table is valid. If not, then initialize normally. 516 * the system table is valid. If not, then initialize normally.
513 */ 517 */
514#ifdef CONFIG_EFI 518#ifdef CONFIG_EFI
515 if ((LOADER_TYPE == 0x50) && EFI_SYSTAB) 519 if ((boot_params.hdr.type_of_loader == 0x50) &&
520 boot_params.efi_info.efi_systab)
516 efi_enabled = 1; 521 efi_enabled = 1;
517#endif 522#endif
518 523
519 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 524 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
520 screen_info = SCREEN_INFO; 525 screen_info = boot_params.screen_info;
521 edid_info = EDID_INFO; 526 edid_info = boot_params.edid_info;
522 apm_info.bios = APM_BIOS_INFO; 527 apm_info.bios = boot_params.apm_bios_info;
523 ist_info = IST_INFO; 528 ist_info = boot_params.ist_info;
524 saved_videomode = VIDEO_MODE; 529 saved_videomode = boot_params.hdr.vid_mode;
525 if( SYS_DESC_TABLE.length != 0 ) { 530 if( boot_params.sys_desc_table.length != 0 ) {
526 set_mca_bus(SYS_DESC_TABLE.table[3] & 0x2); 531 set_mca_bus(boot_params.sys_desc_table.table[3] & 0x2);
527 machine_id = SYS_DESC_TABLE.table[0]; 532 machine_id = boot_params.sys_desc_table.table[0];
528 machine_submodel_id = SYS_DESC_TABLE.table[1]; 533 machine_submodel_id = boot_params.sys_desc_table.table[1];
529 BIOS_revision = SYS_DESC_TABLE.table[2]; 534 BIOS_revision = boot_params.sys_desc_table.table[2];
530 } 535 }
531 bootloader_type = LOADER_TYPE; 536 bootloader_type = boot_params.hdr.type_of_loader;
532 537
533#ifdef CONFIG_BLK_DEV_RAM 538#ifdef CONFIG_BLK_DEV_RAM
534 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; 539 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
535 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); 540 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
536 rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); 541 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
537#endif 542#endif
538 ARCH_SETUP 543 ARCH_SETUP
539 if (efi_enabled) 544 if (efi_enabled)
@@ -545,7 +550,7 @@ void __init setup_arch(char **cmdline_p)
545 550
546 copy_edd(); 551 copy_edd();
547 552
548 if (!MOUNT_ROOT_RDONLY) 553 if (!boot_params.hdr.root_flags)
549 root_mountflags &= ~MS_RDONLY; 554 root_mountflags &= ~MS_RDONLY;
550 init_mm.start_code = (unsigned long) _text; 555 init_mm.start_code = (unsigned long) _text;
551 init_mm.end_code = (unsigned long) _etext; 556 init_mm.end_code = (unsigned long) _etext;
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 85b5b6310acc..8159bf0be17a 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -52,7 +52,6 @@
52#include <asm/dma.h> 52#include <asm/dma.h>
53#include <asm/mpspec.h> 53#include <asm/mpspec.h>
54#include <asm/mmu_context.h> 54#include <asm/mmu_context.h>
55#include <asm/bootsetup.h>
56#include <asm/proto.h> 55#include <asm/proto.h>
57#include <asm/setup.h> 56#include <asm/setup.h>
58#include <asm/mach_apic.h> 57#include <asm/mach_apic.h>
@@ -180,10 +179,11 @@ EXPORT_SYMBOL(edd);
180 */ 179 */
181static inline void copy_edd(void) 180static inline void copy_edd(void)
182{ 181{
183 memcpy(edd.mbr_signature, EDD_MBR_SIGNATURE, sizeof(edd.mbr_signature)); 182 memcpy(edd.mbr_signature, boot_params.edd_mbr_sig_buffer,
184 memcpy(edd.edd_info, EDD_BUF, sizeof(edd.edd_info)); 183 sizeof(edd.mbr_signature));
185 edd.mbr_signature_nr = EDD_MBR_SIG_NR; 184 memcpy(edd.edd_info, boot_params.eddbuf, sizeof(edd.edd_info));
186 edd.edd_info_nr = EDD_NR; 185 edd.mbr_signature_nr = boot_params.edd_mbr_sig_buf_entries;
186 edd.edd_info_nr = boot_params.eddbuf_entries;
187} 187}
188#else 188#else
189static inline void copy_edd(void) 189static inline void copy_edd(void)
@@ -220,21 +220,21 @@ void __init setup_arch(char **cmdline_p)
220{ 220{
221 printk(KERN_INFO "Command line: %s\n", boot_command_line); 221 printk(KERN_INFO "Command line: %s\n", boot_command_line);
222 222
223 ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV); 223 ROOT_DEV = old_decode_dev(boot_params.hdr.root_dev);
224 screen_info = SCREEN_INFO; 224 screen_info = boot_params.screen_info;
225 edid_info = EDID_INFO; 225 edid_info = boot_params.edid_info;
226 saved_video_mode = SAVED_VIDEO_MODE; 226 saved_video_mode = boot_params.hdr.vid_mode;
227 bootloader_type = LOADER_TYPE; 227 bootloader_type = boot_params.hdr.type_of_loader;
228 228
229#ifdef CONFIG_BLK_DEV_RAM 229#ifdef CONFIG_BLK_DEV_RAM
230 rd_image_start = RAMDISK_FLAGS & RAMDISK_IMAGE_START_MASK; 230 rd_image_start = boot_params.hdr.ram_size & RAMDISK_IMAGE_START_MASK;
231 rd_prompt = ((RAMDISK_FLAGS & RAMDISK_PROMPT_FLAG) != 0); 231 rd_prompt = ((boot_params.hdr.ram_size & RAMDISK_PROMPT_FLAG) != 0);
232 rd_doload = ((RAMDISK_FLAGS & RAMDISK_LOAD_FLAG) != 0); 232 rd_doload = ((boot_params.hdr.ram_size & RAMDISK_LOAD_FLAG) != 0);
233#endif 233#endif
234 setup_memory_region(); 234 setup_memory_region();
235 copy_edd(); 235 copy_edd();
236 236
237 if (!MOUNT_ROOT_RDONLY) 237 if (!boot_params.hdr.root_flags)
238 root_mountflags &= ~MS_RDONLY; 238 root_mountflags &= ~MS_RDONLY;
239 init_mm.start_code = (unsigned long) &_text; 239 init_mm.start_code = (unsigned long) &_text;
240 init_mm.end_code = (unsigned long) &_etext; 240 init_mm.end_code = (unsigned long) &_etext;
@@ -339,17 +339,20 @@ void __init setup_arch(char **cmdline_p)
339 */ 339 */
340 find_smp_config(); 340 find_smp_config();
341#ifdef CONFIG_BLK_DEV_INITRD 341#ifdef CONFIG_BLK_DEV_INITRD
342 if (LOADER_TYPE && INITRD_START) { 342 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
343 if (INITRD_START + INITRD_SIZE <= (end_pfn << PAGE_SHIFT)) { 343 unsigned long ramdisk_image = boot_params.hdr.ramdisk_image;
344 reserve_bootmem_generic(INITRD_START, INITRD_SIZE); 344 unsigned long ramdisk_size = boot_params.hdr.ramdisk_size;
345 initrd_start = INITRD_START + PAGE_OFFSET; 345 unsigned long ramdisk_end = ramdisk_image + ramdisk_size;
346 initrd_end = initrd_start+INITRD_SIZE; 346 unsigned long end_of_mem = end_pfn << PAGE_SHIFT;
347 } 347
348 else { 348 if (ramdisk_end <= end_of_mem) {
349 reserve_bootmem_generic(ramdisk_image, ramdisk_size);
350 initrd_start = ramdisk_image + PAGE_OFFSET;
351 initrd_end = initrd_start+ramdisk_size;
352 } else {
349 printk(KERN_ERR "initrd extends beyond end of memory " 353 printk(KERN_ERR "initrd extends beyond end of memory "
350 "(0x%08lx > 0x%08lx)\ndisabling initrd\n", 354 "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
351 (unsigned long)(INITRD_START + INITRD_SIZE), 355 ramdisk_end, end_of_mem);
352 (unsigned long)(end_pfn << PAGE_SHIFT));
353 initrd_start = 0; 356 initrd_start = 0;
354 } 357 }
355 } 358 }
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c
index 7f635c7a2381..1bd82983986d 100644
--- a/arch/x86/mach-default/setup.c
+++ b/arch/x86/mach-default/setup.c
@@ -159,16 +159,18 @@ char * __init machine_specific_memory_setup(void)
159 * Otherwise fake a memory map; one section from 0k->640k, 159 * Otherwise fake a memory map; one section from 0k->640k,
160 * the next section from 1mb->appropriate_mem_k 160 * the next section from 1mb->appropriate_mem_k
161 */ 161 */
162 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 162 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
163 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { 163 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
164 < 0) {
164 unsigned long mem_size; 165 unsigned long mem_size;
165 166
166 /* compare results from other methods and take the greater */ 167 /* compare results from other methods and take the greater */
167 if (ALT_MEM_K < EXT_MEM_K) { 168 if (boot_params.alt_mem_k
168 mem_size = EXT_MEM_K; 169 < boot_params.screen_info.ext_mem_k) {
170 mem_size = boot_params.screen_info.ext_mem_k;
169 who = "BIOS-88"; 171 who = "BIOS-88";
170 } else { 172 } else {
171 mem_size = ALT_MEM_K; 173 mem_size = boot_params.alt_mem_k;
172 who = "BIOS-e801"; 174 who = "BIOS-e801";
173 } 175 }
174 176
diff --git a/arch/x86/mach-visws/setup.c b/arch/x86/mach-visws/setup.c
index 1f81f10e03a0..de4c9dbd086f 100644
--- a/arch/x86/mach-visws/setup.c
+++ b/arch/x86/mach-visws/setup.c
@@ -152,7 +152,7 @@ char * __init machine_specific_memory_setup(void)
152{ 152{
153 long long gfx_mem_size = 8 * MB; 153 long long gfx_mem_size = 8 * MB;
154 154
155 mem_size = ALT_MEM_K; 155 mem_size = boot_params.alt_mem_k;
156 156
157 if (!mem_size) { 157 if (!mem_size) {
158 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n"); 158 printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n");
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index 2b55694e6400..a0ab4002abcd 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -83,7 +83,7 @@ char * __init machine_specific_memory_setup(void)
83 83
84 if(inb(catbase) != VOYAGER_DINO) { 84 if(inb(catbase) != VOYAGER_DINO) {
85 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); 85 printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
86 tom = (EXT_MEM_K)<<10; 86 tom = (boot_params.screen_info.ext_mem_k)<<10;
87 } 87 }
88 who = "Voyager-TOM"; 88 who = "Voyager-TOM";
89 add_memory_region(0, 0x9f000, E820_RAM); 89 add_memory_region(0, 0x9f000, E820_RAM);
@@ -104,16 +104,18 @@ char * __init machine_specific_memory_setup(void)
104 * Otherwise fake a memory map; one section from 0k->640k, 104 * Otherwise fake a memory map; one section from 0k->640k,
105 * the next section from 1mb->appropriate_mem_k 105 * the next section from 1mb->appropriate_mem_k
106 */ 106 */
107 sanitize_e820_map(E820_MAP, &E820_MAP_NR); 107 sanitize_e820_map(boot_params.e820_map, &boot_params.e820_entries);
108 if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { 108 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
109 < 0) {
109 unsigned long mem_size; 110 unsigned long mem_size;
110 111
111 /* compare results from other methods and take the greater */ 112 /* compare results from other methods and take the greater */
112 if (ALT_MEM_K < EXT_MEM_K) { 113 if (boot_params.alt_mem_k
113 mem_size = EXT_MEM_K; 114 < boot_params.screen_info.ext_mem_k) {
115 mem_size = boot_params.screen_info.ext_mem_k;
114 who = "BIOS-88"; 116 who = "BIOS-88";
115 } else { 117 } else {
116 mem_size = ALT_MEM_K; 118 mem_size = boot_params.alt_mem_k;
117 who = "BIOS-e801"; 119 who = "BIOS-e801";
118 } 120 }
119 121
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c
index 860e912a3fbb..b1e45457d4ef 100644
--- a/arch/x86/mm/discontig_32.c
+++ b/arch/x86/mm/discontig_32.c
@@ -288,8 +288,9 @@ unsigned long __init setup_memory(void)
288 288
289#ifdef CONFIG_BLK_DEV_INITRD 289#ifdef CONFIG_BLK_DEV_INITRD
290 /* Numa kva area is below the initrd */ 290 /* Numa kva area is below the initrd */
291 if (LOADER_TYPE && INITRD_START) 291 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image)
292 kva_start_pfn = PFN_DOWN(INITRD_START) - kva_pages; 292 kva_start_pfn = PFN_DOWN(boot_params.hdr.ramdisk_image)
293 - kva_pages;
293#endif 294#endif
294 kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1); 295 kva_start_pfn -= kva_start_pfn & (PTRS_PER_PTE-1);
295 296
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f01bfcd4bdee..493a083f6886 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -1137,9 +1137,10 @@ asmlinkage void __init xen_start_kernel(void)
1137 new_cpu_data.x86_capability[0] = cpuid_edx(1); 1137 new_cpu_data.x86_capability[0] = cpuid_edx(1);
1138 1138
1139 /* Poke various useful things into boot_params */ 1139 /* Poke various useful things into boot_params */
1140 LOADER_TYPE = (9 << 4) | 0; 1140 boot_params.hdr.type_of_loader = (9 << 4) | 0;
1141 INITRD_START = xen_start_info->mod_start ? __pa(xen_start_info->mod_start) : 0; 1141 boot_params.hdr.ramdisk_image = xen_start_info->mod_start
1142 INITRD_SIZE = xen_start_info->mod_len; 1142 ? __pa(xen_start_info->mod_start) : 0;
1143 boot_params.hdr.ramdisk_size = xen_start_info->mod_len;
1143 1144
1144 /* Start the world */ 1145 /* Start the world */
1145 start_kernel(); 1146 start_kernel();
diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c
index ee1c6d05c3d3..4a579c840301 100644
--- a/drivers/lguest/lguest.c
+++ b/drivers/lguest/lguest.c
@@ -893,7 +893,9 @@ static __init char *lguest_memory_setup(void)
893 893
894 /* The Linux bootloader header contains an "e820" memory map: the 894 /* The Linux bootloader header contains an "e820" memory map: the
895 * Launcher populated the first entry with our memory limit. */ 895 * Launcher populated the first entry with our memory limit. */
896 add_memory_region(E820_MAP->addr, E820_MAP->size, E820_MAP->type); 896 add_memory_region(boot_params.e820_map[0].addr,
897 boot_params.e820_map[0].size,
898 boot_params.e820_map[0].type);
897 899
898 /* This string is for the boot messages. */ 900 /* This string is for the boot messages. */
899 return "LGUEST"; 901 return "LGUEST";
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index e9afb7ebd566..a5698714d43d 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -372,7 +372,7 @@ static const char *vgacon_startup(void)
372#endif 372#endif
373 } 373 }
374 374
375 /* SCREEN_INFO initialized? */ 375 /* boot_params.screen_info initialized? */
376 if ((ORIG_VIDEO_MODE == 0) && 376 if ((ORIG_VIDEO_MODE == 0) &&
377 (ORIG_VIDEO_LINES == 0) && 377 (ORIG_VIDEO_LINES == 0) &&
378 (ORIG_VIDEO_COLS == 0)) 378 (ORIG_VIDEO_COLS == 0))
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild
index c5e43cb39874..80744dbcfafd 100644
--- a/include/asm-x86/Kbuild
+++ b/include/asm-x86/Kbuild
@@ -1,7 +1,6 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += boot.h 3header-y += boot.h
4header-y += bootsetup.h
5header-y += debugreg_32.h 4header-y += debugreg_32.h
6header-y += debugreg_64.h 5header-y += debugreg_64.h
7header-y += debugreg.h 6header-y += debugreg.h
diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h
index b91b01783e4b..ef67b59dbdb9 100644
--- a/include/asm-x86/bootparam.h
+++ b/include/asm-x86/bootparam.h
@@ -14,6 +14,9 @@ struct setup_header {
14 u16 root_flags; 14 u16 root_flags;
15 u32 syssize; 15 u32 syssize;
16 u16 ram_size; 16 u16 ram_size;
17#define RAMDISK_IMAGE_START_MASK 0x07FF
18#define RAMDISK_PROMPT_FLAG 0x8000
19#define RAMDISK_LOAD_FLAG 0x4000
17 u16 vid_mode; 20 u16 vid_mode;
18 u16 root_dev; 21 u16 root_dev;
19 u16 boot_flag; 22 u16 boot_flag;
diff --git a/include/asm-x86/bootsetup.h b/include/asm-x86/bootsetup.h
deleted file mode 100644
index 7b1c3ad155fd..000000000000
--- a/include/asm-x86/bootsetup.h
+++ /dev/null
@@ -1,40 +0,0 @@
1
2#ifndef _X86_64_BOOTSETUP_H
3#define _X86_64_BOOTSETUP_H 1
4
5#define BOOT_PARAM_SIZE 4096
6extern char x86_boot_params[BOOT_PARAM_SIZE];
7
8/*
9 * This is set up by the setup-routine at boot-time
10 */
11#define PARAM ((unsigned char *)x86_boot_params)
12#define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
13#define EXT_MEM_K (*(unsigned short *) (PARAM+2))
14#define ALT_MEM_K (*(unsigned int *) (PARAM+0x1e0))
15#define E820_MAP_NR (*(char*) (PARAM+E820NR))
16#define E820_MAP ((struct e820entry *) (PARAM+E820MAP))
17#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
18#define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
19#define SYS_DESC_TABLE (*(struct sys_desc_table_struct*)(PARAM+0xa0))
20#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
21#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8))
22#define SAVED_VIDEO_MODE (*(unsigned short *) (PARAM+0x1FA))
23#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
24#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
25#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
26#define KERNEL_START (*(unsigned int *) (PARAM+0x214))
27#define INITRD_START (*(unsigned int *) (PARAM+0x218))
28#define INITRD_SIZE (*(unsigned int *) (PARAM+0x21c))
29#define EDID_INFO (*(struct edid_info *) (PARAM+0x140))
30#define EDD_NR (*(unsigned char *) (PARAM+EDDNR))
31#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
32#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
33#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
34#define COMMAND_LINE boot_command_line
35
36#define RAMDISK_IMAGE_START_MASK 0x07FF
37#define RAMDISK_PROMPT_FLAG 0x8000
38#define RAMDISK_LOAD_FLAG 0x4000
39
40#endif
diff --git a/include/asm-x86/setup_32.h b/include/asm-x86/setup_32.h
index 7862fe858a9e..7a57ca8a1793 100644
--- a/include/asm-x86/setup_32.h
+++ b/include/asm-x86/setup_32.h
@@ -34,35 +34,6 @@
34 */ 34 */
35extern struct boot_params boot_params; 35extern struct boot_params boot_params;
36 36
37#define PARAM ((char *)&boot_params)
38#define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
39#define EXT_MEM_K (*(unsigned short *) (PARAM+2))
40#define ALT_MEM_K (*(unsigned long *) (PARAM+0x1e0))
41#define E820_MAP_NR (*(char*) (PARAM+E820NR))
42#define E820_MAP ((struct e820entry *) (PARAM+E820MAP))
43#define APM_BIOS_INFO (*(struct apm_bios_info *) (PARAM+0x40))
44#define IST_INFO (*(struct ist_info *) (PARAM+0x60))
45#define SYS_DESC_TABLE (*(struct sys_desc_table *)(PARAM+0xa0))
46#define EFI_SYSTAB ((efi_system_table_t *) *((unsigned long *)(PARAM+0x1c4)))
47#define EFI_MEMDESC_SIZE (*((unsigned long *) (PARAM+0x1c8)))
48#define EFI_MEMDESC_VERSION (*((unsigned long *) (PARAM+0x1cc)))
49#define EFI_MEMMAP ((void *) *((unsigned long *)(PARAM+0x1d0)))
50#define EFI_MEMMAP_SIZE (*((unsigned long *) (PARAM+0x1d4)))
51#define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
52#define RAMDISK_FLAGS (*(unsigned short *) (PARAM+0x1F8))
53#define VIDEO_MODE (*(unsigned short *) (PARAM+0x1FA))
54#define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
55#define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
56#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
57#define KERNEL_START (*(unsigned long *) (PARAM+0x214))
58#define INITRD_START (*(unsigned long *) (PARAM+0x218))
59#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
60#define EDID_INFO (*(struct edid_info *) (PARAM+0x140))
61#define EDD_NR (*(unsigned char *) (PARAM+EDDNR))
62#define EDD_MBR_SIG_NR (*(unsigned char *) (PARAM+EDD_MBR_SIG_NR_BUF))
63#define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
64#define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF))
65
66/* 37/*
67 * Do NOT EVER look at the BIOS memory size location. 38 * Do NOT EVER look at the BIOS memory size location.
68 * It does not work on many machines. 39 * It does not work on many machines.
diff --git a/include/asm-x86/setup_64.h b/include/asm-x86/setup_64.h
index eaeff73d6c10..a04aadcccf67 100644
--- a/include/asm-x86/setup_64.h
+++ b/include/asm-x86/setup_64.h
@@ -3,4 +3,17 @@
3 3
4#define COMMAND_LINE_SIZE 2048 4#define COMMAND_LINE_SIZE 2048
5 5
6#ifdef __KERNEL__
7
8#ifndef __ASSEMBLY__
9#include <asm/bootparam.h>
10
11/*
12 * This is set up by the setup-routine at boot-time
13 */
14extern struct boot_params boot_params;
15
16#endif /* not __ASSEMBLY__ */
17#endif /* __KERNEL__ */
18
6#endif 19#endif