x86: move e820_mark_nosave_regions to e820.c
authorYinghai Lu <yhlu.kernel@gmail.com>
Wed, 21 May 2008 03:10:58 +0000 (20:10 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Sun, 25 May 2008 09:35:53 +0000 (11:35 +0200)
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>
arch/x86/kernel/e820.c
arch/x86/kernel/e820_32.c
arch/x86/kernel/e820_64.c
arch/x86/kernel/setup_32.c
arch/x86/kernel/setup_64.c
include/asm-x86/e820.h
include/asm-x86/e820_32.h
include/asm-x86/e820_64.h

index 35da8cdbe5e666dae6961ccc952b313fc17e5c93..0cd9132c9450f276cf3502b1f69940909ad9ced8 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/pfn.h>
+#include <linux/suspend.h>
 
 #include <asm/pgtable.h>
 #include <asm/page.h>
@@ -495,6 +496,37 @@ __init void e820_setup_gap(void)
               pci_mem_start, gapstart, gapsize);
 }
 
+#if defined(CONFIG_X86_64) || \
+       (defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
+/**
+ * Find the ranges of physical addresses that do not correspond to
+ * e820 RAM areas and mark the corresponding pages as nosave for
+ * hibernation (32 bit) or software suspend and suspend to RAM (64 bit).
+ *
+ * This function requires the e820 map to be sorted and without any
+ * overlapping entries and assumes the first e820 area to be RAM.
+ */
+void __init e820_mark_nosave_regions(unsigned long limit_pfn)
+{
+       int i;
+       unsigned long pfn;
+
+       pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
+       for (i = 1; i < e820.nr_map; i++) {
+               struct e820entry *ei = &e820.map[i];
+
+               if (pfn < PFN_UP(ei->addr))
+                       register_nosave_region(pfn, PFN_UP(ei->addr));
+
+               pfn = PFN_DOWN(ei->addr + ei->size);
+               if (ei->type != E820_RAM)
+                       register_nosave_region(PFN_UP(ei->addr), pfn);
+
+               if (pfn >= limit_pfn)
+                       break;
+       }
+}
+#endif
 
 /*
  * Early reserved memory areas.
index dfe25751038b5b2640c554ab3717f8a3cdda4b61..db760d4706af6eff0159df93d7aa23e1f621b43f 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/mm.h>
 #include <linux/pfn.h>
 #include <linux/uaccess.h>
-#include <linux/suspend.h>
 
 #include <asm/pgtable.h>
 #include <asm/page.h>
@@ -208,37 +207,6 @@ void __init init_iomem_resources(struct resource *code_resource,
        }
 }
 
-#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
-/**
- * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
- * correspond to e820 RAM areas and mark the corresponding pages as nosave for
- * hibernation.
- *
- * This function requires the e820 map to be sorted and without any
- * overlapping entries and assumes the first e820 area to be RAM.
- */
-void __init e820_mark_nosave_regions(void)
-{
-       int i;
-       unsigned long pfn;
-
-       pfn = PFN_DOWN(e820.map[0].addr + e820.map[0].size);
-       for (i = 1; i < e820.nr_map; i++) {
-               struct e820entry *ei = &e820.map[i];
-
-               if (pfn < PFN_UP(ei->addr))
-                       register_nosave_region(pfn, PFN_UP(ei->addr));
-
-               pfn = PFN_DOWN(ei->addr + ei->size);
-               if (ei->type != E820_RAM)
-                       register_nosave_region(PFN_UP(ei->addr), pfn);
-
-               if (pfn >= max_low_pfn)
-                       break;
-       }
-}
-#endif
-
 /*
  * Find the highest page frame number we have available
  */
index 3b2e0b1bb49b65a76234c79512b625cefc9abe9a..5e063e72b24a10c38b2c627bd1e8a9129da9810c 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/kexec.h>
 #include <linux/module.h>
 #include <linux/mm.h>
-#include <linux/suspend.h>
 #include <linux/pfn.h>
 #include <linux/pci.h>
 
@@ -93,37 +92,6 @@ void __init e820_reserve_resources(void)
        }
 }
 
