]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86 boot: change sanitize_e820_map parameter from byte to int to allow bigger memory...
authorPaul Jackson <pj@sgi.com>
Wed, 14 May 2008 15:15:46 +0000 (08:15 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Sun, 25 May 2008 08:55:11 +0000 (10:55 +0200)
The map size counter passed into, and back out of, sanitize_e820_map(),
was an eight bit type (char or u8), as derived from its origins in
legacy BIOS E820 structures.  This patch changes that type to an 'int',
to allow this sanitize routine to also be used on larger maps (larger
than the 256 count that fits in a char).  The legacy BIOS E820 interface
of course does not change; that remains at 8 bits for this count, holding
up to E820MAX == 128 entries.  But the kernel internals can handle more
when those additional memory map entries are passed from the BIOS via
EFI interfaces.

Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/e820.c
arch/x86/kernel/e820_64.c
arch/x86/mach-default/setup.c
arch/x86/mach-voyager/setup.c
include/asm-x86/e820.h

index 3f7777b255aa5d8d8fc62f1ebcf9e4786c7d05f6..91abf5b2fb946c5df74d13249e1fd31cea9bc0bc 100644 (file)
@@ -143,7 +143,7 @@ void __init e820_print_map(char *who)
  *
  */
 int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map,
-                               char *pnr_map)
+                               int *pnr_map)
 {
        struct change_member {
                struct e820entry *pbios; /* pointer to original bios entry */
@@ -204,6 +204,7 @@ static struct e820entry new_bios[E820_X_MAX] __initdata;
                return -1;
 
        old_nr = *pnr_map;
+       BUG_ON(old_nr > max_nr_map);
 
        /* bail out if we find any unreasonable addresses in bios map */
        for (i = 0; i < old_nr; i++)
@@ -401,7 +402,7 @@ u64 __init update_memory_range(u64 start, u64 size, unsigned old_type,
 
 void __init update_e820(void)
 {
-       u8 nr_map;
+       int nr_map;
 
        nr_map = e820.nr_map;
        if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map))
index 58dc6eee4d4f3e6de2d8bab4a873a67f5b87dce4..354fbb22170917af25d354fc5705e9924f5afcd6 100644 (file)
@@ -407,15 +407,18 @@ static void early_panic(char *msg)
 char *__init machine_specific_memory_setup(void)
 {
        char *who = "BIOS-e820";
+       int new_nr;
        /*
         * Try to copy the BIOS-supplied E820-map.
         *
         * Otherwise fake a memory map; one section from 0k->640k,
         * the next section from 1mb->appropriate_mem_k
         */
+       new_nr = boot_params.e820_entries;
        sanitize_e820_map(boot_params.e820_map,
                        ARRAY_SIZE(boot_params.e820_map),
-                       &boot_params.e820_entries);
+                       &new_nr);
+       boot_params.e820_entries = new_nr;
        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");
@@ -484,7 +487,7 @@ early_param("memmap", parse_memmap_opt);
 void __init finish_e820_parsing(void)
 {
        if (userdef) {
-               char nr = e820.nr_map;
+               int nr = e820.nr_map;
 
                if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0)
                        early_panic("Invalid user supplied memory map");
index 38a856c4fc07a891d5e5705789135e8431858d53..56b4c39cb7fa87fbc89ba92e055ad49eabcc66ba 100644 (file)
@@ -153,6 +153,7 @@ late_initcall(print_ipi_mode);
 char * __init machine_specific_memory_setup(void)
 {
        char *who;
+       int new_nr;
 
 
        who = "BIOS-e820";
@@ -163,9 +164,11 @@ char * __init machine_specific_memory_setup(void)
         * Otherwise fake a memory map; one section from 0k->640k,
         * the next section from 1mb->appropriate_mem_k
         */
+       new_nr = boot_params.e820_entries;
        sanitize_e820_map(boot_params.e820_map,
                        ARRAY_SIZE(boot_params.e820_map),
-                       &boot_params.e820_entries);
+                       &new_nr);
+       boot_params.e820_entries = new_nr;
        if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
            < 0) {
                unsigned long mem_size;
index 662b5c0a77d691cee4dc8e9ddace03fe2499c956..f4aca9fa9546f23ff49874a322d1a684078f485b 100644 (file)
@@ -62,6 +62,7 @@ void __init time_init_hook(void)
 char *__init machine_specific_memory_setup(void)
 {
        char *who;
+       int new_nr;
 
        who = "NOT VOYAGER";
 
@@ -111,9 +112,11 @@ char *__init machine_specific_memory_setup(void)
         * Otherwise fake a memory map; one section from 0k->640k,
         * the next section from 1mb->appropriate_mem_k
         */
+       new_nr = boot_params.e820_entries;
        sanitize_e820_map(boot_params.e820_map,
                        ARRAY_SIZE(boot_params.e820_map),
-                       &boot_params.e820_entries);
+                       &new_nr);
+       boot_params.e820_entries = new_nr;
        if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
            < 0) {
                unsigned long mem_size;
index ab18457a95c0911edf1824404c4c5bb3a571f876..1eb13b88143752ec5f20767e257499d2ad712b3b 100644 (file)
@@ -63,7 +63,7 @@ extern int e820_all_mapped(u64 start, u64 end, unsigned type);
 extern void add_memory_region(u64 start, u64 size, int type);
 extern void e820_print_map(char *who);
 extern int
-sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, char *pnr_map);
+sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, int *pnr_map);
 extern int copy_e820_map(struct e820entry *biosmap, int nr_map);
 extern u64 update_memory_range(u64 start, u64 size, unsigned old_type,
                               unsigned new_type);