All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/19] cuboot bootwrapper patchset
@ 2007-02-07 23:00 Scott Wood
  2007-02-07 23:01 ` [PATCH 01/19] bootwrapper: Add stddef.h to ops.h Scott Wood
                   ` (18 more replies)
  0 siblings, 19 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:00 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

I've updated the following patchset based on feedback received (and
tested on mpc83xx and pmac); please apply for 2.6.21 (or comment).

-Scott

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

* [PATCH 01/19] bootwrapper: Add stddef.h to ops.h
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 02/19] bootwrapper: Set -msoft-float and assembler target options Scott Wood
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

ops.h references NULL, so include stddef.h, so files including ops.h
don't have to.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/ops.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 8abb651..4ac7b02 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -11,6 +11,7 @@
 #ifndef _PPC_BOOT_OPS_H_
 #define _PPC_BOOT_OPS_H_
 
+#include <stddef.h>
 #include "types.h"
 
 #define	COMMAND_LINE_SIZE	512
-- 
1.4.4

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

* [PATCH 02/19] bootwrapper: Set -msoft-float and assembler target options.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
  2007-02-07 23:01 ` [PATCH 01/19] bootwrapper: Add stddef.h to ops.h Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 03/19] bootwrapper: Remove OF-isms Scott Wood
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

The bootwrapper should be built with the same target options as the
kernel.  In particular, -msoft-float and the assembler target need to be
set.

Without -msoft-float, floating point code can be executed (causing
problems on chips without FP).

Without the assembler target option, the assembler will use the old
dedicated mftb/mftbu instructions, rather than mfspr.  This causes the
boot to hang on e500, which doesn't have the dedicated instructions.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/Makefile      |   10 +++++++---
 arch/powerpc/boot/Makefile |    6 ++++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a00fe72..8e93565 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -69,7 +69,7 @@ CFLAGS-$(CONFIG_PPC64)	:= -mminimal-toc
 CFLAGS-$(CONFIG_PPC32)	:= -Iarch/$(ARCH) -ffixed-r2 -mmultiple
 CPPFLAGS	+= $(CPPFLAGS-y)
 AFLAGS		+= $(AFLAGS-y)
-CFLAGS		+= -msoft-float -pipe $(CFLAGS-y)
+CFLAGS		+= -pipe $(CFLAGS-y)
 CPP		= $(CC) -E $(CFLAGS)
 # Temporary hack until we have migrated to asm-powerpc
 LINUXINCLUDE-$(CONFIG_PPC32)	:= -Iarch/$(ARCH)/include
@@ -116,8 +116,12 @@ cpu-as-$(CONFIG_POWER4)		+= -Wa,-maltive
 cpu-as-$(CONFIG_E500)		+= -Wa,-me500
 cpu-as-$(CONFIG_E200)		+= -Wa,-me200
 
-AFLAGS += $(cpu-as-y)
-CFLAGS += $(cpu-as-y)
+PLATFORM_AFLAGS += $(cpu-as-y)
+PLATFORM_CFLAGS += $(cpu-as-y) -msoft-float
+export PLATFORM_AFLAGS PLATFORM_CFLAGS
+
+AFLAGS += $(PLATFORM_AFLAGS)
+CFLAGS += $(PLATFORM_CFLAGS)
 
 head-y				:= arch/powerpc/kernel/head_32.o
 head-$(CONFIG_PPC64)		:= arch/powerpc/kernel/head_64.o
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index dc77940..6a5e2c2 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -24,8 +24,10 @@ all: $(obj)/zImage
 
 HOSTCC		:= gcc
 BOOTCFLAGS	:= $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
-		   $(shell $(CROSS32CC) -print-file-name=include) -fPIC
-BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
+		   $(shell $(CROSS32CC) -print-file-name=include) -fPIC \
+		   $(PLATFORM_CFLAGS)
+BOOTAFLAGS	:= -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc \
+		   $(PLATFORM_AFLAGS)
 
 ifeq ($(call cc-option-yn, -fstack-protector),y)
 BOOTCFLAGS	+= -fno-stack-protector
-- 
1.4.4

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

* [PATCH 03/19] bootwrapper: Remove OF-isms
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
  2007-02-07 23:01 ` [PATCH 01/19] bootwrapper: Add stddef.h to ops.h Scott Wood
  2007-02-07 23:01 ` [PATCH 02/19] bootwrapper: Set -msoft-float and assembler target options Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 04/19] bootwrapper: Add ft_root_node() Scott Wood
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Remove some OF-specific assumptions in generic bootwrapper code in
preparation for an old-U-Boot compatibility target.  Up to five parameter
registers can now be passed to platform_init, and only platform code
should interpret them.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/crt0.S |    2 +-
 arch/powerpc/boot/main.c |   35 +++++++++++++++--------------------
 arch/powerpc/boot/of.c   |    9 +++++++--
 arch/powerpc/boot/ops.h  |   12 +++++++++++-
 4 files changed, 34 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 70e65b1..fac9d3d 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -59,6 +59,6 @@ _zimage_start:
 	sync
 	isync
 
-	mr	r6,r1
+	mr	r8,r1
 	b	start
 
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 6f6b50d..f60d8cf 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -30,14 +30,9 @@ extern char _initrd_end[];
 extern char _dtb_start[];
 extern char _dtb_end[];
 
-struct addr_range {
-	unsigned long addr;
-	unsigned long size;
-	unsigned long memsize;
-};
 static struct addr_range vmlinux;
 static struct addr_range vmlinuz;
-static struct addr_range initrd;
+struct addr_range initrd;
 
 static unsigned long elfoffset;
 static int is_64bit;
@@ -46,7 +41,7 @@ static int is_64bit;
 static char scratch[46912];
 static char elfheader[256];
 
-typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *);
+typedef void (*kernel_entry_t)(unsigned long, unsigned long, unsigned long);
 
 #undef DEBUG
 
@@ -169,7 +164,7 @@ static int is_elf32(void *hdr)
 	return 1;
 }
 
-static void prep_kernel(unsigned long a1, unsigned long a2)
+static void prep_kernel(void)
 {
 	int len;
 
@@ -210,9 +205,10 @@ static void prep_kernel(unsigned long a1
 	 * First see if we have an image attached to us.  If so
 	 * allocate memory for it and copy it there.
 	 */
-	initrd.size = (unsigned long)(_initrd_end - _initrd_start);
-	initrd.memsize = initrd.size;
-	if (initrd.size > 0) {
+	if (_initrd_end != _initrd_start) {
+		initrd.size = (unsigned long)(_initrd_end - _initrd_start);
+		initrd.memsize = initrd.size;
+
 		printf("Allocating 0x%lx bytes for initrd ...\n\r",
 		       initrd.size);
 		initrd.addr = (unsigned long)malloc((u32)initrd.size);
@@ -228,10 +224,8 @@ static void prep_kernel(unsigned long a1
 			initrd.size);
 		printf("initrd head: 0x%lx\n\r",
 				*((unsigned long *)initrd.addr));
-	} else if (a2 != 0) {
+	} else if (initrd.size != 0) {
 		/* Otherwise, see if yaboot or another loader gave us an initrd */
-		initrd.addr = a1;
-		initrd.memsize = initrd.size = a2;
 		printf("Using loader supplied initrd at 0x%lx (0x%lx bytes)\n\r",
 		       initrd.addr, initrd.size);
 	}
@@ -294,7 +288,8 @@ struct platform_ops platform_ops;
 struct dt_ops dt_ops;
 struct console_ops console_ops;
 
-void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
+void start(unsigned long r3, unsigned long r4, unsigned long r5,
+           unsigned long r6, unsigned long r7, void *sp)
 {
 	kernel_entry_t kentry;
 	char cmdline[COMMAND_LINE_SIZE];
@@ -305,7 +300,7 @@ void start(unsigned long a1, unsigned lo
 	memset(&dt_ops, 0, sizeof(dt_ops));
 	memset(&console_ops, 0, sizeof(console_ops));
 
-	if (platform_init(promptr, _dtb_start, _dtb_end))
+	if (platform_init(r3, r4, r5, r6, r7, _dtb_start, _dtb_end))
 		exit();
 	if (console_ops.open && (console_ops.open() < 0))
 		exit();
@@ -315,7 +310,7 @@ void start(unsigned long a1, unsigned lo
 	printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r",
 	       _start, sp);
 
-	prep_kernel(a1, a2);
+	prep_kernel();
 
 	/* If cmdline came from zimage wrapper or if we can edit the one
 	 * in the dt, print it out and edit it, if possible.
@@ -335,17 +330,17 @@ void start(unsigned long a1, unsigned lo
 	if (ft_addr)
 		printf(" flat tree at 0x%lx\n\r", ft_addr);
 	else
-		printf(" using OF tree (promptr=%p)\n\r", promptr);
+		printf(" using OF tree (promptr=%p)\n\r", r5);
 
 	if (console_ops.close)
 		console_ops.close();
 
 	kentry = (kernel_entry_t) vmlinux.addr;
 	if (ft_addr)
-		kentry(ft_addr, 0, NULL);
+		kentry(ft_addr, 0, 0);
 	else
 		/* XXX initrd addr/size should be passed in properties */
-		kentry(initrd.addr, initrd.size, promptr);
+		kentry(initrd.addr, initrd.size, r5);
 
 	/* console closed so printf below may not work */
 	printf("Error: Linux kernel returned to zImage boot wrapper!\n\r");
diff --git a/arch/powerpc/boot/of.c b/arch/powerpc/boot/of.c
index 0182f38..f6a696c 100644
--- a/arch/powerpc/boot/of.c
+++ b/arch/powerpc/boot/of.c
@@ -256,7 +256,9 @@ static void of_console_write(char *buf,
 	call_prom("write", 3, 1, of_stdout_handle, buf, len);
 }
 
-int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end)
+int platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+                  unsigned long r6, unsigned long r7,
+                  char *dt_blob_start, char *dt_blob_end)
 {
 	platform_ops.image_hdr = of_image_hdr;
 	platform_ops.malloc = of_try_claim;
@@ -269,6 +271,9 @@ int platform_init(void *promptr, char *d
 	console_ops.open = of_console_open;
 	console_ops.write = of_console_write;
 
-	prom = (int (*)(void *))promptr;
+	initrd.addr = r3;
+	initrd.memsize = initrd.size = r4;
+
+	prom = (int (*)(void *))r5;
 	return 0;
 }
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 4ac7b02..42c723d 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -59,7 +59,9 @@ struct serial_console_data {
 	void		(*close)(void);
 };
 
-int platform_init(void *promptr, char *dt_blob_start, char *dt_blob_end);
+int platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+                  unsigned long r6, unsigned long r7,
+                  char *dt_blob_start, char *dt_blob_end);
 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
 int serial_console_init(void);
 int ns16550_console_init(void *devp, struct serial_console_data *scdp);
@@ -100,4 +102,12 @@ static inline void exit(void)
 	for(;;);
 }
 
+struct addr_range {
+	unsigned long addr;
+	unsigned long size;
+	unsigned long memsize;
+};
+
+extern struct addr_range initrd;
+
 #endif /* _PPC_BOOT_OPS_H_ */
-- 
1.4.4

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

* [PATCH 04/19] bootwrapper: Add ft_root_node().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (2 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 03/19] bootwrapper: Remove OF-isms Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 05/19] bootwrapper: Rename ft_node_add() to ft_get_phandle() Scott Wood
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Clean up some of the open-coded data structure references by providing a
function to return a pointer to the tree's root node.  This is only used
in high-level functions trying to access the root of the tree, not in
low-level code that is actually manipulating the data structure.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index c76c194..02823a8 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -29,6 +29,11 @@
 
 #define _ALIGN(x, al)	(((x) + (al) - 1) & ~((al) - 1))
 
+static char *ft_root_node(struct ft_cxt *cxt)
+{
+	return cxt->rgn[FT_STRUCT].start;
+}
+
 /* Routines for keeping node ptrs returned by ft_find_device current */
 /* First entry not used b/c it would return 0 and be taken as NULL/error */
 static void *ft_node_add(struct ft_cxt *cxt, char *node)
@@ -590,7 +595,7 @@ int ft_add_rsvmap(struct ft_cxt *cxt, u6
 
 void ft_begin_tree(struct ft_cxt *cxt)
 {
-	cxt->p = cxt->rgn[FT_STRUCT].start;
+	cxt->p = ft_root_node(cxt);
 }
 
 void ft_end_tree(struct ft_cxt *cxt)
@@ -636,7 +641,7 @@ void *ft_find_device(struct ft_cxt *cxt,
 	/* require absolute path */
 	if (srch_path[0] != '/')
 		return NULL;
-	node = ft_find_descendent(cxt, cxt->rgn[FT_STRUCT].start, srch_path);
+	node = ft_find_descendent(cxt, ft_root_node(cxt), srch_path);
 	return ft_node_add(cxt, node);
 }
 
@@ -717,7 +722,7 @@ void *ft_get_parent(struct ft_cxt *cxt,
 			return cxt->genealogy[d > 0 ? d - 1 : 0];
 
 	/* have to do it the hard way... */
-	p = cxt->rgn[FT_STRUCT].start;
+	p = ft_root_node(cxt);
 	d = 0;
 	while ((p = ft_next(cxt, p, &atom)) != NULL) {
 		switch (atom.tag) {
@@ -855,7 +860,7 @@ void *ft_create_node(struct ft_cxt *cxt,
 	char *p, *next;
 	int depth = 0;
 
-	p = cxt->rgn[FT_STRUCT].start;
+	p = ft_root_node(cxt);
 	while ((next = ft_next(cxt, p, &atom)) != NULL) {
 		switch (atom.tag) {
 		case OF_DT_BEGIN_NODE:
-- 
1.4.4

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

* [PATCH 05/19] bootwrapper: Rename ft_node_add() to ft_get_phandle().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (3 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 04/19] bootwrapper: Add ft_root_node() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 06/19] bootwrapper: Make ft_get_phandle() accept and return NULL Scott Wood
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

This name better reflects what the function does, which is to
look up the phandle for an internal node pointer, and add it to the
internal pointer to phandle table if not found.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 02823a8..971420a 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -36,7 +36,7 @@ static char *ft_root_node(struct ft_cxt
 
 /* Routines for keeping node ptrs returned by ft_find_device current */
 /* First entry not used b/c it would return 0 and be taken as NULL/error */
-static void *ft_node_add(struct ft_cxt *cxt, char *node)
+static void *ft_get_phandle(struct ft_cxt *cxt, char *node)
 {
 	unsigned int i;
 
@@ -642,7 +642,7 @@ void *ft_find_device(struct ft_cxt *cxt,
 	if (srch_path[0] != '/')
 		return NULL;
 	node = ft_find_descendent(cxt, ft_root_node(cxt), srch_path);
-	return ft_node_add(cxt, node);
+	return ft_get_phandle(cxt, node);
 }
 
 void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path)
-- 
1.4.4

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

* [PATCH 06/19] bootwrapper: Make ft_get_phandle() accept and return NULL.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (4 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 05/19] bootwrapper: Rename ft_node_add() to ft_get_phandle() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 07/19] bootwrapper: Preserve the pp pointer in ft_make_space() when calling ft_reorder() Scott Wood
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Currently, if ft_get_phandle() is passed NULL it will allocate an entry
for it and return a non-NULL phandle.  This patch makes it simply pass
the NULL through.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 971420a..6c18773 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -40,6 +40,9 @@ static void *ft_get_phandle(struct ft_cx
 {
 	unsigned int i;
 
+	if (!node)
+		return NULL;
+
 	for (i = 1; i < cxt->nodes_used; i++)	/* already there? */
 		if (cxt->node_tbl[i] == node)
 			return (void *)i;
-- 
1.4.4

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

* [PATCH 07/19] bootwrapper: Preserve the pp pointer in ft_make_space() when calling ft_reorder().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (5 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 06/19] bootwrapper: Make ft_get_phandle() accept and return NULL Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 08/19] bootwrapper: Modify *pp, not *p, in ft_shuffle() Scott Wood
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

The ft_reorder() function may change the start of the region of interest,
so the pointer provided by the caller into that region must be fixed up
to still point to the same datum.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 6c18773..0fa4f98 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -261,8 +261,14 @@ static int ft_make_space(struct ft_cxt *
 	char *str, *next;
 	enum ft_rgn_id r;
 
-	if (!cxt->isordered && !ft_reorder(cxt, nextra))
-		return 0;
+	if (!cxt->isordered) {
+		unsigned long rgn_off = *pp - cxt->rgn[rgn].start;
+
+		if (!ft_reorder(cxt, nextra))
+			return 0;
+
+		*pp = cxt->rgn[rgn].start + rgn_off;
+	}
 	if (ft_shuffle(cxt, pp, rgn, nextra))
 		return 1;
 
-- 
1.4.4

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

* [PATCH 08/19] bootwrapper: Modify *pp, not *p, in ft_shuffle().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (6 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 07/19] bootwrapper: Preserve the pp pointer in ft_make_space() when calling ft_reorder() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 09/19] bootwrapper: Rename p and pp to anchor and anchorptr Scott Wood
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Move the caller's pointer back to match the change in the region's start,
rather than alter a byte of the device tree's content.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 0fa4f98..f2a29ca 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -246,7 +246,7 @@ static int ft_shuffle(struct ft_cxt *cxt
 			if (rgn == FT_STRUCT)
 				ft_node_update_before(cxt, p, -nextra);
 		}
-		*p -= nextra;
+		*pp -= nextra;
 		cxt->rgn[rgn].start -= nextra;
 		cxt->rgn[rgn].size += nextra;
 		return 1;
-- 
1.4.4

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

* [PATCH 09/19] bootwrapper: Rename p and pp to anchor and anchorptr.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (7 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 08/19] bootwrapper: Modify *pp, not *p, in ft_shuffle() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 10/19] bootwrapper: Use map_string() instead of lookup_string() in ft_prop() Scott Wood
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

This makes the meaning of "p" clearer, and increases the visual
difference between the two to avoid bugs such as the one fixed in
"Modify *pp, not *p, in ft_shuffle()".

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   44 +++++++++++++++++++++-----------------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index f2a29ca..0c8970e 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -215,23 +215,25 @@ static inline char *next_start(struct ft
  * See if we can expand region rgn by nextra bytes by using up
  * free space after or before the region.
  */
-static int ft_shuffle(struct ft_cxt *cxt, char **pp, enum ft_rgn_id rgn,
-		int nextra)
+static int ft_shuffle(struct ft_cxt *cxt, char **anchorptr,
+                      enum ft_rgn_id rgn, int nextra)
 {
-	char *p = *pp;
+	char *anchor = *anchorptr;
 	char *rgn_start, *rgn_end;
 
 	rgn_start = cxt->rgn[rgn].start;
 	rgn_end = rgn_start + cxt->rgn[rgn].size;
 	if (nextra <= 0 || rgn_end + nextra <= next_start(cxt, rgn)) {
 		/* move following stuff */
-		if (p < rgn_end) {
+		if (anchor < rgn_end) {
 			if (nextra < 0)
-				memmove(p, p - nextra, rgn_end - p + nextra);
+				memmove(anchor, anchor - nextra,
+				        rgn_end - anchor + nextra);
 			else
-				memmove(p + nextra, p, rgn_end - p);
+				memmove(anchor + nextra, anchor,
+				        rgn_end - anchor);
 			if (rgn == FT_STRUCT)
-				ft_node_update_after(cxt, p, nextra);
+				ft_node_update_after(cxt, anchor, nextra);
 		}
 		cxt->rgn[rgn].size += nextra;
 		if (rgn == FT_STRINGS)
@@ -241,12 +243,13 @@ static int ft_shuffle(struct ft_cxt *cxt
 	}
 	if (prev_end(cxt, rgn) <= rgn_start - nextra) {
 		/* move preceding stuff */
-		if (p > rgn_start) {
-			memmove(rgn_start - nextra, rgn_start, p - rgn_start);
+		if (anchor > rgn_start) {
+			memmove(rgn_start - nextra, rgn_start,
+			        anchor - rgn_start);
 			if (rgn == FT_STRUCT)
-				ft_node_update_before(cxt, p, -nextra);
+				ft_node_update_before(cxt, anchor, -nextra);
 		}
-		*pp -= nextra;
+		*anchorptr -= nextra;
 		cxt->rgn[rgn].start -= nextra;
 		cxt->rgn[rgn].size += nextra;
 		return 1;
@@ -254,22 +257,22 @@ static int ft_shuffle(struct ft_cxt *cxt
 	return 0;
 }
 
-static int ft_make_space(struct ft_cxt *cxt, char **pp, enum ft_rgn_id rgn,
-			 int nextra)
+static int ft_make_space(struct ft_cxt *cxt, char **anchorptr,
+                         enum ft_rgn_id rgn, int nextra)
 {
 	unsigned long size, ssize, tot;
 	char *str, *next;
 	enum ft_rgn_id r;
 
 	if (!cxt->isordered) {
-		unsigned long rgn_off = *pp - cxt->rgn[rgn].start;
+		unsigned long rgn_off = *anchorptr - cxt->rgn[rgn].start;
 
 		if (!ft_reorder(cxt, nextra))
 			return 0;
 
-		*pp = cxt->rgn[rgn].start + rgn_off;
+		*anchorptr = cxt->rgn[rgn].start + rgn_off;
 	}
-	if (ft_shuffle(cxt, pp, rgn, nextra))
+	if (ft_shuffle(cxt, anchorptr, rgn, nextra))
 		return 1;
 
 	/* See if there is space after the strings section */
@@ -282,7 +285,8 @@ static int ft_make_space(struct ft_cxt *
 		memmove(str, cxt->rgn[FT_STRINGS].start, ssize);
 		cxt->rgn[FT_STRINGS].start = str;
 		/* enough space now? */
-		if (rgn >= FT_STRUCT && ft_shuffle(cxt, pp, rgn, nextra))
+		if (rgn >= FT_STRUCT &&
+		    ft_shuffle(cxt, anchorptr, rgn, nextra))
 			return 1;
 	}
 
@@ -316,7 +320,7 @@ static int ft_make_space(struct ft_cxt *
 				new_start = cxt->rgn[r].start + shift;
 				cxt->rgn[r].start = new_start;
 			}
-			*pp += shift;
+			*anchorptr += shift;
 			cxt->str_anchor += shift;
 		}
 
@@ -326,7 +330,7 @@ static int ft_make_space(struct ft_cxt *
 		memmove(str, cxt->rgn[FT_STRINGS].start, ssize);
 		cxt->rgn[FT_STRINGS].start = str;
 
-		if (ft_shuffle(cxt, pp, rgn, nextra))
+		if (ft_shuffle(cxt, anchorptr, rgn, nextra))
 			return 1;
 	}
 
@@ -341,7 +345,7 @@ static int ft_make_space(struct ft_cxt *
 		ft_node_update_after(cxt, cxt->rgn[FT_STRUCT].start, nextra);
 		cxt->rgn[FT_STRUCT].start = next;
 
-		if (ft_shuffle(cxt, pp, rgn, nextra))
+		if (ft_shuffle(cxt, anchorptr, rgn, nextra))
 			return 1;
 	}
 
-- 
1.4.4

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

* [PATCH 10/19] bootwrapper: Use map_string() instead of lookup_string() in ft_prop().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (8 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 09/19] bootwrapper: Rename p and pp to anchor and anchorptr Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 11/19] bootwrapper: Add ft_find_device_rel() Scott Wood
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

When adding a property, the property name should be added to the string
table if it doesn't already exist.  map_string() does that;
lookup_string() will fail instead.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 0c8970e..605d248 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -433,7 +433,7 @@ int ft_prop(struct ft_cxt *cxt, const ch
 {
 	int off, len;
 
-	off = lookup_string(cxt, name);
+	off = map_string(cxt, name);
 	if (off == NO_STRING)
 		return -1;
 
-- 
1.4.4

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

* [PATCH 11/19] bootwrapper: Add ft_find_device_rel().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (9 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 10/19] bootwrapper: Use map_string() instead of lookup_string() in ft_prop() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-08  1:11   ` David Gibson
  2007-02-07 23:01 ` [PATCH 12/19] bootwrapper: Refactor ft_get_prop() into internal and external functions Scott Wood
                   ` (7 subsequent siblings)
  18 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Add a function to look up a relative, rather than absolute, path name.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   13 +++++++++++++
 arch/powerpc/boot/flatdevtree.h |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 605d248..b0d27c9 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -658,6 +658,19 @@ void *ft_find_device(struct ft_cxt *cxt,
 	return ft_get_phandle(cxt, node);
 }
 
