linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/21] FDT clean-ups and libfdt support
@ 2014-04-23  1:18 Rob Herring
  2014-04-23  1:18 ` [PATCH v2 01/21] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
                   ` (24 more replies)
  0 siblings, 25 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Aurelien Jacquiot, Benjamin Herrenschmidt,
	Chris Zankel, H. Peter Anvin, Ingo Molnar, James Hogan,
	Jonas Bonn, linux-arm-kernel, linux-c6x-dev, linux, linux-metag,
	linux-mips, linuxppc-dev, linux-xtensa, Mark Salter,
	Max Filippov, Michal Simek, Paul Mackerras, Ralf Baechle,
	Russell King, Thomas Gleixner, Vineet Gupta, x86

From: Rob Herring <robh@kernel.org>

This is a series of clean-ups of architecture FDT code and converts the
core FDT code over to using libfdt functions. This is in preparation
to add FDT based address translation parsing functions for early
console support. This series removes direct access to FDT data from all
arches except powerpc.

The current MIPS lantiq and xlp DT code is buggy as built-in DTBs need
to be copied out of init section. Patches 2 and 3 should be applied to
3.15.

Changes in v2 are relatively minor. There was a bug in the unflattening
code where walking up the tree was not being handled correctly (thanks
to Michal Simek). I re-worked things a bit to avoid globally adding
libfdt include paths.

A branch is available here[1], and I plan to put into linux-next in a few
days. Please test! I've compiled on arm, arm64, mips, microblaze, xtensa,
and powerpc and booted on arm and arm64.

Rob

[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git libfdt

Rob Herring (21):
  mips: octeon: convert to use unflatten_and_copy_device_tree
  mips: lantiq: copy built-in DTB out of init section
  mips: xlp: copy built-in DTB out of init section
  mips: ralink: convert to use unflatten_and_copy_device_tree
  ARM: dt: use default early_init_dt_alloc_memory_arch
  c6x: convert fdt pointers to opaque pointers
  mips: convert fdt pointers to opaque pointers
  of/fdt: consolidate built-in dtb section variables
  of/fdt: remove some unneeded includes
  of/fdt: remove unused of_scan_flat_dt_by_path
  of/fdt: update of_get_flat_dt_prop in prep for libfdt
  of/fdt: Convert FDT functions to use libfdt
  of/fdt: use libfdt accessors for header data
  of/fdt: create common debugfs
  of/fdt: move memreserve and dtb memory reservations into core
  of/fdt: fix phys_addr_t related print size warnings
  of/fdt: introduce of_get_flat_dt_size
  powerpc: use libfdt accessors for header data
  x86: use FDT accessors for FDT blob header data
  of/fdt: convert initial_boot_params to opaque pointer
  of: push struct boot_param_header and defines into powerpc

 arch/arc/include/asm/sections.h             |   1 -
 arch/arc/kernel/devtree.c                   |   2 +-
 arch/arm/include/asm/prom.h                 |   2 -
 arch/arm/kernel/devtree.c                   |  34 +--
 arch/arm/mach-exynos/exynos.c               |   2 +-
 arch/arm/mach-vexpress/platsmp.c            |   2 +-
 arch/arm/mm/init.c                          |   1 -
 arch/arm/plat-samsung/s5p-dev-mfc.c         |   4 +-
 arch/arm64/mm/init.c                        |  21 --
 arch/c6x/kernel/setup.c                     |   4 +-
 arch/metag/kernel/setup.c                   |   4 -
 arch/microblaze/kernel/prom.c               |  39 +--
 arch/mips/cavium-octeon/setup.c             |  20 +-
 arch/mips/include/asm/mips-boards/generic.h |   4 -
 arch/mips/include/asm/prom.h                |   6 +-
 arch/mips/kernel/prom.c                     |   2 +-
 arch/mips/lantiq/prom.c                     |  15 +-
 arch/mips/lantiq/prom.h                     |   2 -
 arch/mips/mti-sead3/sead3-setup.c           |   8 +-
 arch/mips/netlogic/xlp/dt.c                 |  19 +-
 arch/mips/ralink/of.c                       |  29 +-
 arch/openrisc/kernel/vmlinux.h              |   2 -
 arch/powerpc/include/asm/prom.h             |  39 +++
 arch/powerpc/kernel/Makefile                |   1 +
 arch/powerpc/kernel/epapr_paravirt.c        |   2 +-
 arch/powerpc/kernel/fadump.c                |   4 +-
 arch/powerpc/kernel/prom.c                  |  78 ++----
 arch/powerpc/kernel/rtas.c                  |   2 +-
 arch/powerpc/mm/hash_utils_64.c             |  22 +-
 arch/powerpc/platforms/52xx/efika.c         |   4 +-
 arch/powerpc/platforms/chrp/setup.c         |   4 +-
 arch/powerpc/platforms/powernv/opal.c       |  12 +-
 arch/powerpc/platforms/pseries/setup.c      |   4 +-
 arch/x86/kernel/devicetree.c                |  12 +-
 arch/xtensa/kernel/setup.c                  |   3 +-
 drivers/of/Kconfig                          |   1 +
 drivers/of/Makefile                         |   2 +
 drivers/of/fdt.c                            | 398 ++++++++++------------------
 drivers/of/of_reserved_mem.c                |   4 +-
 include/linux/of_fdt.h                      |  63 +----
 40 files changed, 280 insertions(+), 598 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 34+ messages in thread

* [PATCH v2 01/21] mips: octeon: convert to use unflatten_and_copy_device_tree
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 02/21] mips: lantiq: copy built-in DTB out of init section Rob Herring
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The octeon FDT code can be simplified by using
unflatten_and_copy_device_tree function. This removes all accesses to
FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
v2: fix build error

 arch/mips/cavium-octeon/setup.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 331b837..f1bec00 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -1053,36 +1053,26 @@ void prom_free_prom_memory(void)
 int octeon_prune_device_tree(void);
 
 extern const char __dtb_octeon_3xxx_begin;
-extern const char __dtb_octeon_3xxx_end;
 extern const char __dtb_octeon_68xx_begin;
-extern const char __dtb_octeon_68xx_end;
 void __init device_tree_init(void)
 {
-	int dt_size;
-	struct boot_param_header *fdt;
+	const void *fdt;
 	bool do_prune;
 
 	if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) {
 		fdt = phys_to_virt(octeon_bootinfo->fdt_addr);
 		if (fdt_check_header(fdt))
 			panic("Corrupt Device Tree passed to kernel.");
-		dt_size = be32_to_cpu(fdt->totalsize);
 		do_prune = false;
 	} else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
-		fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin;
-		dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin;
+		fdt = &__dtb_octeon_68xx_begin;
 		do_prune = true;
 	} else {
-		fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin;
-		dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin;
+		fdt = &__dtb_octeon_3xxx_begin;
 		do_prune = true;
 	}
 
-	/* Copy the default tree from init memory. */
-	initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
-	if (initial_boot_params == NULL)
-		panic("Could not allocate initial_boot_params");
-	memcpy(initial_boot_params, fdt, dt_size);
+	initial_boot_params = (void *)fdt;
 
 	if (do_prune) {
 		octeon_prune_device_tree();
@@ -1090,7 +1080,7 @@ void __init device_tree_init(void)
 	} else {
 		pr_info("Using passed Device Tree.\n");
 	}
-	unflatten_device_tree();
+	unflatten_and_copy_device_tree();
 }
 
 static int __initdata disable_octeon_edac_p;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 02/21] mips: lantiq: copy built-in DTB out of init section
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
  2014-04-23  1:18 ` [PATCH v2 01/21] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 03/21] mips: xlp: " Rob Herring
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The existing code is buggy because built-in DTBs are in init memory.
Fix this by using the unflatten_and_copy_device_tree function.

This removes all accesses to FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
v2: no change

 arch/mips/lantiq/prom.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 19686c5..cdea687 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -76,18 +76,7 @@ void __init plat_mem_setup(void)
 
 void __init device_tree_init(void)
 {
-	unsigned long base, size;
-
-	if (!initial_boot_params)
-		return;
-
-	base = virt_to_phys((void *)initial_boot_params);
-	size = be32_to_cpu(initial_boot_params->totalsize);
-
-	/* Before we do anything, lets reserve the dt blob */
-	reserve_bootmem(base, size, BOOTMEM_DEFAULT);
-
-	unflatten_device_tree();
+	unflatten_and_copy_device_tree();
 }
 
 void __init prom_init(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 03/21] mips: xlp: copy built-in DTB out of init section
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
  2014-04-23  1:18 ` [PATCH v2 01/21] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
  2014-04-23  1:18 ` [PATCH v2 02/21] mips: lantiq: copy built-in DTB out of init section Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 04/21] mips: ralink: convert to use unflatten_and_copy_device_tree Rob Herring
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The existing code is buggy because built-in DTBs are in init memory.
It is also broken because the reserved bootmem was then freed after
unflattening, but the unflattened tree points to data in the flat tree.
Fix this by using the unflatten_and_copy_device_tree function.

This removes all accesses to FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
v2: no change

 arch/mips/netlogic/xlp/dt.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 5754097..7f9615a 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -87,22 +87,7 @@ void __init xlp_early_init_devtree(void)
 
 void __init device_tree_init(void)
 {
-	unsigned long base, size;
-	struct boot_param_header *fdtp = xlp_fdt_blob;
-
-	if (!fdtp)
-		return;
-
-	base = virt_to_phys(fdtp);
-	size = be32_to_cpu(fdtp->totalsize);
-
-	/* Before we do anything, lets reserve the dt blob */
-	reserve_bootmem(base, size, BOOTMEM_DEFAULT);
-
-	unflatten_device_tree();
-
-	/* free the space reserved for the dt blob */
-	free_bootmem(base, size);
+	unflatten_and_copy_device_tree();
 }
 
 static struct of_device_id __initdata xlp_ids[] = {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 04/21] mips: ralink: convert to use unflatten_and_copy_device_tree
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (2 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 03/21] mips: xlp: " Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 05/21] ARM: dt: use default early_init_dt_alloc_memory_arch Rob Herring
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Ralf Baechle, linux-mips

From: Rob Herring <robh@kernel.org>

The ralink FDT code can be simplified by using
unflatten_and_copy_device_tree function. This removes all accesses to
FDT header data by the arch code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
v2: no change

 arch/mips/ralink/of.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index eccc552..0170d82 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -52,30 +52,7 @@ __iomem void *plat_of_remap_node(const char *node)
 
 void __init device_tree_init(void)
 {
-	unsigned long base, size;
-	void *fdt_copy;
-
-	if (!initial_boot_params)
-		return;
-
-	base = virt_to_phys((void *)initial_boot_params);
-	size = be32_to_cpu(initial_boot_params->totalsize);
-
-	/* Before we do anything, lets reserve the dt blob */
-	reserve_bootmem(base, size, BOOTMEM_DEFAULT);
-
-	/* The strings in the flattened tree are referenced directly by the
-	 * device tree, so copy the flattened device tree from init memory
-	 * to regular memory.
-	 */
-	fdt_copy = alloc_bootmem(size);
-	memcpy(fdt_copy, initial_boot_params, size);
-	initial_boot_params = fdt_copy;
-
-	unflatten_device_tree();
-
-	/* free the space reserved for the dt blob */
-	free_bootmem(base, size);
+	unflatten_and_copy_device_tree();
 }
 
 void __init plat_mem_setup(void)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 05/21] ARM: dt: use default early_init_dt_alloc_memory_arch
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (3 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 04/21] mips: ralink: convert to use unflatten_and_copy_device_tree Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 06/21] c6x: convert fdt pointers to opaque pointers Rob Herring
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Russell King, linux-arm-kernel

From: Rob Herring <robh@kernel.org>

Now that ARM is using memblock instead of bootmem, the default version
of early_init_dt_alloc_memory_arch can be used.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org
---
v2: no change

 arch/arm/kernel/devtree.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index c7419a5..dff9cc0 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -32,11 +32,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	arm_add_memory(base, size);
 }
 
-void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
-{
-	return memblock_virt_alloc(size, align);
-}
-
 void __init arm_dt_memblock_reserve(void)
 {
 	u64 *reserve_map, base, size;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 06/21] c6x: convert fdt pointers to opaque pointers
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (4 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 05/21] ARM: dt: use default early_init_dt_alloc_memory_arch Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-24 14:21   ` Mark Salter
  2014-04-23  1:18 ` [PATCH v2 07/21] mips: " Rob Herring
                   ` (18 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Mark Salter, Aurelien Jacquiot, linux-c6x-dev

From: Rob Herring <robh@kernel.org>

The architecture code does not need to access the internals of the FDT
blob, so make the pointer to it void *.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: linux-c6x-dev@linux-c6x.org
---
v2: remove unneeded casting

 arch/c6x/kernel/setup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
index 731db4b..7571288 100644
--- a/arch/c6x/kernel/setup.c
+++ b/arch/c6x/kernel/setup.c
@@ -265,8 +265,8 @@ int __init c6x_add_memory(phys_addr_t start, unsigned long size)
  */
 notrace void __init machine_init(unsigned long dt_ptr)
 {
-	struct boot_param_header *dtb = __va(dt_ptr);
-	struct boot_param_header *fdt = (struct boot_param_header *)_fdt_start;
+	const void *dtb = __va(dt_ptr);
+	const void *fdt = _fdt_start;
 
 	/* interrupts must be masked */
 	set_creg(IER, 2);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 07/21] mips: convert fdt pointers to opaque pointers
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (5 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 06/21] c6x: convert fdt pointers to opaque pointers Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 08/21] of/fdt: consolidate built-in dtb section variables Rob Herring
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring, Ralf Baechle

From: Rob Herring <robh@kernel.org>

The architecture code does not need to access the internals of the FDT
blob directly, so make the pointers to it void * and use char arrays
for section variables.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
---
v2: no change

 arch/mips/include/asm/mips-boards/generic.h | 4 +---
 arch/mips/include/asm/prom.h                | 6 +++---
 arch/mips/kernel/prom.c                     | 2 +-
 arch/mips/lantiq/prom.c                     | 2 +-
 arch/mips/lantiq/prom.h                     | 2 +-
 arch/mips/mti-sead3/sead3-setup.c           | 8 ++++----
 arch/mips/ralink/of.c                       | 4 ++--
 7 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
index 4861681..b969491 100644
--- a/arch/mips/include/asm/mips-boards/generic.h
+++ b/arch/mips/include/asm/mips-boards/generic.h
@@ -67,9 +67,7 @@
 
 extern int mips_revision_sconid;
 
-#ifdef CONFIG_OF
-extern struct boot_param_header __dtb_start;
-#endif
+extern char __dtb_start[];
 
 #ifdef CONFIG_PCI
 extern void mips_pcibios_init(void);
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
index ccd2b75..a9494c0 100644
--- a/arch/mips/include/asm/prom.h
+++ b/arch/mips/include/asm/prom.h
@@ -21,13 +21,13 @@ extern void device_tree_init(void);
 
 struct boot_param_header;
 
