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>
This commit is contained in:
parent
53df8fdc15
commit
1b5576e69a
3 changed files with 26 additions and 17 deletions
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue