diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2005-08-03 06:21:26 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-08-28 20:53:37 -0400 |
commit | 71e1f55ad4bc4c8bcfe696400a950a34263a750e (patch) | |
tree | d8355e0b1302b201114c9998570c0a4ee7a26fcc /arch/ppc64 | |
parent | 180379dcefb39e8bd05d562b0685e9084dffcc0a (diff) |
[PATCH] ppc64: Simplify some lmb functions
lmb_phys_mem_size() can always return lmb.memory.size, as long as it's called
after lmb_analyze(), which it is. There's no need to recalculate the size on
every call.
lmb_analyze() was calculating a few things we then threw away, so just don't
calculate them to start with.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/ppc64')
-rw-r--r-- | arch/ppc64/kernel/lmb.c | 27 |
1 files changed, 5 insertions, 22 deletions
diff --git a/arch/ppc64/kernel/lmb.c b/arch/ppc64/kernel/lmb.c index 6ed6312d848f..5adaca2ddc9d 100644 --- a/arch/ppc64/kernel/lmb.c +++ b/arch/ppc64/kernel/lmb.c | |||
@@ -119,20 +119,12 @@ lmb_init(void) | |||
119 | void __init | 119 | void __init |
120 | lmb_analyze(void) | 120 | lmb_analyze(void) |
121 | { | 121 | { |
122 | unsigned long i; | 122 | int i; |
123 | unsigned long mem_size = 0; | ||
124 | unsigned long size_mask = 0; | ||
125 | |||
126 | for (i=0; i < lmb.memory.cnt; i++) { | ||
127 | unsigned long lmb_size; | ||
128 | 123 | ||
129 | lmb_size = lmb.memory.region[i].size; | 124 | lmb.memory.size = 0; |
130 | 125 | ||
131 | mem_size += lmb_size; | 126 | for (i = 0; i < lmb.memory.cnt; i++) |
132 | size_mask |= lmb_size; | 127 | lmb.memory.size += lmb.memory.region[i].size; |
133 | } | ||
134 | |||
135 | lmb.memory.size = mem_size; | ||
136 | } | 128 | } |
137 | 129 | ||
138 | /* This routine called with relocation disabled. */ | 130 | /* This routine called with relocation disabled. */ |
@@ -266,20 +258,11 @@ lmb_alloc_base(unsigned long size, unsigned long align, unsigned long max_addr) | |||
266 | return base; | 258 | return base; |
267 | } | 259 | } |
268 | 260 | ||
261 | /* You must call lmb_analyze() before this. */ | ||
269 | unsigned long __init | 262 | unsigned long __init |
270 | lmb_phys_mem_size(void) | 263 | lmb_phys_mem_size(void) |
271 | { | 264 | { |
272 | #ifdef CONFIG_MSCHUNKS | ||
273 | return lmb.memory.size; | 265 | return lmb.memory.size; |
274 | #else | ||
275 | unsigned long total = 0; | ||
276 | int i; | ||
277 | |||
278 | /* add all physical memory to the bootmem map */ | ||
279 | for (i=0; i < lmb.memory.cnt; i++) | ||
280 | total += lmb.memory.region[i].size; | ||
281 | return total; | ||
282 | #endif /* CONFIG_MSCHUNKS */ | ||
283 | } | 266 | } |
284 | 267 | ||
285 | unsigned long __init | 268 | unsigned long __init |