aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/e820.c
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-05-20 23:10:58 -0400
committerThomas Gleixner <tglx@linutronix.de>2008-05-25 05:35:53 -0400
commitbf62f3981c7076714e3b9f5fa6989a806cad02bf (patch)
tree8c47942af4b670d6381e853ff22f085b336ebc68 /arch/x86/kernel/e820.c
parentaafbdf71f1d3aeffd679b1a86e1b28f71515856c (diff)
x86: move e820_mark_nosave_regions to e820.c
and make e820_mark_nosave_regions to take limit_pfn to use max_low_pfn for 32bit and end_pfn for 64bit Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/e820.c')
-rw-r--r--arch/x86/kernel/e820.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 35da8cdbe5e6..0cd9132c9450 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -18,6 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/pfn.h> 20#include <linux/pfn.h>
21#include <linux/suspend.h>
21 22
22#include <asm/pgtable.h> 23#include <asm/pgtable.h>
23#include <asm/page.h> 24#include <asm/page.h>
@@ -495,6 +496,37 @@ __init void e820_setup_gap(void)
495 pci_mem_start, gapstart, gapsize); 496 pci_mem_start, gapstart, gapsize);
496} 497}
497 498
499#if defined(CONFIG_X86_64) || \
500 (defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
501/**
502 * Find the ranges of physical addresses that do not correspond to
503 * e820 RAM areas and mark the corresponding pages as nosave for
504 * hibernation (32 bit) or software suspend and suspend to RAM (64 bit).
505 *
506 * This function requires the e820 map to be sorted and without any
507 * overlapping entries and assumes the first e820 area to be RAM.
508 */
509void __init e820_mark_nosave_regions(unsigned long limit_pfn)
510{
511 int i;
512 unsigned long pfn;
513
514 pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
515 for (i = 1; i < e820.nr_map; i++) {
516 struct e820entry *ei = &e820.map[i];
517
518 if (pfn < PFN_UP(ei->addr))
519 register_nosave_region(pfn, PFN_UP(ei->addr));
520
521 pfn = PFN_DOWN(ei->addr + ei->size);
522 if (ei->type != E820_RAM)
523 register_nosave_region(PFN_UP(ei->addr), pfn);
524
525 if (pfn >= limit_pfn)
526 break;
527 }
528}
529#endif
498 530
499/* 531/*
500 * Early reserved memory areas. 532 * Early reserved memory areas.