diff options
author | Alok Kataria <akataria@vmware.com> | 2008-06-25 14:02:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:16:17 -0400 |
commit | fd6493e16625b92a506fba13deda31c0be5f1cd4 (patch) | |
tree | 0980d27707d1658e5830ae9aad5edbee41fcd07c | |
parent | 6a2f47ca27fad36f99e8478a3807d4b8c7db80e7 (diff) |
x86: cleanup e820_setup_gap(), v2
e820_search_gap also take a end_addr parameter to limit search from
start_addr to end_addr.
Signed-off-by: AloK N Kataria <akataria@vmware.com>
Acked-by: Yinghai Lu <yhlu.kernel@gmail.com>
Cc: "lenb@kernel.org" <lenb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/e820.c | 12 | ||||
-rw-r--r-- | include/asm-x86/e820.h | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index e03b89ac8f2b..d3f6c5f6d3b1 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -487,17 +487,19 @@ void __init update_e820(void) | |||
487 | printk(KERN_INFO "modified physical RAM map:\n"); | 487 | printk(KERN_INFO "modified physical RAM map:\n"); |
488 | e820_print_map("modified"); | 488 | e820_print_map("modified"); |
489 | } | 489 | } |
490 | 490 | #define MAX_GAP_END 0x100000000ull | |
491 | /* | 491 | /* |
492 | * Search for a gap in the e820 memory space from start_addr to 2^32. | 492 | * Search for a gap in the e820 memory space from start_addr to end_addr. |
493 | */ | 493 | */ |
494 | __init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, | 494 | __init int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, |
495 | unsigned long start_addr) | 495 | unsigned long start_addr, unsigned long long end_addr) |
496 | { | 496 | { |
497 | unsigned long long last = 0x100000000ull; | 497 | unsigned long long last; |
498 | int i = e820.nr_map; | 498 | int i = e820.nr_map; |
499 | int found = 0; | 499 | int found = 0; |
500 | 500 | ||
501 | last = (end_addr && end_addr < MAX_GAP_END) ? end_addr : MAX_GAP_END; | ||
502 | |||
501 | while (--i >= 0) { | 503 | while (--i >= 0) { |
502 | unsigned long long start = e820.map[i].addr; | 504 | unsigned long long start = e820.map[i].addr; |
503 | unsigned long long end = start + e820.map[i].size; | 505 | unsigned long long end = start + e820.map[i].size; |
@@ -537,7 +539,7 @@ __init void e820_setup_gap(void) | |||
537 | 539 | ||
538 | gapstart = 0x10000000; | 540 | gapstart = 0x10000000; |
539 | gapsize = 0x400000; | 541 | gapsize = 0x400000; |
540 | found = e820_search_gap(&gapstart, &gapsize, 0); | 542 | found = e820_search_gap(&gapstart, &gapsize, 0, MAX_GAP_END); |
541 | 543 | ||
542 | #ifdef CONFIG_X86_64 | 544 | #ifdef CONFIG_X86_64 |
543 | if (!found) { | 545 | if (!found) { |
diff --git a/include/asm-x86/e820.h b/include/asm-x86/e820.h index 45e904fe4076..05a7dc33334c 100644 --- a/include/asm-x86/e820.h +++ b/include/asm-x86/e820.h | |||
@@ -75,7 +75,7 @@ extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type, | |||
75 | extern void update_e820(void); | 75 | extern void update_e820(void); |
76 | extern void e820_setup_gap(void); | 76 | extern void e820_setup_gap(void); |
77 | extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, | 77 | extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize, |
78 | unsigned long start_addr); | 78 | unsigned long start_addr, unsigned long long end_addr); |
79 | struct setup_data; | 79 | struct setup_data; |
80 | extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data); | 80 | extern void parse_e820_ext(struct setup_data *data, unsigned long pa_data); |
81 | 81 | ||