+void *ft_find_device_rel(struct ft_cxt *cxt, const void *top,
+                         const char *srch_path)
+{
+	char *node;
+
+	node = ft_node_ph2node(cxt, top);
+	if (node == NULL)
+		return NULL;
+
+	node = ft_find_descendent(cxt, node, srch_path);
+	return ft_get_phandle(cxt, node);
+}
+
 void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path)
 {
 	struct ft_atom atom;
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index b9cd9f6..1f37ca2 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -97,6 +97,8 @@ int ft_add_rsvmap(struct ft_cxt *cxt, u6
 void ft_dump_blob(const void *bphp);
 void ft_merge_blob(struct ft_cxt *cxt, void *blob);
 void *ft_find_device(struct ft_cxt *cxt, const char *srch_path);
+void *ft_find_device_rel(struct ft_cxt *cxt, const void *top,
+                         const char *srch_path);
 void *ft_find_descendent(struct ft_cxt *cxt, void *top, const char *srch_path);
 int ft_get_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
 		void *buf, const unsigned int buflen);
-- 
1.4.4

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

* [PATCH 12/19] bootwrapper: Refactor ft_get_prop() into internal and external functions.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (10 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 11/19] bootwrapper: Add ft_find_device_rel() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 13/19] bootwrapper: Make ft_get_parent() return a phandle, and NULL if already top-level Scott Wood
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

