diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2006-04-07 13:49:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-04-09 14:53:50 -0400 |
commit | 952223683ec989e86328c24808fdb962c4dbeb0a (patch) | |
tree | 0c7473d4469cba883bf880bbaa04900960806742 /arch/i386/kernel/setup.c | |
parent | eee5a9fa63c97366cdea6ab3aa2ed9e3601812d0 (diff) |
[PATCH] x86_64: Introduce e820_all_mapped
Introduce a e820_all_mapped() function which checks if the entire range
<start,end> is mapped with type.
This is done by moving the local start variable to the end of each
known-good region; if at the end of the function the start address is
still before end, there must be a part that's not of the correct type;
otherwise it's a good region.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/i386/kernel/setup.c')
-rw-r--r-- | arch/i386/kernel/setup.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index eacc3f0a2ea4..8e70894a9f86 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -963,6 +963,36 @@ efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg) | |||
963 | return 0; | 963 | return 0; |
964 | } | 964 | } |
965 | 965 | ||
966 | /* | ||
967 | * This function checks if the entire range <start,end> is mapped with type. | ||
968 | * | ||
969 | * Note: this function only works correct if the e820 table is sorted and | ||
970 | * not-overlapping, which is the case | ||
971 | */ | ||
972 | int __init | ||
973 | e820_all_mapped(unsigned long start, unsigned long end, unsigned type) | ||
974 | { | ||
975 | int i; | ||
976 | for (i = 0; i < e820.nr_map; i++) { | ||
977 | struct e820entry *ei = &e820.map[i]; | ||
978 | if (type && ei->type != type) | ||
979 | continue; | ||
980 | /* is the region (part) in overlap with the current region ?*/ | ||
981 | if (ei->addr >= end || ei->addr + ei->size <= start) | ||
982 | continue; | ||
983 | /* if the region is at the beginning of <start,end> we move | ||
984 | * start to the end of the region since it's ok until there | ||
985 | */ | ||
986 | if (ei->addr <= start) | ||
987 | start = ei->addr + ei->size; | ||
988 | /* if start is now at or beyond end, we're done, full | ||
989 | * coverage */ | ||
990 | if (start >= end) | ||
991 | return 1; /* we're done */ | ||
992 | } | ||
993 | return 0; | ||
994 | } | ||
995 | |||
966 | /* | 996 | /* |
967 | * Find the highest page frame number we have available | 997 | * Find the highest page frame number we have available |
968 | */ | 998 | */ |