diff options
-rw-r--r-- | arch/arm/kernel/setup.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 9fed5fa194d9..8cf733daa800 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -395,6 +395,20 @@ static void __init early_initrd(char **p) | |||
395 | } | 395 | } |
396 | __early_param("initrd=", early_initrd); | 396 | __early_param("initrd=", early_initrd); |
397 | 397 | ||
398 | static void __init add_memory(unsigned long start, unsigned long size) | ||
399 | { | ||
400 | /* | ||
401 | * Ensure that start/size are aligned to a page boundary. | ||
402 | * Size is appropriately rounded down, start is rounded up. | ||
403 | */ | ||
404 | size -= start & ~PAGE_MASK; | ||
405 | |||
406 | meminfo.bank[meminfo.nr_banks].start = PAGE_ALIGN(start); | ||
407 | meminfo.bank[meminfo.nr_banks].size = size & PAGE_MASK; | ||
408 | meminfo.bank[meminfo.nr_banks].node = PHYS_TO_NID(start); | ||
409 | meminfo.nr_banks += 1; | ||
410 | } | ||
411 | |||
398 | /* | 412 | /* |
399 | * Pick out the memory size. We look for mem=size@start, | 413 | * Pick out the memory size. We look for mem=size@start, |
400 | * where start and size are "size[KkMm]" | 414 | * where start and size are "size[KkMm]" |
@@ -419,10 +433,7 @@ static void __init early_mem(char **p) | |||
419 | if (**p == '@') | 433 | if (**p == '@') |
420 | start = memparse(*p + 1, p); | 434 | start = memparse(*p + 1, p); |
421 | 435 | ||
422 | meminfo.bank[meminfo.nr_banks].start = start; | 436 | add_memory(start, size); |
423 | meminfo.bank[meminfo.nr_banks].size = size; | ||
424 | meminfo.bank[meminfo.nr_banks].node = PHYS_TO_NID(start); | ||
425 | meminfo.nr_banks += 1; | ||
426 | } | 437 | } |
427 | __early_param("mem=", early_mem); | 438 | __early_param("mem=", early_mem); |
428 | 439 | ||
@@ -564,11 +575,7 @@ static int __init parse_tag_mem32(const struct tag *tag) | |||
564 | tag->u.mem.start, tag->u.mem.size / 1024); | 575 | tag->u.mem.start, tag->u.mem.size / 1024); |
565 | return -EINVAL; | 576 | return -EINVAL; |
566 | } | 577 | } |
567 | meminfo.bank[meminfo.nr_banks].start = tag->u.mem.start; | 578 | add_memory(tag->u.mem.start, tag->u.mem.size); |
568 | meminfo.bank[meminfo.nr_banks].size = tag->u.mem.size; | ||
569 | meminfo.bank[meminfo.nr_banks].node = PHYS_TO_NID(tag->u.mem.start); | ||
570 | meminfo.nr_banks += 1; | ||
571 | |||
572 | return 0; | 579 | return 0; |
573 | } | 580 | } |
574 | 581 | ||