diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-03 22:35:04 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-04 06:01:58 -0400 |
commit | 7b2a0a6c4866cac146dcb0433e6984eb19a81335 (patch) | |
tree | d498d35f1281894fddbf39dcfd5c8d848ab87bb9 /arch/x86/kernel/e820_32.c | |
parent | ee0c80fadfa56bf4f9d90c1c023429a6bd8edd69 (diff) |
x86: make 32-bit use e820_register_active_regions()
this way 32-bit is more similar to 64-bit, and smarter e820 and numa.
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/e820_32.c')
-rw-r--r-- | arch/x86/kernel/e820_32.c | 68 |
1 files changed, 3 insertions, 65 deletions
diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c index 0c025d04fc2e..e8a3b968c9fa 100644 --- a/arch/x86/kernel/e820_32.c +++ b/arch/x86/kernel/e820_32.c | |||
@@ -207,69 +207,6 @@ void __init init_iomem_resources(struct resource *code_resource, | |||
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | /* | ||
211 | * Find the highest page frame number we have available | ||
212 | */ | ||
213 | void __init find_max_pfn(void) | ||
214 | { | ||
215 | int i; | ||
216 | |||
217 | max_pfn = 0; | ||
218 | |||
219 | for (i = 0; i < e820.nr_map; i++) { | ||
220 | unsigned long start, end; | ||
221 | /* RAM? */ | ||
222 | if (e820.map[i].type != E820_RAM) | ||
223 | continue; | ||
224 | start = PFN_UP(e820.map[i].addr); | ||
225 | end = PFN_DOWN(e820.map[i].addr + e820.map[i].size); | ||
226 | if (start >= end) | ||
227 | continue; | ||
228 | if (end > max_pfn) | ||
229 | max_pfn = end; | ||
230 | } | ||
231 | } | ||
232 | |||
233 | /* | ||
234 | * Register fully available low RAM pages with the bootmem allocator. | ||
235 | */ | ||
236 | void __init register_bootmem_low_pages(unsigned long max_low_pfn) | ||
237 | { | ||
238 | int i; | ||
239 | |||
240 | for (i = 0; i < e820.nr_map; i++) { | ||
241 | unsigned long curr_pfn, last_pfn, size; | ||
242 | /* | ||
243 | * Reserve usable low memory | ||
244 | */ | ||
245 | if (e820.map[i].type != E820_RAM) | ||
246 | continue; | ||
247 | /* | ||
248 | * We are rounding up the start address of usable memory: | ||
249 | */ | ||
250 | curr_pfn = PFN_UP(e820.map[i].addr); | ||
251 | if (curr_pfn >= max_low_pfn) | ||
252 | continue; | ||
253 | /* | ||
254 | * ... and at the end of the usable range downwards: | ||
255 | */ | ||
256 | last_pfn = PFN_DOWN(e820.map[i].addr + e820.map[i].size); | ||
257 | |||
258 | if (last_pfn > max_low_pfn) | ||
259 | last_pfn = max_low_pfn; | ||
260 | |||
261 | /* | ||
262 | * .. finally, did all the rounding and playing | ||
263 | * around just make the area go away? | ||
264 | */ | ||
265 | if (last_pfn <= curr_pfn) | ||
266 | continue; | ||
267 | |||
268 | size = last_pfn - curr_pfn; | ||
269 | free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | void __init limit_regions(unsigned long long size) | 210 | void __init limit_regions(unsigned long long size) |
274 | { | 211 | { |
275 | unsigned long long current_addr; | 212 | unsigned long long current_addr; |
@@ -360,8 +297,9 @@ static int __init parse_memmap(char *arg) | |||
360 | * size before original memory map is | 297 | * size before original memory map is |
361 | * reset. | 298 | * reset. |
362 | */ | 299 | */ |
363 | find_max_pfn(); | 300 | e820_register_active_regions(0, 0, -1UL); |
364 | saved_max_pfn = max_pfn; | 301 | saved_max_pfn = e820_end_of_ram(); |
302 | remove_all_active_ranges(); | ||
365 | #endif | 303 | #endif |
366 | e820.nr_map = 0; | 304 | e820.nr_map = 0; |
367 | user_defined_memmap = 1; | 305 | user_defined_memmap = 1; |