diff options
Diffstat (limited to 'arch/i386/kernel/setup.c')
| -rw-r--r-- | arch/i386/kernel/setup.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index eacc3f0a2ea4..80cb3b2d0997 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 | */ |
| @@ -1317,8 +1347,8 @@ legacy_init_iomem_resources(struct resource *code_resource, struct resource *dat | |||
| 1317 | /* | 1347 | /* |
| 1318 | * Request address space for all standard resources | 1348 | * Request address space for all standard resources |
| 1319 | * | 1349 | * |
| 1320 | * This is called just before pcibios_assign_resources(), which is also | 1350 | * This is called just before pcibios_init(), which is also a |
| 1321 | * an fs_initcall, but is linked in later (in arch/i386/pci/i386.c). | 1351 | * subsys_initcall, but is linked in later (in arch/i386/pci/common.c). |
| 1322 | */ | 1352 | */ |
| 1323 | static int __init request_standard_resources(void) | 1353 | static int __init request_standard_resources(void) |
| 1324 | { | 1354 | { |
| @@ -1339,7 +1369,7 @@ static int __init request_standard_resources(void) | |||
| 1339 | return 0; | 1369 | return 0; |
| 1340 | } | 1370 | } |
| 1341 | 1371 | ||
| 1342 | fs_initcall(request_standard_resources); | 1372 | subsys_initcall(request_standard_resources); |
| 1343 | 1373 | ||
| 1344 | static void __init register_memory(void) | 1374 | static void __init register_memory(void) |
| 1345 | { | 1375 | { |
