aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-18 20:27:08 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-08 04:39:01 -0400
commit95a71a45c250177854f7c530810c88a8a19a443b (patch)
tree9a063a825cdc5d088973ad06b7cecfb789c3a0dd
parent66a6f8d539416c9664f3a04ecb12f55a0097ab8c (diff)
x86: cleanup machine_specific_memory_setup, v2
1. let 64bit support 88 and e801 too 2. introduce default_machine_specific_memory_setup, and reuse it for voyager v2: fix 64 bit compiling Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/e820.c13
-rw-r--r--arch/x86/mach-voyager/setup.c32
-rw-r--r--include/asm-x86/e820.h3
-rw-r--r--include/asm-x86/setup.h3
4 files changed, 11 insertions, 40 deletions
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 49477484a2fa..7b613d2efb04 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1029,7 +1029,7 @@ void __init e820_reserve_resources(void)
1029 } 1029 }
1030} 1030}
1031 1031
1032char *__init __attribute__((weak)) machine_specific_memory_setup(void) 1032char *__init default_machine_specific_memory_setup(void)
1033{ 1033{
1034 char *who = "BIOS-e820"; 1034 char *who = "BIOS-e820";
1035 int new_nr; 1035 int new_nr;
@@ -1045,10 +1045,7 @@ char *__init __attribute__((weak)) machine_specific_memory_setup(void)
1045 &new_nr); 1045 &new_nr);
1046 boot_params.e820_entries = new_nr; 1046 boot_params.e820_entries = new_nr;
1047 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) { 1047 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries) < 0) {
1048#ifdef CONFIG_X86_64 1048 u64 mem_size;
1049 early_panic("Cannot find a valid memory map");
1050#else
1051 unsigned long mem_size;
1052 1049
1053 /* compare results from other methods and take the greater */ 1050 /* compare results from other methods and take the greater */
1054 if (boot_params.alt_mem_k 1051 if (boot_params.alt_mem_k
@@ -1063,13 +1060,17 @@ char *__init __attribute__((weak)) machine_specific_memory_setup(void)
1063 e820.nr_map = 0; 1060 e820.nr_map = 0;
1064 e820_add_region(0, LOWMEMSIZE(), E820_RAM); 1061 e820_add_region(0, LOWMEMSIZE(), E820_RAM);
1065 e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM); 1062 e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
1066#endif
1067 } 1063 }
1068 1064
1069 /* In case someone cares... */ 1065 /* In case someone cares... */
1070 return who; 1066 return who;
1071} 1067}
1072 1068
1069char *__init __attribute__((weak)) machine_specific_memory_setup(void)
1070{
1071 return default_machine_specific_memory_setup();
1072}
1073
1073/* Overridden in paravirt.c if CONFIG_PARAVIRT */ 1074/* Overridden in paravirt.c if CONFIG_PARAVIRT */
1074char * __init __attribute__((weak)) memory_setup(void) 1075char * __init __attribute__((weak)) memory_setup(void)
1075{ 1076{
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index f27b583154e5..6bbdd633864c 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -104,35 +104,5 @@ char *__init machine_specific_memory_setup(void)
104 return who; 104 return who;
105 } 105 }
106 106
107 who = "BIOS-e820"; 107 return default_machine_specific_memory_setup();
108
109 /*
110 * Try to copy the BIOS-supplied E820-map.
111 *
112 * Otherwise fake a memory map; one section from 0k->640k,
113 * the next section from 1mb->appropriate_mem_k
114 */
115 new_nr = boot_params.e820_entries;
116 sanitize_e820_map(boot_params.e820_map,
117 ARRAY_SIZE(boot_params.e820_map),
118 &new_nr);
119 boot_params.e820_entries = new_nr;
120 if (copy_e820_map(boot_params.e820_map, boot_params.e820_entries)
121 < 0) {
122 unsigned long mem_size;
123
124 /* compare results from other methods and take the greater */
125 if (boot_params.alt_mem_k < boot_params.screen_info.ext_mem_k) {
126 mem_size = boot_params.screen_info.ext_mem_k;
127 who = "BIOS-88";
128 } else {
129 mem_size = boot_params.alt_mem_k;
130 who = "BIOS-e801";
131 }
132
133 e820.nr_map = 0;
134 e820_add_region(0, LOWMEMSIZE(), E820_RAM);
135 e820_add_region(HIGH_MEMORY, mem_size << 10, E820_RAM);
136 }
137 return who;
138} 108}
diff --git a/include/asm-x86/e820.h b/include/asm-x86/e820.h
index 83144cb6c68d..668a0d743d25 100644
--- a/include/asm-x86/e820.h
+++ b/include/asm-x86/e820.h
@@ -102,6 +102,7 @@ extern u64 e820_hole_size(u64 start, u64 end);
102extern void finish_e820_parsing(void); 102extern void finish_e820_parsing(void);
103extern void e820_reserve_resources(void); 103extern void e820_reserve_resources(void);
104extern void setup_memory_map(void); 104extern void setup_memory_map(void);
105extern char *default_machine_specific_memory_setup(void);
105extern char *machine_specific_memory_setup(void); 106extern char *machine_specific_memory_setup(void);
106extern char *memory_setup(void); 107extern char *memory_setup(void);
107 108
@@ -116,9 +117,7 @@ extern char *memory_setup(void);
116#ifdef __KERNEL__ 117#ifdef __KERNEL__
117#include <linux/ioport.h> 118#include <linux/ioport.h>
118 119
119#ifdef CONFIG_X86_32
120#define HIGH_MEMORY (1024*1024) 120#define HIGH_MEMORY (1024*1024)
121#endif
122#endif /* __KERNEL__ */ 121#endif /* __KERNEL__ */
123 122
124#endif /* __ASM_E820_H */ 123#endif /* __ASM_E820_H */
diff --git a/include/asm-x86/setup.h b/include/asm-x86/setup.h
index b676b0be7986..e14b6e73d266 100644
--- a/include/asm-x86/setup.h
+++ b/include/asm-x86/setup.h
@@ -42,13 +42,14 @@ void vsmp_init(void);
42 */ 42 */
43extern struct boot_params boot_params; 43extern struct boot_params boot_params;
44 44
45#ifdef __i386__
46/* 45/*
47 * Do NOT EVER look at the BIOS memory size location. 46 * Do NOT EVER look at the BIOS memory size location.
48 * It does not work on many machines. 47 * It does not work on many machines.
49 */ 48 */
50#define LOWMEMSIZE() (0x9f000) 49#define LOWMEMSIZE() (0x9f000)
51 50
51#ifdef __i386__
52
52void __init i386_start_kernel(void); 53void __init i386_start_kernel(void);
53 54
54extern unsigned long init_pg_tables_start; 55extern unsigned long init_pg_tables_start;