aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2014-03-31 16:15:00 -0400
committerRob Herring <robh@kernel.org>2014-04-30 01:59:18 -0400
commit060f78c2543a890626cab81796b0d6f7070bd989 (patch)
tree5d402737cef84ba79aedd44be8f1577b7ee769de
parentc0556d3f2c3f42eaed049139ce6f0899ecdb0217 (diff)
powerpc: use libfdt accessors for header data
With libfdt support, we can take advantage of helper accessors in libfdt for accessing the FDT header data. This makes the code more readable and makes the FDT blob structure more opaque to the kernel. This also prepares for removing struct boot_param_header completely. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Tested-by: Grant Likely <grant.likely@linaro.org> Tested-by: Stephen Chivers <schivers@csc.com>
-rw-r--r--arch/powerpc/kernel/Makefile1
-rw-r--r--arch/powerpc/kernel/prom.c11
2 files changed, 7 insertions, 5 deletions
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index fcc9a89a4695..fab19ec25597 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -2,6 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5CFLAGS_prom.o = -I$(src)/../../../scripts/dtc/libfdt
5CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"' 6CFLAGS_ptrace.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
6 7
7subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror 8subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 73b7e9b45054..613a860a203c 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -33,6 +33,7 @@
33#include <linux/memblock.h> 33#include <linux/memblock.h>
34#include <linux/of.h> 34#include <linux/of.h>
35#include <linux/of_fdt.h> 35#include <linux/of_fdt.h>
36#include <linux/libfdt.h>
36 37
37#include <asm/prom.h> 38#include <asm/prom.h>
38#include <asm/rtas.h> 39#include <asm/rtas.h>
@@ -117,14 +118,14 @@ static void __init move_device_tree(void)
117 DBG("-> move_device_tree\n"); 118 DBG("-> move_device_tree\n");
118 119
119 start = __pa(initial_boot_params); 120 start = __pa(initial_boot_params);
120 size = be32_to_cpu(initial_boot_params->totalsize); 121 size = fdt_totalsize(initial_boot_params);
121 122
122 if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) || 123 if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) ||
123 overlaps_crashkernel(start, size) || 124 overlaps_crashkernel(start, size) ||
124 overlaps_initrd(start, size)) { 125 overlaps_initrd(start, size)) {
125 p = __va(memblock_alloc(size, PAGE_SIZE)); 126 p = __va(memblock_alloc(size, PAGE_SIZE));
126 memcpy(p, initial_boot_params, size); 127 memcpy(p, initial_boot_params, size);
127 initial_boot_params = (struct boot_param_header *)p; 128 initial_boot_params = p;
128 DBG("Moved device tree to 0x%p\n", p); 129 DBG("Moved device tree to 0x%p\n", p);
129 } 130 }
130 131
@@ -324,9 +325,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
324 * version 2 of the kexec param format adds the phys cpuid of 325 * version 2 of the kexec param format adds the phys cpuid of
325 * booted proc. 326 * booted proc.
326 */ 327 */
327 if (be32_to_cpu(initial_boot_params->version) >= 2) { 328 if (fdt_version(initial_boot_params) >= 2) {
328 if (be32_to_cpu(intserv[i]) == 329 if (be32_to_cpu(intserv[i]) ==
329 be32_to_cpu(initial_boot_params->boot_cpuid_phys)) { 330 fdt_boot_cpuid_phys(initial_boot_params)) {
330 found = boot_cpu_count; 331 found = boot_cpu_count;
331 found_thread = i; 332 found_thread = i;
332 } 333 }
@@ -599,7 +600,7 @@ static void __init early_reserve_mem(void)
599 __be64 *reserve_map; 600 __be64 *reserve_map;
600 601
601 reserve_map = (__be64 *)(((unsigned long)initial_boot_params) + 602 reserve_map = (__be64 *)(((unsigned long)initial_boot_params) +
602 be32_to_cpu(initial_boot_params->off_mem_rsvmap)); 603 fdt_off_mem_rsvmap(initial_boot_params));
603 604
604 /* Look for the new "reserved-regions" property in the DT */ 605 /* Look for the new "reserved-regions" property in the DT */
605 early_reserve_mem_dt(); 606 early_reserve_mem_dt();