lkml.org 
[lkml]   [2013]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 14/17] dt: Consolidate __dtb_start declarations in <linux/of_fdt.h>
On Tue, Nov 12, 2013 at 1:42 PM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> The different architectures used their own (and different) declarations:
>
> extern struct boot_param_header __dtb_start;
> extern u32 __dtb_start[];
> extern char __dtb_start[];
>
> Consolidate them using the first variant in <linux/of_fdt.h>.
> This requires adding a few "address of" operators on architectures where
> __dtb_start was an array before.
>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: 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: Rob Herring <rob.herring@calxeda.com>
> Cc: devicetree@vger.kernel.org
> ---
> arch/arc/include/asm/sections.h | 1 -
> arch/arc/kernel/setup.c | 2 +-
> arch/metag/kernel/setup.c | 6 +-----
> arch/mips/include/asm/mips-boards/generic.h | 4 ----
> arch/mips/lantiq/prom.h | 2 --
> arch/mips/netlogic/xlp/dt.c | 4 ++--
> arch/mips/ralink/of.c | 2 --
> arch/openrisc/kernel/setup.c | 2 +-
> arch/openrisc/kernel/vmlinux.h | 2 --
> arch/xtensa/kernel/setup.c | 3 +--
> include/linux/of_fdt.h | 3 +++
> 11 files changed, 9 insertions(+), 22 deletions(-)

This is great, but I would like to see this taken one step further and
move the selection logic into the core code. We can try to use the
built-in dtb if early_init_dt_scan is passed a NULL or invalid dtb. This
should work for most arches I think and still allows an arch to do a
different selection algorithm if desired.

Are the DT related patches dependent on the rest of the series?

Something like this is what I have in mind:

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 5c47910..723f854d 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -869,14 +869,16 @@ void * __init __weak
early_init_dt_alloc_memory_arch(u64 size, u64 align)

bool __init early_init_dt_scan(void *params)
{
- if (!params)
- return false;
-
/* Setup flat device-tree pointer */
initial_boot_params = params;

+ if (!initial_boot_params ||
+ (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER))
+ initial_boot_params = &__dtb_start;
+
/* check device tree validity */
- if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
+ if (!initial_boot_params ||
+ (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER)) {
initial_boot_params = NULL;
return false;
}

\
 
 \ /
  Last update: 2013-11-13 18:01    [W:2.551 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site