-/*
- * Find the ranges of physical addresses that do not correspond to
- * e820 RAM areas and mark the corresponding pages as nosave for software
- * suspend and suspend to RAM.
- *
- * This function requires the e820 map to be sorted and without any
- * overlapping entries and assumes the first e820 area to be RAM.
- */
-void __init e820_mark_nosave_regions(void)
-{
-       int i;
-       unsigned long paddr;
-
-       paddr = round_down(e820.map[0].addr + e820.map[0].size, PAGE_SIZE);
-       for (i = 1; i < e820.nr_map; i++) {
-               struct e820entry *ei = &e820.map[i];
-
-               if (paddr < ei->addr)
-                       register_nosave_region(PFN_DOWN(paddr),
-                                               PFN_UP(ei->addr));
-
-               paddr = round_down(ei->addr + ei->size, PAGE_SIZE);
-               if (ei->type != E820_RAM)
-                       register_nosave_region(PFN_UP(ei->addr),
-                                               PFN_DOWN(paddr));
-
-               if (paddr >= (end_pfn << PAGE_SHIFT))
-                       break;
-       }
-}
-
 /*
  * Finds an active region in the address range from start_pfn to last_pfn and
  * returns its range in ei_startpfn and ei_endpfn for the e820 entry.
index 3c451d143ebab6e872eb14793a2cd99a8a942bd9..e1173aecf69a705a6d3f2311da8b137c55c912ea 100644 (file)
@@ -820,7 +820,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
        e820_setup_gap();
-       e820_mark_nosave_regions();
+       e820_mark_nosave_regions(max_low_pfn);
 
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
index 6dff1286ad8adec4b9fc6bb7808c3a233c476fd2..975a5da46e49312f62644e9283959a416e1dec70 100644 (file)
@@ -516,7 +516,7 @@ void __init setup_arch(char **cmdline_p)
         * We trust e820 completely. No explicit ROM probing in memory.
         */
        e820_reserve_resources();
-       e820_mark_nosave_regions();
+       e820_mark_nosave_regions(end_pfn);
 
        /* request I/O space for devices used on all i[345]86 PCs */
        for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
index 5a58e2bb1d78eba5f40b370ced1a41f16eb7d341..4266a2c5f2e842e617e61627de0b3a1fa0b49eb3 100644 (file)
@@ -70,6 +70,15 @@ extern u64 update_memory_range(u64 start, u64 size, unsigned old_type,
 extern void update_e820(void);
 extern void e820_setup_gap(void);
 
+#if defined(CONFIG_X86_64) || \
+       (defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))
+extern void e820_mark_nosave_regions(unsigned long limit_pfn);
+#else
+static inline void e820_mark_nosave_regions(unsigned long limit_pfn)
+{
+}
+#endif
+
 extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
 extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
 extern void reserve_early(u64 start, u64 end, char *name);
index 9576b438fbd955b34f1809db65b9723ca6dedbcb..7ace82570a36033831c7688f83990e49c6adca9a 100644 (file)
@@ -28,13 +28,5 @@ extern void init_iomem_resources(struct resource *code_resource,
                                 struct resource *data_resource,
                                 struct resource *bss_resource);
 
-#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
-extern void e820_mark_nosave_regions(void);
-#else
-static inline void e820_mark_nosave_regions(void)
-{
-}
-#endif
-
 #endif/*!__ASSEMBLY__*/
 #endif/*__E820_HEADER*/
index 37f176a02bc6f50d7f60ddfbc0488fbe1ee12e48..917963ccab69e58cb812c7b1dd441028b413522e 100644 (file)
@@ -18,7 +18,6 @@ extern void setup_memory_region(void);
 extern void contig_e820_setup(void);
 extern unsigned long e820_end_of_ram(void);
 extern void e820_reserve_resources(void);
-extern void e820_mark_nosave_regions(void);
 extern int e820_any_non_reserved(unsigned long start, unsigned long end);
 extern int is_memory_any_valid(unsigned long start, unsigned long end);
 extern int e820_all_non_reserved(unsigned long start, unsigned long end);
This page took 0.032639 seconds and 5 git commands to generate.