diff options
Diffstat (limited to 'arch/powerpc/kernel/prom.c')
-rw-r--r-- | arch/powerpc/kernel/prom.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c index fed9bf6187d1..9e3132db718b 100644 --- a/arch/powerpc/kernel/prom.c +++ b/arch/powerpc/kernel/prom.c | |||
@@ -66,6 +66,7 @@ | |||
66 | int __initdata iommu_is_off; | 66 | int __initdata iommu_is_off; |
67 | int __initdata iommu_force_on; | 67 | int __initdata iommu_force_on; |
68 | unsigned long tce_alloc_start, tce_alloc_end; | 68 | unsigned long tce_alloc_start, tce_alloc_end; |
69 | u64 ppc64_rma_size; | ||
69 | #endif | 70 | #endif |
70 | 71 | ||
71 | static int __init early_parse_mem(char *p) | 72 | static int __init early_parse_mem(char *p) |
@@ -98,7 +99,7 @@ static void __init move_device_tree(void) | |||
98 | 99 | ||
99 | if ((memory_limit && (start + size) > memory_limit) || | 100 | if ((memory_limit && (start + size) > memory_limit) || |
100 | overlaps_crashkernel(start, size)) { | 101 | overlaps_crashkernel(start, size)) { |
101 | p = __va(memblock_alloc_base(size, PAGE_SIZE, memblock.rmo_size)); | 102 | p = __va(memblock_alloc(size, PAGE_SIZE)); |
102 | memcpy(p, initial_boot_params, size); | 103 | memcpy(p, initial_boot_params, size); |
103 | initial_boot_params = (struct boot_param_header *)p; | 104 | initial_boot_params = (struct boot_param_header *)p; |
104 | DBG("Moved device tree to 0x%p\n", p); | 105 | DBG("Moved device tree to 0x%p\n", p); |
@@ -363,10 +364,15 @@ static int __init early_init_dt_scan_cpus(unsigned long node, | |||
363 | return 0; | 364 | return 0; |
364 | } | 365 | } |
365 | 366 | ||
366 | void __init early_init_dt_scan_chosen_arch(unsigned long node) | 367 | int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname, |
368 | int depth, void *data) | ||
367 | { | 369 | { |
368 | unsigned long *lprop; | 370 | unsigned long *lprop; |
369 | 371 | ||
372 | /* Use common scan routine to determine if this is the chosen node */ | ||
373 | if (early_init_dt_scan_chosen(node, uname, depth, data) == 0) | ||
374 | return 0; | ||
375 | |||
370 | #ifdef CONFIG_PPC64 | 376 | #ifdef CONFIG_PPC64 |
371 | /* check if iommu is forced on or off */ | 377 | /* check if iommu is forced on or off */ |
372 | if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL) | 378 | if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL) |
@@ -398,6 +404,9 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node) | |||
398 | if (lprop) | 404 | if (lprop) |
399 | crashk_res.end = crashk_res.start + *lprop - 1; | 405 | crashk_res.end = crashk_res.start + *lprop - 1; |
400 | #endif | 406 | #endif |
407 | |||
408 | /* break now */ | ||
409 | return 1; | ||
401 | } | 410 | } |
402 | 411 | ||
403 | #ifdef CONFIG_PPC_PSERIES | 412 | #ifdef CONFIG_PPC_PSERIES |
@@ -492,7 +501,7 @@ static int __init early_init_dt_scan_memory_ppc(unsigned long node, | |||
492 | 501 | ||
493 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) | 502 | void __init early_init_dt_add_memory_arch(u64 base, u64 size) |
494 | { | 503 | { |
495 | #if defined(CONFIG_PPC64) | 504 | #ifdef CONFIG_PPC64 |
496 | if (iommu_is_off) { | 505 | if (iommu_is_off) { |
497 | if (base >= 0x80000000ul) | 506 | if (base >= 0x80000000ul) |
498 | return; | 507 | return; |
@@ -501,9 +510,13 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) | |||
501 | } | 510 | } |
502 | #endif | 511 | #endif |
503 | 512 | ||
504 | memblock_add(base, size); | 513 | /* First MEMBLOCK added, do some special initializations */ |
505 | 514 | if (memstart_addr == ~(phys_addr_t)0) | |
515 | setup_initial_memory_limit(base, size); | ||
506 | memstart_addr = min((u64)memstart_addr, base); | 516 | memstart_addr = min((u64)memstart_addr, base); |
517 | |||
518 | /* Add the chunk to the MEMBLOCK list */ | ||
519 | memblock_add(base, size); | ||
507 | } | 520 | } |
508 | 521 | ||
509 | u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) | 522 | u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) |
@@ -655,7 +668,6 @@ static void __init phyp_dump_reserve_mem(void) | |||
655 | static inline void __init phyp_dump_reserve_mem(void) {} | 668 | static inline void __init phyp_dump_reserve_mem(void) {} |
656 | #endif /* CONFIG_PHYP_DUMP && CONFIG_PPC_RTAS */ | 669 | #endif /* CONFIG_PHYP_DUMP && CONFIG_PPC_RTAS */ |
657 | 670 | ||
658 | |||
659 | void __init early_init_devtree(void *params) | 671 | void __init early_init_devtree(void *params) |
660 | { | 672 | { |
661 | phys_addr_t limit; | 673 | phys_addr_t limit; |
@@ -679,10 +691,11 @@ void __init early_init_devtree(void *params) | |||
679 | * device-tree, including the platform type, initrd location and | 691 | * device-tree, including the platform type, initrd location and |
680 | * size, TCE reserve, and more ... | 692 | * size, TCE reserve, and more ... |
681 | */ | 693 | */ |
682 | of_scan_flat_dt(early_init_dt_scan_chosen, NULL); | 694 | of_scan_flat_dt(early_init_dt_scan_chosen_ppc, NULL); |
683 | 695 | ||
684 | /* Scan memory nodes and rebuild MEMBLOCKs */ | 696 | /* Scan memory nodes and rebuild MEMBLOCKs */ |
685 | memblock_init(); | 697 | memblock_init(); |
698 | |||
686 | of_scan_flat_dt(early_init_dt_scan_root, NULL); | 699 | of_scan_flat_dt(early_init_dt_scan_root, NULL); |
687 | of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); | 700 | of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL); |
688 | 701 | ||