-extern void __dt_setup_arch(struct boot_param_header *bph);
+extern void __dt_setup_arch(void *bph);
 
 #define dt_setup_arch(sym)						\
 ({									\
-	extern struct boot_param_header __dtb_##sym##_begin;		\
+	extern char __dtb_##sym##_begin[];				\
 									\
-	__dt_setup_arch(&__dtb_##sym##_begin);				\
+	__dt_setup_arch(__dtb_##sym##_begin);				\
 })
 
 #else /* CONFIG_OF */
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 3c3b0df..5d39bb8 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -47,7 +47,7 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
 	return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
 }
 
-void __init __dt_setup_arch(struct boot_param_header *bph)
+void __init __dt_setup_arch(void *bph)
 {
 	if (!early_init_dt_scan(bph))
 		return;
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index cdea687..7447d32 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -71,7 +71,7 @@ void __init plat_mem_setup(void)
 	 * Load the builtin devicetree. This causes the chosen node to be
 	 * parsed resulting in our memory appearing
 	 */
-	__dt_setup_arch(&__dtb_start);
+	__dt_setup_arch(__dtb_start);
 }
 
 void __init device_tree_init(void)
diff --git a/arch/mips/lantiq/prom.h b/arch/mips/lantiq/prom.h
index 8e07b5f..69a4c58 100644
--- a/arch/mips/lantiq/prom.h
+++ b/arch/mips/lantiq/prom.h
@@ -26,6 +26,6 @@ struct ltq_soc_info {
 extern void ltq_soc_detect(struct ltq_soc_info *i);
 extern void ltq_soc_init(void);
 
-extern struct boot_param_header __dtb_start;
+extern char __dtb_start[];
 
 #endif
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index bf7fe48..e43f480 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -69,17 +69,17 @@ static void __init parse_memsize_param(void)
 	if (!memsize)
 		return;
 
-	offset = fdt_path_offset(&__dtb_start, "/memory");
+	offset = fdt_path_offset(__dtb_start, "/memory");
 	if (offset > 0) {
 		uint64_t new_value;
 		/*
 		 * reg contains 2 32-bits BE values, offset and size. We just
 		 * want to replace the size value without affecting the offset
 		 */
-		prop_value = fdt_getprop(&__dtb_start, offset, "reg", &prop_len);
+		prop_value = fdt_getprop(__dtb_start, offset, "reg", &prop_len);
 		new_value = be64_to_cpu(*prop_value);
 		new_value =  (new_value & ~0xffffffffllu) | memsize;
-		fdt_setprop_inplace_u64(&__dtb_start, offset, "reg", new_value);
+		fdt_setprop_inplace_u64(__dtb_start, offset, "reg", new_value);
 	}
 }
 
@@ -92,7 +92,7 @@ void __init plat_mem_setup(void)
 	 * Load the builtin devicetree. This causes the chosen node to be
 	 * parsed resulting in our memory appearing
 	 */
-	__dt_setup_arch(&__dtb_start);
+	__dt_setup_arch(__dtb_start);
 }
 
 void __init device_tree_init(void)
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 0170d82..91d7060 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -28,7 +28,7 @@
 __iomem void *rt_sysc_membase;
 __iomem void *rt_memc_membase;
 
-extern struct boot_param_header __dtb_start;
+extern char __dtb_start[];
 
 __iomem void *plat_of_remap_node(const char *node)
 {
@@ -63,7 +63,7 @@ void __init plat_mem_setup(void)
 	 * Load the builtin devicetree. This causes the chosen node to be
 	 * parsed resulting in our memory appearing
 	 */
-	__dt_setup_arch(&__dtb_start);
+	__dt_setup_arch(__dtb_start);
 
 	if (soc_info.mem_size)
 		add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 08/21] of/fdt: consolidate built-in dtb section variables
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (6 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 07/21] mips: " Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 09/21] of/fdt: remove some unneeded includes Rob Herring
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Ralf Baechle, Jonas Bonn, Chris Zankel,
	Max Filippov, linux-metag, linux-mips, linux, linux-xtensa

From: Rob Herring <robh@kernel.org>

Unify the various architectures __dtb_start and __dtb_end definitions
moving them into of_fdt.h.

Signed-off-by: Rob Herring <robh@kernel.org>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: linux-metag@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux@lists.openrisc.net
Cc: linux-xtensa@linux-xtensa.org
---
v2: no change

 arch/arc/include/asm/sections.h             | 1 -
 arch/metag/kernel/setup.c                   | 4 ----
 arch/mips/include/asm/mips-boards/generic.h | 2 --
 arch/mips/lantiq/prom.h                     | 2 --
 arch/mips/netlogic/xlp/dt.c                 | 2 +-
 arch/mips/ralink/of.c                       | 2 --
 arch/openrisc/kernel/vmlinux.h              | 2 --
 arch/xtensa/kernel/setup.c                  | 1 -
 include/linux/of_fdt.h                      | 3 +++
 9 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/arch/arc/include/asm/sections.h b/arch/arc/include/asm/sections.h
index 764f1e3..09db952 100644
--- a/arch/arc/include/asm/sections.h
+++ b/arch/arc/include/asm/sections.h
@@ -12,6 +12,5 @@
 #include <asm-generic/sections.h>
 
 extern char __arc_dccm_base[];
-extern char __dtb_start[];
 
 #endif
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index 129c7cd..31cf53d 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -105,10 +105,6 @@
 
 extern char _heap_start[];
 
-#ifdef CONFIG_METAG_BUILTIN_DTB
-extern u32 __dtb_start[];
-#endif
-
 #ifdef CONFIG_DA_CONSOLE
 /* Our early channel based console driver */
 extern struct console dash_console;
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
index b969491..c904c24 100644
--- a/arch/mips/include/asm/mips-boards/generic.h
+++ b/arch/mips/include/asm/mips-boards/generic.h
@@ -67,8 +67,6 @@
 
 extern int mips_revision_sconid;
 
-extern char __dtb_start[];
-
 #ifdef CONFIG_PCI
 extern void mips_pcibios_init(void);
 #else
diff --git a/arch/mips/lantiq/prom.h b/arch/mips/lantiq/prom.h
index 69a4c58..bfd2d58 100644
--- a/arch/mips/lantiq/prom.h
+++ b/arch/mips/lantiq/prom.h
@@ -26,6 +26,4 @@ struct ltq_soc_info {
 extern void ltq_soc_detect(struct ltq_soc_info *i);
 extern void ltq_soc_init(void);
 
-extern char __dtb_start[];
-
 #endif
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 7f9615a..bdde331 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -42,7 +42,7 @@
 #include <asm/prom.h>
 
 extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
-	__dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[], __dtb_start[];
+	__dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[];
 static void *xlp_fdt_blob;
 
 void __init *xlp_dt_init(void *fdtp)
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 91d7060..2513952 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -28,8 +28,6 @@
 __iomem void *rt_sysc_membase;
 __iomem void *rt_memc_membase;
 
-extern char __dtb_start[];
-
 __iomem void *plat_of_remap_node(const char *node)
 {
 	struct resource res;
diff --git a/arch/openrisc/kernel/vmlinux.h b/arch/openrisc/kernel/vmlinux.h
index 70b9ce4..bbcdf21 100644
--- a/arch/openrisc/kernel/vmlinux.h
+++ b/arch/openrisc/kernel/vmlinux.h
@@ -5,6 +5,4 @@
 extern char __initrd_start, __initrd_end;
 #endif
 
-extern u32 __dtb_start[];
-
 #endif
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 84fe931..89986e5 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -73,7 +73,6 @@ extern int initrd_below_start_ok;
 #endif
 
 #ifdef CONFIG_OF
-extern u32 __dtb_start[];
 void *dtb_start = __dtb_start;
 #endif
 
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index ddd7219..d4d0efe 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -80,6 +80,9 @@ extern int __initdata dt_root_addr_cells;
 extern int __initdata dt_root_size_cells;
 extern struct boot_param_header *initial_boot_params;
 
+extern char __dtb_start[];
+extern char __dtb_end[];
+
 /* For scanning the flat device-tree at boot time */
 extern char *find_flat_dt_string(u32 offset);
 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 09/21] of/fdt: remove some unneeded includes
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (7 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 08/21] of/fdt: consolidate built-in dtb section variables Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 10/21] of/fdt: remove unused of_scan_flat_dt_by_path Rob Herring
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring

From: Rob Herring <robh@kernel.org>

Whatever needed powerpc machdep.h appears to have been removed, so the
include can be dropped.

module.h is not needed as this code is always built-in.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
---
v2: no change

 drivers/of/fdt.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 7a2ef7b..63bdcee 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -12,7 +12,6 @@
 #include <linux/kernel.h>
 #include <linux/initrd.h>
 #include <linux/memblock.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
 #include <linux/of_reserved_mem.h>
@@ -22,10 +21,6 @@
 #include <linux/slab.h>
 
 #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
-#ifdef CONFIG_PPC
-#include <asm/machdep.h>
-#endif /* CONFIG_PPC */
-
 #include <asm/page.h>
 
 char *of_fdt_get_string(struct boot_param_header *blob, u32 offset)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 10/21] of/fdt: remove unused of_scan_flat_dt_by_path
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (8 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 09/21] of/fdt: remove some unneeded includes Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 11/21] of/fdt: update of_get_flat_dt_prop in prep for libfdt Rob Herring
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring

From: Rob Herring <robh@kernel.org>

of_scan_flat_dt_by_path is unused anywhere in the kernel, so remove it.

Signed-off-by: Rob Herring <robh@kernel.org>
---
v2: no change

 drivers/of/fdt.c       | 67 --------------------------------------------------
 include/linux/of_fdt.h |  3 ---
 2 files changed, 70 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 63bdcee..9c85352 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -671,73 +671,6 @@ struct fdt_scan_status {
 	void *data;
 };
 
-/**
- * fdt_scan_node_by_path - iterator for of_scan_flat_dt_by_path function
- */
-static int __init fdt_scan_node_by_path(unsigned long node, const char *uname,
-					int depth, void *data)
-{
-	struct fdt_scan_status *st = data;
-
-	/*
-	 * if scan at the requested fdt node has been completed,
-	 * return -ENXIO to abort further scanning
-	 */
-	if (depth <= st->depth)
-		return -ENXIO;
-
-	/* requested fdt node has been found, so call iterator function */
-	if (st->found)
-		return st->iterator(node, uname, depth, st->data);
-
-	/* check if scanning automata is entering next level of fdt nodes */
-	if (depth == st->depth + 1 &&
-	    strncmp(st->name, uname, st->namelen) == 0 &&
-	    uname[st->namelen] == 0) {
-		st->depth += 1;
-		if (st->name[st->namelen] == 0) {
-			st->found = 1;
-		} else {
-			const char *next = st->name + st->namelen + 1;
-			st->name = next;
-			st->namelen = strcspn(next, "/");
-		}
-		return 0;
-	}
-
-	/* scan next fdt node */
-	return 0;
-}
-
-/**
- * of_scan_flat_dt_by_path - scan flattened tree blob and call callback on each
- *			     child of the given path.
- * @path: path to start searching for children
- * @it: callback function
- * @data: context data pointer
- *
- * This function is used to scan the flattened device-tree starting from the
- * node given by path. It is used to extract information (like reserved
- * memory), which is required on ealy boot before we can unflatten the tree.
- */
-int __init of_scan_flat_dt_by_path(const char *path,
-	int (*it)(unsigned long node, const char *name, int depth, void *data),
-	void *data)
-{
-	struct fdt_scan_status st = {path, 0, -1, 0, it, data};
-	int ret = 0;
-
-	if (initial_boot_params)
-                ret = of_scan_flat_dt(fdt_scan_node_by_path, &st);
-
-	if (!st.found)
-		return -ENOENT;
-	else if (ret == -ENXIO)	/* scan has been completed */
-		return 0;
-	else
-		return ret;
-}
-
 const char * __init of_flat_dt_get_machine_name(void)
 {
 	const char *name;
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index d4d0efe..991ec74 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -93,9 +93,6 @@ extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern int of_flat_dt_match(unsigned long node, const char *const *matches);
 extern unsigned long of_get_flat_dt_root(void);
-extern int of_scan_flat_dt_by_path(const char *path,
-	int (*it)(unsigned long node, const char *name, int depth, void *data),
-	void *data);
 
 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 11/21] of/fdt: update of_get_flat_dt_prop in prep for libfdt
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (9 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 10/21] of/fdt: remove unused of_scan_flat_dt_by_path Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 12/21] of/fdt: Convert FDT functions to use libfdt Rob Herring
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring

From: Rob Herring <robh@kernel.org>

Make of_get_flat_dt_prop arguments compatible with libfdt fdt_getprop
call in preparation to convert FDT code to use libfdt. Make the return
value const and the property length ptr type an int.

Signed-off-by: Rob Herring <robh@kernel.org>
---
v2: fix warning on microblaze

 arch/arc/kernel/devtree.c              |  2 +-
 arch/arm/kernel/devtree.c              |  2 +-
 arch/arm/mach-exynos/exynos.c          |  2 +-
 arch/arm/mach-vexpress/platsmp.c       |  2 +-
 arch/arm/plat-samsung/s5p-dev-mfc.c    |  4 ++--
 arch/microblaze/kernel/prom.c          |  8 +++----
 arch/powerpc/kernel/epapr_paravirt.c   |  2 +-
 arch/powerpc/kernel/fadump.c           |  4 ++--
 arch/powerpc/kernel/prom.c             | 24 +++++++++++----------
 arch/powerpc/kernel/rtas.c             |  2 +-
 arch/powerpc/mm/hash_utils_64.c        | 22 +++++++++----------
 arch/powerpc/platforms/52xx/efika.c    |  4 ++--
 arch/powerpc/platforms/chrp/setup.c    |  4 ++--
 arch/powerpc/platforms/powernv/opal.c  | 12 +++++------
 arch/powerpc/platforms/pseries/setup.c |  4 ++--
 arch/xtensa/kernel/setup.c             |  2 +-
 drivers/of/fdt.c                       | 39 +++++++++++++++++-----------------
 drivers/of/of_reserved_mem.c           |  4 ++--
 include/linux/of_fdt.h                 |  8 +++----
 19 files changed, 77 insertions(+), 74 deletions(-)

diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index b6dc4e2..0b3ef40 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -42,7 +42,7 @@ const struct machine_desc * __init setup_machine_fdt(void *dt)
 	const struct machine_desc *mdesc;
 	unsigned long dt_root;
 	void *clk;
