diff options
author | Paul Jackson <pj@sgi.com> | 2008-05-14 11:15:46 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2008-05-25 04:55:11 -0400 |
commit | 6e9bcc796b120d17b08dde7ab958b82ddb899889 (patch) | |
tree | e7cecb5a49f875beae9b6aff6bb44777be714430 /arch | |
parent | 028b785888c523baccdf27af0cdbf1deb92edec0 (diff) |
x86 boot: change sanitize_e820_map parameter from byte to int to allow bigger memory maps
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/e820.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/e820_64.c | 7 | ||||
-rw-r--r-- | arch/x86/mach-default/setup.c | 5 | ||||
-rw-r--r-- | arch/x86/mach-voyager/setup.c | 5 |
4 files changed, 16 insertions, 6 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index 3f7777b255aa..91abf5b2fb94 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -143,7 +143,7 @@ void __init e820_print_map(char *who) | |||
143 | * | 143 | * |
144 | */ | 144 | */ |
145 | int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, | 145 | int __init sanitize_e820_map(struct e820entry *biosmap, int max_nr_map, |
146 | char *pnr_map) | 146 | int *pnr_map) |
147 | { | 147 | { |
148 | struct change_member { | 148 | struct change_member { |
149 | struct e820entry *pbios; /* pointer to original bios entry */ | 149 | struct e820entry *pbios; /* pointer to original bios entry */ |
@@ -204,6 +204,7 @@ static struct e820entry new_bios[E820_X_MAX] __initdata; | |||
204 | return -1; | 204 | return -1; |
205 | 205 | ||
206 | old_nr = *pnr_map; | 206 | old_nr = *pnr_map; |
207 | BUG_ON(old_nr > max_nr_map); | ||
207 | 208 | ||
208 | /* bail out if we find any unreasonable addresses in bios map */ | 209 | /* bail out if we find any unreasonable addresses in bios map */ |
209 | for (i = 0; i < old_nr; i++) | 210 | for (i = 0; i < old_nr; i++) |
@@ -401,7 +402,7 @@ u64 __init update_memory_range(u64 start, u64 size, unsigned old_type, | |||
401 | 402 | ||
402 | void __init update_e820(void) | 403 | void __init update_e820(void) |
403 | { | 404 | { |
404 | u8 nr_map; | 405 | int nr_map; |
405 | 406 | ||
406 | nr_map = e820.nr_map; | 407 | nr_map = e820.nr_map; |
407 | if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map)) | 408 | if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr_map)) |
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c index 58dc6eee4d4f..354fbb221709 100644 --- a/arch/x86/kernel/e820_64.c +++ b/arch/x86/kernel/e820_64.c | |||
@@ -407,15 +407,18 @@ static void early_panic(char *msg) | |||
407 | char *__init machine_specific_memory_setup(void) | 407 | char *__init machine_specific_memory_setup(void) |
408 | { | 408 | { |
409 | char *who = "BIOS-e820"; | 409 | char *who = "BIOS-e820"; |
410 | int new_nr; | ||
410 | /* | 411 | /* |
411 | * Try to copy the BIOS-supplied E820-map. | 412 | * Try to copy the BIOS-supplied E820-map. |
412 | * | 413 | * |
413 | * Otherwise fake a memory map; one section from 0k->640k, | 414 | * Otherwise fake a memory map; one section from 0k->640k, |
414 | * the next section from 1mb->appropriate_mem_k | 415 | * the next section from 1mb->appropriate_mem_k |
415 | */ | 416 | */ |
417 | new_nr = boot_params.e820_entries; | ||
416 | sanitize_e820_map(boot_params.e820_map, | 418 | sanitize_e820_map(boot_params.e820_map, |
417 | ARRAY_SIZE(boot_params.e820_map), | 419 | ARRAY_SIZE(boot_params.e820_map), |
418 | &boot_params.e820_entries); | 420 | &new_nr); |
421 | boot_params.e820_entries = new_nr; | ||
419 | if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) | 422 | if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) |
420 | early_panic("Cannot find a valid memory map"); | 423 | early_panic("Cannot find a valid memory map"); |
421 | printk(KERN_INFO "BIOS-provided physical RAM map:\n"); | 424 | printk(KERN_INFO "BIOS-provided physical RAM map:\n"); |
@@ -484,7 +487,7 @@ early_param("memmap", parse_memmap_opt); | |||
484 | void __init finish_e820_parsing(void) | 487 | void __init finish_e820_parsing(void) |
485 | { | 488 | { |
486 | if (userdef) { | 489 | if (userdef) { |
487 | char nr = e820.nr_map; | 490 | int nr = e820.nr_map; |
488 | 491 | ||
489 | if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0) | 492 | if (sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &nr) < 0) |
490 | early_panic("Invalid user supplied memory map"); | 493 | early_panic("Invalid user supplied memory map"); |
diff --git a/arch/x86/mach-default/setup.c b/arch/x86/mach-default/setup.c index 38a856c4fc07..56b4c39cb7fa 100644 --- a/arch/x86/mach-default/setup.c +++ b/arch/x86/mach-default/setup.c | |||
@@ -153,6 +153,7 @@ late_initcall(print_ipi_mode); | |||
153 | char * __init machine_specific_memory_setup(void) | 153 | char * __init machine_specific_memory_setup(void) |
154 | { | 154 | { |
155 | char *who; | 155 | char *who; |
156 | int new_nr; | ||
156 | 157 | ||
157 | 158 | ||
158 | who = "BIOS-e820"; | 159 | who = "BIOS-e820"; |
@@ -163,9 +164,11 @@ char * __init machine_specific_memory_setup(void) | |||
163 | * Otherwise fake a memory map; one section from 0k->640k, | 164 | * Otherwise fake a memory map; one section from 0k->640k, |
164 | * the next section from 1mb->appropriate_mem_k | 165 | * the next section from 1mb->appropriate_mem_k |
165 | */ | 166 | */ |
167 | new_nr = boot_params.e820_entries; | ||
166 | sanitize_e820_map(boot_params.e820_map, | 168 | sanitize_e820_map(boot_params.e820_map, |
167 | ARRAY_SIZE(boot_params.e820_map), | 169 | ARRAY_SIZE(boot_params.e820_map), |
168 | &boot_params.e820_entries); | 170 | &new_nr); |
171 | boot_params.e820_entries = new_nr; | ||
169 | if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) | 172 | if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) |
170 | < 0) { | 173 | < 0) { |
171 | unsigned long mem_size; | 174 | unsigned long mem_size; |
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c index 662b5c0a77d6..f4aca9fa9546 100644 --- a/arch/x86/mach-voyager/setup.c +++ b/arch/x86/mach-voyager/setup.c | |||
@@ -62,6 +62,7 @@ void __init time_init_hook(void) | |||
62 | char *__init machine_specific_memory_setup(void) | 62 | char *__init machine_specific_memory_setup(void) |
63 | { | 63 | { |
64 | char *who; | 64 | char *who; |
65 | int new_nr; | ||
65 | 66 | ||
66 | who = "NOT VOYAGER"; | 67 | who = "NOT VOYAGER"; |
67 | 68 | ||
@@ -111,9 +112,11 @@ char *__init machine_specific_memory_setup(void) | |||
111 | * Otherwise fake a memory map; one section from 0k->640k, | 112 | * Otherwise fake a memory map; one section from 0k->640k, |
112 | * the next section from 1mb->appropriate_mem_k | 113 | * the next section from 1mb->appropriate_mem_k |
113 | */ | 114 | */ |
115 | new_nr = boot_params.e820_entries; | ||
114 | sanitize_e820_map(boot_params.e820_map, | 116 | sanitize_e820_map(boot_params.e820_map, |
115 | ARRAY_SIZE(boot_params.e820_map), | 117 | ARRAY_SIZE(boot_params.e820_map), |
116 | &boot_params.e820_entries); | 118 | &new_nr); |
119 | boot_params.e820_entries = new_nr; | ||
117 | if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) | 120 | if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) |
118 | < 0) { | 121 | < 0) { |
119 | unsigned long mem_size; | 122 | unsigned long mem_size; |