aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/e820.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-21 17:48:05 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 06:48:37 -0400
commit7a1fd9866cbb59a00006f1e0fd5726951b167c97 (patch)
treeb10694e46643af2d8286e678297387b2022c009a /arch/x86/kernel/e820.c
parent9a250347591da3e60b5ee53dd1d341732f081117 (diff)
x86: add e820_remove_range
... so could add real hole in e820 agp check is using request_mem_region, and could fail if e820 is reserved... Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/e820.c')
-rw-r--r--arch/x86/kernel/e820.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 7b613d2efb04..e285ea38c8e5 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -429,6 +429,41 @@ u64 __init e820_update_range(u64 start, u64 size, unsigned old_type,
429 return real_updated_size; 429 return real_updated_size;
430} 430}
431 431
432/* make e820 not cover the range */
433u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
434 int checktype)
435{
436 int i;
437 u64 real_removed_size = 0;
438
439 for (i = 0; i < e820.nr_map; i++) {
440 struct e820entry *ei = &e820.map[i];
441 u64 final_start, final_end;
442
443 if (checktype && ei->type != old_type)
444 continue;
445 /* totally covered? */
446 if (ei->addr >= start &&
447 (ei->addr + ei->size) <= (start + size)) {
448 real_removed_size += ei->size;
449 memset(ei, 0, sizeof(struct e820entry));
450 continue;
451 }
452 /* partially covered */
453 final_start = max(start, ei->addr);
454 final_end = min(start + size, ei->addr + ei->size);
455 if (final_start >= final_end)
456 continue;
457 real_removed_size += final_end - final_start;
458
459 ei->size -= final_end - final_start;
460 if (ei->addr < final_start)
461 continue;
462 ei->addr = final_end;
463 }
464 return real_removed_size;
465}
466
432void __init update_e820(void) 467void __init update_e820(void)
433{ 468{
434 int nr_map; 469 int nr_map;