]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
x86: Remove BIOS data range from e820
authorYinghai Lu <yinghai@kernel.org>
Fri, 22 Jan 2010 03:21:04 +0000 (11:21 +0800)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 2 Feb 2010 00:58:17 +0000 (16:58 -0800)
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>
arch/x86/kernel/e820.c
arch/x86/kernel/setup.c
arch/x86/mm/ioremap.c

index d17d482a04f4c84edd4e87229372b52621e5d1c8..230687ba5ba5fd0feb6a2fcdfffa9520eccc33b7 100644 (file)
@@ -517,11 +517,19 @@ u64 __init e820_remove_range(u64 start, u64 size, unsigned old_type,
                             int checktype)
 {
        int i;
+       u64 end;
        u64 real_removed_size = 0;
 
        if (size > (ULLONG_MAX - start))
                size = ULLONG_MAX - start;
 
+       end = start + size;
+       printk(KERN_DEBUG "e820 remove range: %016Lx - %016Lx ",
+                      (unsigned long long) start,
+                      (unsigned long long) end);
+       e820_print_type(old_type);
+       printk(KERN_CONT "\n");
+
        for (i = 0; i < e820.nr_map; i++) {
                struct e820entry *ei = &e820.map[i];
                u64 final_start, final_end;
index cdb6a8a506ddbca3bb50a6c09c9c3484edc9f99f..f9b1f4e5ab74cb5dc7cf4c0b64c0edfc3e0709af 100644 (file)
@@ -650,6 +650,23 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
        {}
 };
 
+static void __init trim_bios_range(void)
+{
+       /*
+        * A special case is the first 4Kb of memory;
+        * This is a BIOS owned area, not kernel ram, but generally
+        * not listed as such in the E820 table.
+        */
+       e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED);
+       /*
+        * special case: Some BIOSen report the PC BIOS
+        * area (640->1Mb) as ram even though it is not.
+        * take them out.
+        */
+       e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1);
+       sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
+}
+
 /*
  * Determine if we were loaded by an EFI loader.  If so, then we have also been
  * passed the efi memmap, systab, etc., so we should use these data structures
@@ -813,7 +830,7 @@ void __init setup_arch(char **cmdline_p)
        insert_resource(&iomem_resource, &data_resource);
        insert_resource(&iomem_resource, &bss_resource);
 
-
+       trim_bios_range();
 #ifdef CONFIG_X86_32
        if (ppro_with_ram_bug()) {
                e820_update_range(0x70000000ULL, 0x40000ULL, E820_RAM,
index 334e63ca7b2b468d096828cd56684604ca3ab0c4..30e068d6462ebf60eef010c12badf4e1d66c5b3c 100644 (file)
@@ -29,22 +29,6 @@ int page_is_ram(unsigned long pagenr)
        resource_size_t addr, end;
        int i;
 
-       /*
-        * A special case is the first 4Kb of memory;
-        * This is a BIOS owned area, not kernel ram, but generally
-        * not listed as such in the E820 table.
-        */
-       if (pagenr == 0)
-               return 0;
-
-       /*
-        * Second special case: Some BIOSen report the PC BIOS
-        * area (640->1Mb) as ram even though it is not.
-        */
-       if (pagenr >= (BIOS_BEGIN >> PAGE_SHIFT) &&
-                   pagenr < (BIOS_END >> PAGE_SHIFT))
-               return 0;
-
        for (i = 0; i < e820.nr_map; i++) {
                /*
                 * Not usable memory: