[PATCH 31/37] x86: Change e820_saved to __initdata

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yinghai Lu
Date: Tuesday, June 15, 2010 - 10:42 pm

for 2.6.34

Add save_e820_map() and change e820_saved to static
also make it to be __initdata to get some bytes memory back.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/x86/include/asm/e820.h |    2 +-
 arch/x86/kernel/e820.c      |    9 +++++++--
 arch/x86/kernel/setup.c     |    2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/e820.h b/arch/x86/include/asm/e820.h
index 25962e1..334281f 100644
--- a/arch/x86/include/asm/e820.h
+++ b/arch/x86/include/asm/e820.h
@@ -75,7 +75,6 @@ struct e820map {
 #ifdef __KERNEL__
 /* see comment in arch/x86/kernel/e820.c */
 extern struct e820map e820;
-extern struct e820map e820_saved;
 
 extern unsigned long pci_mem_start;
 extern int e820_any_mapped(u64 start, u64 end, unsigned type);
@@ -83,6 +82,7 @@ extern int e820_all_mapped(u64 start, u64 end, unsigned type);
 extern void e820_add_region(u64 start, u64 size, int type);
 extern void e820_print_map(char *who);
 int sanitize_e820_map(void);
+void save_e820_map(void);
 extern u64 e820_update_range(u64 start, u64 size, unsigned old_type,
 			       unsigned new_type);
 extern u64 e820_remove_range(u64 start, u64 size, unsigned old_type,
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 6d85399..63b46ac 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -36,7 +36,7 @@
  * next kernel with full memory.
  */
 struct e820map e820;
-struct e820map e820_saved;
+static struct e820map __initdata e820_saved;
 
 /* For PCI or other memory-mapped resources */
 unsigned long pci_mem_start = 0xaeedbabe;
@@ -1072,12 +1072,17 @@ char *__init default_machine_specific_memory_setup(void)
 	return who;
 }
 
+void __init save_e820_map(void)
+{
+	memcpy(&e820_saved, &e820, sizeof(struct e820map));
+}
+
 void __init setup_memory_map(void)
 {
 	char *who;
 
 	who = x86_init.resources.memory_setup();
-	memcpy(&e820_saved, &e820, sizeof(struct e820map));
+	save_e820_map();
 	printk(KERN_INFO "BIOS-provided physical RAM map:\n");
 	e820_print_map(who);
 }
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 30cbf8c..dc6b77b 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -463,7 +463,7 @@ static void __init e820_reserve_setup_data(void)
 		return;
 
 	sanitize_e820_map();
-	memcpy(&e820_saved, &e820, sizeof(struct e820map));
+	save_e820_map();
 	printk(KERN_INFO "extended physical RAM map:\n");
 	e820_print_map("reserve setup_data");
 }
-- 
1.6.4.2

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -v18 00/37] Use lmb with x86, Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 04/37] lmb: Export LMB_ERROR again, Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 07/37] lmb: Add lmb_find_in_range(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 08/37] x86, lmb: Add lmb_find_in_range_size(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 10/37] x86, lmb: Add lmb_to_bootmem(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 14/37] lmb: Add find_memory_core_early(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 15/37] x86, lmb: Add lmb_find_in_range_node(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 16/37] x86, lmb: Add lmb_free_memory_in_range(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 17/37] x86, lmb: Add lmb_memory_in_range(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 20/37] x86: Use lmb to replace early_res, Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 22/37] x86: Remove not used early_res code, Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 30/37] x86: Add sanitize_e820_map(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 31/37] x86: Change e820_saved to __initdata, Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 32/37] x86: Align e820 ram range to page, Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 34/37] x86: Add get_centaur_ram_top(), Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 35/37] x86: Change e820_any_mapped() to __init, Yinghai Lu, (Tue Jun 15, 10:42 pm)
[PATCH 37/37] x86: make e820 to be __initdata, Yinghai Lu, (Tue Jun 15, 10:42 pm)
Re: [PATCH -v18 00/37] Use lmb with x86, Linus Torvalds, (Tue Jun 15, 11:10 pm)
Re: [PATCH -v18 00/37] Use lmb with x86, Benjamin Herrenschmidt, (Wed Jun 16, 1:41 am)
Re: [PATCH -v18 00/37] Use lmb with x86, Yinghai Lu, (Wed Jun 16, 8:43 am)