The property searching part of ft_get_prop is factored out into an
internal __ft_get_prop() which does not deal with phandles and does not
copy the property data.  ft_get_prop() is then a wrapper that does the
phandle translation and copying.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   53 +++++++++++++++++++++++++--------------
 1 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index b0d27c9..b7ae463 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -769,38 +769,53 @@ void *ft_get_parent(struct ft_cxt *cxt,
 	return NULL;
 }
 
-int ft_get_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
-		void *buf, const unsigned int buflen)
+static const void *__ft_get_prop(struct ft_cxt *cxt, void *node,
+                                 const char *propname, unsigned int *len)
 {
 	struct ft_atom atom;
-	void *node;
-	char *p;
-	int depth;
-	unsigned int size;
-
-	node = ft_node_ph2node(cxt, phandle);
-	if (node == NULL)
-		return -1;
-
-	depth = 0;
-	p = (char *)node;
+	int depth = 0;
 
-	while ((p = ft_next(cxt, p, &atom)) != NULL) {
+	while ((node = ft_next(cxt, node, &atom)) != NULL) {
 		switch (atom.tag) {
 		case OF_DT_BEGIN_NODE:
 			++depth;
 			break;
+
 		case OF_DT_PROP:
-			if ((depth != 1) || strcmp(atom.name, propname))
+			if (depth != 1 || strcmp(atom.name, propname))
 				break;
-			size = min(atom.size, buflen);
-			memcpy(buf, atom.data, size);
-			return atom.size;
+
+			if (len)
+				*len = atom.size;
+
+			return atom.data;
+
 		case OF_DT_END_NODE:
 			if (--depth <= 0)
-				return -1;
+				return NULL;
 		}
 	}
+
+	return NULL;
+}
+
+int ft_get_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
+		void *buf, const unsigned int buflen)
+{
+	const void *data;
+	unsigned int size;
+
+	void *node = ft_node_ph2node(cxt, phandle);
+	if (!node)
+		return -1;
+
+	data = __ft_get_prop(cxt, node, propname, &size);
+	if (data) {
+		unsigned int clipped_size = min(size, buflen);
+		memcpy(buf, data, clipped_size);
+		return size;
+	}
+
 	return -1;
 }
 
-- 
1.4.4

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

* [PATCH 13/19] bootwrapper: Make ft_get_parent() return a phandle, and NULL if already top-level.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (11 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 12/19] bootwrapper: Refactor ft_get_prop() into internal and external functions Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 14/19] bootwrapper: Add ft_find_node_by_prop_value() Scott Wood
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Most of ft_get_parent() is factored out into __ft_get_parent(), which
deals only in internal node pointers.  The ft_get_parent() wrapper
handles phandle conversion in both directions (previously,
ft_get_parent() did not convert its return value).

It also now returns NULL as the parent of the toplevel node, rather than
just returning the toplevel node again (which made it rather useless in
loops).

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   21 +++++++++++++--------
 arch/powerpc/boot/flatdevtree.h |    1 +
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index b7ae463..8afb835 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -732,20 +732,15 @@ void *ft_find_descendent(struct ft_cxt *
 	return NULL;
 }
 
