aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/mm/lmb.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/mm/lmb.c')
-rw-r--r--arch/powerpc/mm/lmb.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c
index 9584608fd768..874cd103ce6e 100644
--- a/arch/powerpc/mm/lmb.c
+++ b/arch/powerpc/mm/lmb.c
@@ -31,6 +31,8 @@
31#define DBG(fmt...) 31#define DBG(fmt...)
32#endif 32#endif
33 33
34#define LMB_ALLOC_ANYWHERE 0
35
34struct lmb lmb; 36struct lmb lmb;
35 37
36void lmb_dump_all(void) 38void lmb_dump_all(void)
@@ -197,6 +199,8 @@ long __init lmb_reserve(unsigned long base, unsigned long size)
197{ 199{
198 struct lmb_region *_rgn = &(lmb.reserved); 200 struct lmb_region *_rgn = &(lmb.reserved);
199 201
202 BUG_ON(0 == size);
203
200 return lmb_add_region(_rgn, base, size); 204 return lmb_add_region(_rgn, base, size);
201} 205}
202 206
@@ -224,9 +228,25 @@ unsigned long __init lmb_alloc(unsigned long size, unsigned long align)
224unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align, 228unsigned long __init lmb_alloc_base(unsigned long size, unsigned long align,
225 unsigned long max_addr) 229 unsigned long max_addr)
226{ 230{
231 unsigned long alloc;
232
233 alloc = __lmb_alloc_base(size, align, max_addr);
234
235 if (alloc < 0)
236 panic("ERROR: Failed to allocate 0x%lx bytes below 0x%lx.\n",
237 size, max_addr);
238
239 return alloc;
240}
241
242unsigned long __init __lmb_alloc_base(unsigned long size, unsigned long align,
243 unsigned long max_addr)
244{
227 long i, j; 245 long i, j;
228 unsigned long base = 0; 246 unsigned long base = 0;
229 247
248 BUG_ON(0 == size);
249
230#ifdef CONFIG_PPC32 250#ifdef CONFIG_PPC32
231 /* On 32-bit, make sure we allocate lowmem */ 251 /* On 32-bit, make sure we allocate lowmem */
232 if (max_addr == LMB_ALLOC_ANYWHERE) 252 if (max_addr == LMB_ALLOC_ANYWHERE)