-	unsigned long len;
+	int len;
 
 	if (!early_init_dt_scan(dt))
 		return NULL;
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index dff9cc0..38f4711 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -247,7 +247,7 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
 
 	if (!mdesc) {
 		const char *prop;
-		long size;
+		int size;
 		unsigned long dt_root;
 
 		early_print("\nError: unrecognized/unsupported "
diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c
index b32a907..77293d3 100644
--- a/arch/arm/mach-exynos/exynos.c
+++ b/arch/arm/mach-exynos/exynos.c
@@ -250,7 +250,7 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname,
 {
 	struct map_desc iodesc;
 	__be32 *reg;
-	unsigned long len;
+	int len;
 
 	if (!of_flat_dt_is_compatible(node, "samsung,exynos4210-chipid") &&
 		!of_flat_dt_is_compatible(node, "samsung,exynos5440-clock"))
diff --git a/arch/arm/mach-vexpress/platsmp.c b/arch/arm/mach-vexpress/platsmp.c
index 993c9ae..b4a5f0d 100644
--- a/arch/arm/mach-vexpress/platsmp.c
+++ b/arch/arm/mach-vexpress/platsmp.c
@@ -53,7 +53,7 @@ static int __init vexpress_dt_find_scu(unsigned long node,
 {
 	if (of_flat_dt_match(node, vexpress_dt_cortex_a9_match)) {
 		phys_addr_t phys_addr;
-		__be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
+		const __be32 *reg = of_get_flat_dt_prop(node, "reg", NULL);
 
 		if (WARN_ON(!reg))
 			return -EINVAL;
diff --git a/arch/arm/plat-samsung/s5p-dev-mfc.c b/arch/arm/plat-samsung/s5p-dev-mfc.c
index 98087b6..469b862 100644
--- a/arch/arm/plat-samsung/s5p-dev-mfc.c
+++ b/arch/arm/plat-samsung/s5p-dev-mfc.c
@@ -125,8 +125,8 @@ device_initcall(s5p_mfc_memory_init);
 int __init s5p_fdt_alloc_mfc_mem(unsigned long node, const char *uname,
 				int depth, void *data)
 {
-	__be32 *prop;
-	unsigned long len;
+	const __be32 *prop;
+	int len;
 	struct s5p_mfc_dt_meminfo mfc_mem;
 
 	if (!data)
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index abdfb10..c766306 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -43,13 +43,13 @@
 #include <asm/pci-bridge.h>
 
 #ifdef CONFIG_EARLY_PRINTK
-static char *stdout;
+static const char *stdout;
 
 static int __init early_init_dt_scan_chosen_serial(unsigned long node,
 				const char *uname, int depth, void *data)
 {
-	unsigned long l;
-	char *p;
+	int l;
+	const char *p;
 
 	pr_debug("%s: depth: %d, uname: %s\n", __func__, depth, uname);
 
@@ -80,7 +80,7 @@ static int __init early_init_dt_scan_chosen_serial(unsigned long node,
 				(strncmp(p, "xlnx,opb-uartlite", 17) == 0) ||
 				(strncmp(p, "xlnx,axi-uartlite", 17) == 0) ||
 				(strncmp(p, "xlnx,mdm", 8) == 0)) {
-			unsigned int *addrp;
+			const unsigned int *addrp;
 
 			*(u32 *)data = UARTLITE;
 
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index 7898be9..d64e92b 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -36,7 +36,7 @@ static int __init early_init_dt_scan_epapr(unsigned long node,
 					   int depth, void *data)
 {
 	const u32 *insts;
-	unsigned long len;
+	int len;
 	int i;
 
 	insts = of_get_flat_dt_prop(node, "hcall-instructions", &len);
diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
index 2230fd0..7213d93 100644
--- a/arch/powerpc/kernel/fadump.c
+++ b/arch/powerpc/kernel/fadump.c
@@ -55,9 +55,9 @@ int crash_mem_ranges;
 int __init early_init_dt_scan_fw_dump(unsigned long node,
 			const char *uname, int depth, void *data)
 {
-	__be32 *sections;
+	const __be32 *sections;
 	int i, num_sections;
-	unsigned long size;
+	int size;
 	const int *token;
 
 	if (depth != 1 || strcmp(uname, "rtas") != 0)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 668aa47..f971134 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -163,7 +163,7 @@ static struct ibm_pa_feature {
 	{CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
 };
 
-static void __init scan_features(unsigned long node, unsigned char *ftrs,
+static void __init scan_features(unsigned long node, const unsigned char *ftrs,
 				 unsigned long tablelen,
 				 struct ibm_pa_feature *fp,
 				 unsigned long ft_size)
@@ -202,8 +202,8 @@ static void __init scan_features(unsigned long node, unsigned char *ftrs,
 
 static void __init check_cpu_pa_features(unsigned long node)
 {
-	unsigned char *pa_ftrs;
-	unsigned long tablelen;
+	const unsigned char *pa_ftrs;
+	int tablelen;
 
 	pa_ftrs = of_get_flat_dt_prop(node, "ibm,pa-features", &tablelen);
 	if (pa_ftrs == NULL)
@@ -216,7 +216,7 @@ static void __init check_cpu_pa_features(unsigned long node)
 #ifdef CONFIG_PPC_STD_MMU_64
 static void __init check_cpu_slb_size(unsigned long node)
 {
-	__be32 *slb_size_ptr;
+	const __be32 *slb_size_ptr;
 
 	slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL);
 	if (slb_size_ptr != NULL) {
@@ -257,7 +257,7 @@ static struct feature_property {
 static inline void identical_pvr_fixup(unsigned long node)
 {
 	unsigned int pvr;
-	char *model = of_get_flat_dt_prop(node, "model", NULL);
+	const char *model = of_get_flat_dt_prop(node, "model", NULL);
 
 	/*
 	 * Since 440GR(x)/440EP(x) processors have the same pvr,
@@ -295,11 +295,11 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 					  const char *uname, int depth,
 					  void *data)
 {
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
 	const __be32 *prop;
 	const __be32 *intserv;
 	int i, nthreads;
-	unsigned long len;
+	int len;
 	int found = -1;
 	int found_thread = 0;
 
@@ -392,7 +392,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
 					 int depth, void *data)
 {
-	unsigned long *lprop; /* All these set by kernel, so no need to convert endian */
+	const unsigned long *lprop; /* All these set by kernel, so no need to convert endian */
 
 	/* Use common scan routine to determine if this is the chosen node */
 	if (early_init_dt_scan_chosen(node, uname, depth, data) == 0)
@@ -443,8 +443,9 @@ int __init early_init_dt_scan_chosen_ppc(unsigned long node, const char *uname,
  */
 static int __init early_init_dt_scan_drconf_memory(unsigned long node)
 {
-	__be32 *dm, *ls, *usm;
-	unsigned long l, n, flags;
+	const __be32 *dm, *ls, *usm;
+	int l;
+	unsigned long n, flags;
 	u64 base, size, memblock_size;
 	unsigned int is_kexec_kdump = 0, rngs;
 
@@ -564,7 +565,8 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 
 static void __init early_reserve_mem_dt(void)
 {
-	unsigned long i, len, dt_root;
+	unsigned long i, dt_root;
+	int len;
 	const __be32 *prop;
 
 	dt_root = of_get_flat_dt_root();
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 8cd5ed0..8b4c857 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -1142,7 +1142,7 @@ void __init rtas_initialize(void)
 int __init early_init_dt_scan_rtas(unsigned long node,
 		const char *uname, int depth, void *data)
 {
-	u32 *basep, *entryp, *sizep;
+	const u32 *basep, *entryp, *sizep;
 
 	if (depth != 1 || strcmp(uname, "rtas") != 0)
 		return 0;
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index d766d6e..59cc19a 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -265,9 +265,9 @@ static int __init htab_dt_scan_seg_sizes(unsigned long node,
 					 const char *uname, int depth,
 					 void *data)
 {
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	__be32 *prop;
-	unsigned long size = 0;
+	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	const __be32 *prop;
+	int size = 0;
 
 	/* We are scanning "cpu" nodes only */
 	if (type == NULL || strcmp(type, "cpu") != 0)
@@ -320,9 +320,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
 					  const char *uname, int depth,
 					  void *data)
 {
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	__be32 *prop;
-	unsigned long size = 0;
+	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	const __be32 *prop;
+	int size = 0;
 
 	/* We are scanning "cpu" nodes only */
 	if (type == NULL || strcmp(type, "cpu") != 0)
@@ -402,9 +402,9 @@ static int __init htab_dt_scan_page_sizes(unsigned long node,
 static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
 					const char *uname, int depth,
 					void *data) {
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	__be64 *addr_prop;
-	__be32 *page_count_prop;
+	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	const __be64 *addr_prop;
+	const __be32 *page_count_prop;
 	unsigned int expected_pages;
 	long unsigned int phys_addr;
 	long unsigned int block_size;
@@ -546,8 +546,8 @@ static int __init htab_dt_scan_pftsize(unsigned long node,
 				       const char *uname, int depth,
 				       void *data)
 {
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	__be32 *prop;
+	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	const __be32 *prop;
 
 	/* We are scanning "cpu" nodes only */
 	if (type == NULL || strcmp(type, "cpu") != 0)
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c
index 18c1048..6e19b0a 100644
--- a/arch/powerpc/platforms/52xx/efika.c
+++ b/arch/powerpc/platforms/52xx/efika.c
@@ -199,8 +199,8 @@ static void __init efika_setup_arch(void)
 
 static int __init efika_probe(void)
 {
-	char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
-					  "model", NULL);
+	const char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+						"model", NULL);
 
 	if (model == NULL)
 		return 0;
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index c665d7d..7044fd3 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -574,8 +574,8 @@ chrp_init2(void)
 
 static int __init chrp_probe(void)
 {
- 	char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
- 					  "device_type", NULL);
+	const char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
+						"device_type", NULL);
  	if (dtype == NULL)
  		return 0;
  	if (strcmp(dtype, "chrp"))
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 49d2f00..c132984 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -61,7 +61,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
 				   const char *uname, int depth, void *data)
 {
 	const void *basep, *entryp, *sizep;
-	unsigned long basesz, entrysz, runtimesz;
+	int basesz, entrysz, runtimesz;
 
 	if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
 		return 0;
@@ -77,11 +77,11 @@ int __init early_init_dt_scan_opal(unsigned long node,
 	opal.entry = of_read_number(entryp, entrysz/4);
 	opal.size = of_read_number(sizep, runtimesz/4);
 
-	pr_debug("OPAL Base  = 0x%llx (basep=%p basesz=%ld)\n",
+	pr_debug("OPAL Base  = 0x%llx (basep=%p basesz=%d)\n",
 		 opal.base, basep, basesz);
-	pr_debug("OPAL Entry = 0x%llx (entryp=%p basesz=%ld)\n",
+	pr_debug("OPAL Entry = 0x%llx (entryp=%p basesz=%d)\n",
 		 opal.entry, entryp, entrysz);
-	pr_debug("OPAL Entry = 0x%llx (sizep=%p runtimesz=%ld)\n",
+	pr_debug("OPAL Entry = 0x%llx (sizep=%p runtimesz=%d)\n",
 		 opal.size, sizep, runtimesz);
 
 	powerpc_firmware_features |= FW_FEATURE_OPAL;
@@ -102,7 +102,7 @@ int __init early_init_dt_scan_opal(unsigned long node,
 int __init early_init_dt_scan_recoverable_ranges(unsigned long node,
 				   const char *uname, int depth, void *data)
 {
-	unsigned long i, psize, size;
+	int i, psize, size;
 	const __be32 *prop;
 
 	if (depth != 1 || strcmp(uname, "ibm,opal") != 0)
@@ -359,7 +359,7 @@ int opal_get_chars(uint32_t vtermno, char *buf, int count)
 	if ((be64_to_cpu(evt) & OPAL_EVENT_CONSOLE_INPUT) == 0)
 		return 0;
 	len = cpu_to_be64(count);
-	rc = opal_console_read(vtermno, &len, buf);	
+	rc = opal_console_read(vtermno, &len, buf);
 	if (rc == OPAL_SUCCESS)
 		return be64_to_cpu(len);
 	return 0;
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 2db8cc6..099d2df 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -665,7 +665,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
 					    void *data)
 {
 	const char *prop;
-	unsigned long len;
+	int len;
 	static int hypertas_found;
 	static int vec5_found;
 
@@ -698,7 +698,7 @@ static int __init pseries_probe_fw_features(unsigned long node,
 static int __init pSeries_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
- 	char *dtype = of_get_flat_dt_prop(root, "device_type", NULL);
+	const char *dtype = of_get_flat_dt_prop(root, "device_type", NULL);
 
  	if (dtype == NULL)
  		return 0;
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 89986e5..1991a3d 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -220,7 +220,7 @@ static int __init xtensa_dt_io_area(unsigned long node, const char *uname,
 		int depth, void *data)
 {
 	const __be32 *ranges;
-	unsigned long len;
+	int len;
 
 	if (depth > 1)
 		return 0;
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 9c85352..1d1582b 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -35,7 +35,7 @@ char *of_fdt_get_string(struct boot_param_header *blob, u32 offset)
  */
 void *of_fdt_get_property(struct boot_param_header *blob,
 		       unsigned long node, const char *name,
-		       unsigned long *size)
+		       int *size)
 {
 	unsigned long p = node;
 
@@ -85,7 +85,8 @@ int of_fdt_is_compatible(struct boot_param_header *blob,
 		      unsigned long node, const char *compat)
 {
 	const char *cp;
-	unsigned long cplen, l, score = 0;
+	int cplen;
+	unsigned long l, score = 0;
 
 	cp = of_fdt_get_property(blob, node, "compatible", &cplen);
 	if (cp == NULL)
@@ -444,8 +445,8 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
 {
 	int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
 	phys_addr_t base, size;
-	unsigned long len;
-	__be32 *prop;
+	int len;
+	const __be32 *prop;
 	int nomap, first = 1;
 
 	prop = of_get_flat_dt_prop(node, "reg", &len);
@@ -488,7 +489,7 @@ static int __init __reserved_mem_reserve_reg(unsigned long node,
  */
 static int __init __reserved_mem_check_root(unsigned long node)
 {
-	__be32 *prop;
+	const __be32 *prop;
 
 	prop = of_get_flat_dt_prop(node, "#size-cells", NULL);
 	if (!prop || be32_to_cpup(prop) != dt_root_size_cells)
@@ -638,8 +639,8 @@ unsigned long __init of_get_flat_dt_root(void)
  * This function can be used within scan_flattened_dt callback to get
  * access to properties
  */
-void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
-				 unsigned long *size)
+const void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
+				       int *size)
 {
 	return of_fdt_get_property(initial_boot_params, node, name, size);
 }
@@ -710,7 +711,7 @@ const void * __init of_flat_dt_match_machine(const void *default_match,
 	}
 	if (!best_data) {
 		const char *prop;
-		long size;
+		int size;
 
 		pr_err("\n unrecognized device tree list:\n[ ");
 
@@ -739,8 +740,8 @@ const void * __init of_flat_dt_match_machine(const void *default_match,
 static void __init early_init_dt_check_for_initrd(unsigned long node)
 {
 	u64 start, end;
-	unsigned long len;
-	__be32 *prop;
+	int len;
+	const __be32 *prop;
 
 	pr_debug("Looking for initrd properties... ");
 
@@ -773,7 +774,7 @@ static inline void early_init_dt_check_for_initrd(unsigned long node)
 int __init early_init_dt_scan_root(unsigned long node, const char *uname,
 				   int depth, void *data)
 {
-	__be32 *prop;
+	const __be32 *prop;
 
 	if (depth != 0)
 		return 0;
@@ -795,9 +796,9 @@ int __init early_init_dt_scan_root(unsigned long node, const char *uname,
 	return 1;
 }
 
-u64 __init dt_mem_next_cell(int s, __be32 **cellp)
+u64 __init dt_mem_next_cell(int s, const __be32 **cellp)
 {
-	__be32 *p = *cellp;
+	const __be32 *p = *cellp;
 
 	*cellp = p + s;
 	return of_read_number(p, s);
@@ -809,9 +810,9 @@ u64 __init dt_mem_next_cell(int s, __be32 **cellp)
 int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
 				     int depth, void *data)
 {
-	char *type = of_get_flat_dt_prop(node, "device_type", NULL);
-	__be32 *reg, *endp;
-	unsigned long l;
+	const char *type = of_get_flat_dt_prop(node, "device_type", NULL);
+	const __be32 *reg, *endp;
+	int l;
 
 	/* We are scanning "memory" nodes only */
 	if (type == NULL) {
@@ -832,7 +833,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
 
 	endp = reg + (l / sizeof(__be32));
 
-	pr_debug("memory scan node %s, reg size %ld, data: %x %x %x %x,\n",
+	pr_debug("memory scan node %s, reg size %d, data: %x %x %x %x,\n",
 	    uname, l, reg[0], reg[1], reg[2], reg[3]);
 
 	while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) {
@@ -855,8 +856,8 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname,
 int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data)
 {
-	unsigned long l;
-	char *p;
+	int l;
+	const char *p;
 
 	pr_debug("search \"chosen\", depth: %d, uname: %s\n", depth, uname);
 
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index daaaf93..e420eb5 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -95,8 +95,8 @@ static int __init __reserved_mem_alloc_size(unsigned long node,
 	int t_len = (dt_root_addr_cells + dt_root_size_cells) * sizeof(__be32);
 	phys_addr_t start = 0, end = 0;
 	phys_addr_t base = 0, align = 0, size;
-	unsigned long len;
-	__be32 *prop;
+	int len;
+	const __be32 *prop;
 	int nomap;
 	int ret;
 
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 991ec74..b36a50d 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -66,7 +66,7 @@ extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);
 extern void *of_fdt_get_property(struct boot_param_header *blob,
 				 unsigned long node,
 				 const char *name,
-				 unsigned long *size);
+				 int *size);
 extern int of_fdt_is_compatible(struct boot_param_header *blob,
 				unsigned long node,
 				const char *compat);
@@ -88,8 +88,8 @@ extern char *find_flat_dt_string(u32 offset);
 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
 				     int depth, void *data),
 			   void *data);
-extern void *of_get_flat_dt_prop(unsigned long node, const char *name,
-				 unsigned long *size);
+extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
+				       int *size);
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern int of_flat_dt_match(unsigned long node, const char *const *matches);
 extern unsigned long of_get_flat_dt_root(void);
@@ -103,7 +103,7 @@ extern void early_init_dt_add_memory_arch(u64 base, u64 size);
 extern int early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size,
 					     bool no_map);
 extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
-extern u64 dt_mem_next_cell(int s, __be32 **cellp);
+extern u64 dt_mem_next_cell(int s, const __be32 **cellp);
 
 /* Early flat tree scan hooks */
 extern int early_init_dt_scan_root(unsigned long node, const char *uname,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 12/21] of/fdt: Convert FDT functions to use libfdt
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (10 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 11/21] of/fdt: update of_get_flat_dt_prop in prep for libfdt Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 13/21] of/fdt: use libfdt accessors for header data Rob Herring
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring

From: Rob Herring <robh@kernel.org>

The kernel FDT functions predate libfdt and are much more limited in
functionality. Also, the kernel functions and libfdt functions are
not compatible with each other because they have different definitions
of node offsets. To avoid this incompatibility and in preparation to
add more FDT parsing functions which will need libfdt, let's first
convert the existing code to use libfdt.

The FDT unflattening, top-level FDT scanning, and property retrieval
functions are converted to use libfdt. The scanning code should be
re-worked to be more efficient and understandable by using libfdt to
find nodes directly by path or compatible strings.

Signed-off-by: Rob Herring <robh@kernel.org>
---
v2: fix bug reported by Michal Simek in unflatten_dt_node in tracking tree
 depth.
 
 drivers/of/Kconfig     |   1 +
 drivers/of/Makefile    |   2 +
 drivers/of/fdt.c       | 209 ++++++++++++++-----------------------------------
 include/linux/of_fdt.h |   1 -
 4 files changed, 60 insertions(+), 153 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 889005f..2dcb054 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -20,6 +20,7 @@ config OF_SELFTEST
 config OF_FLATTREE
 	bool
 	select DTC
+	select LIBFDT
 
 config OF_EARLY_FLATTREE
 	bool
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index ed9660a..9891232 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -10,3 +10,5 @@ obj-$(CONFIG_OF_PCI)	+= of_pci.o
 obj-$(CONFIG_OF_PCI_IRQ)  += of_pci_irq.o
 obj-$(CONFIG_OF_MTD)	+= of_mtd.o
 obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
+
+CFLAGS_fdt.o = -I$(src)/../../scripts/dtc/libfdt
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 1d1582b..8e820a2 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -19,58 +19,11 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
+#include <linux/libfdt.h>
 
 #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
 #include <asm/page.h>
 
-char *of_fdt_get_string(struct boot_param_header *blob, u32 offset)
-{
-	return ((char *)blob) +
-		be32_to_cpu(blob->off_dt_strings) + offset;
-}
-
-/**
- * of_fdt_get_property - Given a node in the given flat blob, return
- * the property ptr
- */
-void *of_fdt_get_property(struct boot_param_header *blob,
-		       unsigned long node, const char *name,
-		       int *size)
-{
-	unsigned long p = node;
-
-	do {
-		u32 tag = be32_to_cpup((__be32 *)p);
-		u32 sz, noff;
-		const char *nstr;
-
-		p += 4;
-		if (tag == OF_DT_NOP)
-			continue;
-		if (tag != OF_DT_PROP)
-			return NULL;
-
-		sz = be32_to_cpup((__be32 *)p);
-		noff = be32_to_cpup((__be32 *)(p + 4));
-		p += 8;
-		if (be32_to_cpu(blob->version) < 0x10)
-			p = ALIGN(p, sz >= 8 ? 8 : 4);
-
-		nstr = of_fdt_get_string(blob, noff);
-		if (nstr == NULL) {
-			pr_warning("Can't find property index name !\n");
-			return NULL;
-		}
-		if (strcmp(name, nstr) == 0) {
-			if (size)
-				*size = sz;
-			return (void *)p;
-		}
-		p += sz;
-		p = ALIGN(p, 4);
-	} while (1);
-}
-
 /**
  * of_fdt_is_compatible - Return true if given node from the given blob has
  * compat in its compatible list
@@ -88,7 +41,7 @@ int of_fdt_is_compatible(struct boot_param_header *blob,
 	int cplen;
 	unsigned long l, score = 0;
 
-	cp = of_fdt_get_property(blob, node, "compatible", &cplen);
+	cp = fdt_getprop(blob, node, "compatible", &cplen);
 	if (cp == NULL)
 		return 0;
 	while (cplen > 0) {
@@ -147,28 +100,27 @@ static void *unflatten_dt_alloc(void **mem, unsigned long size,
  */
 static void * unflatten_dt_node(struct boot_param_header *blob,
 				void *mem,
-				void **p,
+				int *poffset,
 				struct device_node *dad,
 				struct device_node ***allnextpp,
 				unsigned long fpsize)
 {
+	const __be32 *p;
 	struct device_node *np;
 	struct property *pp, **prev_pp = NULL;
-	char *pathp;
-	u32 tag;
+	const char *pathp;
 	unsigned int l, allocl;
+	static int depth = 0;
+	int old_depth;
+	int offset;
 	int has_name = 0;
 	int new_format = 0;
 
-	tag = be32_to_cpup(*p);
-	if (tag != OF_DT_BEGIN_NODE) {
-		pr_err("Weird tag at start of node: %x\n", tag);
+	pathp = fdt_get_name(blob, *poffset, &l);
+	if (!pathp)
 		return mem;
-	}
-	*p += 4;
-	pathp = *p;
-	l = allocl = strlen(pathp) + 1;
-	*p = PTR_ALIGN(*p + l, 4);
+
+	allocl = l++;
 
 	/* version 0x10 has a more compact unit name here instead of the full
 	 * path. we accumulate the full path size using "fpsize", we'll rebuild
@@ -186,7 +138,7 @@ static void * unflatten_dt_node(struct boot_param_header *blob,
 			fpsize = 1;
 			allocl = 2;
 			l = 1;
-			*pathp = '\0';
+			pathp = "";
 		} else {
 			/* account for '/' and path size minus terminal 0
 			 * already in 'l'
@@ -233,32 +185,23 @@ static void * unflatten_dt_node(struct boot_param_header *blob,
 		}
 	}
 	/* process properties */
-	while (1) {
-		u32 sz, noff;
-		char *pname;
-
-		tag = be32_to_cpup(*p);
-		if (tag == OF_DT_NOP) {
-			*p += 4;
-			continue;
-		}
-		if (tag != OF_DT_PROP)
+	for (offset = fdt_first_property_offset(blob, *poffset);
+	     (offset >= 0);
+	     (offset = fdt_next_property_offset(blob, offset))) {
+		const char *pname;
+		u32 sz;
+
+		if (!(p = fdt_getprop_by_offset(blob, offset, &pname, &sz))) {
+			offset = -FDT_ERR_INTERNAL;
 			break;
-		*p += 4;
-		sz = be32_to_cpup(*p);
-		noff = be32_to_cpup(*p + 4);
-		*p += 8;
-		if (be32_to_cpu(blob->version) < 0x10)
-			*p = PTR_ALIGN(*p, sz >= 8 ? 8 : 4);
-
-		pname = of_fdt_get_string(blob, noff);
+		}
+
 		if (pname == NULL) {
 			pr_info("Can't find property name in list !\n");
 			break;
 		}
 		if (strcmp(pname, "name") == 0)
 			has_name = 1;
-		l = strlen(pname) + 1;
 		pp = unflatten_dt_alloc(&mem, sizeof(struct property),
 					__alignof__(struct property));
 		if (allnextpp) {
@@ -270,26 +213,25 @@ static void * unflatten_dt_node(struct boot_param_header *blob,
 			if ((strcmp(pname, "phandle") == 0) ||
 			    (strcmp(pname, "linux,phandle") == 0)) {
 				if (np->phandle == 0)
-					np->phandle = be32_to_cpup((__be32*)*p);
+					np->phandle = be32_to_cpup(p);
 			}
 			/* And we process the "ibm,phandle" property
 			 * used in pSeries dynamic device tree
 			 * stuff */
 			if (strcmp(pname, "ibm,phandle") == 0)
-				np->phandle = be32_to_cpup((__be32 *)*p);
-			pp->name = pname;
+				np->phandle = be32_to_cpup(p);
+			pp->name = (char *)pname;
 			pp->length = sz;
-			pp->value = *p;
+			pp->value = (__be32 *)p;
 			*prev_pp = pp;
 			prev_pp = &pp->next;
 		}
-		*p = PTR_ALIGN((*p) + sz, 4);
 	}
 	/* with version 0x10 we may not have the name property, recreate
 	 * it here from the unit name if absent
 	 */
 	if (!has_name) {
-		char *p1 = pathp, *ps = pathp, *pa = NULL;
+		const char *p1 = pathp, *ps = pathp, *pa = NULL;
 		int sz;
 
 		while (*p1) {
@@ -326,19 +268,18 @@ static void * unflatten_dt_node(struct boot_param_header *blob,
 		if (!np->type)
 			np->type = "<NULL>";
 	}
-	while (tag == OF_DT_BEGIN_NODE || tag == OF_DT_NOP) {
-		if (tag == OF_DT_NOP)
-			*p += 4;
-		else
-			mem = unflatten_dt_node(blob, mem, p, np, allnextpp,
-						fpsize);
-		tag = be32_to_cpup(*p);
-	}
-	if (tag != OF_DT_END_NODE) {
-		pr_err("Weird tag at end of node: %x\n", tag);
-		return mem;
-	}
-	*p += 4;
+
+	old_depth = depth;
+	*poffset = fdt_next_node(blob, *poffset, &depth);
+	if (depth < 0)
+		depth = 0;
+	while (*poffset > 0 && depth > old_depth)
+		mem = unflatten_dt_node(blob, mem, poffset, np, allnextpp,
+					fpsize);
+
+	if (*poffset < 0 && *poffset != -FDT_ERR_NOTFOUND)
+		pr_err("unflatten: error %d processing FDT\n", *poffset);
+
 	return mem;
 }
 
@@ -359,7 +300,8 @@ static void __unflatten_device_tree(struct boot_param_header *blob,
 			     void * (*dt_alloc)(u64 size, u64 align))
 {
 	unsigned long size;
-	void *start, *mem;
+	int start;
+	void *mem;
 	struct device_node **allnextp = mynodes;
 
 	pr_debug(" -> unflatten_device_tree()\n");
@@ -380,7 +322,7 @@ static void __unflatten_device_tree(struct boot_param_header *blob,
 	}
 
 	/* First pass, scan for size */
-	start = ((void *)blob) + be32_to_cpu(blob->off_dt_struct);
+	start = 0;
 	size = (unsigned long)unflatten_dt_node(blob, 0, &start, NULL, NULL, 0);
 	size = ALIGN(size, 4);
 
@@ -395,10 +337,8 @@ static void __unflatten_device_tree(struct boot_param_header *blob,
 	pr_debug("  unflattening %p...\n", mem);
 
 	/* Second pass, do actual unflattening */
-	start = ((void *)blob) + be32_to_cpu(blob->off_dt_struct);
+	start = 0;
 	unflatten_dt_node(blob, mem, &start, NULL, &allnextp, 0);
-	if (be32_to_cpup(start) != OF_DT_END)
-		pr_warning("Weird tag at end of tree: %08x\n", be32_to_cpup(start));
 	if (be32_to_cpup(mem + size) != 0xdeadbeef)
 		pr_warning("End of tree marker overwritten: %08x\n",
 			   be32_to_cpup(mem + size));
@@ -574,47 +514,19 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
 				     void *data),
 			   void *data)
 {
-	unsigned long p = ((unsigned long)initial_boot_params) +
-		be32_to_cpu(initial_boot_params->off_dt_struct);
-	int rc = 0;
-	int depth = -1;
-
-	do {
-		u32 tag = be32_to_cpup((__be32 *)p);
-		const char *pathp;
-
-		p += 4;
-		if (tag == OF_DT_END_NODE) {
-			depth--;
-			continue;
-		}
-		if (tag == OF_DT_NOP)
-			continue;
-		if (tag == OF_DT_END)
-			break;
-		if (tag == OF_DT_PROP) {
-			u32 sz = be32_to_cpup((__be32 *)p);
-			p += 8;
-			if (be32_to_cpu(initial_boot_params->version) < 0x10)
-				p = ALIGN(p, sz >= 8 ? 8 : 4);
-			p += sz;
-			p = ALIGN(p, 4);
-			continue;
-		}
-		if (tag != OF_DT_BEGIN_NODE) {
-			pr_err("Invalid tag %x in flat device tree!\n", tag);
-			return -EINVAL;
-		}
-		depth++;
-		pathp = (char *)p;
-		p = ALIGN(p + strlen(pathp) + 1, 4);
+	const void *blob = initial_boot_params;
+	const char *pathp;
+	int offset, rc = 0, depth = -1;
+
+        for (offset = fdt_next_node(blob, -1, &depth);
+             offset >= 0 && depth >= 0 && !rc;
+             offset = fdt_next_node(blob, offset, &depth)) {
+
+		pathp = fdt_get_name(blob, offset, NULL);
 		if (*pathp == '/')
 			pathp = kbasename(pathp);
-		rc = it(p, pathp, depth, data);
-		if (rc != 0)
-			break;
-	} while (1);
-
+		rc = it(offset, pathp, depth, data);
+	}
 	return rc;
 }
 
@@ -623,14 +535,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
  */
 unsigned long __init of_get_flat_dt_root(void)
 {
-	unsigned long p = ((unsigned long)initial_boot_params) +
-		be32_to_cpu(initial_boot_params->off_dt_struct);
-
-	while (be32_to_cpup((__be32 *)p) == OF_DT_NOP)
-		p += 4;
-	BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE);
-	p += 4;
-	return ALIGN(p + strlen((char *)p) + 1, 4);
+	return 0;
 }
 
 /**
@@ -642,7 +547,7 @@ unsigned long __init of_get_flat_dt_root(void)
 const void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
 				       int *size)
 {
-	return of_fdt_get_property(initial_boot_params, node, name, size);
+	return fdt_getprop(initial_boot_params, node, name, size);
 }
 
 /**
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index b36a50d..26cef9a 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -84,7 +84,6 @@ extern char __dtb_start[];
 extern char __dtb_end[];
 
 /* For scanning the flat device-tree at boot time */
-extern char *find_flat_dt_string(u32 offset);
 extern int of_scan_flat_dt(int (*it)(unsigned long node, const char *uname,
 				     int depth, void *data),
 			   void *data);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 13/21] of/fdt: use libfdt accessors for header data
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (11 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 12/21] of/fdt: Convert FDT functions to use libfdt Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 14/21] of/fdt: create common debugfs Rob Herring
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring, Max Filippov

From: Rob Herring <robh@kernel.org>

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: Max Filippov <jcmvbkbc@gmail.com>
---
v2: fix alignment to be power of 2 in unflatten_and_copy_device_tree

 drivers/of/fdt.c       | 26 ++++++++++++--------------
 include/linux/of_fdt.h |  8 ++++----
 2 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 8e820a2..0b38a6a 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -34,7 +34,7 @@
  * On match, returns a non-zero value with smaller values returned for more
  * specific compatible values.
  */
-int of_fdt_is_compatible(struct boot_param_header *blob,
+int of_fdt_is_compatible(const void *blob,
 		      unsigned long node, const char *compat)
 {
 	const char *cp;
@@ -59,7 +59,7 @@ int of_fdt_is_compatible(struct boot_param_header *blob,
 /**
  * of_fdt_match - Return true if node matches a list of compatible values
  */
-int of_fdt_match(struct boot_param_header *blob, unsigned long node,
+int of_fdt_match(const void *blob, unsigned long node,
                  const char *const *compat)
 {
 	unsigned int tmp, score = 0;
@@ -98,7 +98,7 @@ static void *unflatten_dt_alloc(void **mem, unsigned long size,
  * @allnextpp: pointer to ->allnext from last allocated device_node
  * @fpsize: Size of the node path up at the current depth.
  */
-static void * unflatten_dt_node(struct boot_param_header *blob,
+static void * unflatten_dt_node(void *blob,
 				void *mem,
 				int *poffset,
 				struct device_node *dad,
@@ -295,7 +295,7 @@ static void * unflatten_dt_node(struct boot_param_header *blob,
  * @dt_alloc: An allocator that provides a virtual address to memory
  * for the resulting tree
  */
-static void __unflatten_device_tree(struct boot_param_header *blob,
+static void __unflatten_device_tree(void *blob,
 			     struct device_node **mynodes,
 			     void * (*dt_alloc)(u64 size, u64 align))
 {
@@ -312,11 +312,11 @@ static void __unflatten_device_tree(struct boot_param_header *blob,
 	}
 
 	pr_debug("Unflattening device tree:\n");
-	pr_debug("magic: %08x\n", be32_to_cpu(blob->magic));
-	pr_debug("size: %08x\n", be32_to_cpu(blob->totalsize));
-	pr_debug("version: %08x\n", be32_to_cpu(blob->version));
+	pr_debug("magic: %08x\n", fdt_magic(blob));
+	pr_debug("size: %08x\n", fdt_totalsize(blob));
+	pr_debug("version: %08x\n", fdt_version(blob));
 
-	if (be32_to_cpu(blob->magic) != OF_DT_HEADER) {
+	if (fdt_check_header(blob)) {
 		pr_err("Invalid device tree blob header\n");
 		return;
 	}
@@ -363,9 +363,7 @@ static void *kernel_tree_alloc(u64 size, u64 align)
 void of_fdt_unflatten_tree(unsigned long *blob,
 			struct device_node **mynodes)
 {
-	struct boot_param_header *device_tree =
-		(struct boot_param_header *)blob;
-	__unflatten_device_tree(device_tree, mynodes, &kernel_tree_alloc);
+	__unflatten_device_tree(blob, mynodes, &kernel_tree_alloc);
 }
 EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree);
 
@@ -852,7 +850,7 @@ bool __init early_init_dt_scan(void *params)
 	initial_boot_params = params;
 
 	/* check device tree validity */
-	if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
+	if (fdt_check_header(params)) {
 		initial_boot_params = NULL;
 		return false;
 	}
@@ -907,9 +905,9 @@ void __init unflatten_and_copy_device_tree(void)
 		return;
 	}
 
-	size = __be32_to_cpu(initial_boot_params->totalsize);
+	size = fdt_totalsize(initial_boot_params);
 	dt = early_init_dt_alloc_memory_arch(size,
-		__alignof__(struct boot_param_header));
+					     roundup_pow_of_two(FDT_V17_SIZE));
 
 	if (dt) {
 		memcpy(dt, initial_boot_params, size);
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 26cef9a..348dae2 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -62,15 +62,15 @@ struct boot_param_header {
 struct device_node;
 
 /* For scanning an arbitrary device-tree at any time */
-extern char *of_fdt_get_string(struct boot_param_header *blob, u32 offset);
-extern void *of_fdt_get_property(struct boot_param_header *blob,
+extern char *of_fdt_get_string(const void *blob, u32 offset);
+extern void *of_fdt_get_property(const void *blob,
 				 unsigned long node,
 				 const char *name,
 				 int *size);
-extern int of_fdt_is_compatible(struct boot_param_header *blob,
+extern int of_fdt_is_compatible(const void *blob,
 				unsigned long node,
 				const char *compat);
-extern int of_fdt_match(struct boot_param_header *blob, unsigned long node,
+extern int of_fdt_match(const void *blob, unsigned long node,
 			const char *const *compat);
 extern void of_fdt_unflatten_tree(unsigned long *blob,
 			       struct device_node **mynodes);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 14/21] of/fdt: create common debugfs
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (12 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 13/21] of/fdt: use libfdt accessors for header data Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23 13:52   ` Michal Simek
  2014-04-23  1:18 ` [PATCH v2 15/21] of/fdt: move memreserve and dtb memory reservations into core Rob Herring
                   ` (10 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Michal Simek, Benjamin Herrenschmidt,
	Paul Mackerras, linuxppc-dev

From: Rob Herring <robh@kernel.org>

Both powerpc and microblaze have the same FDT blob in debugfs feature.
Move this to common location and remove the powerpc and microblaze
implementations. This feature could become more useful when FDT
overlay support is added.

This changes the path of the blob from "$arch/flat-device-tree" to
"device-tree/flat-device-tree".

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
v2: move to after libfdt conversion

 arch/microblaze/kernel/prom.c | 31 -------------------------------
 arch/powerpc/kernel/prom.c    | 21 ---------------------
 drivers/of/fdt.c              | 24 ++++++++++++++++++++++++
 3 files changed, 24 insertions(+), 52 deletions(-)

diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index c766306..68f0999 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -114,34 +114,3 @@ void __init early_init_devtree(void *params)
 
 	pr_debug(" <- early_init_devtree()\n");
 }
-
-/*******
- *
- * New implementation of the OF "find" APIs, return a refcounted
- * object, call of_node_put() when done.  The device tree and list
- * are protected by a rw_lock.
- *
- * Note that property management will need some locking as well,
- * this isn't dealt with yet.
- *
- *******/
-
-#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
-static struct debugfs_blob_wrapper flat_dt_blob;
-
-static int __init export_flat_device_tree(void)
-{
-	struct dentry *d;
-
-	flat_dt_blob.data = initial_boot_params;
-	flat_dt_blob.size = initial_boot_params->totalsize;
-
-	d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
-				of_debugfs_root, &flat_dt_blob);
-	if (!d)
-		return 1;
-
-	return 0;
-}
-device_initcall(export_flat_device_tree);
-#endif
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index f971134..03624ce 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -29,7 +29,6 @@
 #include <linux/bitops.h>
 #include <linux/export.h>
 #include <linux/kexec.h>
-#include <linux/debugfs.h>
 #include <linux/irq.h>
 #include <linux/memblock.h>
 #include <linux/of.h>
@@ -924,23 +923,3 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
 {
 	return (int)phys_id == get_hard_smp_processor_id(cpu);
 }
-
-#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
-static struct debugfs_blob_wrapper flat_dt_blob;
-
-static int __init export_flat_device_tree(void)
-{
-	struct dentry *d;
-
-	flat_dt_blob.data = initial_boot_params;
-	flat_dt_blob.size = be32_to_cpu(initial_boot_params->totalsize);
-
-	d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
-				powerpc_debugfs_root, &flat_dt_blob);
-	if (!d)
-		return 1;
-
-	return 0;
-}
-__initcall(export_flat_device_tree);
-#endif
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 0b38a6a..4129f74 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -20,6 +20,7 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/libfdt.h>
+#include <linux/debugfs.h>
 
 #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
 #include <asm/page.h>
@@ -916,4 +917,27 @@ void __init unflatten_and_copy_device_tree(void)
 	unflatten_device_tree();
 }
 
+#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
+static struct debugfs_blob_wrapper flat_dt_blob;
+
+static int __init of_flat_dt_debugfs_export_fdt(void)
+{
+	struct dentry *d = debugfs_create_dir("device-tree", NULL);
+
+	if (!d)
+		return -ENOENT;
+
+	flat_dt_blob.data = initial_boot_params;
+	flat_dt_blob.size = fdt_totalsize(initial_boot_params);
+
+	d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
+				d, &flat_dt_blob);
+	if (!d)
+		return -ENOENT;
+
+	return 0;
+}
+module_init(of_flat_dt_debugfs_export_fdt);
+#endif
+
 #endif /* CONFIG_OF_EARLY_FLATTREE */
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 15/21] of/fdt: move memreserve and dtb memory reservations into core
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (13 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 14/21] of/fdt: create common debugfs Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-05-01 16:27   ` Catalin Marinas
  2014-04-23  1:18 ` [PATCH v2 16/21] of/fdt: fix phys_addr_t related print size warnings Rob Herring
                   ` (9 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Russell King, Catalin Marinas, Will Deacon,
	Benjamin Herrenschmidt, Paul Mackerras

From: Rob Herring <robh@kernel.org>

Move the /memreserve/ processing and dtb memory reservations into
early_init_fdt_scan_reserved_mem. This converts arm, arm64, and powerpc
as they are the only users of early_init_fdt_scan_reserved_mem.

memblock_reserve is safe to call on the same region twice, so the
reservation check for the dtb in powerpc 32-bit reservations is safe to
remove.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
---
v2: No change

 arch/arm/include/asm/prom.h |  2 --
 arch/arm/kernel/devtree.c   | 27 ---------------------------
 arch/arm/mm/init.c          |  1 -
 arch/arm64/mm/init.c        | 21 ---------------------
 arch/powerpc/kernel/prom.c  | 22 ----------------------
 drivers/of/fdt.c            | 16 ++++++++++++++++
 6 files changed, 16 insertions(+), 73 deletions(-)

diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h
index b681575..cd94ef2 100644
--- a/arch/arm/include/asm/prom.h
+++ b/arch/arm/include/asm/prom.h
@@ -14,7 +14,6 @@
 #ifdef CONFIG_OF
 
 extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
-extern void arm_dt_memblock_reserve(void);
 extern void __init arm_dt_init_cpu_maps(void);
 
 #else /* CONFIG_OF */
@@ -24,7 +23,6 @@ static inline const struct machine_desc *setup_machine_fdt(unsigned int dt_phys)
 	return NULL;
 }
 
-static inline void arm_dt_memblock_reserve(void) { }
 static inline void arm_dt_init_cpu_maps(void) { }
 
 #endif /* CONFIG_OF */
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 38f4711..3e5a205 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -32,33 +32,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 	arm_add_memory(base, size);
 }
 
-void __init arm_dt_memblock_reserve(void)
-{
-	u64 *reserve_map, base, size;
-
-	if (!initial_boot_params)
-		return;
-
-	/* Reserve the dtb region */
-	memblock_reserve(virt_to_phys(initial_boot_params),
-			 be32_to_cpu(initial_boot_params->totalsize));
-
-	/*
-	 * Process the reserve map.  This will probably overlap the initrd
-	 * and dtb locations which are already reserved, but overlaping
-	 * doesn't hurt anything
-	 */
-	reserve_map = ((void*)initial_boot_params) +
-			be32_to_cpu(initial_boot_params->off_mem_rsvmap);
-	while (1) {
-		base = be64_to_cpup(reserve_map++);
-		size = be64_to_cpup(reserve_map++);
-		if (!size)
-			break;
-		memblock_reserve(base, size);
-	}
-}
-
 #ifdef CONFIG_SMP
 extern struct of_cpu_method __cpu_method_of_table_begin[];
 extern struct of_cpu_method __cpu_method_of_table_end[];
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2a77ba8..928d596 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -317,7 +317,6 @@ void __init arm_memblock_init(struct meminfo *mi,
 #endif
 
 	arm_mm_memblock_reserve();
-	arm_dt_memblock_reserve();
 
 	/* reserve any platform specific memblock areas */
 	if (mdesc->reserve)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 51d5352..091d428 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -126,8 +126,6 @@ static void arm64_memory_present(void)
 
 void __init arm64_memblock_init(void)
 {
-	u64 *reserve_map, base, size;
-
 	/* Register the kernel text, kernel data and initrd with memblock */
 	memblock_reserve(__pa(_text), _end - _text);
 #ifdef CONFIG_BLK_DEV_INITRD
@@ -142,25 +140,6 @@ void __init arm64_memblock_init(void)
 	memblock_reserve(__pa(swapper_pg_dir), SWAPPER_DIR_SIZE);
 	memblock_reserve(__pa(idmap_pg_dir), IDMAP_DIR_SIZE);
 
-	/* Reserve the dtb region */
-	memblock_reserve(virt_to_phys(initial_boot_params),
-			 be32_to_cpu(initial_boot_params->totalsize));
-
-	/*
-	 * Process the reserve map.  This will probably overlap the initrd
-	 * and dtb locations which are already reserved, but overlapping
-	 * doesn't hurt anything
-	 */
-	reserve_map = ((void*)initial_boot_params) +
-			be32_to_cpu(initial_boot_params->off_mem_rsvmap);
-	while (1) {
-		base = be64_to_cpup(reserve_map++);
-		size = be64_to_cpup(reserve_map++);
-		if (!size)
-			break;
-		memblock_reserve(base, size);
-	}
-
 	early_init_fdt_scan_reserved_mem();
 	dma_contiguous_reserve(0);
 
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 03624ce..b1de8e3 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -596,19 +596,11 @@ static void __init early_reserve_mem_dt(void)
 
 static void __init early_reserve_mem(void)
 {
-	u64 base, size;
 	__be64 *reserve_map;
-	unsigned long self_base;
-	unsigned long self_size;
 
 	reserve_map = (__be64 *)(((unsigned long)initial_boot_params) +
 			be32_to_cpu(initial_boot_params->off_mem_rsvmap));
 
-	/* before we do anything, lets reserve the dt blob */
-	self_base = __pa((unsigned long)initial_boot_params);
-	self_size = be32_to_cpu(initial_boot_params->totalsize);
-	memblock_reserve(self_base, self_size);
-
 	/* Look for the new "reserved-regions" property in the DT */
 	early_reserve_mem_dt();
 
@@ -637,26 +629,12 @@ static void __init early_reserve_mem(void)
 			size_32 = be32_to_cpup(reserve_map_32++);
 			if (size_32 == 0)
 				break;
-			/* skip if the reservation is for the blob */
-			if (base_32 == self_base && size_32 == self_size)
-				continue;
 			DBG("reserving: %x -> %x\n", base_32, size_32);
 			memblock_reserve(base_32, size_32);
 		}
 		return;
 	}
 #endif
-	DBG("Processing reserve map\n");
-
-	/* Handle the reserve map in the fdt blob if it exists */
-	while (1) {
-		base = be64_to_cpup(reserve_map++);
-		size = be64_to_cpup(reserve_map++);
-		if (size == 0)
-			break;
-		DBG("reserving: %llx -> %llx\n", base, size);
-		memblock_reserve(base, size);
-	}
 }
 
 void __init early_init_devtree(void *params)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 4129f74..051be4c 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -492,9 +492,25 @@ static int __init __fdt_scan_reserved_mem(unsigned long node, const char *uname,
  */
 void __init early_init_fdt_scan_reserved_mem(void)
 {
+	int n;
+	u64 base, size;
+
 	if (!initial_boot_params)
 		return;
 
+	/* Reserve the dtb region */
+	early_init_dt_reserve_memory_arch(__pa(initial_boot_params),
+					  fdt_totalsize(initial_boot_params),
+					  0);
+
+	/* Process header /memreserve/ fields */
+	for (n = 0; ; n++) {
+		fdt_get_mem_rsv(initial_boot_params, n, &base, &size);
+		if (!size)
+			break;
+		early_init_dt_reserve_memory_arch(base, size, 0);
+	}
+
 	of_scan_flat_dt(__fdt_scan_reserved_mem, NULL);
 	fdt_init_reserved_mem();
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 16/21] of/fdt: fix phys_addr_t related print size warnings
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (14 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 15/21] of/fdt: move memreserve and dtb memory reservations into core Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 17/21] of/fdt: introduce of_get_flat_dt_size Rob Herring
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring

From: Rob Herring <robh@kernel.org>

Fix warnings in early_init_dt_reserve_memory_arch when phys_addr_t is
32-bit and memblock is not enabled.

Signed-off-by: Rob Herring <robh@kernel.org>
---
v2: New patch

 drivers/of/fdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 051be4c..d9e6450 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -852,8 +852,8 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
 int __init __weak early_init_dt_reserve_memory_arch(phys_addr_t base,
 					phys_addr_t size, bool nomap)
 {
-	pr_err("Reserved memory not supported, ignoring range 0x%llx - 0x%llx%s\n",
-		  base, size, nomap ? " (nomap)" : "");
+	pr_err("Reserved memory not supported, ignoring range 0x%pa - 0x%pa%s\n",
+		  &base, &size, nomap ? " (nomap)" : "");
 	return -ENOSYS;
 }
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 17/21] of/fdt: introduce of_get_flat_dt_size
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (15 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 16/21] of/fdt: fix phys_addr_t related print size warnings Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23 13:45   ` Michal Simek
  2014-04-23  1:18 ` [PATCH v2 18/21] powerpc: use libfdt accessors for header data Rob Herring
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring

From: Rob Herring <robh@kernel.org>

Add a wrapper function to retrieve the FDT size from the FDT header. This
is primarily to avoid libfdt include paths for the whole kernel.

Signed-off-by: Rob Herring <robh@kernel.org>
---
v2: new patch

 drivers/of/fdt.c       | 8 ++++++++
 include/linux/of_fdt.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d9e6450..358bcf0 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -554,6 +554,14 @@ unsigned long __init of_get_flat_dt_root(void)
 }
 
 /**
+ * of_get_flat_dt_size - Return the total size of the FDT
+ */
+int __init of_get_flat_dt_size(void)
+{
+	return fdt_totalsize(initial_boot_params);
+}
+
+/**
  * of_get_flat_dt_prop - Given a node in the flat blob, return the property ptr
  *
  * This function can be used within scan_flattened_dt callback to get
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 348dae2..e10099c 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -92,6 +92,7 @@ extern const void *of_get_flat_dt_prop(unsigned long node, const char *name,
 extern int of_flat_dt_is_compatible(unsigned long node, const char *name);
 extern int of_flat_dt_match(unsigned long node, const char *const *matches);
 extern unsigned long of_get_flat_dt_root(void);
+extern int of_get_flat_dt_size(void);
 
 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
 				     int depth, void *data);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 18/21] powerpc: use libfdt accessors for header data
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (16 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 17/21] of/fdt: introduce of_get_flat_dt_size Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23 13:48   ` Michal Simek
  2014-04-23  1:18 ` [PATCH v2 19/21] x86: use FDT accessors for FDT blob " Rob Herring
                   ` (6 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Benjamin Herrenschmidt, Paul Mackerras

From: Rob Herring <robh@kernel.org>

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>
---
v2: As powerpc is the only platform needing FDT header access, make
 prom.c include libfdt directly.
 
 arch/powerpc/kernel/Makefile |  1 +
 arch/powerpc/kernel/prom.c   | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index fcc9a89..fab19ec 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -2,6 +2,7 @@
 # Makefile for the linux kernel.
 #
 
+CFLAGS_prom.o		= -I$(src)/../../../scripts/dtc/libfdt
 CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
 
 subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index b1de8e3..0239f0b 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -33,6 +33,7 @@
 #include <linux/memblock.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/libfdt.h>
 
 #include <asm/prom.h>
 #include <asm/rtas.h>
@@ -117,14 +118,14 @@ static void __init move_device_tree(void)
 	DBG("-> move_device_tree\n");
 
 	start = __pa(initial_boot_params);
-	size = be32_to_cpu(initial_boot_params->totalsize);
+	size = fdt_totalsize(initial_boot_params);
 
 	if ((memory_limit && (start + size) > PHYSICAL_START + memory_limit) ||
 			overlaps_crashkernel(start, size) ||
 			overlaps_initrd(start, size)) {
 		p = __va(memblock_alloc(size, PAGE_SIZE));
 		memcpy(p, initial_boot_params, size);
-		initial_boot_params = (struct boot_param_header *)p;
+		initial_boot_params = p;
 		DBG("Moved device tree to 0x%p\n", p);
 	}
 
@@ -324,9 +325,9 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 		 * version 2 of the kexec param format adds the phys cpuid of
 		 * booted proc.
 		 */
-		if (be32_to_cpu(initial_boot_params->version) >= 2) {
+		if (fdt_version(initial_boot_params) >= 2) {
 			if (be32_to_cpu(intserv[i]) ==
-			    be32_to_cpu(initial_boot_params->boot_cpuid_phys)) {
+			    fdt_boot_cpuid_phys(initial_boot_params)) {
 				found = boot_cpu_count;
 				found_thread = i;
 			}
@@ -599,7 +600,7 @@ static void __init early_reserve_mem(void)
 	__be64 *reserve_map;
 
 	reserve_map = (__be64 *)(((unsigned long)initial_boot_params) +
-			be32_to_cpu(initial_boot_params->off_mem_rsvmap));
+			fdt_off_mem_rsvmap(initial_boot_params));
 
 	/* Look for the new "reserved-regions" property in the DT */
 	early_reserve_mem_dt();
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 19/21] x86: use FDT accessors for FDT blob header data
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (17 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 18/21] powerpc: use libfdt accessors for header data Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 20/21] of/fdt: convert initial_boot_params to opaque pointer Rob Herring
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86

From: Rob Herring <robh@kernel.org>

Remove the direct accesses to FDT header data using accessor
function instead. This makes the code more readable and makes the FDT
blob structure more opaque to the arch code. This also prepares for
removing struct boot_param_header completely.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
---
v2: reworked to use of_get_flat_dt_size helper function

 arch/x86/kernel/devicetree.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index d35078e..7db54b5 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -206,23 +206,21 @@ static void __init dtb_apic_setup(void)
 static void __init x86_flattree_get_config(void)
 {
 	u32 size, map_len;
-	struct boot_param_header *dt;
+	void *dt;
 
 	if (!initial_dtb)
 		return;
 
-	map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK),
-			(u64)sizeof(struct boot_param_header));
+	map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128);
 
-	dt = early_memremap(initial_dtb, map_len);
-	size = be32_to_cpu(dt->totalsize);
+	initial_boot_params = dt = early_memremap(initial_dtb, map_len);
+	size = of_get_flat_dt_size();
 	if (map_len < size) {
 		early_iounmap(dt, map_len);
-		dt = early_memremap(initial_dtb, size);
+		initial_boot_params = dt = early_memremap(initial_dtb, size);
 		map_len = size;
 	}
 
-	initial_boot_params = dt;
 	unflatten_and_copy_device_tree();
 	early_iounmap(dt, map_len);
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 20/21] of/fdt: convert initial_boot_params to opaque pointer
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (18 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 19/21] x86: use FDT accessors for FDT blob " Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-23  1:18 ` [PATCH v2 21/21] of: push struct boot_param_header and defines into powerpc Rob Herring
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree; +Cc: Rob Herring

From: Rob Herring <robh@kernel.org>

Now that all accesses to FDT header data has been converted to accessor
helpers, initial_boot_params can become an opaque pointer.

Signed-off-by: Rob Herring <robh@kernel.org>
---
v2: no change

 drivers/of/fdt.c       | 2 +-
 include/linux/of_fdt.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 358bcf0..a6f83ea 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -372,7 +372,7 @@ EXPORT_SYMBOL_GPL(of_fdt_unflatten_tree);
 int __initdata dt_root_addr_cells;
 int __initdata dt_root_size_cells;
 
-struct boot_param_header *initial_boot_params;
+void *initial_boot_params;
 
 #ifdef CONFIG_OF_EARLY_FLATTREE
 
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index e10099c..1f882e1 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -78,7 +78,7 @@ extern void of_fdt_unflatten_tree(unsigned long *blob,
 /* TBD: Temporary export of fdt globals - remove when code fully merged */
 extern int __initdata dt_root_addr_cells;
 extern int __initdata dt_root_size_cells;
-extern struct boot_param_header *initial_boot_params;
+extern void *initial_boot_params;
 
 extern char __dtb_start[];
 extern char __dtb_end[];
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* [PATCH v2 21/21] of: push struct boot_param_header and defines into powerpc
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (19 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 20/21] of/fdt: convert initial_boot_params to opaque pointer Rob Herring
@ 2014-04-23  1:18 ` Rob Herring
  2014-04-28  1:37   ` Benjamin Herrenschmidt
  2014-04-23 14:22 ` [PATCH v2 00/21] FDT clean-ups and libfdt support Michal Simek
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2014-04-23  1:18 UTC (permalink / raw)
  To: Grant Likely, linux-kernel, devicetree
  Cc: Rob Herring, Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev

From: Rob Herring <robh@kernel.org>

Now powerpc is the only user of struct boot_param_header and FDT defines,
so they can be moved into the powerpc architecture code.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
---
v2: no change

 arch/powerpc/include/asm/prom.h | 39 +++++++++++++++++++++++++++++++++++++++
 include/linux/of_fdt.h          | 37 -------------------------------------
 2 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index d977b9b..74b79f0 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -26,6 +26,45 @@
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
 
+#define OF_DT_BEGIN_NODE	0x1		/* Start of node, full name */
+#define OF_DT_END_NODE		0x2		/* End node */
+#define OF_DT_PROP		0x3		/* Property: name off, size,
+						 * content */
+#define OF_DT_NOP		0x4		/* nop */
+#define OF_DT_END		0x9
+
+#define OF_DT_VERSION		0x10
+
+/*
+ * This is what gets passed to the kernel by prom_init or kexec
+ *
+ * The dt struct contains the device tree structure, full pathes and
+ * property contents. The dt strings contain a separate block with just
+ * the strings for the property names, and is fully page aligned and
+ * self contained in a page, so that it can be kept around by the kernel,
+ * each property name appears only once in this page (cheap compression)
+ *
+ * the mem_rsvmap contains a map of reserved ranges of physical memory,
+ * passing it here instead of in the device-tree itself greatly simplifies
+ * the job of everybody. It's just a list of u64 pairs (base/size) that
+ * ends when size is 0
+ */
+struct boot_param_header {
+	__be32	magic;			/* magic word OF_DT_HEADER */
+	__be32	totalsize;		/* total size of DT block */
+	__be32	off_dt_struct;		/* offset to structure */
+	__be32	off_dt_strings;		/* offset to strings */
+	__be32	off_mem_rsvmap;		/* offset to memory reserve map */
+	__be32	version;		/* format version */
+	__be32	last_comp_version;	/* last compatible version */
+	/* version 2 fields below */
+	__be32	boot_cpuid_phys;	/* Physical CPU id we're booting on */
+	/* version 3 fields below */
+	__be32	dt_strings_size;	/* size of the DT strings block */
+	/* version 17 fields below */
+	__be32	dt_struct_size;		/* size of the DT structure block */
+};
+
 /*
  * OF address retreival & translation
  */
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index 1f882e1..5c0ab05 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -17,45 +17,8 @@
 
 /* Definitions used by the flattened device tree */
 #define OF_DT_HEADER		0xd00dfeed	/* marker */
-#define OF_DT_BEGIN_NODE	0x1		/* Start of node, full name */
-#define OF_DT_END_NODE		0x2		/* End node */
-#define OF_DT_PROP		0x3		/* Property: name off, size,
-						 * content */
-#define OF_DT_NOP		0x4		/* nop */
-#define OF_DT_END		0x9
-
-#define OF_DT_VERSION		0x10
 
 #ifndef __ASSEMBLY__
-/*
- * This is what gets passed to the kernel by prom_init or kexec
- *
- * The dt struct contains the device tree structure, full pathes and
- * property contents. The dt strings contain a separate block with just
- * the strings for the property names, and is fully page aligned and
- * self contained in a page, so that it can be kept around by the kernel,
- * each property name appears only once in this page (cheap compression)
- *
- * the mem_rsvmap contains a map of reserved ranges of physical memory,
- * passing it here instead of in the device-tree itself greatly simplifies
- * the job of everybody. It's just a list of u64 pairs (base/size) that
- * ends when size is 0
- */
-struct boot_param_header {
-	__be32	magic;			/* magic word OF_DT_HEADER */
-	__be32	totalsize;		/* total size of DT block */
-	__be32	off_dt_struct;		/* offset to structure */
-	__be32	off_dt_strings;		/* offset to strings */
-	__be32	off_mem_rsvmap;		/* offset to memory reserve map */
-	__be32	version;		/* format version */
-	__be32	last_comp_version;	/* last compatible version */
-	/* version 2 fields below */
-	__be32	boot_cpuid_phys;	/* Physical CPU id we're booting on */
-	/* version 3 fields below */
-	__be32	dt_strings_size;	/* size of the DT strings block */
-	/* version 17 fields below */
-	__be32	dt_struct_size;		/* size of the DT structure block */
-};
 
 #if defined(CONFIG_OF_FLATTREE)
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 17/21] of/fdt: introduce of_get_flat_dt_size
  2014-04-23  1:18 ` [PATCH v2 17/21] of/fdt: introduce of_get_flat_dt_size Rob Herring
@ 2014-04-23 13:45   ` Michal Simek
  0 siblings, 0 replies; 34+ messages in thread
From: Michal Simek @ 2014-04-23 13:45 UTC (permalink / raw)
  To: Rob Herring; +Cc: Grant Likely, linux-kernel, devicetree, Rob Herring

[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]

On 04/23/2014 03:18 AM, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> Add a wrapper function to retrieve the FDT size from the FDT header. This
> is primarily to avoid libfdt include paths for the whole kernel.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> v2: new patch
> 
>  drivers/of/fdt.c       | 8 ++++++++
>  include/linux/of_fdt.h | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d9e6450..358bcf0 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -554,6 +554,14 @@ unsigned long __init of_get_flat_dt_root(void)
>  }
>  
>  /**
> + * of_get_flat_dt_size - Return the total size of the FDT
> + */

It looks like that you are trying to use kernel-doc format
but I believe this will caused kernel-doc warning.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 18/21] powerpc: use libfdt accessors for header data
  2014-04-23  1:18 ` [PATCH v2 18/21] powerpc: use libfdt accessors for header data Rob Herring
@ 2014-04-23 13:48   ` Michal Simek
  2014-04-23 14:05     ` Rob Herring
  0 siblings, 1 reply; 34+ messages in thread
From: Michal Simek @ 2014-04-23 13:48 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, linux-kernel, devicetree, Rob Herring,
	Benjamin Herrenschmidt, Paul Mackerras

[-- Attachment #1: Type: text/plain, Size: 2452 bytes --]

On 04/23/2014 03:18 AM, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> 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>
> ---
> v2: As powerpc is the only platform needing FDT header access, make
>  prom.c include libfdt directly.
>  
>  arch/powerpc/kernel/Makefile |  1 +
>  arch/powerpc/kernel/prom.c   | 11 ++++++-----
>  2 files changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> index fcc9a89..fab19ec 100644
> --- a/arch/powerpc/kernel/Makefile
> +++ b/arch/powerpc/kernel/Makefile
> @@ -2,6 +2,7 @@
>  # Makefile for the linux kernel.
>  #
>  
> +CFLAGS_prom.o		= -I$(src)/../../../scripts/dtc/libfdt
>  CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
>  
>  subdir-ccflags-$(CONFIG_PPC_WERROR) := -Werror
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index b1de8e3..0239f0b 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -33,6 +33,7 @@
>  #include <linux/memblock.h>
>  #include <linux/of.h>
>  #include <linux/of_fdt.h>
> +#include <linux/libfdt.h>
>  
>  #include <asm/prom.h>
>  #include <asm/rtas.h>
> @@ -117,14 +118,14 @@ static void __init move_device_tree(void)
>  	DBG("-> move_device_tree\n");
>  
>  	start = __pa(initial_boot_params);
> -	size = be32_to_cpu(initial_boot_params->totalsize);
> +	size = fdt_totalsize(initial_boot_params);

In 19/21 you use your newly introduced of_get_flat_dt_size()
that's why I expect you will use it here too.
size = of_get_flat_dt_size();

The same is for 14/21 where you can use this new function too.
It means moving 14/21 to the end and using this new function
makes more sense.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 14/21] of/fdt: create common debugfs
  2014-04-23  1:18 ` [PATCH v2 14/21] of/fdt: create common debugfs Rob Herring
@ 2014-04-23 13:52   ` Michal Simek
  0 siblings, 0 replies; 34+ messages in thread
From: Michal Simek @ 2014-04-23 13:52 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, linux-kernel, devicetree, Rob Herring,
	Benjamin Herrenschmidt, Paul Mackerras, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 4920 bytes --]

On 04/23/2014 03:18 AM, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> Both powerpc and microblaze have the same FDT blob in debugfs feature.
> Move this to common location and remove the powerpc and microblaze
> implementations. This feature could become more useful when FDT
> overlay support is added.
> 
> This changes the path of the blob from "$arch/flat-device-tree" to
> "device-tree/flat-device-tree".
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Michal Simek <monstr@monstr.eu>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
> v2: move to after libfdt conversion
> 
>  arch/microblaze/kernel/prom.c | 31 -------------------------------
>  arch/powerpc/kernel/prom.c    | 21 ---------------------
>  drivers/of/fdt.c              | 24 ++++++++++++++++++++++++
>  3 files changed, 24 insertions(+), 52 deletions(-)
> 
> diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
> index c766306..68f0999 100644
> --- a/arch/microblaze/kernel/prom.c
> +++ b/arch/microblaze/kernel/prom.c
> @@ -114,34 +114,3 @@ void __init early_init_devtree(void *params)
>  
>  	pr_debug(" <- early_init_devtree()\n");
>  }
> -
> -/*******
> - *
> - * New implementation of the OF "find" APIs, return a refcounted
> - * object, call of_node_put() when done.  The device tree and list
> - * are protected by a rw_lock.
> - *
> - * Note that property management will need some locking as well,
> - * this isn't dealt with yet.
> - *
> - *******/
> -
> -#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
> -static struct debugfs_blob_wrapper flat_dt_blob;
> -
> -static int __init export_flat_device_tree(void)
> -{
> -	struct dentry *d;
> -
> -	flat_dt_blob.data = initial_boot_params;
> -	flat_dt_blob.size = initial_boot_params->totalsize;
> -
> -	d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
> -				of_debugfs_root, &flat_dt_blob);
> -	if (!d)
> -		return 1;
> -
> -	return 0;
> -}
> -device_initcall(export_flat_device_tree);
> -#endif
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index f971134..03624ce 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -29,7 +29,6 @@
>  #include <linux/bitops.h>
>  #include <linux/export.h>
>  #include <linux/kexec.h>
> -#include <linux/debugfs.h>
>  #include <linux/irq.h>
>  #include <linux/memblock.h>
>  #include <linux/of.h>
> @@ -924,23 +923,3 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
>  {
>  	return (int)phys_id == get_hard_smp_processor_id(cpu);
>  }
> -
> -#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
> -static struct debugfs_blob_wrapper flat_dt_blob;
> -
> -static int __init export_flat_device_tree(void)
> -{
> -	struct dentry *d;
> -
> -	flat_dt_blob.data = initial_boot_params;
> -	flat_dt_blob.size = be32_to_cpu(initial_boot_params->totalsize);
> -
> -	d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
> -				powerpc_debugfs_root, &flat_dt_blob);
> -	if (!d)
> -		return 1;
> -
> -	return 0;
> -}
> -__initcall(export_flat_device_tree);
> -#endif
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index 0b38a6a..4129f74 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -20,6 +20,7 @@
>  #include <linux/errno.h>
>  #include <linux/slab.h>
>  #include <linux/libfdt.h>
> +#include <linux/debugfs.h>
>  
>  #include <asm/setup.h>  /* for COMMAND_LINE_SIZE */
>  #include <asm/page.h>
> @@ -916,4 +917,27 @@ void __init unflatten_and_copy_device_tree(void)
>  	unflatten_device_tree();
>  }
>  
> +#if defined(CONFIG_DEBUG_FS) && defined(DEBUG)
> +static struct debugfs_blob_wrapper flat_dt_blob;
> +
> +static int __init of_flat_dt_debugfs_export_fdt(void)
> +{
> +	struct dentry *d = debugfs_create_dir("device-tree", NULL);
> +
> +	if (!d)
> +		return -ENOENT;
> +
> +	flat_dt_blob.data = initial_boot_params;
> +	flat_dt_blob.size = fdt_totalsize(initial_boot_params);

As I wrote in different patch. I would move this to the end of this
series and
flat_dt_blob.size = of_get_flat_dt_size();

> +
> +	d = debugfs_create_blob("flat-device-tree", S_IFREG | S_IRUSR,
> +				d, &flat_dt_blob);
> +	if (!d)
> +		return -ENOENT;
> +
> +	return 0;
> +}
> +module_init(of_flat_dt_debugfs_export_fdt);
> +#endif
> +
>  #endif /* CONFIG_OF_EARLY_FLATTREE */
> 

Other than comment above:
For Microblaze:
Tested-by: Michal Simek <monstr@monstr.eu>

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 18/21] powerpc: use libfdt accessors for header data
  2014-04-23 13:48   ` Michal Simek
@ 2014-04-23 14:05     ` Rob Herring
  2014-04-23 14:21       ` Michal Simek
  0 siblings, 1 reply; 34+ messages in thread
From: Rob Herring @ 2014-04-23 14:05 UTC (permalink / raw)
  To: Michal Simek
  Cc: Grant Likely, linux-kernel, devicetree, Benjamin Herrenschmidt,
	Paul Mackerras

On Wed, Apr 23, 2014 at 8:48 AM, Michal Simek <monstr@monstr.eu> wrote:
> On 04/23/2014 03:18 AM, Rob Herring wrote:
>> From: Rob Herring <robh@kernel.org>
>>
>> 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.

[...]

>> @@ -117,14 +118,14 @@ static void __init move_device_tree(void)
>>       DBG("-> move_device_tree\n");
>>
>>       start = __pa(initial_boot_params);
>> -     size = be32_to_cpu(initial_boot_params->totalsize);
>> +     size = fdt_totalsize(initial_boot_params);
>
> In 19/21 you use your newly introduced of_get_flat_dt_size()
> that's why I expect you will use it here too.
> size = of_get_flat_dt_size();
>
> The same is for 14/21 where you can use this new function too.
> It means moving 14/21 to the end and using this new function
> makes more sense.

Really, I would prefer to just use libfdt accessors directly rather
than have wrappers, but including libfdt.h is not the cleanest
solution. Since x86 just needed this one function, I added a wrapper.
Since PPC needs other header fields I prefer to use the libfdt
accessors directly for all fields. The same goes for drivers/of/fdt.c.

Rob

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 18/21] powerpc: use libfdt accessors for header data
  2014-04-23 14:05     ` Rob Herring
@ 2014-04-23 14:21       ` Michal Simek
  0 siblings, 0 replies; 34+ messages in thread
From: Michal Simek @ 2014-04-23 14:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, linux-kernel, devicetree, Benjamin Herrenschmidt,
	Paul Mackerras

[-- Attachment #1: Type: text/plain, Size: 1917 bytes --]

On 04/23/2014 04:05 PM, Rob Herring wrote:
> On Wed, Apr 23, 2014 at 8:48 AM, Michal Simek <monstr@monstr.eu> wrote:
>> On 04/23/2014 03:18 AM, Rob Herring wrote:
>>> From: Rob Herring <robh@kernel.org>
>>>
>>> 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.
> 
> [...]
> 
>>> @@ -117,14 +118,14 @@ static void __init move_device_tree(void)
>>>       DBG("-> move_device_tree\n");
>>>
>>>       start = __pa(initial_boot_params);
>>> -     size = be32_to_cpu(initial_boot_params->totalsize);
>>> +     size = fdt_totalsize(initial_boot_params);
>>
>> In 19/21 you use your newly introduced of_get_flat_dt_size()
>> that's why I expect you will use it here too.
>> size = of_get_flat_dt_size();
>>
>> The same is for 14/21 where you can use this new function too.
>> It means moving 14/21 to the end and using this new function
>> makes more sense.
> 
> Really, I would prefer to just use libfdt accessors directly rather
> than have wrappers, but including libfdt.h is not the cleanest
> solution. Since x86 just needed this one function, I added a wrapper.
> Since PPC needs other header fields I prefer to use the libfdt
> accessors directly for all fields. The same goes for drivers/of/fdt.c.

Ok. I see your point but maybe will be good to reflect that it is
there just for x86 case and none else should use it.

Thanks,
Michal


-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 00/21] FDT clean-ups and libfdt support
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (20 preceding siblings ...)
  2014-04-23  1:18 ` [PATCH v2 21/21] of: push struct boot_param_header and defines into powerpc Rob Herring
@ 2014-04-23 14:22 ` Michal Simek
  2014-04-23 21:04 ` Max Filippov
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Michal Simek @ 2014-04-23 14:22 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, linux-kernel, devicetree, Rob Herring,
	Aurelien Jacquiot, Benjamin Herrenschmidt, Chris Zankel,
	H. Peter Anvin, Ingo Molnar, James Hogan, Jonas Bonn,
	linux-arm-kernel, linux-c6x-dev, linux, linux-metag, linux-mips,
	linuxppc-dev, linux-xtensa, Mark Salter, Max Filippov,
	Paul Mackerras, Ralf Baechle, Russell King, Thomas Gleixner,
	Vineet Gupta, x86

[-- Attachment #1: Type: text/plain, Size: 5051 bytes --]

On 04/23/2014 03:18 AM, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> This is a series of clean-ups of architecture FDT code and converts the
> core FDT code over to using libfdt functions. This is in preparation
> to add FDT based address translation parsing functions for early
> console support. This series removes direct access to FDT data from all
> arches except powerpc.
> 
> The current MIPS lantiq and xlp DT code is buggy as built-in DTBs need
> to be copied out of init section. Patches 2 and 3 should be applied to
> 3.15.
> 
> Changes in v2 are relatively minor. There was a bug in the unflattening
> code where walking up the tree was not being handled correctly (thanks
> to Michal Simek). I re-worked things a bit to avoid globally adding
> libfdt include paths.
> 
> A branch is available here[1], and I plan to put into linux-next in a few
> days. Please test! I've compiled on arm, arm64, mips, microblaze, xtensa,
> and powerpc and booted on arm and arm64.
> 
> Rob
> 
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git libfdt
> 
> Rob Herring (21):
>   mips: octeon: convert to use unflatten_and_copy_device_tree
>   mips: lantiq: copy built-in DTB out of init section
>   mips: xlp: copy built-in DTB out of init section
>   mips: ralink: convert to use unflatten_and_copy_device_tree
>   ARM: dt: use default early_init_dt_alloc_memory_arch
>   c6x: convert fdt pointers to opaque pointers
>   mips: convert fdt pointers to opaque pointers
>   of/fdt: consolidate built-in dtb section variables
>   of/fdt: remove some unneeded includes
>   of/fdt: remove unused of_scan_flat_dt_by_path
>   of/fdt: update of_get_flat_dt_prop in prep for libfdt
>   of/fdt: Convert FDT functions to use libfdt
>   of/fdt: use libfdt accessors for header data
>   of/fdt: create common debugfs
>   of/fdt: move memreserve and dtb memory reservations into core
>   of/fdt: fix phys_addr_t related print size warnings
>   of/fdt: introduce of_get_flat_dt_size
>   powerpc: use libfdt accessors for header data
>   x86: use FDT accessors for FDT blob header data
>   of/fdt: convert initial_boot_params to opaque pointer
>   of: push struct boot_param_header and defines into powerpc
> 
>  arch/arc/include/asm/sections.h             |   1 -
>  arch/arc/kernel/devtree.c                   |   2 +-
>  arch/arm/include/asm/prom.h                 |   2 -
>  arch/arm/kernel/devtree.c                   |  34 +--
>  arch/arm/mach-exynos/exynos.c               |   2 +-
>  arch/arm/mach-vexpress/platsmp.c            |   2 +-
>  arch/arm/mm/init.c                          |   1 -
>  arch/arm/plat-samsung/s5p-dev-mfc.c         |   4 +-
>  arch/arm64/mm/init.c                        |  21 --
>  arch/c6x/kernel/setup.c                     |   4 +-
>  arch/metag/kernel/setup.c                   |   4 -
>  arch/microblaze/kernel/prom.c               |  39 +--
>  arch/mips/cavium-octeon/setup.c             |  20 +-
>  arch/mips/include/asm/mips-boards/generic.h |   4 -
>  arch/mips/include/asm/prom.h                |   6 +-
>  arch/mips/kernel/prom.c                     |   2 +-
>  arch/mips/lantiq/prom.c                     |  15 +-
>  arch/mips/lantiq/prom.h                     |   2 -
>  arch/mips/mti-sead3/sead3-setup.c           |   8 +-
>  arch/mips/netlogic/xlp/dt.c                 |  19 +-
>  arch/mips/ralink/of.c                       |  29 +-
>  arch/openrisc/kernel/vmlinux.h              |   2 -
>  arch/powerpc/include/asm/prom.h             |  39 +++
>  arch/powerpc/kernel/Makefile                |   1 +
>  arch/powerpc/kernel/epapr_paravirt.c        |   2 +-
>  arch/powerpc/kernel/fadump.c                |   4 +-
>  arch/powerpc/kernel/prom.c                  |  78 ++----
>  arch/powerpc/kernel/rtas.c                  |   2 +-
>  arch/powerpc/mm/hash_utils_64.c             |  22 +-
>  arch/powerpc/platforms/52xx/efika.c         |   4 +-
>  arch/powerpc/platforms/chrp/setup.c         |   4 +-
>  arch/powerpc/platforms/powernv/opal.c       |  12 +-
>  arch/powerpc/platforms/pseries/setup.c      |   4 +-
>  arch/x86/kernel/devicetree.c                |  12 +-
>  arch/xtensa/kernel/setup.c                  |   3 +-
>  drivers/of/Kconfig                          |   1 +
>  drivers/of/Makefile                         |   2 +
>  drivers/of/fdt.c                            | 398 ++++++++++------------------
>  drivers/of/of_reserved_mem.c                |   4 +-
>  include/linux/of_fdt.h                      |  63 +----
>  40 files changed, 280 insertions(+), 598 deletions(-)
> 

For Microblaze and generic changes:
Tested-by: Michal Simek <monstr@monstr.eu>

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 00/21] FDT clean-ups and libfdt support
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (21 preceding siblings ...)
  2014-04-23 14:22 ` [PATCH v2 00/21] FDT clean-ups and libfdt support Michal Simek
@ 2014-04-23 21:04 ` Max Filippov
  2014-04-29 14:00 ` Grant Likely
  2014-04-30  0:33 ` Stephen N Chivers
  24 siblings, 0 replies; 34+ messages in thread
From: Max Filippov @ 2014-04-23 21:04 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, LKML, devicetree, Rob Herring, Aurelien Jacquiot,
	Benjamin Herrenschmidt, Chris Zankel, H. Peter Anvin,
	Ingo Molnar, James Hogan, Jonas Bonn, linux-arm-kernel,
	linux-c6x-dev, linux, linux-metag, linux-mips, linuxppc-dev,
	linux-xtensa, Mark Salter, Michal Simek, Paul Mackerras,
	Ralf Baechle, Russell King, Thomas Gleixner, Vineet Gupta, x86

On Wed, Apr 23, 2014 at 5:18 AM, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <robh@kernel.org>
>
> This is a series of clean-ups of architecture FDT code and converts the
> core FDT code over to using libfdt functions. This is in preparation
> to add FDT based address translation parsing functions for early
> console support. This series removes direct access to FDT data from all
> arches except powerpc.
>
> The current MIPS lantiq and xlp DT code is buggy as built-in DTBs need
> to be copied out of init section. Patches 2 and 3 should be applied to
> 3.15.
>
> Changes in v2 are relatively minor. There was a bug in the unflattening
> code where walking up the tree was not being handled correctly (thanks
> to Michal Simek). I re-worked things a bit to avoid globally adding
> libfdt include paths.
>
> A branch is available here[1], and I plan to put into linux-next in a few
> days. Please test! I've compiled on arm, arm64, mips, microblaze, xtensa,
> and powerpc and booted on arm and arm64.
>
> Rob
>
> [1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git libfdt

For xtensa: Tested-by: Max Filippov <jcmvbkbc@gmail.com>

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 06/21] c6x: convert fdt pointers to opaque pointers
  2014-04-23  1:18 ` [PATCH v2 06/21] c6x: convert fdt pointers to opaque pointers Rob Herring
@ 2014-04-24 14:21   ` Mark Salter
  0 siblings, 0 replies; 34+ messages in thread
From: Mark Salter @ 2014-04-24 14:21 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, linux-kernel, devicetree, Rob Herring,
	Aurelien Jacquiot, linux-c6x-dev

On Tue, 2014-04-22 at 20:18 -0500, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> The architecture code does not need to access the internals of the FDT
> blob, so make the pointer to it void *.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Mark Salter <msalter@redhat.com>
> Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
> Cc: linux-c6x-dev@linux-c6x.org
> ---

Acked-by: Mark Salter <msalter@redhat.com>



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 21/21] of: push struct boot_param_header and defines into powerpc
  2014-04-23  1:18 ` [PATCH v2 21/21] of: push struct boot_param_header and defines into powerpc Rob Herring
@ 2014-04-28  1:37   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 34+ messages in thread
From: Benjamin Herrenschmidt @ 2014-04-28  1:37 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, linux-kernel, devicetree, Rob Herring,
	Paul Mackerras, linuxppc-dev

On Tue, 2014-04-22 at 20:18 -0500, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> Now powerpc is the only user of struct boot_param_header and FDT defines,
> so they can be moved into the powerpc architecture code.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---

I assume we want to get rid of that too eventually ? :-)

We should be able to get the definitions from libfdt too....

In the meantime:

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
--

> v2: no change
> 
>  arch/powerpc/include/asm/prom.h | 39 +++++++++++++++++++++++++++++++++++++++
>  include/linux/of_fdt.h          | 37 -------------------------------------
>  2 files changed, 39 insertions(+), 37 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
> index d977b9b..74b79f0 100644
> --- a/arch/powerpc/include/asm/prom.h
> +++ b/arch/powerpc/include/asm/prom.h
> @@ -26,6 +26,45 @@
>  #include <linux/of_irq.h>
>  #include <linux/platform_device.h>
>  
> +#define OF_DT_BEGIN_NODE	0x1		/* Start of node, full name */
> +#define OF_DT_END_NODE		0x2		/* End node */
> +#define OF_DT_PROP		0x3		/* Property: name off, size,
> +						 * content */
> +#define OF_DT_NOP		0x4		/* nop */
> +#define OF_DT_END		0x9
> +
> +#define OF_DT_VERSION		0x10
> +
> +/*
> + * This is what gets passed to the kernel by prom_init or kexec
> + *
> + * The dt struct contains the device tree structure, full pathes and
> + * property contents. The dt strings contain a separate block with just
> + * the strings for the property names, and is fully page aligned and
> + * self contained in a page, so that it can be kept around by the kernel,
> + * each property name appears only once in this page (cheap compression)
> + *
> + * the mem_rsvmap contains a map of reserved ranges of physical memory,
> + * passing it here instead of in the device-tree itself greatly simplifies
> + * the job of everybody. It's just a list of u64 pairs (base/size) that
> + * ends when size is 0
> + */
> +struct boot_param_header {
> +	__be32	magic;			/* magic word OF_DT_HEADER */
> +	__be32	totalsize;		/* total size of DT block */
> +	__be32	off_dt_struct;		/* offset to structure */
> +	__be32	off_dt_strings;		/* offset to strings */
> +	__be32	off_mem_rsvmap;		/* offset to memory reserve map */
> +	__be32	version;		/* format version */
> +	__be32	last_comp_version;	/* last compatible version */
> +	/* version 2 fields below */
> +	__be32	boot_cpuid_phys;	/* Physical CPU id we're booting on */
> +	/* version 3 fields below */
> +	__be32	dt_strings_size;	/* size of the DT strings block */
> +	/* version 17 fields below */
> +	__be32	dt_struct_size;		/* size of the DT structure block */
> +};
> +
>  /*
>   * OF address retreival & translation
>   */
> diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
> index 1f882e1..5c0ab05 100644
> --- a/include/linux/of_fdt.h
> +++ b/include/linux/of_fdt.h
> @@ -17,45 +17,8 @@
>  
>  /* Definitions used by the flattened device tree */
>  #define OF_DT_HEADER		0xd00dfeed	/* marker */
> -#define OF_DT_BEGIN_NODE	0x1		/* Start of node, full name */
> -#define OF_DT_END_NODE		0x2		/* End node */
> -#define OF_DT_PROP		0x3		/* Property: name off, size,
> -						 * content */
> -#define OF_DT_NOP		0x4		/* nop */
> -#define OF_DT_END		0x9
> -
> -#define OF_DT_VERSION		0x10
>  
>  #ifndef __ASSEMBLY__
> -/*
> - * This is what gets passed to the kernel by prom_init or kexec
> - *
> - * The dt struct contains the device tree structure, full pathes and
> - * property contents. The dt strings contain a separate block with just
> - * the strings for the property names, and is fully page aligned and
> - * self contained in a page, so that it can be kept around by the kernel,
> - * each property name appears only once in this page (cheap compression)
> - *
> - * the mem_rsvmap contains a map of reserved ranges of physical memory,
> - * passing it here instead of in the device-tree itself greatly simplifies
> - * the job of everybody. It's just a list of u64 pairs (base/size) that
> - * ends when size is 0
> - */
> -struct boot_param_header {
> -	__be32	magic;			/* magic word OF_DT_HEADER */
> -	__be32	totalsize;		/* total size of DT block */
> -	__be32	off_dt_struct;		/* offset to structure */
> -	__be32	off_dt_strings;		/* offset to strings */
> -	__be32	off_mem_rsvmap;		/* offset to memory reserve map */
> -	__be32	version;		/* format version */
> -	__be32	last_comp_version;	/* last compatible version */
> -	/* version 2 fields below */
> -	__be32	boot_cpuid_phys;	/* Physical CPU id we're booting on */
> -	/* version 3 fields below */
> -	__be32	dt_strings_size;	/* size of the DT strings block */
> -	/* version 17 fields below */
> -	__be32	dt_struct_size;		/* size of the DT structure block */
> -};
>  
>  #if defined(CONFIG_OF_FLATTREE)
>  



^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 00/21] FDT clean-ups and libfdt support
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (22 preceding siblings ...)
  2014-04-23 21:04 ` Max Filippov
@ 2014-04-29 14:00 ` Grant Likely
  2014-04-30  0:33 ` Stephen N Chivers
  24 siblings, 0 replies; 34+ messages in thread
From: Grant Likely @ 2014-04-29 14:00 UTC (permalink / raw)
  To: Rob Herring, linux-kernel, devicetree
  Cc: Rob Herring, Aurelien Jacquiot, Benjamin Herrenschmidt,
	Chris Zankel, H. Peter Anvin, Ingo Molnar, James Hogan,
	Jonas Bonn, linux-arm-kernel, linux-c6x-dev, linux, linux-metag,
	linux-mips, linuxppc-dev, linux-xtensa, Mark Salter,
	Max Filippov, Michal Simek, Paul Mackerras, Ralf Baechle,
	Russell King, Thomas Gleixner, Vineet Gupta, x86

On Tue, 22 Apr 2014 20:18:00 -0500, Rob Herring <robherring2@gmail.com> wrote:
> From: Rob Herring <robh@kernel.org>
> 
> This is a series of clean-ups of architecture FDT code and converts the
> core FDT code over to using libfdt functions. This is in preparation
> to add FDT based address translation parsing functions for early
> console support. This series removes direct access to FDT data from all
> arches except powerpc.
> 
> The current MIPS lantiq and xlp DT code is buggy as built-in DTBs need
> to be copied out of init section. Patches 2 and 3 should be applied to
> 3.15.
> 
> Changes in v2 are relatively minor. There was a bug in the unflattening
> code where walking up the tree was not being handled correctly (thanks
> to Michal Simek). I re-worked things a bit to avoid globally adding
> libfdt include paths.
> 
> A branch is available here[1], and I plan to put into linux-next in a few
> days. Please test! I've compiled on arm, arm64, mips, microblaze, xtensa,
> and powerpc and booted on arm and arm64.

This is pretty great work. I'll read through them again and I may have a
comment or two, but in general you can add my tested by tag:

Tested-by: Grant Likely <grant.likely@linaro.org>

>  40 files changed, 280 insertions(+), 598 deletions(-)

I love the diffstat!

g.

^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 00/21] FDT clean-ups and libfdt support
  2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
                   ` (23 preceding siblings ...)
  2014-04-29 14:00 ` Grant Likely
@ 2014-04-30  0:33 ` Stephen N Chivers
  24 siblings, 0 replies; 34+ messages in thread
From: Stephen N Chivers @ 2014-04-30  0:33 UTC (permalink / raw)
  To: Rob Herring
  Cc: Aurelien Jacquiot, Benjamin Herrenschmidt, Chris Zankel,
	devicetree, Grant Likely, H. Peter Anvin, James Hogan,
	linux-kernel, linux-kernel-owner, Ingo Molnar, linuxppc-dev

> From: Rob Herring <robherring2@gmail.com>
> To: Grant Likely <grant.likely@linaro.org>, linux-
> kernel@vger.kernel.org, devicetree@vger.kernel.org
> Cc: Rob Herring <robh@kernel.org>, Aurelien Jacquiot <a-
> jacquiot@ti.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org>,
> Chris Zankel <chris@zankel.net>, "H. Peter Anvin" <hpa@zytor.com>, 
> Ingo Molnar <mingo@redhat.com>, James Hogan <james.hogan@imgtec.co>
> Date: 04/30/2014 09:45 AM
> Subject: [PATCH v2 00/21] FDT clean-ups and libfdt support
> Sent by: linux-kernel-owner@vger.kernel.org
> 
> From: Rob Herring <robh@kernel.org>
> 
> This is a series of clean-ups of architecture FDT code and converts the
> core FDT code over to using libfdt functions. This is in preparation
> to add FDT based address translation parsing functions for early
> console support. This series removes direct access to FDT data from all
> arches except powerpc.
> 
> The current MIPS lantiq and xlp DT code is buggy as built-in DTBs need
> to be copied out of init section. Patches 2 and 3 should be applied to
> 3.15.
> 
> Changes in v2 are relatively minor. There was a bug in the unflattening
> code where walking up the tree was not being handled correctly (thanks
> to Michal Simek). I re-worked things a bit to avoid globally adding
> libfdt include paths.
> 
> A branch is available here[1], and I plan to put into linux-next in a 
few
> days. Please test! I've compiled on arm, arm64, mips, microblaze, 
xtensa,
> and powerpc and booted on arm and arm64.
I have tested this for PowerPC using a snapshot of libfdt[1] collected 
from
the today (30/04/2014).

The computers used were 32 bit, Freescale and IBM/AMCC CPUs:

        MVME5100 - Motorola/Fresscale CPU - PPCBug firmware
        SAM440EP - IBM/AMCC - U-Boot firmware

Tested-by: Stephen Chivers <schivers@csc.com>

Stephen Chivers,
CSC Australia Pty. Ltd.

[1] git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git libfdt


^ permalink raw reply	[flat|nested] 34+ messages in thread

* Re: [PATCH v2 15/21] of/fdt: move memreserve and dtb memory reservations into core
  2014-04-23  1:18 ` [PATCH v2 15/21] of/fdt: move memreserve and dtb memory reservations into core Rob Herring
@ 2014-05-01 16:27   ` Catalin Marinas
  0 siblings, 0 replies; 34+ messages in thread
From: Catalin Marinas @ 2014-05-01 16:27 UTC (permalink / raw)
  To: Rob Herring
  Cc: Grant Likely, linux-kernel, devicetree, Rob Herring,
	Russell King, Will Deacon, Benjamin Herrenschmidt,
	Paul Mackerras

On Tue, Apr 22, 2014 at 08:18:15PM -0500, Rob Herring wrote:
> From: Rob Herring <robh@kernel.org>
> 
> Move the /memreserve/ processing and dtb memory reservations into
> early_init_fdt_scan_reserved_mem. This converts arm, arm64, and powerpc
> as they are the only users of early_init_fdt_scan_reserved_mem.
> 
> memblock_reserve is safe to call on the same region twice, so the
> reservation check for the dtb in powerpc 32-bit reservations is safe to
> remove.
> 
> Signed-off-by: Rob Herring <robh@kernel.org>
> Cc: Russell King <linux@arm.linux.org.uk>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> ---
> v2: No change
> 
>  arch/arm/include/asm/prom.h |  2 --
>  arch/arm/kernel/devtree.c   | 27 ---------------------------
>  arch/arm/mm/init.c          |  1 -
>  arch/arm64/mm/init.c        | 21 ---------------------
>  arch/powerpc/kernel/prom.c  | 22 ----------------------
>  drivers/of/fdt.c            | 16 ++++++++++++++++
>  6 files changed, 16 insertions(+), 73 deletions(-)

For arm64:

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

^ permalink raw reply	[flat|nested] 34+ messages in thread

end of thread, other threads:[~2014-05-01 16:28 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-23  1:18 [PATCH v2 00/21] FDT clean-ups and libfdt support Rob Herring
2014-04-23  1:18 ` [PATCH v2 01/21] mips: octeon: convert to use unflatten_and_copy_device_tree Rob Herring
2014-04-23  1:18 ` [PATCH v2 02/21] mips: lantiq: copy built-in DTB out of init section Rob Herring
2014-04-23  1:18 ` [PATCH v2 03/21] mips: xlp: " Rob Herring
2014-04-23  1:18 ` [PATCH v2 04/21] mips: ralink: convert to use unflatten_and_copy_device_tree Rob Herring
2014-04-23  1:18 ` [PATCH v2 05/21] ARM: dt: use default early_init_dt_alloc_memory_arch Rob Herring
2014-04-23  1:18 ` [PATCH v2 06/21] c6x: convert fdt pointers to opaque pointers Rob Herring
2014-04-24 14:21   ` Mark Salter
2014-04-23  1:18 ` [PATCH v2 07/21] mips: " Rob Herring
2014-04-23  1:18 ` [PATCH v2 08/21] of/fdt: consolidate built-in dtb section variables Rob Herring
2014-04-23  1:18 ` [PATCH v2 09/21] of/fdt: remove some unneeded includes Rob Herring
2014-04-23  1:18 ` [PATCH v2 10/21] of/fdt: remove unused of_scan_flat_dt_by_path Rob Herring
2014-04-23  1:18 ` [PATCH v2 11/21] of/fdt: update of_get_flat_dt_prop in prep for libfdt Rob Herring
2014-04-23  1:18 ` [PATCH v2 12/21] of/fdt: Convert FDT functions to use libfdt Rob Herring
2014-04-23  1:18 ` [PATCH v2 13/21] of/fdt: use libfdt accessors for header data Rob Herring
2014-04-23  1:18 ` [PATCH v2 14/21] of/fdt: create common debugfs Rob Herring
2014-04-23 13:52   ` Michal Simek
2014-04-23  1:18 ` [PATCH v2 15/21] of/fdt: move memreserve and dtb memory reservations into core Rob Herring
2014-05-01 16:27   ` Catalin Marinas
2014-04-23  1:18 ` [PATCH v2 16/21] of/fdt: fix phys_addr_t related print size warnings Rob Herring
2014-04-23  1:18 ` [PATCH v2 17/21] of/fdt: introduce of_get_flat_dt_size Rob Herring
2014-04-23 13:45   ` Michal Simek
2014-04-23  1:18 ` [PATCH v2 18/21] powerpc: use libfdt accessors for header data Rob Herring
2014-04-23 13:48   ` Michal Simek
2014-04-23 14:05     ` Rob Herring
2014-04-23 14:21       ` Michal Simek
2014-04-23  1:18 ` [PATCH v2 19/21] x86: use FDT accessors for FDT blob " Rob Herring
2014-04-23  1:18 ` [PATCH v2 20/21] of/fdt: convert initial_boot_params to opaque pointer Rob Herring
2014-04-23  1:18 ` [PATCH v2 21/21] of: push struct boot_param_header and defines into powerpc Rob Herring
2014-04-28  1:37   ` Benjamin Herrenschmidt
2014-04-23 14:22 ` [PATCH v2 00/21] FDT clean-ups and libfdt support Michal Simek
2014-04-23 21:04 ` Max Filippov
2014-04-29 14:00 ` Grant Likely
2014-04-30  0:33 ` Stephen N Chivers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).