aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinghai Lu <Yinghai.Lu@Sun.COM>2008-02-22 20:07:16 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:40:49 -0400
commit3def3d6ddf43dbe20c00c3cbc38dfacc8586998f (patch)
tree0d9b56966bc5c525d9d3a1be66e8ccd9d476e589
parent700efc1b9f6afe34caae231b87d129ad8ffb559f (diff)
x86: clean up e820_reserve_resources on 64-bit
e820_resource_resources could use insert_resource instead of request_resource also move code_resource, data_resource, bss_resource, and crashk_res out of e820_reserve_resources. Signed-off-by: Yinghai Lu <yinghai.lu@sun.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/e820_64.c19
-rw-r--r--arch/x86/kernel/setup_64.c8
-rw-r--r--include/asm-x86/e820_64.h3
3 files changed, 10 insertions, 20 deletions
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index a8694a35352b..8b914a833ac6 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -229,8 +229,7 @@ unsigned long __init e820_end_of_ram(void)
229/* 229/*
230 * Mark e820 reserved areas as busy for the resource manager. 230 * Mark e820 reserved areas as busy for the resource manager.
231 */ 231 */
232void __init e820_reserve_resources(struct resource *code_resource, 232void __init e820_reserve_resources(void)
233 struct resource *data_resource, struct resource *bss_resource)
234{ 233{
235 int i; 234 int i;
236 for (i = 0; i < e820.nr_map; i++) { 235 for (i = 0; i < e820.nr_map; i++) {
@@ -245,21 +244,7 @@ void __init e820_reserve_resources(struct resource *code_resource,
245 res->start = e820.map[i].addr; 244 res->start = e820.map[i].addr;
246 res->end = res->start + e820.map[i].size - 1; 245 res->end = res->start + e820.map[i].size - 1;
247 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 246 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
248 request_resource(&iomem_resource, res); 247 insert_resource(&iomem_resource, res);
249 if (e820.map[i].type == E820_RAM) {
250 /*
251 * We don't know which RAM region contains kernel data,
252 * so we try it repeatedly and let the resource manager
253 * test it.
254 */
255 request_resource(res, code_resource);
256 request_resource(res, data_resource);
257 request_resource(res, bss_resource);
258#ifdef CONFIG_KEXEC
259 if (crashk_res.start != crashk_res.end)
260 request_resource(res, &crashk_res);
261#endif
262 }
263 } 248 }
264} 249}
265 250
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index 187f084b9491..e3cb3ea96ca1 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -248,6 +248,7 @@ static void __init reserve_crashkernel(void)
248 (unsigned long)(total_mem >> 20)); 248 (unsigned long)(total_mem >> 20));
249 crashk_res.start = crash_base; 249 crashk_res.start = crash_base;
250 crashk_res.end = crash_base + crash_size - 1; 250 crashk_res.end = crash_base + crash_size - 1;
251 insert_resource(&iomem_resource, &crashk_res);
251 } 252 }
252} 253}
253#else 254#else
@@ -322,6 +323,11 @@ void __init setup_arch(char **cmdline_p)
322 323
323 finish_e820_parsing(); 324 finish_e820_parsing();
324 325
326 /* after parse_early_param, so could debug it */
327 insert_resource(&iomem_resource, &code_resource);
328 insert_resource(&iomem_resource, &data_resource);
329 insert_resource(&iomem_resource, &bss_resource);
330
325 early_gart_iommu_check(); 331 early_gart_iommu_check();
326 332
327 e820_register_active_regions(0, 0, -1UL); 333 e820_register_active_regions(0, 0, -1UL);
@@ -454,7 +460,7 @@ void __init setup_arch(char **cmdline_p)
454 /* 460 /*
455 * We trust e820 completely. No explicit ROM probing in memory. 461 * We trust e820 completely. No explicit ROM probing in memory.
456 */ 462 */
457 e820_reserve_resources(&code_resource, &data_resource, &bss_resource); 463 e820_reserve_resources();
458 e820_mark_nosave_regions(); 464 e820_mark_nosave_regions();
459 465
460 /* request I/O space for devices used on all i[345]86 PCs */ 466 /* request I/O space for devices used on all i[345]86 PCs */
diff --git a/include/asm-x86/e820_64.h b/include/asm-x86/e820_64.h
index 9e06c6eb4e27..ef653a403e0b 100644
--- a/include/asm-x86/e820_64.h
+++ b/include/asm-x86/e820_64.h
@@ -23,8 +23,7 @@ extern void update_memory_range(u64 start, u64 size, unsigned old_type,
23extern void setup_memory_region(void); 23extern void setup_memory_region(void);
24extern void contig_e820_setup(void); 24extern void contig_e820_setup(void);
25extern unsigned long e820_end_of_ram(void); 25extern unsigned long e820_end_of_ram(void);
26extern void e820_reserve_resources(struct resource *code_resource, 26extern void e820_reserve_resources(void);
27 struct resource *data_resource, struct resource *bss_resource);
28extern void e820_mark_nosave_regions(void); 27extern void e820_mark_nosave_regions(void);
29extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type); 28extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
30extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type); 29extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);