diff options
-rw-r--r-- | arch/mips/mm/init.c | 2 | ||||
-rw-r--r-- | arch/score/mm/init.c | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/page_types.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/e820.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/setup.c | 19 | ||||
-rw-r--r-- | arch/x86/mm/ioremap.c | 37 | ||||
-rw-r--r-- | include/linux/mm.h | 2 | ||||
-rw-r--r-- | kernel/resource.c | 13 |
8 files changed, 43 insertions, 41 deletions
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 1651942f7fe..dee564aad23 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long start, unsigned long end, | |||
298 | } | 298 | } |
299 | 299 | ||
300 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 300 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
301 | static int __init page_is_ram(unsigned long pagenr) | 301 | int page_is_ram(unsigned long pagenr) |
302 | { | 302 | { |
303 | int i; | 303 | int i; |
304 | 304 | ||
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c index dfaf458d670..7f001bbedb0 100644 --- a/arch/score/mm/init.c +++ b/arch/score/mm/init.c | |||
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(void) | |||
59 | } | 59 | } |
60 | 60 | ||
61 | #ifndef CONFIG_NEED_MULTIPLE_NODES | 61 | #ifndef CONFIG_NEED_MULTIPLE_NODES |
62 | static int __init page_is_ram(unsigned long pagenr) | 62 | int page_is_ram(unsigned long pagenr) |
63 | { | 63 | { |
64 | if (pagenr >= min_low_pfn && pagenr < max_low_pfn) | 64 | if (pagenr >= min_low_pfn && pagenr < max_low_pfn) |
65 | return 1; | 65 | return 1; |
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 642fe34b36a..a667f24c725 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h | |||
@@ -40,7 +40,6 @@ | |||
40 | 40 | ||
41 | #ifndef __ASSEMBLY__ | 41 | #ifndef __ASSEMBLY__ |
42 | 42 | ||
43 | extern int page_is_ram(unsigned long pagenr); | ||
44 | extern int devmem_is_allowed(unsigned long pagenr); | 43 | extern int devmem_is_allowed(unsigned long pagenr); |
45 | 44 | ||
46 | extern unsigned long max_low_pfn_mapped; | 45 | extern unsigned long max_low_pfn_mapped; |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index a1a7876cadc..a966b753e49 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -517,11 +517,19 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type, | |||
517 | int checktype) | 517 | int checktype) |
518 | { | 518 | { |
519 | int i; | 519 | int i; |
520 | u64 end; | ||
520 | u64 real_removed_size = 0; | 521 | u64 real_removed_size = 0; |
521 | 522 | ||
522 | if (size > (ULLONG_MAX - start)) | 523 | if (size > (ULLONG_MAX - start)) |
523 | size = ULLONG_MAX - start; | 524 | size = ULLONG_MAX - start; |
524 | 525 | ||
526 | end = start + size; | ||
527 | printk(KERN_DEBUG "e820 remove range: %016Lx - %016Lx ", | ||
528 | (unsigned long long) start, | ||
529 | (unsigned long long) end); | ||
530 | e820_print_type(old_type); | ||
531 | printk(KERN_CONT "\n"); | ||
532 | |||
525 | for (i = 0; i < e820.nr_map; i++) { | 533 | for (i = 0; i < e820.nr_map; i++) { |
526 | struct e820entry *ei = &e820.map[i]; | 534 | struct e820entry *ei = &e820.map[i]; |
527 | u64 final_start, final_end; | 535 | u64 final_start, final_end; |
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 5d9e40c5862..3499b4fabc9 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -667,6 +667,23 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = { | |||
667 | {} | 667 | {} |
668 | }; | 668 | }; |
669 | 669 | ||
670 | static void __init trim_bios_range(void) | ||
671 | { | ||
672 | /* | ||
673 | * A special case is the first 4Kb of memory; | ||
674 | * This is a BIOS owned area, not kernel ram, but generally | ||
675 | * not listed as such in the E820 table. | ||
676 | */ | ||
677 | e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED); | ||
678 | /* | ||
679 | * special case: Some BIOSen report the PC BIOS | ||
680 | * area (640->1Mb) as ram even though it is not. | ||
681 | * take them out. | ||
682 | */ | ||
683 | e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); | ||
684 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
685 | } | ||
686 | |||
670 | /* | 687 | /* |
671 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 688 | * Determine if we were loaded by an EFI loader. If so, then we have also been |
672 | * passed the efi memmap, systab, etc., so we should use these data structures | 689 | * passed the efi memmap, systab, etc., so we should use these data structures |
@@ -830,7 +847,7 @@ void __init setup_arch(char **cmdline_p) | |||
830 | insert_resource(&iomem_resource, &data_resource); | 847 | insert_resource(&iomem_resource, &data_resource); |
831 | insert_resource(&iomem_resource, &bss_resource); | 848 | insert_resource(&iomem_resource, &bss_resource); |
832 | 849 | ||
833 | 850 | trim_bios_range(); | |
834 | #ifdef CONFIG_X86_32 | 851 | #ifdef CONFIG_X86_32 |
835 | if (ppro_with_ram_bug()) { | 852 | if (ppro_with_ram_bug()) { |
836 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, | 853 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index c246d259822..e404ffe3021 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -24,43 +24,6 @@ | |||
24 | 24 | ||
25 | #include "physaddr.h" | 25 | #include "physaddr.h" |
26 | 26 | ||
27 | int page_is_ram(unsigned long pagenr) | ||
28 | { | ||
29 | resource_size_t addr, end; | ||
30 | int i; | ||
31 | |||
32 | /* | ||
33 | * A special case is the first 4Kb of memory; | ||
34 | * This is a BIOS owned area, not kernel ram, but generally | ||
35 | * not listed as such in the E820 table. | ||
36 | */ | ||
37 | if (pagenr == 0) | ||
38 | return 0; | ||
39 | |||
40 | /* | ||
41 | * Second special case: Some BIOSen report the PC BIOS | ||
42 | * area (640->1Mb) as ram even though it is not. | ||
43 | */ | ||
44 | if (pagenr >= (BIOS_BEGIN >> PAGE_SHIFT) && | ||
45 | pagenr < (BIOS_END >> PAGE_SHIFT)) | ||
46 | return 0; | ||
47 | |||
48 | for (i = 0; i < e820.nr_map; i++) { | ||
49 | /* | ||
50 | * Not usable memory: | ||
51 | */ | ||
52 | if (e820.map[i].type != E820_RAM) | ||
53 | continue; | ||
54 | addr = (e820.map[i].addr + PAGE_SIZE-1) >> PAGE_SHIFT; | ||
55 | end = (e820.map[i].addr + e820.map[i].size) >> PAGE_SHIFT; | ||
56 | |||
57 | |||
58 | if ((pagenr >= addr) && (pagenr < end)) | ||
59 | return 1; | ||
60 | } | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | /* | 27 | /* |
65 | * Fix up the linear direct mapping of the kernel to avoid cache attribute | 28 | * Fix up the linear direct mapping of the kernel to avoid cache attribute |
66 | * conflicts. | 29 | * conflicts. |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 60c467bfbab..8b2fa8593c6 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -265,6 +265,8 @@ static inline int get_page_unless_zero(struct page *page) | |||
265 | return atomic_inc_not_zero(&page->_count); | 265 | return atomic_inc_not_zero(&page->_count); |
266 | } | 266 | } |
267 | 267 | ||
268 | extern int page_is_ram(unsigned long pfn); | ||
269 | |||
268 | /* Support for virtually mapped pages */ | 270 | /* Support for virtually mapped pages */ |
269 | struct page *vmalloc_to_page(const void *addr); | 271 | struct page *vmalloc_to_page(const void *addr); |
270 | unsigned long vmalloc_to_pfn(const void *addr); | 272 | unsigned long vmalloc_to_pfn(const void *addr); |
diff --git a/kernel/resource.c b/kernel/resource.c index af96c1e4b54..03c897f7935 100644 --- a/kernel/resource.c +++ b/kernel/resource.c | |||
@@ -297,6 +297,19 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, | |||
297 | 297 | ||
298 | #endif | 298 | #endif |
299 | 299 | ||
300 | static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg) | ||
301 | { | ||
302 | return 1; | ||
303 | } | ||
304 | /* | ||
305 | * This generic page_is_ram() returns true if specified address is | ||
306 | * registered as "System RAM" in iomem_resource list. | ||
307 | */ | ||
308 | int __weak page_is_ram(unsigned long pfn) | ||
309 | { | ||
310 | return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1; | ||
311 | } | ||
312 | |||
300 | /* | 313 | /* |
301 | * Find empty slot in the resource tree given range and alignment. | 314 | * Find empty slot in the resource tree given range and alignment. |
302 | */ | 315 | */ |