提交 3def3d6d 编写于 作者: Y Yinghai Lu 提交者: Ingo Molnar

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: NYinghai Lu <yinghai.lu@sun.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 700efc1b
...@@ -229,8 +229,7 @@ unsigned long __init e820_end_of_ram(void) ...@@ -229,8 +229,7 @@ unsigned long __init e820_end_of_ram(void)
/* /*
* Mark e820 reserved areas as busy for the resource manager. * Mark e820 reserved areas as busy for the resource manager.
*/ */
void __init e820_reserve_resources(struct resource *code_resource, void __init e820_reserve_resources(void)
struct resource *data_resource, struct resource *bss_resource)
{ {
int i; int i;
for (i = 0; i < e820.nr_map; i++) { for (i = 0; i < e820.nr_map; i++) {
...@@ -245,21 +244,7 @@ void __init e820_reserve_resources(struct resource *code_resource, ...@@ -245,21 +244,7 @@ void __init e820_reserve_resources(struct resource *code_resource,
res->start = e820.map[i].addr; res->start = e820.map[i].addr;
res->end = res->start + e820.map[i].size - 1; res->end = res->start + e820.map[i].size - 1;
res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
request_resource(&iomem_resource, res); insert_resource(&iomem_resource, res);
if (e820.map[i].type == E820_RAM) {
/*
* We don't know which RAM region contains kernel data,
* so we try it repeatedly and let the resource manager
* test it.
*/
request_resource(res, code_resource);
request_resource(res, data_resource);
request_resource(res, bss_resource);
#ifdef CONFIG_KEXEC
if (crashk_res.start != crashk_res.end)
request_resource(res, &crashk_res);
#endif
}
} }
} }
......
...@@ -248,6 +248,7 @@ static void __init reserve_crashkernel(void) ...@@ -248,6 +248,7 @@ static void __init reserve_crashkernel(void)
(unsigned long)(total_mem >> 20)); (unsigned long)(total_mem >> 20));
crashk_res.start = crash_base; crashk_res.start = crash_base;
crashk_res.end = crash_base + crash_size - 1; crashk_res.end = crash_base + crash_size - 1;
insert_resource(&iomem_resource, &crashk_res);
} }
} }
#else #else
...@@ -322,6 +323,11 @@ void __init setup_arch(char **cmdline_p) ...@@ -322,6 +323,11 @@ void __init setup_arch(char **cmdline_p)
finish_e820_parsing(); finish_e820_parsing();
/* after parse_early_param, so could debug it */
insert_resource(&iomem_resource, &code_resource);
insert_resource(&iomem_resource, &data_resource);
insert_resource(&iomem_resource, &bss_resource);
early_gart_iommu_check(); early_gart_iommu_check();
e820_register_active_regions(0, 0, -1UL); e820_register_active_regions(0, 0, -1UL);
...@@ -454,7 +460,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -454,7 +460,7 @@ void __init setup_arch(char **cmdline_p)
/* /*
* We trust e820 completely. No explicit ROM probing in memory. * We trust e820 completely. No explicit ROM probing in memory.
*/ */
e820_reserve_resources(&code_resource, &data_resource, &bss_resource); e820_reserve_resources();
e820_mark_nosave_regions(); e820_mark_nosave_regions();
/* request I/O space for devices used on all i[345]86 PCs */ /* request I/O space for devices used on all i[345]86 PCs */
......
...@@ -23,8 +23,7 @@ extern void update_memory_range(u64 start, u64 size, unsigned old_type, ...@@ -23,8 +23,7 @@ extern void update_memory_range(u64 start, u64 size, unsigned old_type,
extern void setup_memory_region(void); extern void setup_memory_region(void);
extern void contig_e820_setup(void); extern void contig_e820_setup(void);
extern unsigned long e820_end_of_ram(void); extern unsigned long e820_end_of_ram(void);
extern void e820_reserve_resources(struct resource *code_resource, extern void e820_reserve_resources(void);
struct resource *data_resource, struct resource *bss_resource);
extern void e820_mark_nosave_regions(void); extern void e820_mark_nosave_regions(void);
extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type); extern int e820_any_mapped(unsigned long start, unsigned long end, unsigned type);
extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type); extern int e820_all_mapped(unsigned long start, unsigned long end, unsigned type);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册