diff options
author | Magnus Damm <magnus.damm@gmail.com> | 2008-04-23 07:56:44 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-05-08 06:51:51 -0400 |
commit | 0146ba78b9339c27ed12545f9bdc208604354bb3 (patch) | |
tree | 1866ff99bce81899a671727a90d22b09372f8ebf /arch/sh | |
parent | 3d83984e99d80672b1d2e3c7dfdd393631883428 (diff) |
sh: add memory resources to /proc/iomem
Add physical memory resources such as System RAM, Kernel code/data/bss
and reserved crash dump area to /proc/iomem. Same strategy as on x86.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r-- | arch/sh/kernel/setup.c | 38 | ||||
-rw-r--r-- | arch/sh/mm/numa.c | 2 |
2 files changed, 38 insertions, 2 deletions
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index c9fb912a78e2..516bde9c50fa 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c | |||
@@ -87,6 +87,8 @@ EXPORT_SYMBOL(memory_start); | |||
87 | unsigned long memory_end = 0; | 87 | unsigned long memory_end = 0; |
88 | EXPORT_SYMBOL(memory_end); | 88 | EXPORT_SYMBOL(memory_end); |
89 | 89 | ||
90 | static struct resource mem_resources[MAX_NUMNODES]; | ||
91 | |||
90 | int l1i_cache_shape, l1d_cache_shape, l2_cache_shape; | 92 | int l1i_cache_shape, l1d_cache_shape, l2_cache_shape; |
91 | 93 | ||
92 | static int __init early_parse_mem(char *p) | 94 | static int __init early_parse_mem(char *p) |
@@ -175,6 +177,40 @@ static inline void __init reserve_crashkernel(void) | |||
175 | {} | 177 | {} |
176 | #endif | 178 | #endif |
177 | 179 | ||
180 | void __init __add_active_range(unsigned int nid, unsigned long start_pfn, | ||
181 | unsigned long end_pfn) | ||
182 | { | ||
183 | struct resource *res = &mem_resources[nid]; | ||
184 | |||
185 | WARN_ON(res->name); /* max one active range per node for now */ | ||
186 | |||
187 | res->name = "System RAM"; | ||
188 | res->start = start_pfn << PAGE_SHIFT; | ||
189 | res->end = (end_pfn << PAGE_SHIFT) - 1; | ||
190 | res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
191 | if (request_resource(&iomem_resource, res)) { | ||
192 | pr_err("unable to request memory_resource 0x%lx 0x%lx\n", | ||
193 | start_pfn, end_pfn); | ||
194 | return; | ||
195 | } | ||
196 | |||
197 | /* | ||
198 | * We don't know which RAM region contains kernel data, | ||
199 | * so we try it repeatedly and let the resource manager | ||
200 | * test it. | ||
201 | */ | ||
202 | request_resource(res, &code_resource); | ||
203 | request_resource(res, &data_resource); | ||
204 | request_resource(res, &bss_resource); | ||
205 | |||
206 | #ifdef CONFIG_KEXEC | ||
207 | if (crashk_res.start != crashk_res.end) | ||
208 | request_resource(res, &crashk_res); | ||
209 | #endif | ||
210 | |||
211 | add_active_range(nid, start_pfn, end_pfn); | ||
212 | } | ||
213 | |||
178 | void __init setup_bootmem_allocator(unsigned long free_pfn) | 214 | void __init setup_bootmem_allocator(unsigned long free_pfn) |
179 | { | 215 | { |
180 | unsigned long bootmap_size; | 216 | unsigned long bootmap_size; |
@@ -187,7 +223,7 @@ void __init setup_bootmem_allocator(unsigned long free_pfn) | |||
187 | bootmap_size = init_bootmem_node(NODE_DATA(0), free_pfn, | 223 | bootmap_size = init_bootmem_node(NODE_DATA(0), free_pfn, |
188 | min_low_pfn, max_low_pfn); | 224 | min_low_pfn, max_low_pfn); |
189 | 225 | ||
190 | add_active_range(0, min_low_pfn, max_low_pfn); | 226 | __add_active_range(0, min_low_pfn, max_low_pfn); |
191 | register_bootmem_low_pages(); | 227 | register_bootmem_low_pages(); |
192 | 228 | ||
193 | node_set_online(0); | 229 | node_set_online(0); |
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 2de7302724fc..1663199ce888 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c | |||
@@ -59,7 +59,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) | |||
59 | free_pfn = start_pfn = start >> PAGE_SHIFT; | 59 | free_pfn = start_pfn = start >> PAGE_SHIFT; |
60 | end_pfn = end >> PAGE_SHIFT; | 60 | end_pfn = end >> PAGE_SHIFT; |
61 | 61 | ||
62 | add_active_range(nid, start_pfn, end_pfn); | 62 | __add_active_range(nid, start_pfn, end_pfn); |
63 | 63 | ||
64 | /* Node-local pgdat */ | 64 | /* Node-local pgdat */ |
65 | NODE_DATA(nid) = pfn_to_kaddr(free_pfn); | 65 | NODE_DATA(nid) = pfn_to_kaddr(free_pfn); |