diff options
author | Yinghai Lu <yinghai@kernel.org> | 2010-01-21 22:21:04 -0500 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-01 19:58:17 -0500 |
commit | 1b5576e69a5fe168c08a159685ac366316ac9bbc (patch) | |
tree | 0f5948f32578e1b74edb86ff8008ef42faa7f32f /arch | |
parent | 53df8fdc15fb646b0219e43c989c2cdab1ab100c (diff) |
x86: Remove BIOS data range from e820
In preparation for moving to the generic page_is_ram(), make explicit
what we expect to be reserved and not reserved.
Tested-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <20100122033004.335813103@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch')
-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 | 16 |
3 files changed, 26 insertions, 17 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index d17d482a04f4..230687ba5ba5 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 cdb6a8a506dd..f9b1f4e5ab74 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c | |||
@@ -650,6 +650,23 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = { | |||
650 | {} | 650 | {} |
651 | }; | 651 | }; |
652 | 652 | ||
653 | static void __init trim_bios_range(void) | ||
654 | { | ||
655 | /* | ||
656 | * A special case is the first 4Kb of memory; | ||
657 | * This is a BIOS owned area, not kernel ram, but generally | ||
658 | * not listed as such in the E820 table. | ||
659 | */ | ||
660 | e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED); | ||
661 | /* | ||
662 | * special case: Some BIOSen report the PC BIOS | ||
663 | * area (640->1Mb) as ram even though it is not. | ||
664 | * take them out. | ||
665 | */ | ||
666 | e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); | ||
667 | sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); | ||
668 | } | ||
669 | |||
653 | /* | 670 | /* |
654 | * Determine if we were loaded by an EFI loader. If so, then we have also been | 671 | * Determine if we were loaded by an EFI loader. If so, then we have also been |
655 | * passed the efi memmap, systab, etc., so we should use these data structures | 672 | * passed the efi memmap, systab, etc., so we should use these data structures |
@@ -813,7 +830,7 @@ void __init setup_arch(char **cmdline_p) | |||
813 | insert_resource(&iomem_resource, &data_resource); | 830 | insert_resource(&iomem_resource, &data_resource); |
814 | insert_resource(&iomem_resource, &bss_resource); | 831 | insert_resource(&iomem_resource, &bss_resource); |
815 | 832 | ||
816 | 833 | trim_bios_range(); | |
817 | #ifdef CONFIG_X86_32 | 834 | #ifdef CONFIG_X86_32 |
818 | if (ppro_with_ram_bug()) { | 835 | if (ppro_with_ram_bug()) { |
819 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, | 836 | e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM, |
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c index 334e63ca7b2b..30e068d6462e 100644 --- a/arch/x86/mm/ioremap.c +++ b/arch/x86/mm/ioremap.c | |||
@@ -29,22 +29,6 @@ int page_is_ram(unsigned long pagenr) | |||
29 | resource_size_t addr, end; | 29 | resource_size_t addr, end; |
30 | int i; | 30 | int i; |
31 | 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++) { | 32 | for (i = 0; i < e820.nr_map; i++) { |
49 | /* | 33 | /* |
50 | * Not usable memory: | 34 | * Not usable memory: |