aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-07-03 14:39:00 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-09 01:43:22 -0400
commitfc9036ea1a4b14229788e6df3936b451a6abac98 (patch)
tree5741a5f6f8f65fa076abf5cf39ee1f57cffae89c
parenta0a0becd2da0ba0d7f0204a61d1905926cdb163d (diff)
x86: let early_reserve_e820 update e820_saved too
so when it is called after early_param, e820_saved get updated too. esp for mpc update. Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Cc: Bernhard Walle <bwalle@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/e820.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 13e32986cb5f..e07d4019e266 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -414,8 +414,9 @@ static int __init append_e820_map(struct e820entry *biosmap, int nr_map)
414 return __append_e820_map(biosmap, nr_map); 414 return __append_e820_map(biosmap, nr_map);
415} 415}
416 416
417u64 __init e820_update_range(u64 start, u64 size, unsigned old_type, 417static u64 __init e820_update_range_map(struct e820map *e820x, u64 start,
418 unsigned new_type) 418 u64 size, unsigned old_type,
419 unsigned new_type)
419{ 420{
420 int i; 421 int i;
421 u64 real_updated_size = 0; 422 u64 real_updated_size = 0;
@@ -426,7 +427,7 @@ u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
426 size = ULLONG_MAX - start; 427 size = ULLONG_MAX - start;
427 428
428 for (i = 0; i < e820.nr_map; i++) { 429 for (i = 0; i < e820.nr_map; i++) {
429 struct e820entry *ei = &e820.map[i]; 430 struct e820entry *ei = &e820x->map[i];
430 u64 final_start, final_end; 431 u64 final_start, final_end;
431 if (ei->type != old_type) 432 if (ei->type != old_type)
432 continue; 433 continue;
@@ -454,6 +455,19 @@ u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
454 return real_updated_size; 455 return real_updated_size;
455} 456}
456 457
458u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
459 unsigned new_type)
460{
461 return e820_update_range_map(&e820, start, size, old_type, new_type);
462}
463
464static u64 __init e820_update_range_saved(u64 start, u64 size,
465 unsigned old_type, unsigned new_type)
466{
467 return e820_update_range_map(&e820_saved, start, size, old_type,
468 new_type);
469}
470
457/* make e820 not cover the range */ 471/* make e820 not cover the range */
458u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, 472u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
459 int checktype) 473 int checktype)
@@ -503,6 +517,15 @@ void __init update_e820(void)
503 printk(KERN_INFO "modified physical RAM map:\n"); 517 printk(KERN_INFO "modified physical RAM map:\n");
504 e820_print_map("modified"); 518 e820_print_map("modified");
505} 519}
520static void __init update_e820_saved(void)
521{
522 int nr_map;
523
524 nr_map = e820_saved.nr_map;
525 if (sanitize_e820_map(e820_saved.map, ARRAY_SIZE(e820_saved.map), &nr_map))
526 return;
527 e820_saved.nr_map = nr_map;
528}
506#define MAX_GAP_END 0x100000000ull 529#define MAX_GAP_END 0x100000000ull
507/* 530/*
508 * Search for a gap in the e820 memory space from start_addr to end_addr. 531 * Search for a gap in the e820 memory space from start_addr to end_addr.
@@ -1007,8 +1030,10 @@ u64 __init early_reserve_e820(u64 startt, u64 sizet, u64 align)
1007 1030
1008 addr = round_down(start + size - sizet, align); 1031 addr = round_down(start + size - sizet, align);
1009 e820_update_range(addr, sizet, E820_RAM, E820_RESERVED); 1032 e820_update_range(addr, sizet, E820_RAM, E820_RESERVED);
1033 e820_update_range_saved(addr, sizet, E820_RAM, E820_RESERVED);
1010 printk(KERN_INFO "update e820 for early_reserve_e820\n"); 1034 printk(KERN_INFO "update e820 for early_reserve_e820\n");
1011 update_e820(); 1035 update_e820();
1036 update_e820_saved();
1012 1037
1013 return addr; 1038 return addr;
1014} 1039}