-void *ft_get_parent(struct ft_cxt *cxt, const void *phandle)
+void *__ft_get_parent(struct ft_cxt *cxt, void *node)
 {
-	void *node;
 	int d;
 	struct ft_atom atom;
 	char *p;
 
-	node = ft_node_ph2node(cxt, phandle);
-	if (node == NULL)
-		return NULL;
-
 	for (d = 0; cxt->genealogy[d] != NULL; ++d)
 		if (cxt->genealogy[d] == node)
-			return cxt->genealogy[d > 0 ? d - 1 : 0];
+			return d > 0 ? cxt->genealogy[d - 1] : NULL;
 
 	/* have to do it the hard way... */
 	p = ft_root_node(cxt);
@@ -757,7 +752,7 @@ void *ft_get_parent(struct ft_cxt *cxt,
 			if (node == atom.data) {
 				/* found it */
 				cxt->genealogy[d + 1] = NULL;
-				return d > 0 ? cxt->genealogy[d - 1] : node;
+				return d > 0 ? cxt->genealogy[d - 1] : NULL;
 			}
 			++d;
 			break;
@@ -769,6 +764,16 @@ void *ft_get_parent(struct ft_cxt *cxt,
 	return NULL;
 }
 
+void *ft_get_parent(struct ft_cxt *cxt, const void *phandle)
+{
+	void *node = ft_node_ph2node(cxt, phandle);
+	if (node == NULL)
+		return NULL;
+
+	node = __ft_get_parent(cxt, node);
+	return ft_get_phandle(cxt, node);
+}
+
 static const void *__ft_get_prop(struct ft_cxt *cxt, void *node,
                                  const char *propname, unsigned int *len)
 {
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index 1f37ca2..9500424 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -104,5 +104,6 @@ int ft_get_prop(struct ft_cxt *cxt, cons
 		void *buf, const unsigned int buflen);
 int ft_set_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
 		const void *buf, const unsigned int buflen);
+void *ft_get_parent(struct ft_cxt *cxt, const void *phandle);
 
 #endif /* FLATDEVTREE_H */
-- 
1.4.4

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

* [PATCH 14/19] bootwrapper: Add ft_find_node_by_prop_value().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (12 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 13/19] bootwrapper: Make ft_get_parent() return a phandle, and NULL if already top-level Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize() Scott Wood
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

ft_find_node_by_prop_value() finds nodes with the specified
property/value pair.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   65 +++++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/flatdevtree.h |    3 ++
 2 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 8afb835..97698a9 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -824,6 +824,71 @@ int ft_get_prop(struct ft_cxt *cxt, cons
 	return -1;
 }
 
+void *__ft_find_node_by_prop_value(struct ft_cxt *cxt, void *prev,
+                                   const char *propname, const char *propval,
+                                   unsigned int proplen)
+{
+	struct ft_atom atom;
+	char *p = ft_root_node(cxt);
+	char *next;
+	int past_prev = prev ? 0 : 1;
+	int depth = -1;
+
+	while ((next = ft_next(cxt, p, &atom)) != NULL) {
+		const void *data;
+		unsigned int size;
+
+		switch (atom.tag) {
+		case OF_DT_BEGIN_NODE:
+			depth++;
+
+			if (prev == p) {
+				past_prev = 1;
+				break;
+			}
+
+			if (!past_prev || depth < 1)
+				break;
+
+			data = __ft_get_prop(cxt, p, propname, &size);
+			if (!data || size != proplen)
+				break;
+			if (memcmp(data, propval, size))
+				break;
+
+			return p;
+
+		case OF_DT_END_NODE:
+			if (depth-- == 0)
+				return NULL;
+
+			break;
+		}
+
+		p = next;
+	}
+
+	return NULL;
+}
+
+void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev,
+                                 const char *propname, const char *propval,
+                                 int proplen)
+{
+	void *node = NULL;
+
+	if (prev) {
+		node = ft_node_ph2node(cxt, prev);
+
+		if (!node)
+			return NULL;
+	}
+
+	node = __ft_find_node_by_prop_value(cxt, node, propname,
+	                                    propval, proplen);
+	return ft_get_phandle(cxt, node);
+}
+
 int ft_set_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
 		const void *buf, const unsigned int buflen)
 {
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index 9500424..e3e3e79 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -105,5 +105,8 @@ int ft_get_prop(struct ft_cxt *cxt, cons
 int ft_set_prop(struct ft_cxt *cxt, const void *phandle, const char *propname,
 		const void *buf, const unsigned int buflen);
 void *ft_get_parent(struct ft_cxt *cxt, const void *phandle);
+void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev,
+                                 const char *propname, const char *propval,
+                                 int proplen);
 
 #endif /* FLATDEVTREE_H */
-- 
1.4.4

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

* [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize().
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (13 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 14/19] bootwrapper: Add ft_find_node_by_prop_value() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-09 23:02   ` Mark A. Greer
  2007-02-07 23:01 ` [PATCH 16/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter Scott Wood
                   ` (3 subsequent siblings)
  18 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

linux,initrd-start and linux,initrd-end are added to the device tree
based on the values that platform code puts in the initrd struct.
ft_finalize() is also made global, so that platform code can do further
manipulation before returning to generic code.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree_misc.c |   14 +++++++++++++-
 arch/powerpc/boot/ops.h              |    1 +
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
index 04da38f..39fa010 100644
--- a/arch/powerpc/boot/flatdevtree_misc.c
+++ b/arch/powerpc/boot/flatdevtree_misc.c
@@ -33,8 +33,20 @@ static int ft_setprop(const void *phandl
 	return ft_set_prop(&cxt, phandle, propname, buf, buflen);
 }
 
-static unsigned long ft_finalize(void)
+unsigned long ft_finalize(void)
 {
+	unsigned long initrd_end = initrd.addr + initrd.size;
+	void *devp;
+
+	if (initrd.size && (devp = finddevice("/chosen"))) {
+		setprop(devp, "linux,initrd-start", &initrd.addr,
+		        sizeof(initrd.addr));
+		setprop(devp, "linux,initrd-end", &initrd_end,
+		        sizeof(initrd_end));
+
+		ft_add_rsvmap(&cxt, initrd.addr, initrd.size);
+	}
+
 	ft_end_tree(&cxt);
 	return (unsigned long)cxt.bph;
 }
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 42c723d..0bc4a68 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -63,6 +63,7 @@ int platform_init(unsigned long r3, unsi
                   unsigned long r6, unsigned long r7,
                   char *dt_blob_start, char *dt_blob_end);
 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device);
+unsigned long ft_finalize(void);
 int serial_console_init(void);
 int ns16550_console_init(void *devp, struct serial_console_data *scdp);
 void *simple_alloc_init(char *base, u32 heap_size, u32 granularity,
-- 
1.4.4

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

* [PATCH 16/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (14 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize() Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-07 23:01 ` [PATCH 17/19] bootwrapper: Add dt_ops methods Scott Wood
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree.c |   17 ++++++++++++-----
 arch/powerpc/boot/flatdevtree.h |    1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 97698a9..8b67745 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -965,19 +965,26 @@ int ft_del_prop(struct ft_cxt *cxt, cons
 	return -1;
 }
 
-void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *path)
+void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name)
 {
 	struct ft_atom atom;
 	char *p, *next;
 	int depth = 0;
 
-	p = ft_root_node(cxt);
+	if (parent) {
+		p = ft_node_ph2node(cxt, parent);
+		if (!p)
+			return NULL;
+	} else {
+		p = ft_root_node(cxt);
+	}
+
 	while ((next = ft_next(cxt, p, &atom)) != NULL) {
 		switch (atom.tag) {
 		case OF_DT_BEGIN_NODE:
 			++depth;
-			if (depth == 1 && strcmp(atom.name, path) == 0)
-				/* duplicate node path, return error */
+			if (depth == 1 && strcmp(atom.name, name) == 0)
+				/* duplicate node name, return error */
 				return NULL;
 			break;
 		case OF_DT_END_NODE:
@@ -986,7 +993,7 @@ void *ft_create_node(struct ft_cxt *cxt,
 				break;
 			/* end of node, insert here */
 			cxt->p = p;
-			ft_begin_node(cxt, path);
+			ft_begin_node(cxt, name);
 			ft_end_node(cxt);
 			return p;
 		}
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index e3e3e79..cb26325 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -108,5 +108,6 @@ void *ft_get_parent(struct ft_cxt *cxt,
 void *ft_find_node_by_prop_value(struct ft_cxt *cxt, const void *prev,
                                  const char *propname, const char *propval,
                                  int proplen);
+void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name);
 
 #endif /* FLATDEVTREE_H */
-- 
1.4.4

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

* [PATCH 17/19] bootwrapper: Add dt_ops methods.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (15 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 16/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-09 23:05   ` Mark A. Greer
  2007-02-07 23:01 ` [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers Scott Wood
  2007-02-07 23:01 ` [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot) Scott Wood
  18 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Add finddevice_rel, get_parent, create_node, and find_node_by_prop_value
to dt_ops.  Currently only implemented by flatdevtree_misc.

Also, add a _str convenience wrapper for setprop.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/flatdevtree_misc.c |   26 ++++++++++++++++
 arch/powerpc/boot/ops.h              |   54 ++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
index 39fa010..10e5f27 100644
--- a/arch/powerpc/boot/flatdevtree_misc.c
+++ b/arch/powerpc/boot/flatdevtree_misc.c
@@ -21,6 +21,11 @@ static void *ft_finddevice(const char *n
 	return ft_find_device(&cxt, name);
 }
 
+static void *ft_finddevice_rel(const void *phandle, const char *name)
+{
+	return ft_find_device_rel(&cxt, phandle, name);
+}
+
 static int ft_getprop(const void *phandle, const char *propname, void *buf,
 		const int buflen)
 {
@@ -51,12 +56,33 @@ unsigned long ft_finalize(void)
 	return (unsigned long)cxt.bph;
 }
 
+void *fdtm_get_parent(const void *phandle)
+{
+	return ft_get_parent(&cxt, phandle);
+}
+
+void *fdtm_create_node(const void *phandle, const char *name)
+{
+	return ft_create_node(&cxt, phandle, name);
+}
+
+void *fdtm_find_node_by_prop_value(const void *prev, const char *propname,
+                                   const char *propval, int proplen)
+{
+	return ft_find_node_by_prop_value(&cxt, prev, propname,
+	                                  propval, proplen);
+}
+
 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device)
 {
 	dt_ops.finddevice = ft_finddevice;
+	dt_ops.finddevice_rel = ft_finddevice_rel;
 	dt_ops.getprop = ft_getprop;
 	dt_ops.setprop = ft_setprop;
 	dt_ops.finalize = ft_finalize;
+	dt_ops.get_parent = fdtm_get_parent;
+	dt_ops.create_node = fdtm_create_node;
+	dt_ops.find_node_by_prop_value = fdtm_find_node_by_prop_value;
 
 	return ft_open(&cxt, dt_blob, max_size, max_find_device,
 			platform_ops.realloc);
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 0bc4a68..381627e 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -13,6 +13,7 @@
 
 #include <stddef.h>
 #include "types.h"
+#include "string.h"
 
 #define	COMMAND_LINE_SIZE	512
 #define	MAX_PATH_LEN		256
@@ -32,10 +33,17 @@ extern struct platform_ops platform_ops;
 /* Device Tree operations */
 struct dt_ops {
 	void *	(*finddevice)(const char *name);
+	void *	(*finddevice_rel)(const void *phandle, const char *name);
 	int	(*getprop)(const void *phandle, const char *name, void *buf,
 			const int buflen);
 	int	(*setprop)(const void *phandle, const char *name,
 			const void *buf, const int buflen);
+	void *(*get_parent)(const void *phandle);
+	/* The node must not already exist. */
+	void *(*create_node)(const void *parent, const char *name);
+	void *(*find_node_by_prop_value)(const void *prev,
+	                                 const char *propname,
+	                                 const char *propval, int proplen);
 	unsigned long (*finalize)(void);
 };
 extern struct dt_ops dt_ops;
@@ -75,6 +83,14 @@ static inline void *finddevice(const cha
 	return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL;
 }
 
+static inline void *finddevice_rel(const void *phandle, const char *name)
+{
+	if (dt_ops.finddevice_rel)
+		return dt_ops.finddevice_rel(phandle, name);
+
+	return NULL;
+}
+
 static inline int getprop(void *devp, const char *name, void *buf, int buflen)
 {
 	return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1;
@@ -85,6 +101,44 @@ static inline int setprop(void *devp, co
 	return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1;
 }
 
+static inline int setprop_str(void *devp, const char *name, const char *buf)
+{
+	if (dt_ops.setprop)
+		return dt_ops.setprop(devp, name, buf, strlen(buf));
+
+	return -1;
+}
+
+static inline void *get_parent(const char *devp)
+{
+	return dt_ops.get_parent ? dt_ops.get_parent(devp) : NULL;
+}
+
+static inline void *create_node(const void *parent, const char *name)
+{
+	return dt_ops.create_node ? dt_ops.create_node(parent, name) : NULL;
+}
+
+
+static inline void *find_node_by_prop_value(const void *prev,
+                                            const char *propname,
+                                            const char *propval, int proplen)
+{
+	if (dt_ops.find_node_by_prop_value)
+		return dt_ops.find_node_by_prop_value(prev, propname,
+		                                      propval, proplen);
+
+	return NULL;
+}
+
+static inline void *find_node_by_prop_value_str(const void *prev,
+                                                const char *propname,
+                                                const char *propval)
+{
+	return find_node_by_prop_value(prev, propname, propval,
+	                               strlen(propval) + 1);
+}
+
 static inline void *malloc(u32 size)
 {
 	return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
-- 
1.4.4

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

* [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers.
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (16 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 17/19] bootwrapper: Add dt_ops methods Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-09 23:07   ` Mark A. Greer
  2007-02-07 23:01 ` [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot) Scott Wood
  18 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

xlate_reg() uses the ranges properties of a node's parentage to find the
absolute physical address of the node's registers.

The ns16550 driver uses this when no virtual-reg property is found.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/Makefile  |    3 +-
 arch/powerpc/boot/devtree.c |  207 +++++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/ns16550.c |    9 ++-
 arch/powerpc/boot/ops.h     |    1 +
 4 files changed, 217 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 6a5e2c2..51a0fd5 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -43,7 +43,8 @@ $(addprefix $(obj)/,$(zlib) main.o): $(a
 		$(addprefix $(obj)/,$(zlibheader))
 
 src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
-		ns16550.c serial.c simple_alloc.c div64.S util.S $(zlib)
+		ns16550.c serial.c simple_alloc.c div64.S util.S $(zlib) \
+		devtree.c
 src-plat := of.c
 src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
 
diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
new file mode 100644
index 0000000..9fee6fb
--- /dev/null
+++ b/arch/powerpc/boot/devtree.c
@@ -0,0 +1,207 @@
+/*
+ * Device Tree functions that are semantic, not structural
+ *
+ * Author: Scott Wood <scottwood@freescale.com>
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "string.h"
+
+#define MAX_ADDR_CELLS 4
+#define MAX_RANGES 8
+
+static int get_reg_format(void *node, u32 *naddr, u32 *nsize)
+{
+	int got_addr = 0, got_size = 0;
+
+	while (node && !(got_addr && got_size)) {
+		if (!got_addr && getprop(node, "#address-cells",
+		                         naddr, 4) == 4)
+			got_addr = 1;
+		if (!got_size && getprop(node, "#size-cells",
+		                         nsize, 4) == 4)
+			got_size = 1;
+
+		node = get_parent(node);
+	}
+
+	if (*naddr <= 0 || *naddr > MAX_ADDR_CELLS ||
+	    *nsize <= 0 || *nsize > *naddr)
+		return 0;
+
+	return got_addr && got_size;
+}
+
+static int sub_reg(u32 *reg, u32 *sub, u32 naddr)
+{
+	int i, borrow = 0;
+
+	for (i = 0; i < naddr; i++) {
+		int prev_borrow = borrow;
+		borrow = reg[i] < sub[i] + prev_borrow;
+		reg[i] -= sub[i] + prev_borrow;
+	}
+
+	return !borrow;
+}
+
+static int add_reg(u32 *reg, u32 *add, u32 naddr, u32 naddr_add)
+{
+	int i, carry = 0;
+	int diff = naddr - naddr_add;
+
+	if (diff < 0) {
+		for (i = 0; i < -diff; i++)
+			if (*add++ != 0)
+				return 0;
+
+		diff = 0;
+	}
+
+	for (i = diff; i < naddr; i++) {
+		u64 tmp = (u64)reg[i] + add[i - diff] + carry;
+		carry = tmp >> 32;
+		reg[i] = (u32)tmp;
+	}
+
+	return !carry;
+}
+
+/* It is assumed that if the first byte of reg fits in a
+ * range, then the whole reg block fits.  It is also assumed
+ * that #size-cells <= #address-cells.
+ */
+static int compare_reg(u32 *reg, u32 *range, u32 *rangesize,
+                       u32 naddr, u32 nsize)
+{
+	int i, sizeoff = naddr - nsize;
+
+	for (i = 0; i < naddr; i++) {
+		if (reg[i] < range[i])
+			return 0;
+		if (reg[i] > range[i])
+			break;
+	}
+
+	for (i = sizeoff; i < naddr; i++) {
+		u32 end = range[i] + rangesize[i - sizeoff];
+
+		if (reg[i] < end)
+			break;
+		if (reg[i] > end)
+			return 0;
+		if (i == naddr && reg[i] == end)
+			return 0;
+	}
+
+	return 1;
+}
+
+static int find_range(u32 *reg, u32 *ranges, int naddr,
+                      int nsize, int nparentaddr, int buflen)
+{
+	int nrange = naddr + nparentaddr + nsize;
+	int i;
+
+	for (i = 0; i + nrange <= buflen; i += nrange) {
+		if (compare_reg(reg, ranges + i,
+		                ranges + i + naddr + nparentaddr,
+		                naddr, nsize))
+			return i;
+	}
+
+	return -1;
+}
+
+/* Currently only generic buses without special encodings are supported.
+ * In particular, PCI is not supported.  Also, only the beginning of the
+ * reg block is tracked; size is ignored except in ranges.
+ */
+int xlate_reg(void *node, int res, unsigned long *addr,
+              unsigned long *size)
+{
+	u32 last_addr[MAX_ADDR_CELLS];
+	u32 buf[MAX_ADDR_CELLS * MAX_RANGES * 3];
+	void *parent;
+	u64 ret_addr, ret_size;
+	u32 naddr, nsize, prev_naddr, prev_nsize;
+	int buflen, offset;
+
+	parent = get_parent(node);
+	if (!parent)
+		return 0;
+
+	if (!get_reg_format(parent, &naddr, &nsize))
+		return 0;
+
+	if (nsize > 2)
+		return 0;
+
+	buflen = getprop(node, "reg", buf, sizeof(buf)) / 4;
+	offset = (naddr + nsize) * res;
+
+	if (buflen < offset + naddr + nsize)
+		return 0;
+
+	memcpy(last_addr, buf + offset, 4 * naddr);
+
+	ret_size = buf[offset + naddr];
+	if (nsize == 2) {
+		ret_size <<= 32;
+		ret_size |= buf[offset + naddr + 1];
+	}
+
+	while ((node = get_parent(node))) {
+		prev_naddr = naddr;
+		prev_nsize = nsize;
+
+		if (!get_reg_format(node, &naddr, &nsize))
+			return 0;
+
+		buflen = getprop(node, "ranges",
+		                        buf, sizeof(buf));
+		if (buflen < 0)
+			continue;
+		if (buflen > sizeof(buf))
+			return 0;
+
+		offset = find_range(last_addr, buf, prev_naddr,
+		                    prev_nsize, naddr, buflen / 4);
+
+		if (offset < 0)
+			return 0;
+
+		if (!sub_reg(last_addr, buf + offset, prev_naddr) ||
+		    !add_reg(buf + offset + prev_naddr, last_addr,
+		             naddr, prev_naddr))
+			return 0;
+
+		memcpy(last_addr, buf + offset + prev_naddr, 4 * naddr);
+	}
+
+	if (naddr > 2)
+		return 0;
+
+	ret_addr = last_addr[0];
+	if (naddr == 2) {
+		ret_addr <<= 32;
+		ret_addr |= last_addr[1];
+	}
+
+	if (sizeof(void *) == 4 &&
+	    (ret_addr >= 0x100000000ULL || ret_size > 0x100000000ULL ||
+	     ret_addr + ret_size > 0x100000000ULL))
+		return 0;
+
+	*addr = ret_addr;
+	if (size)
+		*size = ret_size;
+
+	return 1;
+}
diff --git a/arch/powerpc/boot/ns16550.c b/arch/powerpc/boot/ns16550.c
index 1ffe72e..cce7a11 100644
--- a/arch/powerpc/boot/ns16550.c
+++ b/arch/powerpc/boot/ns16550.c
@@ -55,10 +55,15 @@ static u8 ns16550_tstc(void)
 int ns16550_console_init(void *devp, struct serial_console_data *scdp)
 {
 	int n;
+	unsigned long reg_phys;
 
 	n = getprop(devp, "virtual-reg", &reg_base, sizeof(reg_base));
-	if (n != sizeof(reg_base))
-		return -1;
+	if (n != sizeof(reg_base)) {
+		if (!xlate_reg(devp, 0, &reg_phys, NULL))
+			return -1;
+
+		reg_base = (void *)reg_phys;
+	}
 
 	n = getprop(devp, "reg-shift", &reg_shift, sizeof(reg_shift));
 	if (n != sizeof(reg_shift))
diff --git a/arch/powerpc/boot/ops.h b/arch/powerpc/boot/ops.h
index 381627e..8421f40 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -76,6 +76,7 @@ int serial_console_init(void);
 int ns16550_console_init(void *devp, struct serial_console_data *scdp);
 void *simple_alloc_init(char *base, u32 heap_size, u32 granularity,
 		u32 max_allocs);
+int xlate_reg(void *node, int res, unsigned long *addr, unsigned long *size);
 
 
 static inline void *finddevice(const char *name)
-- 
1.4.4

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

* [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot)
  2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
                   ` (17 preceding siblings ...)
  2007-02-07 23:01 ` [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers Scott Wood
@ 2007-02-07 23:01 ` Scott Wood
  2007-02-08 21:15   ` David Gibson
  18 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-07 23:01 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Add a bootwrapper platform (cuboot) that takes a bd_t from a legacy
U-Boot, and inserts data from it into a device tree which has been
compiled into the kernel.  This should help ease the transition to
arch/powerpc in cases where U-Boot has not yet been updated to pass a
device tree, or where upgrading firmware isn't practical.

The device trees currently in the kernel tree must have
/chosen/linux,stdout-path added to work with cuboot.

The kernel command line, mac addresses, and various clocks will be filled
in based on the bd_t.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
This version of the patch fixes a bug from the previous version
preventing multiple wrapped images from being generated at once (.gzip
was not being appended to $vmz unless compression was actually done).

 arch/powerpc/Kconfig            |   21 +++++
 arch/powerpc/boot/.gitignore    |    2 +
 arch/powerpc/boot/Makefile      |   20 +++++-
 arch/powerpc/boot/cuboot-83xx.c |    4 +
 arch/powerpc/boot/cuboot-85xx.c |    4 +
 arch/powerpc/boot/cuboot-86xx.c |    4 +
 arch/powerpc/boot/cuboot.c      |  160 +++++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/ppcboot.h     |  103 +++++++++++++++++++++++++
 arch/powerpc/boot/wrapper       |   41 ++++++++--
 9 files changed, 349 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index aeb5309..f6e9b5e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -938,6 +938,27 @@ config SECCOMP
 
 	  If unsure, say Y. Only embedded should say N here.
 
+config COMPAT_UIMAGE
+	bool "Build kernel for old non-device-tree PPCBoot/U-Boot"
+	depends on DEFAULT_UIMAGE
+	default n
+	help
+	  If selected, the kernel will be built for older U-Boot
+	  (and PPCBoot) bootloaders that pass a bd_t instead of
+	  a device tree.  Such a kernel will not work with a newer
+	  U-Boot that passes the device tree itself.  If your
+	  U-Boot does not mention a device tree in "help bootm",
+	  say Y.
+
+config CUIMAGE_DTS
+	string "Device tree source file"
+	depends on COMPAT_UIMAGE
+	help
+	  This specifies the device tree source (.dts) file to
+	  be compiled and included in the kernel image.  If
+	  a relative filename is given, then it will be relative
+	  to arch/powerpc/boot/dts.
+
 endmenu
 
 config ISA_DMA_API
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
index 0734b2f..ff8852d 100644
--- a/arch/powerpc/boot/.gitignore
+++ b/arch/powerpc/boot/.gitignore
@@ -18,6 +18,8 @@ kernel-vmlinux.strip.c
 kernel-vmlinux.strip.gz
 mktree
 uImage
+uImage.bin.gz
+uImage.elf
 zImage
 zImage.chrp
 zImage.coff
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 51a0fd5..94eca3e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -35,6 +35,8 @@ endif
 
 BOOTCFLAGS	+= -I$(obj) -I$(srctree)/$(obj)
 
+cuboot-plats := 83xx 85xx 86xx
+
 zlib       := inffast.c inflate.c inftrees.c
 zlibheader := inffast.h inffixed.h inflate.h inftrees.h infutil.h
 zliblinuxheader := zlib.h zconf.h zutil.h
@@ -45,7 +47,7 @@ $(addprefix $(obj)/,$(zlib) main.o): $(a
 src-wlib := string.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
 		ns16550.c serial.c simple_alloc.c div64.S util.S $(zlib) \
 		devtree.c
-src-plat := of.c
+src-plat := of.c $(cuboot-plats:%=cuboot-%.c)
 src-boot := crt0.S $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -122,6 +124,12 @@ quiet_cmd_wrap_initrd = WRAP    $@
       cmd_wrap_initrd =$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
 				-i $(obj)/ramdisk.image.gz vmlinux
 
+dts = $(if $(shell echo $(CONFIG_CUIMAGE_DTS) | grep '^/'),\
+       ,$(srctree)/$(src)/dts/)$(CONFIG_CUIMAGE_DTS)
+quiet_cmd_wrap_dt = WRAP    $@
+      cmd_wrap_dt = $(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
+                    -s "$(dts)" vmlinux
+
 $(obj)/zImage.chrp: vmlinux $(wrapperbits)
 	$(call cmd,wrap,chrp)
 
@@ -158,8 +166,18 @@ $(obj)/zImage.ps3: vmlinux
 $(obj)/zImage.initrd.ps3: vmlinux
 	@echo "  WARNING zImage.initrd.ps3 not supported (yet)"
 
+ifeq ($(CONFIG_COMPAT_UIMAGE),y)
+cuboot-plat-$(CONFIG_83xx) += 83xx
+cuboot-plat-$(CONFIG_85xx) += 85xx
+cuboot-plat-$(CONFIG_86xx) += 86xx
+cuboot-plat-y += unknown-platform
+
+$(obj)/uImage: vmlinux $(wrapperbits)
+	$(call cmd,wrap_dt,cuboot-$(word 1,$(cuboot-plat-y)))
+else
 $(obj)/uImage: vmlinux $(wrapperbits)
 	$(call cmd,wrap,uboot)
+endif
 
 image-$(CONFIG_PPC_PSERIES)		+= zImage.pseries
 image-$(CONFIG_PPC_MAPLE)		+= zImage.pseries
diff --git a/arch/powerpc/boot/cuboot-83xx.c b/arch/powerpc/boot/cuboot-83xx.c
new file mode 100644
index 0000000..6563dcc
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-83xx.c
@@ -0,0 +1,4 @@
+#define CONFIG_83xx
+#define CONFIG_6xx
+
+#include "cuboot.c"
diff --git a/arch/powerpc/boot/cuboot-85xx.c b/arch/powerpc/boot/cuboot-85xx.c
new file mode 100644
index 0000000..16f33e1
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-85xx.c
@@ -0,0 +1,4 @@
+#define CONFIG_85xx
+#define CONFIG_E500
+
+#include "cuboot.c"
diff --git a/arch/powerpc/boot/cuboot-86xx.c b/arch/powerpc/boot/cuboot-86xx.c
new file mode 100644
index 0000000..e9cca26
--- /dev/null
+++ b/arch/powerpc/boot/cuboot-86xx.c
@@ -0,0 +1,4 @@
+#define CONFIG_86xx
+#define CONFIG_6xx
+
+#include "cuboot.c"
diff --git a/arch/powerpc/boot/cuboot.c b/arch/powerpc/boot/cuboot.c
new file mode 100644
index 0000000..98f8427
--- /dev/null
+++ b/arch/powerpc/boot/cuboot.c
@@ -0,0 +1,160 @@
+/*
+ * Compatibility with old U-Boots
+ *
+ * Author: Scott Wood <scottwood@freescale.com>
+ *
+ * Copyright (c) 2007 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "flatdevtree.h"
+#include "ppcboot.h"
+
+static bd_t bd;
+extern char _start[], _end[];
+
+static void set_memory(void)
+{
+	void *devp;
+	unsigned long mem[2] = { bd.bi_memstart, bd.bi_memsize };
+
+	devp = finddevice("/memory");
+	if (!devp) {
+		devp = create_node(NULL, "memory");
+		setprop_str(devp, "device_type", "memory");
+	}
+
+	setprop(devp, "reg", mem, sizeof(mem));
+}
+
+static void set_bootargs(unsigned long cmdline_start,
+                         unsigned long cmdline_size)
+{
+	void *devp;
+
+	devp = finddevice("/chosen");
+	if (!devp)
+		devp = create_node(NULL, "chosen");
+
+	setprop(devp, "bootargs", (void *)cmdline_start, cmdline_size);
+}
+
+static void *set_one_mac(void *last_node, unsigned char *addr)
+{
+	void *node = find_node_by_prop_value_str(last_node, "device_type",
+	                                         "network");
+
+	if (node)
+		setprop(node, "local-mac-address", addr, 6);
+
+	return node;
+}
+
+static void set_mac_addrs(void)
+{
+	__attribute__((unused)) void *node =
+		set_one_mac(NULL, bd.bi_enetaddr);
+
+#ifdef HAVE_ENET1ADDR
+	if (node)
+		node = set_one_mac(node, bd.bi_enet1addr);
+#endif
+#ifdef HAVE_ENET2ADDR
+	if (node)
+		node = set_one_mac(node, bd.bi_enet2addr);
+#endif
+#ifdef HAVE_ENET3ADDR
+	if (node)
+		node = set_one_mac(node, bd.bi_enet3addr);
+#endif
+}
+
+static void set_clocks(void)
+{
+	void *node = NULL;
+
+	while ((node = find_node_by_prop_value_str(node, "device_type",
+	                                           "cpu"))) {
+		unsigned long tbfreq;
+
+		setprop(node, "clock-frequency", &bd.bi_intfreq,
+		        sizeof(bd.bi_intfreq));
+		setprop(node, "bus-frequency", &bd.bi_busfreq,
+		        sizeof(bd.bi_busfreq));
+
+#ifdef CONFIG_6xx
+		tbfreq = bd.bi_busfreq / 4;
+#elif defined(CONFIG_E500)
+		tbfreq = bd.bi_busfreq / 8;
+#else
+#error Unknown timebase frequency.
+#endif
+
+		setprop(node, "timebase-frequency", &tbfreq, sizeof(tbfreq));
+	}
+
+#if defined(CONFIG_83xx) || defined(CONFIG_85xx) || defined(CONFIG_86xx)
+	node = find_node_by_prop_value_str(NULL, "device_type", "soc");
+	if (node) {
+		void *serial;
+
+		setprop(node, "bus-frequency", &bd.bi_busfreq,
+		        sizeof(bd.bi_busfreq));
+
+		serial = finddevice_rel(node, "serial@4500");
+		if (serial)
+			setprop(serial, "clock-frequency", &bd.bi_busfreq,
+			        sizeof(bd.bi_busfreq));
+
+		serial = finddevice_rel(node, "serial@4600");
+		if (serial)
+			setprop(serial, "clock-frequency", &bd.bi_busfreq,
+			        sizeof(bd.bi_busfreq));
+	}
+#endif
+}
+
+/* There's not enough room on 8MiB boards to put the full
+ * heap (including a kernel image) after _end, but the device
+ * tree cannot stay in a heap that is before _start, or it
+ * will get overwritten when the kernel relocates itself.
+ *
+ * Ideally, we wouldn't move the kernel at all if not uncompressing,
+ * but that requires making sure all platforms leave enough room
+ * after _end for the BSS when setting up the heap.
+ */
+static unsigned long cuboot_finalize(void)
+{
+	struct boot_param_header *dt =
+		(struct boot_param_header *)ft_finalize();
+
+	memcpy(_end, dt, dt->totalsize);
+	return (unsigned long)_end;
+}
+
+int platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+                  unsigned long r6, unsigned long r7,
+                  char *dt_blob_start, char *dt_blob_end)
+{
+	memcpy(&bd, (bd_t *)r3, sizeof(bd));
+	initrd.addr = r4;
+	initrd.size = r4 ? r5 : 0;
+
+	if (simple_alloc_init(0, (unsigned long)_start - 0x80000, 4096, 32) >
+	    (void *)_start)
+		return -1;
+	if (ft_init(dt_blob_start, dt_blob_end - dt_blob_start, 32))
+		return -1;
+
+	set_memory();
+	set_bootargs(r6, r7 - r6 + 1);
+	set_mac_addrs();
+	set_clocks();
+
+	dt_ops.finalize = cuboot_finalize;
+	return serial_console_init();
+}
diff --git a/arch/powerpc/boot/ppcboot.h b/arch/powerpc/boot/ppcboot.h
new file mode 100644
index 0000000..d9782ae
--- /dev/null
+++ b/arch/powerpc/boot/ppcboot.h
@@ -0,0 +1,103 @@
+/*
+ * (C) Copyright 2000, 2001
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __PPCBOOT_H__
+#define __PPCBOOT_H__
+
+/*
+ * Board information passed to kernel from PPCBoot
+ *
+ * include/asm-ppc/ppcboot.h
+ */
+
+#include "types.h"
+
+typedef struct bd_info {
+	unsigned long	bi_memstart;	/* start of DRAM memory */
+	unsigned long	bi_memsize;	/* size	 of DRAM memory in bytes */
+	unsigned long	bi_flashstart;	/* start of FLASH memory */
+	unsigned long	bi_flashsize;	/* size	 of FLASH memory */
+	unsigned long	bi_flashoffset; /* reserved area for startup monitor */
+	unsigned long	bi_sramstart;	/* start of SRAM memory */
+	unsigned long	bi_sramsize;	/* size	 of SRAM memory */
+#if defined(CONFIG_8xx) || defined(CONFIG_CPM2) || defined(CONFIG_85xx) ||\
+	defined(CONFIG_83xx)
+	unsigned long	bi_immr_base;	/* base of IMMR register */
+#endif
+#if defined(CONFIG_PPC_MPC52xx)
+	unsigned long   bi_mbar_base;   /* base of internal registers */
+#endif
+	unsigned long	bi_bootflags;	/* boot / reboot flag (for LynxOS) */
+	unsigned long	bi_ip_addr;	/* IP Address */
+	unsigned char	bi_enetaddr[6];	/* Ethernet address */
+	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */
+	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */
+	unsigned long	bi_busfreq;	/* Bus Freq, in MHz */
+#if defined(CONFIG_CPM2)
+	unsigned long	bi_cpmfreq;	/* CPM_CLK Freq, in MHz */
+	unsigned long	bi_brgfreq;	/* BRG_CLK Freq, in MHz */
+	unsigned long	bi_sccfreq;	/* SCC_CLK Freq, in MHz */
+	unsigned long	bi_vco;		/* VCO Out from PLL, in MHz */
+#endif
+#if defined(CONFIG_PPC_MPC52xx)
+	unsigned long   bi_ipbfreq;     /* IPB Bus Freq, in MHz */
+	unsigned long   bi_pcifreq;     /* PCI Bus Freq, in MHz */
+#endif
+	unsigned long	bi_baudrate;	/* Console Baudrate */
+#if defined(CONFIG_4xx)
+	unsigned char	bi_s_version[4];	/* Version of this structure */
+	unsigned char	bi_r_version[32];	/* Version of the ROM (IBM) */
+	unsigned int	bi_procfreq;	/* CPU (Internal) Freq, in Hz */
+	unsigned int	bi_plb_busfreq;	/* PLB Bus speed, in Hz */
+	unsigned int	bi_pci_busfreq;	/* PCI Bus speed, in Hz */
+	unsigned char	bi_pci_enetaddr[6];	/* PCI Ethernet MAC address */
+#endif
+#if defined(CONFIG_HYMOD)
+	hymod_conf_t	bi_hymod_conf;	/* hymod configuration information */
+#endif
+#if defined(CONFIG_EVB64260) || defined(CONFIG_405EP) || defined(CONFIG_44x) || \
+	defined(CONFIG_85xx) ||	defined(CONFIG_83xx)
+	/* second onboard ethernet port */
+	unsigned char	bi_enet1addr[6];
+#define HAVE_ENET1ADDR
+#endif
+#if defined(CONFIG_EVB64260) || defined(CONFIG_440GX) || defined(CONFIG_85xx)
+	/* third onboard ethernet ports */
+	unsigned char	bi_enet2addr[6];
+#define HAVE_ENET2ADDR
+#endif
+#if defined(CONFIG_440GX)
+	/* fourth onboard ethernet ports */
+	unsigned char	bi_enet3addr[6];
+#define HAVE_ENET3ADDR
+#endif
+#if defined(CONFIG_4xx)
+	unsigned int	bi_opbfreq;		/* OB clock in Hz */
+	int		bi_iic_fast[2];		/* Use fast i2c mode */
+#endif
+#if defined(CONFIG_440GX)
+	int		bi_phynum[4];		/* phy mapping */
+	int		bi_phymode[4];		/* phy mode */
+#endif
+} bd_t;
+
+#define bi_tbfreq	bi_intfreq
+
+#endif	/* __PPCBOOT_H__ */
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 024e4d4..f7458c1 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -29,6 +29,7 @@ initrd=
 dtb=
 dts=
 cacheit=
+gzip=.gz
 
 # cross-compilation prefix
 CROSS=
@@ -106,7 +107,7 @@ if [ -n "$dts" ]; then
     if [ -z "$dtb" ]; then
 	dtb="$platform.dtb"
     fi
-    dtc -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1
+    dtc -f -O dtb -o "$dtb" -b 0 -V 16 "$dts" || exit 1
 fi
 
 if [ -z "$kernel" ]; then
@@ -137,31 +138,46 @@ miboot|uboot)
     ksection=image
     isection=initrd
     ;;
+cuboot*)
+    platformo=$object/"$platform".o
+    gzip=
+    ;;
 esac
 
 vmz="$tmpdir/`basename \"$kernel\"`.$ext"
 if [ -z "$cacheit" -o ! -f "$vmz.gz" -o "$vmz.gz" -ot "$kernel" ]; then
     ${CROSS}objcopy $objflags "$kernel" "$vmz.$$"
-    gzip -f -9 "$vmz.$$"
+
+    if [ -n "$gzip" ]; then
+        gzip -f -9 "$vmz.$$"
+    fi
+
     if [ -n "$cacheit" ]; then
-	mv -f "$vmz.$$.gz" "$vmz.gz"
+	mv -f "$vmz.$$$gzip" "$vmz$gzip"
     else
 	vmz="$vmz.$$"
     fi
 fi
 
+vmz="$vmz$gzip"
+
 case "$platform" in
-uboot)
-    rm -f "$ofile"
+uboot|cuboot*)
     version=`${CROSS}strings "$kernel" | grep '^Linux version [-0-9.]' | \
 	cut -d' ' -f3`
     if [ -n "$version" ]; then
 	version="-n Linux-$version"
     fi
+    ;;
+esac
+
+case "$platform" in
+uboot)
+    rm -f "$ofile"
     mkimage -A ppc -O linux -T kernel -C gzip -a 00000000 -e 00000000 \
-	$version -d "$vmz.gz" "$ofile"
+	$version -d "$vmz" "$ofile"
     if [ -z "$cacheit" ]; then
-	rm -f $vmz.gz
+	rm -f $vmz
     fi
     exit 0
     ;;
@@ -173,9 +189,9 @@ addsec() {
 	--set-section-flags=$3=contents,alloc,load,readonly,data
 }
 
-addsec $tmp "$vmz.gz" $ksection $object/empty.o
+addsec $tmp "$vmz" $ksection $object/empty.o
 if [ -z "$cacheit" ]; then
-    rm -f "$vmz.gz"
+    rm -f "$vmz"
 fi
 
 if [ -n "$initrd" ]; then
@@ -204,4 +220,11 @@ pmaccoff)
     ${CROSS}objcopy -O aixcoff-rs6000 --set-start 0x500000 "$ofile"
     $object/hack-coff "$ofile"
     ;;
+cuboot*)
+    mv "$ofile" "$ofile".elf
+    ${CROSS}objcopy -O binary "$ofile".elf "$ofile".bin
+    gzip -f -9 "$ofile".bin
+    mkimage -A ppc -O linux -T kernel -C gzip -a 00400000 -e 00400010 \
+            $version -d "$ofile".bin.gz "$ofile"
+    ;;
 esac
-- 
1.4.4

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

* Re: [PATCH 11/19] bootwrapper: Add ft_find_device_rel().
  2007-02-07 23:01 ` [PATCH 11/19] bootwrapper: Add ft_find_device_rel() Scott Wood
@ 2007-02-08  1:11   ` David Gibson
  2007-02-08 17:14     ` Scott Wood
  0 siblings, 1 reply; 38+ messages in thread
From: David Gibson @ 2007-02-08  1:11 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Feb 07, 2007 at 05:01:33PM -0600, Scott Wood wrote:
> Add a function to look up a relative, rather than absolute, path
> name.

Why do you need this one?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [PATCH 11/19] bootwrapper: Add ft_find_device_rel().
  2007-02-08  1:11   ` David Gibson
@ 2007-02-08 17:14     ` Scott Wood
  0 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-08 17:14 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev, paulus

David Gibson wrote:
> On Wed, Feb 07, 2007 at 05:01:33PM -0600, Scott Wood wrote:
> 
>>Add a function to look up a relative, rather than absolute, path
>>name.
> 
> 
> Why do you need this one?

It's used in set_clocks() in cuboot.c.

-Scott

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

* Re: [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot)
  2007-02-07 23:01 ` [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot) Scott Wood
@ 2007-02-08 21:15   ` David Gibson
  2007-02-09 17:11     ` Scott Wood
  0 siblings, 1 reply; 38+ messages in thread
From: David Gibson @ 2007-02-08 21:15 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Feb 07, 2007 at 05:01:49PM -0600, Scott Wood wrote:
> Add a bootwrapper platform (cuboot) that takes a bd_t from a legacy
> U-Boot, and inserts data from it into a device tree which has been
> compiled into the kernel.  This should help ease the transition to
> arch/powerpc in cases where U-Boot has not yet been updated to pass a
> device tree, or where upgrading firmware isn't practical.
> 
> The device trees currently in the kernel tree must have
> /chosen/linux,stdout-path added to work with cuboot.
> 
> The kernel command line, mac addresses, and various clocks will be filled
> in based on the bd_t.

You're still using config dependent stuff in here...

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot)
  2007-02-08 21:15   ` David Gibson
@ 2007-02-09 17:11     ` Scott Wood
  2007-02-10  1:02       ` David Gibson
  0 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-09 17:11 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev, paulus

David Gibson wrote:
> On Wed, Feb 07, 2007 at 05:01:49PM -0600, Scott Wood wrote:
> 
>>Add a bootwrapper platform (cuboot) that takes a bd_t from a legacy
>>U-Boot, and inserts data from it into a device tree which has been
>>compiled into the kernel.  This should help ease the transition to
>>arch/powerpc in cases where U-Boot has not yet been updated to pass a
>>device tree, or where upgrading firmware isn't practical.
>>
>>The device trees currently in the kernel tree must have
>>/chosen/linux,stdout-path added to work with cuboot.
>>
>>The kernel command line, mac addresses, and various clocks will be filled
>>in based on the bd_t.
> 
> 
> You're still using config dependent stuff in here...

They come from platform files such as cuboot-83xx.c, not (directly) from 
the kernel config.

-Scott

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

* Re: [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize().
  2007-02-07 23:01 ` [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize() Scott Wood
@ 2007-02-09 23:02   ` Mark A. Greer
  2007-02-10  0:37     ` David Gibson
  2007-02-12 16:42     ` Scott Wood
  0 siblings, 2 replies; 38+ messages in thread
From: Mark A. Greer @ 2007-02-09 23:02 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Feb 07, 2007 at 05:01:40PM -0600, Scott Wood wrote:

Sorry for being so slow on this Scott.

<snip>

> diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
> index 04da38f..39fa010 100644
> --- a/arch/powerpc/boot/flatdevtree_misc.c
> +++ b/arch/powerpc/boot/flatdevtree_misc.c
> @@ -33,8 +33,20 @@ static int ft_setprop(const void *phandl
>  	return ft_set_prop(&cxt, phandle, propname, buf, buflen);
>  }
>  
> -static unsigned long ft_finalize(void)
> +unsigned long ft_finalize(void)

This is unnecessary.  There is already global access from
dt_ops.finalize.

>  {
> +	unsigned long initrd_end = initrd.addr + initrd.size;
> +	void *devp;
> +
> +	if (initrd.size && (devp = finddevice("/chosen"))) {
> +		setprop(devp, "linux,initrd-start", &initrd.addr,
> +		        sizeof(initrd.addr));
> +		setprop(devp, "linux,initrd-end", &initrd_end,
> +		        sizeof(initrd_end));
> +
> +		ft_add_rsvmap(&cxt, initrd.addr, initrd.size);
> +	}
> +

IMHO, this is a very unnatural place to put this code.
It really belongs in main.c.  That's where all the rest
of the code that accesses initrd.* is.

Mark

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

* Re: [PATCH 17/19] bootwrapper: Add dt_ops methods.
  2007-02-07 23:01 ` [PATCH 17/19] bootwrapper: Add dt_ops methods Scott Wood
@ 2007-02-09 23:05   ` Mark A. Greer
  0 siblings, 0 replies; 38+ messages in thread
From: Mark A. Greer @ 2007-02-09 23:05 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Feb 07, 2007 at 05:01:44PM -0600, Scott Wood wrote:

<snip>

> diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
> index 39fa010..10e5f27 100644
> --- a/arch/powerpc/boot/flatdevtree_misc.c
> +++ b/arch/powerpc/boot/flatdevtree_misc.c

> +void *fdtm_get_parent(const void *phandle)
> +void *fdtm_create_node(const void *phandle, const char *name)
> +void *fdtm_find_node_by_prop_value(const void *prev, const char *propname,

Make these static.  Also, we should probably make the naming consistent
so would you mind making them all fdtm_* or whatever?

Mark

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

* Re: [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers.
  2007-02-07 23:01 ` [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers Scott Wood
@ 2007-02-09 23:07   ` Mark A. Greer
  2007-02-12 16:45     ` Scott Wood
  0 siblings, 1 reply; 38+ messages in thread
From: Mark A. Greer @ 2007-02-09 23:07 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Feb 07, 2007 at 05:01:45PM -0600, Scott Wood wrote:
> xlate_reg() uses the ranges properties of a node's parentage to find the
> absolute physical address of the node's registers.
> 
> The ns16550 driver uses this when no virtual-reg property is found.

Is this necessary?  Shouldn't there always be a virtual-reg?

Mark

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

* Re: [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize().
  2007-02-09 23:02   ` Mark A. Greer
@ 2007-02-10  0:37     ` David Gibson
  2007-02-12 16:42     ` Scott Wood
  1 sibling, 0 replies; 38+ messages in thread
From: David Gibson @ 2007-02-10  0:37 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev, paulus

On Fri, Feb 09, 2007 at 04:02:07PM -0700, Mark A. Greer wrote:
> On Wed, Feb 07, 2007 at 05:01:40PM -0600, Scott Wood wrote:
> 
> Sorry for being so slow on this Scott.
> 
> <snip>
> 
> > diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
> > index 04da38f..39fa010 100644
> > --- a/arch/powerpc/boot/flatdevtree_misc.c
> > +++ b/arch/powerpc/boot/flatdevtree_misc.c
> > @@ -33,8 +33,20 @@ static int ft_setprop(const void *phandl
> >  	return ft_set_prop(&cxt, phandle, propname, buf, buflen);
> >  }
> >  
> > -static unsigned long ft_finalize(void)
> > +unsigned long ft_finalize(void)
> 
> This is unnecessary.  There is already global access from
> dt_ops.finalize.
> 
> >  {
> > +	unsigned long initrd_end = initrd.addr + initrd.size;
> > +	void *devp;
> > +
> > +	if (initrd.size && (devp = finddevice("/chosen"))) {
> > +		setprop(devp, "linux,initrd-start", &initrd.addr,
> > +		        sizeof(initrd.addr));
> > +		setprop(devp, "linux,initrd-end", &initrd_end,
> > +		        sizeof(initrd_end));
> > +
> > +		ft_add_rsvmap(&cxt, initrd.addr, initrd.size);
> > +	}
> > +
> 
> IMHO, this is a very unnatural place to put this code.
> It really belongs in main.c.  That's where all the rest
> of the code that accesses initrd.* is.

Agreed.  I have a couple of pending patches that do this in a more
sensible place.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot)
  2007-02-09 17:11     ` Scott Wood
@ 2007-02-10  1:02       ` David Gibson
  2007-02-12 16:52         ` Scott Wood
  0 siblings, 1 reply; 38+ messages in thread
From: David Gibson @ 2007-02-10  1:02 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Fri, Feb 09, 2007 at 11:11:29AM -0600, Scott Wood wrote:
> David Gibson wrote:
> > On Wed, Feb 07, 2007 at 05:01:49PM -0600, Scott Wood wrote:
> > 
> >>Add a bootwrapper platform (cuboot) that takes a bd_t from a legacy
> >>U-Boot, and inserts data from it into a device tree which has been
> >>compiled into the kernel.  This should help ease the transition to
> >>arch/powerpc in cases where U-Boot has not yet been updated to pass a
> >>device tree, or where upgrading firmware isn't practical.
> >>
> >>The device trees currently in the kernel tree must have
> >>/chosen/linux,stdout-path added to work with cuboot.
> >>
> >>The kernel command line, mac addresses, and various clocks will be filled
> >>in based on the bd_t.
> > 
> > 
> > You're still using config dependent stuff in here...
> 
> They come from platform files such as cuboot-83xx.c, not (directly) from 
> the kernel config.

/me looks again...

.c files containing only #defines?  My brain hurts.

Better to pass these in as -D flags from the gcc invocation within the
wrapper script, depending on the given platform (for the platform .o
*only*).  Oh, and please don't call them CONFIG_* or everyone will
assume, like me, that they come from the kernel's overall config.h.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize().
  2007-02-09 23:02   ` Mark A. Greer
  2007-02-10  0:37     ` David Gibson
@ 2007-02-12 16:42     ` Scott Wood
  2007-02-13  4:29       ` David Gibson
  1 sibling, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-12 16:42 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev, paulus

Mark A. Greer wrote:
>>diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
>>index 04da38f..39fa010 100644
>>--- a/arch/powerpc/boot/flatdevtree_misc.c
>>+++ b/arch/powerpc/boot/flatdevtree_misc.c
>>@@ -33,8 +33,20 @@ static int ft_setprop(const void *phandl
>> 	return ft_set_prop(&cxt, phandle, propname, buf, buflen);
>> }
>> 
>>-static unsigned long ft_finalize(void)
>>+unsigned long ft_finalize(void)
> 
> 
> This is unnecessary.  There is already global access from
> dt_ops.finalize.

cuboot has its own dt_ops.finalize, which calls ft_finalize, and 
relocates the tree to someplace that won't get overwritten by the kernel 
relocation.

>>+	unsigned long initrd_end = initrd.addr + initrd.size;
>>+	void *devp;
>>+
>>+	if (initrd.size && (devp = finddevice("/chosen"))) {
>>+		setprop(devp, "linux,initrd-start", &initrd.addr,
>>+		        sizeof(initrd.addr));
>>+		setprop(devp, "linux,initrd-end", &initrd_end,
>>+		        sizeof(initrd_end));
>>+
>>+		ft_add_rsvmap(&cxt, initrd.addr, initrd.size);
>>+	}
>>+
> 
> 
> IMHO, this is a very unnatural place to put this code.
> It really belongs in main.c.  That's where all the rest
> of the code that accesses initrd.* is.

I was trying to not change the existing semantics for the of.c platform, 
which passes the initrd information a different way.

-Scott

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

* Re: [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers.
  2007-02-09 23:07   ` Mark A. Greer
@ 2007-02-12 16:45     ` Scott Wood
  2007-02-12 21:10       ` Josh Boyer
  0 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-12 16:45 UTC (permalink / raw)
  To: Mark A. Greer; +Cc: linuxppc-dev, paulus

Mark A. Greer wrote:
> On Wed, Feb 07, 2007 at 05:01:45PM -0600, Scott Wood wrote:
> 
>>xlate_reg() uses the ranges properties of a node's parentage to find the
>>absolute physical address of the node's registers.
>>
>>The ns16550 driver uses this when no virtual-reg property is found.
> 
> 
> Is this necessary?  Shouldn't there always be a virtual-reg?

None of the dts files in the kernel tree currently have such a property...

-Scott

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

* Re: [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot)
  2007-02-10  1:02       ` David Gibson
@ 2007-02-12 16:52         ` Scott Wood
  0 siblings, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-12 16:52 UTC (permalink / raw)
  To: David Gibson; +Cc: linuxppc-dev, paulus

David Gibson wrote:
> On Fri, Feb 09, 2007 at 11:11:29AM -0600, Scott Wood wrote:
>>They come from platform files such as cuboot-83xx.c, not (directly) from 
>>the kernel config.
> 
> 
> /me looks again...
> 
> .c files containing only #defines?  My brain hurts.

So does mine.  It wasn't my idea...

> Better to pass these in as -D flags from the gcc invocation within the
> wrapper script, depending on the given platform (for the platform .o
> *only*). 

I was explicitly told by Paul that it had to be link-time, not compile-time.

See "http://ozlabs.org/pipermail/linuxppc-dev/2007-January/030532.html".

Unless you're saying that the "wrapper" script should do the compilation 
itself, rather than just linking as it currently does...  in which case 
I'd really like to know what real benefit we're getting out of all this 
silliness.

> Oh, and please don't call them CONFIG_* or everyone will
> assume, like me, that they come from the kernel's overall config.h.

Well, they are related, and I'd have to make ppcboot.h diverge even more 
from u-boot's version to call it something else.

But I can rename it TARGET_* or something if it'd make y'all happier.

-Scott

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

* Re: [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers.
  2007-02-12 16:45     ` Scott Wood
@ 2007-02-12 21:10       ` Josh Boyer
  2007-02-13  4:30         ` David Gibson
  2007-02-13 16:00         ` Scott Wood
  0 siblings, 2 replies; 38+ messages in thread
From: Josh Boyer @ 2007-02-12 21:10 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Mon, 2007-02-12 at 10:45 -0600, Scott Wood wrote:
> Mark A. Greer wrote:
> > On Wed, Feb 07, 2007 at 05:01:45PM -0600, Scott Wood wrote:
> > 
> >>xlate_reg() uses the ranges properties of a node's parentage to find the
> >>absolute physical address of the node's registers.
> >>
> >>The ns16550 driver uses this when no virtual-reg property is found.
> > 
> > 
> > Is this necessary?  Shouldn't there always be a virtual-reg?
> 
> None of the dts files in the kernel tree currently have such a property...

4xx will use this.  The bootwrapper will use the UART mapping setup by
the firmware to print out to the console.  At least that is why it was
added to being with, and how I had it working on Ebony a while ago.
David may have changed it since.

josh

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

* Re: [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize().
  2007-02-12 16:42     ` Scott Wood
@ 2007-02-13  4:29       ` David Gibson
  2007-02-13 16:07         ` Scott Wood
  0 siblings, 1 reply; 38+ messages in thread
From: David Gibson @ 2007-02-13  4:29 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Mon, Feb 12, 2007 at 10:42:13AM -0600, Scott Wood wrote:
> Mark A. Greer wrote:
> >>diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
> >>index 04da38f..39fa010 100644
> >>--- a/arch/powerpc/boot/flatdevtree_misc.c
> >>+++ b/arch/powerpc/boot/flatdevtree_misc.c
> >>@@ -33,8 +33,20 @@ static int ft_setprop(const void *phandl
> >> 	return ft_set_prop(&cxt, phandle, propname, buf, buflen);
> >> }
> >> 
> >>-static unsigned long ft_finalize(void)
> >>+unsigned long ft_finalize(void)
> > 
> > 
> > This is unnecessary.  There is already global access from
> > dt_ops.finalize.
> 
> cuboot has its own dt_ops.finalize, which calls ft_finalize, and 
> relocates the tree to someplace that won't get overwritten by the kernel 
> relocation.

Why is cuboot's malloc() allocating the flat tree in a place that's in
danger of being clobbered by the kernel in the first place?

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers.
  2007-02-12 21:10       ` Josh Boyer
@ 2007-02-13  4:30         ` David Gibson
  2007-02-13 16:00         ` Scott Wood
  1 sibling, 0 replies; 38+ messages in thread
From: David Gibson @ 2007-02-13  4:30 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, paulus

On Mon, Feb 12, 2007 at 03:10:15PM -0600, Josh Boyer wrote:
> On Mon, 2007-02-12 at 10:45 -0600, Scott Wood wrote:
> > Mark A. Greer wrote:
> > > On Wed, Feb 07, 2007 at 05:01:45PM -0600, Scott Wood wrote:
> > > 
> > >>xlate_reg() uses the ranges properties of a node's parentage to find the
> > >>absolute physical address of the node's registers.
> > >>
> > >>The ns16550 driver uses this when no virtual-reg property is found.
> > > 
> > > 
> > > Is this necessary?  Shouldn't there always be a virtual-reg?
> > 
> > None of the dts files in the kernel tree currently have such a property...
> 
> 4xx will use this.  The bootwrapper will use the UART mapping setup by
> the firmware to print out to the console.  At least that is why it was
> added to being with, and how I had it working on Ebony a while ago.
> David may have changed it since.

No, I'm using virtual-reg on Ebony.  In fact I think I'm using your
code for it.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

* Re: [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers.
  2007-02-12 21:10       ` Josh Boyer
  2007-02-13  4:30         ` David Gibson
@ 2007-02-13 16:00         ` Scott Wood
  1 sibling, 0 replies; 38+ messages in thread
From: Scott Wood @ 2007-02-13 16:00 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev, paulus

On Mon, Feb 12, 2007 at 03:10:15PM -0600, Josh Boyer wrote:
> On Mon, 2007-02-12 at 10:45 -0600, Scott Wood wrote:
> > Mark A. Greer wrote:
> > > Is this necessary?  Shouldn't there always be a virtual-reg?
> > 
> > None of the dts files in the kernel tree currently have such a property...
> 
> 4xx will use this.  The bootwrapper will use the UART mapping setup by
> the firmware to print out to the console.  At least that is why it was
> added to being with, and how I had it working on Ebony a while ago.
> David may have changed it since.

Note that my patch will still use virtual-reg if it is there; the ranges
parsing is a fall back for the targets that don't need virtual-reg.

-Scott

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

* Re: [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize().
  2007-02-13  4:29       ` David Gibson
@ 2007-02-13 16:07         ` Scott Wood
  2007-02-14  4:43           ` David Gibson
  0 siblings, 1 reply; 38+ messages in thread
From: Scott Wood @ 2007-02-13 16:07 UTC (permalink / raw)
  To: Mark A. Greer, linuxppc-dev, paulus

On Tue, Feb 13, 2007 at 03:29:37PM +1100, David Gibson wrote:
> Why is cuboot's malloc() allocating the flat tree in a place that's in
> danger of being clobbered by the kernel in the first place?

As the comment in cuboot.c explains, there's not enough room to do it any
other way and still run on boards with only 8MiB of RAM -- the dts has to
go above the wrapper image, and the "uncompressed" kernel has to go
below, but the same heap is used for both.  I believe there are some 8xx
boards out there with only this much; even if not, 8xx currently only
maps 8MiB by default.  8xx isn't supported by this patchset, but I'd like
to support it eventually.

-Scott

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

* Re: [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize().
  2007-02-13 16:07         ` Scott Wood
@ 2007-02-14  4:43           ` David Gibson
  0 siblings, 0 replies; 38+ messages in thread
From: David Gibson @ 2007-02-14  4:43 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Tue, Feb 13, 2007 at 10:07:23AM -0600, Scott Wood wrote:
> On Tue, Feb 13, 2007 at 03:29:37PM +1100, David Gibson wrote:
> > Why is cuboot's malloc() allocating the flat tree in a place that's in
> > danger of being clobbered by the kernel in the first place?
> 
> As the comment in cuboot.c explains, there's not enough room to do it any
> other way and still run on boards with only 8MiB of RAM -- the dts has to
> go above the wrapper image, and the "uncompressed" kernel has to go
> below, but the same heap is used for both.  I believe there are some 8xx
> boards out there with only this much; even if not, 8xx currently only
> maps 8MiB by default.  8xx isn't supported by this patchset, but I'd like
> to support it eventually.

Hrm, ok.  You may have seen in my Ebony patch series there's a patch
adding a bootwrapper platform_ops hook giving the address at which to
load the kernel.  At present the wrapper still decompresses the kernel
to heap-allocated space, then moves it to the specified address,
however I'm hoping to write an improved version which decompresses
directly to the final location.  That should address your problem
here, I believe.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

end of thread, other threads:[~2007-02-14  4:43 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 23:00 [PATCH 00/19] cuboot bootwrapper patchset Scott Wood
2007-02-07 23:01 ` [PATCH 01/19] bootwrapper: Add stddef.h to ops.h Scott Wood
2007-02-07 23:01 ` [PATCH 02/19] bootwrapper: Set -msoft-float and assembler target options Scott Wood
2007-02-07 23:01 ` [PATCH 03/19] bootwrapper: Remove OF-isms Scott Wood
2007-02-07 23:01 ` [PATCH 04/19] bootwrapper: Add ft_root_node() Scott Wood
2007-02-07 23:01 ` [PATCH 05/19] bootwrapper: Rename ft_node_add() to ft_get_phandle() Scott Wood
2007-02-07 23:01 ` [PATCH 06/19] bootwrapper: Make ft_get_phandle() accept and return NULL Scott Wood
2007-02-07 23:01 ` [PATCH 07/19] bootwrapper: Preserve the pp pointer in ft_make_space() when calling ft_reorder() Scott Wood
2007-02-07 23:01 ` [PATCH 08/19] bootwrapper: Modify *pp, not *p, in ft_shuffle() Scott Wood
2007-02-07 23:01 ` [PATCH 09/19] bootwrapper: Rename p and pp to anchor and anchorptr Scott Wood
2007-02-07 23:01 ` [PATCH 10/19] bootwrapper: Use map_string() instead of lookup_string() in ft_prop() Scott Wood
2007-02-07 23:01 ` [PATCH 11/19] bootwrapper: Add ft_find_device_rel() Scott Wood
2007-02-08  1:11   ` David Gibson
2007-02-08 17:14     ` Scott Wood
2007-02-07 23:01 ` [PATCH 12/19] bootwrapper: Refactor ft_get_prop() into internal and external functions Scott Wood
2007-02-07 23:01 ` [PATCH 13/19] bootwrapper: Make ft_get_parent() return a phandle, and NULL if already top-level Scott Wood
2007-02-07 23:01 ` [PATCH 14/19] bootwrapper: Add ft_find_node_by_prop_value() Scott Wood
2007-02-07 23:01 ` [PATCH 15/19] bootwrapper: Add initrd information to the device tree in ft_finalize() Scott Wood
2007-02-09 23:02   ` Mark A. Greer
2007-02-10  0:37     ` David Gibson
2007-02-12 16:42     ` Scott Wood
2007-02-13  4:29       ` David Gibson
2007-02-13 16:07         ` Scott Wood
2007-02-14  4:43           ` David Gibson
2007-02-07 23:01 ` [PATCH 16/19] bootwrapper: Make ft_create_node() pay attention to the parent parameter Scott Wood
2007-02-07 23:01 ` [PATCH 17/19] bootwrapper: Add dt_ops methods Scott Wood
2007-02-09 23:05   ` Mark A. Greer
2007-02-07 23:01 ` [PATCH 18/19] bootwrapper: Add xlate_reg(), and use it to find serial registers Scott Wood
2007-02-09 23:07   ` Mark A. Greer
2007-02-12 16:45     ` Scott Wood
2007-02-12 21:10       ` Josh Boyer
2007-02-13  4:30         ` David Gibson
2007-02-13 16:00         ` Scott Wood
2007-02-07 23:01 ` [PATCH 19/19] bootwrapper: compatibility layer for old U-Boots (a.k.a. cuImage, cuboot) Scott Wood
2007-02-08 21:15   ` David Gibson
2007-02-09 17:11     ` Scott Wood
2007-02-10  1:02       ` David Gibson
2007-02-12 16:52         ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.