linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/9] bootwrapper: flatdevtree fixes
@ 2007-08-29 16:45 Scott Wood
  2007-08-29 16:46 ` [PATCH 2/9] bootwrapper: Add strtoull() Scott Wood
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:45 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

1. ft_create_node was returning the internal pointer rather than a phandle.
2. ft_find_device_rel was treating a "top" phandle of NULL as an error,
rather than as the root of the tree.  The old, absolute ft_find_device
is removed, and the relative version is renamed to ft_find_device().

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

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 13761bf..0af7291 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -354,16 +354,21 @@ static void ft_put_bin(struct ft_cxt *cxt, const void *data, unsigned int sz)
 	cxt->p += sza;
 }
 
-int ft_begin_node(struct ft_cxt *cxt, const char *name)
+char *ft_begin_node(struct ft_cxt *cxt, const char *name)
 {
 	unsigned long nlen = strlen(name) + 1;
 	unsigned long len = 8 + _ALIGN(nlen, 4);
+	char *ret;
 
 	if (!ft_make_space(cxt, &cxt->p, FT_STRUCT, len))
-		return -1;
+		return NULL;
+
+	ret = cxt->p;
+
 	ft_put_word(cxt, OF_DT_BEGIN_NODE);
 	ft_put_bin(cxt, name, strlen(name) + 1);
-	return 0;
+
+	return ret;
 }
 
 void ft_end_node(struct ft_cxt *cxt)
@@ -625,25 +630,17 @@ void ft_end_tree(struct ft_cxt *cxt)
 	bph->dt_strings_size = cpu_to_be32(ssize);
 }
 
-void *ft_find_device(struct ft_cxt *cxt, const char *srch_path)
-{
-	char *node;
-
-	/* require absolute path */
-	if (srch_path[0] != '/')
-		return NULL;
-	node = ft_find_descendent(cxt, ft_root_node(cxt), srch_path);
-	return ft_get_phandle(cxt, node);
-}
-
-void *ft_find_device_rel(struct ft_cxt *cxt, const void *top,
-                         const char *srch_path)
+void *ft_find_device(struct ft_cxt *cxt, const void *top, const char *srch_path)
 {
 	char *node;
 
-	node = ft_node_ph2node(cxt, top);
-	if (node == NULL)
-		return NULL;
+	if (top) {
+		node = ft_node_ph2node(cxt, top);
+		if (node == NULL)
+			return NULL;
+	} else {
+		node = ft_root_node(cxt);
+	}
 
 	node = ft_find_descendent(cxt, node, srch_path);
 	return ft_get_phandle(cxt, node);
@@ -945,7 +942,7 @@ int ft_del_prop(struct ft_cxt *cxt, const void *phandle, const char *propname)
 void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name)
 {
 	struct ft_atom atom;
-	char *p, *next;
+	char *p, *next, *ret;
 	int depth = 0;
 
 	if (parent) {
@@ -970,9 +967,9 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name)
 				break;
 			/* end of node, insert here */
 			cxt->p = p;
-			ft_begin_node(cxt, name);
+			ret = ft_begin_node(cxt, name);
 			ft_end_node(cxt);
-			return p;
+			return ft_get_phandle(cxt, ret);
 		}
 		p = next;
 	}
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index cb26325..2c1c826 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -76,7 +76,7 @@ struct ft_cxt {
 	unsigned int nodes_used;
 };
 
-int ft_begin_node(struct ft_cxt *cxt, const char *name);
+char *ft_begin_node(struct ft_cxt *cxt, const char *name);
 void ft_end_node(struct ft_cxt *cxt);
 
 void ft_begin_tree(struct ft_cxt *cxt);
@@ -96,9 +96,8 @@ int ft_add_rsvmap(struct ft_cxt *cxt, u64 physaddr, u64 size);
 
 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_device(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);
diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
index 4341e65..8d1debe 100644
--- a/arch/powerpc/boot/flatdevtree_misc.c
+++ b/arch/powerpc/boot/flatdevtree_misc.c
@@ -18,7 +18,7 @@ static struct ft_cxt cxt;
 
 static void *fdtm_finddevice(const char *name)
 {
-	return ft_find_device(&cxt, name);
+	return ft_find_device(&cxt, NULL, name);
 }
 
 static int fdtm_getprop(const void *phandle, const char *propname,
-- 
1.5.0.3

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

* [PATCH 2/9] bootwrapper: Add strtoull().
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
@ 2007-08-29 16:46 ` Scott Wood
  2007-08-30  0:30   ` David Gibson
  2007-08-30 15:52   ` Milton Miller
  2007-08-29 16:46 ` [PATCH 3/9] bootwrapper: Add get_path() Scott Wood
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:46 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

This will be needed by PlanetCore firmware support.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/Makefile |    2 +-
 arch/powerpc/boot/stdlib.c |   41 +++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/stdlib.h |    6 ++++++
 3 files changed, 48 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/stdlib.c
 create mode 100644 arch/powerpc/boot/stdlib.h

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index cd7c057..90c2f6d 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -45,7 +45,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
 		ns16550.c serial.c simple_alloc.c div64.S util.S \
 		gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
 		4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
-		cpm-serial.c
+		cpm-serial.c stdlib.c
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
 		cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
 		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c cuboot-pq2.c
diff --git a/arch/powerpc/boot/stdlib.c b/arch/powerpc/boot/stdlib.c
new file mode 100644
index 0000000..95877a0
--- /dev/null
+++ b/arch/powerpc/boot/stdlib.c
@@ -0,0 +1,41 @@
+/*
+ * stdlib functions
+ *
+ * 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 "stdlib.h"
+
+/* Not currently supported: leading whitespace, sign, 0x prefix, zero base */
+unsigned long long int strtoull(const char *ptr, char **end, int base)
+{
+	unsigned long long ret = 0;
+
+	while (*ptr) {
+		int digit;
+
+		if (*ptr >= '0' && *ptr <= '9' && *ptr < '0' + base)
+			digit = *ptr - '0';
+		else if (*ptr >= 'A' && *ptr < 'A' + base - 10)
+			digit = *ptr - 'A' + 10;
+		else if (*ptr >= 'a' && *ptr < 'z' + base - 10)
+			digit = *ptr - 'a' + 10;
+		else
+			break;
+
+		ret *= base;
+		ret += digit;
+		ptr++;
+	}
+
+	if (end)
+		*end = (char *)ptr;
+
+	return ret;
+}
diff --git a/arch/powerpc/boot/stdlib.h b/arch/powerpc/boot/stdlib.h
new file mode 100644
index 0000000..1bf01ac
--- /dev/null
+++ b/arch/powerpc/boot/stdlib.h
@@ -0,0 +1,6 @@
+#ifndef _PPC_BOOT_STDLIB_H_
+#define _PPC_BOOT_STDLIB_H_
+
+unsigned long long int strtoull(const char *ptr, char **end, int base);
+
+#endif
-- 
1.5.0.3

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

* [PATCH 3/9] bootwrapper: Add get_path().
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
  2007-08-29 16:46 ` [PATCH 2/9] bootwrapper: Add strtoull() Scott Wood
@ 2007-08-29 16:46 ` Scott Wood
  2007-08-30  0:30   ` David Gibson
  2007-08-29 16:47 ` [PATCH 4/9] bootwrapper: Move strncmp() from flatdevtree_env.h to string.S/string.h Scott Wood
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:46 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

This will be used by the PlanetCore firmware support to construct
a linux,stdout-path from the serial node that it finds.

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

diff --git a/arch/powerpc/boot/flatdevtree.c b/arch/powerpc/boot/flatdevtree.c
index 0af7291..cf30675 100644
--- a/arch/powerpc/boot/flatdevtree.c
+++ b/arch/powerpc/boot/flatdevtree.c
@@ -975,3 +975,62 @@ void *ft_create_node(struct ft_cxt *cxt, const void *parent, const char *name)
 	}
 	return NULL;
 }
+
+/* Returns the start of the path within the provided buffer, or NULL on
+ * error.
+ */
+char *ft_get_path(struct ft_cxt *cxt, const void *phandle,
+                  char *buf, int len)
+{
+	const char *path_comp[FT_MAX_DEPTH];
+	struct ft_atom atom;
+	char *p, *next, *pos;
+	int depth = 0, i;
+	void *node;
+
+	node = ft_node_ph2node(cxt, phandle);
+	if (node == NULL)
+		return NULL;
+
+	p = ft_root_node(cxt);
+
+	while ((next = ft_next(cxt, p, &atom)) != NULL) {
+		switch (atom.tag) {
+		case OF_DT_BEGIN_NODE:
+			path_comp[depth++] = atom.name;
+			if (p == node)
+				goto found;
+
+			break;
+
+		case OF_DT_END_NODE:
+			if (--depth == 0)
+				return NULL;
+		}
+
+		p = next;
+	}
+
+found:
+	pos = buf;
+	for (i = 1; i < depth; i++) {
+		int this_len;
+
+		if (len <= 1)
+			return NULL;
+
+		*pos++ = '/';
+		len--;
+
+		strncpy(pos, path_comp[i], len);
+
+		if (pos[len - 1] != 0)
+			return NULL;
+
+		this_len = strlen(pos);
+		len -= this_len;
+		pos += this_len;
+	}
+
+	return buf;
+}
diff --git a/arch/powerpc/boot/flatdevtree.h b/arch/powerpc/boot/flatdevtree.h
index 2c1c826..b0957a2 100644
--- a/arch/powerpc/boot/flatdevtree.h
+++ b/arch/powerpc/boot/flatdevtree.h
@@ -108,5 +108,6 @@ 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);
+char *ft_get_path(struct ft_cxt *cxt, const void *phandle, char *buf, int len);
 
 #endif /* FLATDEVTREE_H */
diff --git a/arch/powerpc/boot/flatdevtree_misc.c b/arch/powerpc/boot/flatdevtree_misc.c
index 8d1debe..b367009 100644
--- a/arch/powerpc/boot/flatdevtree_misc.c
+++ b/arch/powerpc/boot/flatdevtree_misc.c
@@ -58,6 +58,11 @@ static unsigned long fdtm_finalize(void)
 	return (unsigned long)cxt.bph;
 }
 
+static char *fdtm_get_path(const void *phandle, char *buf, int len)
+{
+	return ft_get_path(&cxt, phandle, buf, len);
+}
+
 int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device)
 {
 	dt_ops.finddevice = fdtm_finddevice;
@@ -67,6 +72,7 @@ int ft_init(void *dt_blob, unsigned int max_size, unsigned int max_find_device)
 	dt_ops.create_node = fdtm_create_node;
 	dt_ops.find_node_by_prop_value = fdtm_find_node_by_prop_value;
 	dt_ops.finalize = fdtm_finalize;
+	dt_ops.get_path = fdtm_get_path;
 
 	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 45c2268..703255b 100644
--- a/arch/powerpc/boot/ops.h
+++ b/arch/powerpc/boot/ops.h
@@ -47,6 +47,7 @@ struct dt_ops {
 	                                 const char *propname,
 	                                 const char *propval, int proplen);
 	unsigned long (*finalize)(void);
+	char *(*get_path)(const void *phandle, char *buf, int len);
 };
 extern struct dt_ops dt_ops;
 
@@ -170,6 +171,14 @@ static inline void *find_node_by_linuxphandle(const u32 linuxphandle)
 			(char *)&linuxphandle, sizeof(u32));
 }
 
+static inline char *get_path(const void *phandle, char *buf, int len)
+{
+	if (dt_ops.get_path)
+		return dt_ops.get_path(phandle, buf, len);
+
+	return NULL;
+}
+
 static inline void *malloc(unsigned long size)
 {
 	return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL;
-- 
1.5.0.3

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

* [PATCH 4/9] bootwrapper: Move strncmp() from flatdevtree_env.h to string.S/string.h.
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
  2007-08-29 16:46 ` [PATCH 2/9] bootwrapper: Add strtoull() Scott Wood
  2007-08-29 16:46 ` [PATCH 3/9] bootwrapper: Add get_path() Scott Wood
@ 2007-08-29 16:47 ` Scott Wood
  2007-08-30  0:31   ` David Gibson
  2007-08-29 16:47 ` [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target Scott Wood
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

It will be needed for PlanetCore firmware support.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
I prepared this patch before David posted his patch which also
does strstr; if you apply that one, then please ignore this one.

 arch/powerpc/boot/flatdevtree_env.h |   14 +-------------
 arch/powerpc/boot/string.S          |   13 +++++++++++++
 arch/powerpc/boot/string.h          |    1 +
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/boot/flatdevtree_env.h b/arch/powerpc/boot/flatdevtree_env.h
index 83bc1c7..643bf7f 100644
--- a/arch/powerpc/boot/flatdevtree_env.h
+++ b/arch/powerpc/boot/flatdevtree_env.h
@@ -2,7 +2,7 @@
  * This file adds the header file glue so that the shared files
  * flatdevicetree.[ch] can compile and work in the powerpc bootwrapper.
  *
- * strncmp & strchr copied from <file:lib/strings.c>
+ * strchr copied from <file:lib/strings.c>
  * Copyright (C) 1991, 1992  Linus Torvalds
  *
  * Maintained by: Mark A. Greer <mgreer@mvista.com>
@@ -24,18 +24,6 @@
 #define be64_to_cpu(x)		(x)
 #define cpu_to_be64(x)		(x)
 
-static inline int strncmp(const char *cs, const char *ct, size_t count)
-{
-	signed char __res = 0;
-
-	while (count) {
-		if ((__res = *cs - *ct++) != 0 || !*cs++)
-			break;
-		count--;
-	}
-	return __res;
-}
-
 static inline char *strchr(const char *s, int c)
 {
 	for (; *s != (char)c; ++s)
diff --git a/arch/powerpc/boot/string.S b/arch/powerpc/boot/string.S
index ac3d43b..ce68c58 100644
--- a/arch/powerpc/boot/string.S
+++ b/arch/powerpc/boot/string.S
@@ -61,6 +61,19 @@ strcmp:
 	beq	1b
 	blr
 
+	.globl strncmp
+strncmp:
+	mtctr	r5
+	addi	r5,r3,-1
+	addi	r4,r4,-1
+1:	lbzu	r3,1(r5)
+	cmpwi	1,r3,0
+	lbzu	r0,1(r4)
+	subf.	r3,r0,r3
+	beqlr	1
+	bdnzt	2, 1b
+	blr
+
 	.globl	strlen
 strlen:
 	addi	r4,r3,-1
diff --git a/arch/powerpc/boot/string.h b/arch/powerpc/boot/string.h
index 9fdff1c..db401b7 100644
--- a/arch/powerpc/boot/string.h
+++ b/arch/powerpc/boot/string.h
@@ -6,6 +6,7 @@ extern char *strcpy(char *dest, const char *src);
 extern char *strncpy(char *dest, const char *src, size_t n);
 extern char *strcat(char *dest, const char *src);
 extern int strcmp(const char *s1, const char *s2);
+extern int strncmp(const char *s1, const char *s2, size_t n);
 extern size_t strlen(const char *s);
 extern size_t strnlen(const char *s, size_t count);
 
-- 
1.5.0.3

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

* [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target.
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
                   ` (2 preceding siblings ...)
  2007-08-29 16:47 ` [PATCH 4/9] bootwrapper: Move strncmp() from flatdevtree_env.h to string.S/string.h Scott Wood
@ 2007-08-29 16:47 ` Scott Wood
  2007-08-30  0:34   ` David Gibson
  2007-08-29 16:47 ` [PATCH 7/9] bootwrapper: Only print MAC addresses when the node is actually present Scott Wood
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

This target produces a flat binary rather than an ELF file,
and fixes the entry point at the beginning of the image.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/Makefile     |    8 ++++++--
 arch/powerpc/boot/fixed-head.S |    4 ++++
 arch/powerpc/boot/wrapper      |   18 ++++++++++++++++++
 3 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/boot/fixed-head.S

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 02f0fe0..27f5772 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -48,7 +48,8 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
 		cpm-serial.c stdlib.c planetcore.c
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
 		cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
-		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c cuboot-pq2.c
+		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c \
+		cuboot-8xx.c cuboot-pq2.c fixed-head.S
 src-boot := $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -124,7 +125,7 @@ endif
 # args (to if_changed): 1 = (this rule), 2 = platform, 3 = dts 4=dtb 5=initrd
 quiet_cmd_wrap	= WRAP    $@
       cmd_wrap	=$(CONFIG_SHELL) $(wrapper) -c -o $@ -p $2 $(CROSSWRAP) \
-		$(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) vmlinux
+		$(if $3, -s $3)$(if $4, -d $4)$(if $5, -i $5) $6 vmlinux
 
 image-$(CONFIG_PPC_PSERIES)		+= zImage.pseries
 image-$(CONFIG_PPC_MAPLE)		+= zImage.pseries
@@ -178,6 +179,9 @@ endif
 $(obj)/zImage.initrd.%: vmlinux $(wrapperbits) $(dts)
 	$(call if_changed,wrap,$*,$(dts),,$(obj)/ramdisk.image.gz)
 
+$(obj)/zImage.bin.%: vmlinux $(wrapperbits) $(dts)
+	$(call if_changed,wrap,$*,$(dts),,,--binary --fixed-entry)
+
 $(obj)/zImage.%: vmlinux $(wrapperbits) $(dts)
 	$(call if_changed,wrap,$*,$(dts))
 
diff --git a/arch/powerpc/boot/fixed-head.S b/arch/powerpc/boot/fixed-head.S
new file mode 100644
index 0000000..8e14cd9
--- /dev/null
+++ b/arch/powerpc/boot/fixed-head.S
@@ -0,0 +1,4 @@
+	.text
+	.global _zimage_start
+_zimage_start:
+	b	_zimage_start_lib
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 65f6854..4d549cc 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -30,6 +30,8 @@ dtb=
 dts=
 cacheit=
 gzip=.gz
+binary=
+fixedentry=
 
 # cross-compilation prefix
 CROSS=
@@ -44,6 +46,7 @@ usage() {
     echo 'Usage: wrapper [-o output] [-p platform] [-i initrd]' >&2
     echo '       [-d devtree] [-s tree.dts] [-c] [-C cross-prefix]' >&2
     echo '       [-D datadir] [-W workingdir] [--no-gzip] [vmlinux]' >&2
+    echo '       [--binary] [--fixed-entry]' >&2
     exit 1
 }
 
@@ -95,6 +98,12 @@ while [ "$#" -gt 0 ]; do
     --no-gzip)
         gzip=
         ;;
+    --binary)
+        binary=y
+        ;;
+    --fixed-entry)
+        fixedentry=y
+        ;;
     -?)
 	usage
 	;;
@@ -214,6 +223,10 @@ if [ -n "$dtb" ]; then
     fi
 fi
 
+if [ -n "$fixedentry" ]; then
+	platformo="$object/fixed-head.o $platformo"
+fi
+
 if [ "$platform" != "miboot" ]; then
     ${CROSS}ld -m elf32ppc -T $lds -o "$ofile" \
 	$platformo $tmp $object/wrapper.a
@@ -295,3 +308,8 @@ ps3)
     gzip --force -9 --stdout "$ofile.bin" > "$object/otheros.bld"
     ;;
 esac
+
+if [ -n "$binary" ]; then
+    mv "$ofile" "$ofile".elf
+    ${CROSS}objcopy -O binary "$ofile".elf "$ofile"
+fi
-- 
1.5.0.3

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

* [PATCH 7/9] bootwrapper: Only print MAC addresses when the node is actually present.
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
                   ` (3 preceding siblings ...)
  2007-08-29 16:47 ` [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target Scott Wood
@ 2007-08-29 16:47 ` Scott Wood
  2007-08-30  0:34   ` David Gibson
  2007-08-29 16:47 ` [PATCH 8/9] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions Scott Wood
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Some firmwares (such as PlanetCore) only provide a base MAC address, and
expect the kernel to set certain bits to generate the addresses for the
other ports.  As such, MAC addresses are generated that may not correspond
to actual hardware.

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

diff --git a/arch/powerpc/boot/devtree.c b/arch/powerpc/boot/devtree.c
index e1b8122..549463b 100644
--- a/arch/powerpc/boot/devtree.c
+++ b/arch/powerpc/boot/devtree.c
@@ -100,12 +100,14 @@ void __dt_fixup_mac_addresses(u32 startindex, ...)
 		devp = find_node_by_prop_value(NULL, "linux,network-index",
 					       (void*)&index, sizeof(index));
 
-		printf("ENET%d: local-mac-address <-"
-		       " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
-		       addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
+		if (devp) {
+			printf("ENET%d: local-mac-address <-"
+			       " %02x:%02x:%02x:%02x:%02x:%02x\n\r", index,
+			       addr[0], addr[1], addr[2],
+			       addr[3], addr[4], addr[5]);
 
-		if (devp)
 			setprop(devp, "local-mac-address", addr, 6);
+		}
 
 		index++;
 	}
-- 
1.5.0.3

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

* [PATCH 8/9] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions.
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
                   ` (4 preceding siblings ...)
  2007-08-29 16:47 ` [PATCH 7/9] bootwrapper: Only print MAC addresses when the node is actually present Scott Wood
@ 2007-08-29 16:47 ` Scott Wood
  2007-08-29 16:47 ` [PATCH 9/9] bootwrapper: Use fsl_get_immr() in cuboot-pq2.c Scott Wood
  2007-08-30  0:28 ` [PATCH 1/9] bootwrapper: flatdevtree fixes David Gibson
  7 siblings, 0 replies; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

fsl_get_immr() is equivalent to the kernel's get_immrbase() function.

mpc885_get_clock() transforms a crystal frequency into a system frequency
according to the PLL register settings.

pq2_get_clocks() does the same as the above for the PowerQUICC II,
except that it produces several different clocks.

The mpc8xx/pq2 set_clocks() functions modify common properties in
the device tree based on the given clock data.

The mpc885/pq2 fixup_clocks() functions call get_clocks(), and
pass the results to set_clocks().

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 arch/powerpc/boot/Makefile  |    2 +-
 arch/powerpc/boot/fsl-soc.c |   47 ++++++++++++++++++++
 arch/powerpc/boot/fsl-soc.h |    8 +++
 arch/powerpc/boot/mpc8xx.c  |   80 ++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/mpc8xx.h  |   11 +++++
 arch/powerpc/boot/pq2.c     |  100 +++++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/pq2.h     |   11 +++++
 7 files changed, 258 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/fsl-soc.c
 create mode 100644 arch/powerpc/boot/fsl-soc.h
 create mode 100644 arch/powerpc/boot/mpc8xx.c
 create mode 100644 arch/powerpc/boot/mpc8xx.h
 create mode 100644 arch/powerpc/boot/pq2.c
 create mode 100644 arch/powerpc/boot/pq2.h

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 27f5772..d96b06a 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -45,7 +45,7 @@ src-wlib := string.S crt0.S stdio.c main.c flatdevtree.c flatdevtree_misc.c \
 		ns16550.c serial.c simple_alloc.c div64.S util.S \
 		gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
 		4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
-		cpm-serial.c stdlib.c planetcore.c
+		cpm-serial.c stdlib.c planetcore.c fsl-soc.c mpc8xx.c pq2.c
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
 		cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
 		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c \
diff --git a/arch/powerpc/boot/fsl-soc.c b/arch/powerpc/boot/fsl-soc.c
new file mode 100644
index 0000000..e86a1fa
--- /dev/null
+++ b/arch/powerpc/boot/fsl-soc.c
@@ -0,0 +1,47 @@
+/*
+ * Freescale SOC support functions
+ *
+ * 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 "types.h"
+#include "fsl-soc.h"
+#include "stdio.h"
+
+static u32 prop_buf[MAX_PROP_LEN / 4];
+
+u32 *fsl_get_immr(void)
+{
+	void *soc;
+	unsigned long ret;
+
+	soc = find_node_by_devtype(NULL, "soc");
+	if (soc) {
+		int size;
+		u32 naddr;
+
+		size = getprop(soc, "#address-cells", prop_buf, MAX_PROP_LEN);
+		if (size == 4)
+			naddr = prop_buf[0];
+		else
+			naddr = 2;
+
+		size = getprop(soc, "ranges", prop_buf, MAX_PROP_LEN);
+		if (size >= 12) {
+			if (!dt_xlate_addr(soc, prop_buf + naddr, 8, &ret)) {
+				printf("fsl_get_immr: Can't xlate %x\r\n",
+				       prop_buf[naddr]);
+				ret = 0;
+			}
+		}
+	} else printf("fsl_get_immr: No SOC node\r\n");
+
+	return (u32 *)ret;
+}
diff --git a/arch/powerpc/boot/fsl-soc.h b/arch/powerpc/boot/fsl-soc.h
new file mode 100644
index 0000000..5da26fc
--- /dev/null
+++ b/arch/powerpc/boot/fsl-soc.h
@@ -0,0 +1,8 @@
+#ifndef _PPC_BOOT_FSL_SOC_H_
+#define _PPC_BOOT_FSL_SOC_H_
+
+#include "types.h"
+
+u32 *fsl_get_immr(void);
+
+#endif
diff --git a/arch/powerpc/boot/mpc8xx.c b/arch/powerpc/boot/mpc8xx.c
new file mode 100644
index 0000000..652e581
--- /dev/null
+++ b/arch/powerpc/boot/mpc8xx.c
@@ -0,0 +1,80 @@
+/*
+ * MPC8xx support functions
+ *
+ * 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 "types.h"
+#include "fsl-soc.h"
+#include "mpc8xx.h"
+#include "stdio.h"
+#include "io.h"
+
+#define MPC8XX_PLPRCR (0x284/4) /* PLL and Reset Control Register */
+
+/* Return system clock from crystal frequency */
+u32 mpc885_get_clock(u32 crystal)
+{
+	u32 *immr;
+	u32 plprcr;
+	int mfi, mfn, mfd, pdf, div;
+	u32 ret;
+
+	immr = fsl_get_immr();
+	if (!immr) {
+		printf("mpc885_get_clock: Couldn't get IMMR base.\r\n");
+		return 0;
+	}
+
+	plprcr = in_be32(&immr[MPC8XX_PLPRCR]);
+
+	mfi = (plprcr >> 16) & 15;
+	if (mfi < 5) {
+		printf("Warning: PLPRCR[MFI] value of %d out-of-bounds\r\n",
+		       mfi);
+		mfi = 5;
+	}
+
+	pdf = (plprcr >> 1) & 0xf;
+	div = (plprcr >> 20) & 3;
+	mfd = (plprcr >> 22) & 0x1f;
+	mfn = (plprcr >> 27) & 0x1f;
+
+	ret = crystal * mfi;
+
+	if (mfn != 0)
+		ret += crystal * mfn / (mfd + 1);
+
+	return ret / (pdf + 1);
+}
+
+/* Set common device tree fields based on the given clock frequencies. */
+void mpc8xx_set_clocks(u32 sysclk)
+{
+	void *node;
+
+	dt_fixup_cpu_clocks(sysclk, sysclk / 16, sysclk);
+
+	node = finddevice("/soc/cpm");
+	if (node) {
+		setprop(node, "clock-frequency", &sysclk, 4);
+		setprop(node, "fsl,brg-frequency", &sysclk, 4);
+	}
+}
+
+int mpc885_fixup_clocks(u32 crystal)
+{
+	u32 sysclk = mpc885_get_clock(crystal);
+	if (!sysclk)
+		return 0;
+
+	mpc8xx_set_clocks(sysclk);
+	return 1;
+}
diff --git a/arch/powerpc/boot/mpc8xx.h b/arch/powerpc/boot/mpc8xx.h
new file mode 100644
index 0000000..3f59901
--- /dev/null
+++ b/arch/powerpc/boot/mpc8xx.h
@@ -0,0 +1,11 @@
+#ifndef _PPC_BOOT_MPC8xx_H_
+#define _PPC_BOOT_MPC8xx_H_
+
+#include "types.h"
+
+void mpc8xx_set_clocks(u32 sysclk);
+
+u32 mpc885_get_clock(u32 crystal);
+int mpc885_fixup_clocks(u32 crystal);
+
+#endif
diff --git a/arch/powerpc/boot/pq2.c b/arch/powerpc/boot/pq2.c
new file mode 100644
index 0000000..7ef5c91
--- /dev/null
+++ b/arch/powerpc/boot/pq2.c
@@ -0,0 +1,100 @@
+/*
+ * PowerQUICC II support functions
+ *
+ * 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 "types.h"
+#include "fsl-soc.h"
+#include "pq2.h"
+#include "stdio.h"
+#include "io.h"
+
+#define PQ2_SCCR (0x10c80/4) /* System Clock Configuration Register */
+#define PQ2_SCMR (0x10c88/4) /* System Clock Mode Register */
+
+static int pq2_corecnf_map[] = {
+	3, 2, 2, 2, 4, 4, 5, 9, 6, 11, 8, 10, 3, 12, 7, -1,
+	6, 5, 13, 2, 14, 4, 15, 9, 0, 11, 8, 10, 16, 12, 7, -1
+};
+
+/* Get various clocks from crystal frequency.
+ * Returns zero on failure and non-zero on success.
+ */
+int pq2_get_clocks(u32 crystal, u32 *sysfreq, u32 *corefreq,
+                   u32 *timebase, u32 *brgfreq)
+{
+	u32 *immr;
+	u32 sccr, scmr, mainclk, busclk;
+	int corecnf, busdf, plldf, pllmf, dfbrg;
+
+	immr = fsl_get_immr();
+	if (!immr) {
+		printf("pq2_get_clocks: Couldn't get IMMR base.\r\n");
+		return 0;
+	}
+
+	sccr = in_be32(&immr[PQ2_SCCR]);
+	scmr = in_be32(&immr[PQ2_SCMR]);
+
+	dfbrg = sccr & 3;
+	corecnf = (scmr >> 24) & 0x1f;
+	busdf = (scmr >> 20) & 0xf;
+	plldf = (scmr >> 12) & 1;
+	pllmf = scmr & 0xfff;
+
+	mainclk = crystal * (pllmf + 1) / (plldf + 1);
+	busclk = mainclk / (busdf + 1);
+
+	if (sysfreq)
+		*sysfreq = mainclk / 2;
+	if (timebase)
+		*timebase = busclk / 4;
+	if (brgfreq)
+		*brgfreq = mainclk / (1 << ((dfbrg + 1) * 2));
+
+	if (corefreq) {
+		int coremult = pq2_corecnf_map[corecnf];
+
+		if (coremult < 0)
+			*corefreq = mainclk / 2;
+		else if (coremult == 0)
+			return 0;
+		else
+			*corefreq = busclk * coremult / 2;
+	}
+
+	return 1;
+}
+
+/* Set common device tree fields based on the given clock frequencies. */
+void pq2_set_clocks(u32 sysfreq, u32 corefreq, u32 timebase, u32 brgfreq)
+{
+	void *node;
+
+	dt_fixup_cpu_clocks(corefreq, timebase, sysfreq);
+
+	node = finddevice("/soc/cpm");
+	if (node) {
+		setprop(node, "clock-frequency", &sysfreq, 4);
+		setprop(node, "fsl,brg-frequency", &brgfreq, 4);
+	}
+}
+
+int pq2_fixup_clocks(u32 crystal)
+{
+	u32 sysfreq, corefreq, timebase, brgfreq;
+
+	if (pq2_get_clocks(crystal, &sysfreq, &corefreq, &timebase, &brgfreq))
+		return 0;
+
+	pq2_set_clocks(sysfreq, corefreq, timebase, brgfreq);
+	return 1;
+}
diff --git a/arch/powerpc/boot/pq2.h b/arch/powerpc/boot/pq2.h
new file mode 100644
index 0000000..481698c
--- /dev/null
+++ b/arch/powerpc/boot/pq2.h
@@ -0,0 +1,11 @@
+#ifndef _PPC_BOOT_PQ2_H_
+#define _PPC_BOOT_PQ2_H_
+
+#include "types.h"
+
+int pq2_get_clocks(u32 crystal, u32 *sysfreq, u32 *corefreq,
+                   u32 *timebase, u32 *brgfreq);
+void pq2_set_clocks(u32 sysfreq, u32 corefreq, u32 timebase, u32 brgfreq);
+int pq2_fixup_clocks(u32 crystal);
+
+#endif
-- 
1.5.0.3

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

* [PATCH 9/9] bootwrapper: Use fsl_get_immr() in cuboot-pq2.c.
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
                   ` (5 preceding siblings ...)
  2007-08-29 16:47 ` [PATCH 8/9] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions Scott Wood
@ 2007-08-29 16:47 ` Scott Wood
  2007-08-30  0:28 ` [PATCH 1/9] bootwrapper: flatdevtree fixes David Gibson
  7 siblings, 0 replies; 18+ messages in thread
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

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

diff --git a/arch/powerpc/boot/cuboot-pq2.c b/arch/powerpc/boot/cuboot-pq2.c
index 8021fd4..9d12ddd 100644
--- a/arch/powerpc/boot/cuboot-pq2.c
+++ b/arch/powerpc/boot/cuboot-pq2.c
@@ -15,6 +15,7 @@
 #include "stdio.h"
 #include "cuboot.h"
 #include "io.h"
+#include "fsl-soc.h"
 
 #define TARGET_CPM2
 #define TARGET_HAS_ETH1
@@ -139,23 +140,20 @@ static void fixup_pci(void)
 	u32 *pci_regs[3];
 	u8 *soc_regs;
 	int i, len;
-	void *ctrl_node, *bus_node, *parent_node, *soc_node;
+	void *ctrl_node, *bus_node, *parent_node;
 	u32 naddr, nsize, bus_ph, mem_log2;
 
 	ctrl_node = finddevice("/soc/pci");
 	if (!ctrl_node || !dt_is_compatible(ctrl_node, "fsl,pq2-pci"))
 		return;
 
-	soc_node = finddevice("/soc");
-	if (!soc_node || !dt_is_compatible(soc_node, "fsl,pq2-soc"))
-		goto err;
-
 	for (i = 0; i < 3; i++)
 		if (!dt_xlate_reg(ctrl_node, i,
 		                  (unsigned long *)&pci_regs[i], NULL))
 			goto err;
 
-	if (!dt_xlate_reg(soc_node, 0, (unsigned long *)&soc_regs, NULL))
+	soc_regs = (u8 *)fsl_get_immr();
+	if (!soc_regs)
 		goto err;
 
 	len = getprop(ctrl_node, "fsl,bus", &bus_ph, 4);
-- 
1.5.0.3

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

* Re: [PATCH 1/9] bootwrapper: flatdevtree fixes
  2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
                   ` (6 preceding siblings ...)
  2007-08-29 16:47 ` [PATCH 9/9] bootwrapper: Use fsl_get_immr() in cuboot-pq2.c Scott Wood
@ 2007-08-30  0:28 ` David Gibson
  7 siblings, 0 replies; 18+ messages in thread
From: David Gibson @ 2007-08-30  0:28 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Aug 29, 2007 at 11:45:34AM -0500, Scott Wood wrote:
> 1. ft_create_node was returning the internal pointer rather than a phandle.
> 2. ft_find_device_rel was treating a "top" phandle of NULL as an error,
> rather than as the root of the tree.  The old, absolute ft_find_device
> is removed, and the relative version is renamed to ft_find_device().
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Seemes reasonable, though I'm still working on obsoleting
flatdevtree.c entirely.

Acked-by: David Gibson <david@gibson.dropbear.id.au>

-- 
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] 18+ messages in thread

* Re: [PATCH 2/9] bootwrapper: Add strtoull().
  2007-08-29 16:46 ` [PATCH 2/9] bootwrapper: Add strtoull() Scott Wood
@ 2007-08-30  0:30   ` David Gibson
  2007-08-30 15:52   ` Milton Miller
  1 sibling, 0 replies; 18+ messages in thread
From: David Gibson @ 2007-08-30  0:30 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Aug 29, 2007 at 11:46:38AM -0500, Scott Wood wrote:
> This will be needed by PlanetCore firmware support.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

-- 
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] 18+ messages in thread

* Re: [PATCH 3/9] bootwrapper: Add get_path().
  2007-08-29 16:46 ` [PATCH 3/9] bootwrapper: Add get_path() Scott Wood
@ 2007-08-30  0:30   ` David Gibson
  0 siblings, 0 replies; 18+ messages in thread
From: David Gibson @ 2007-08-30  0:30 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Aug 29, 2007 at 11:46:40AM -0500, Scott Wood wrote:
> This will be used by the PlanetCore firmware support to construct
> a linux,stdout-path from the serial node that it finds.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>

Heh, I was just implementing an equivalent function in libfdt
yesterday.

-- 
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] 18+ messages in thread

* Re: [PATCH 4/9] bootwrapper: Move strncmp() from flatdevtree_env.h to string.S/string.h.
  2007-08-29 16:47 ` [PATCH 4/9] bootwrapper: Move strncmp() from flatdevtree_env.h to string.S/string.h Scott Wood
@ 2007-08-30  0:31   ` David Gibson
  0 siblings, 0 replies; 18+ messages in thread
From: David Gibson @ 2007-08-30  0:31 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Aug 29, 2007 at 11:47:35AM -0500, Scott Wood wrote:
> It will be needed for PlanetCore firmware support.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>

This one is obsoleted by my recent patch which moves both strncmp()
and strchr() to string.S.

-- 
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] 18+ messages in thread

* Re: [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target.
  2007-08-29 16:47 ` [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target Scott Wood
@ 2007-08-30  0:34   ` David Gibson
  2007-08-30 14:21     ` Scott Wood
  0 siblings, 1 reply; 18+ messages in thread
From: David Gibson @ 2007-08-30  0:34 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Aug 29, 2007 at 11:47:41AM -0500, Scott Wood wrote:
> This target produces a flat binary rather than an ELF file,
> and fixes the entry point at the beginning of the image.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Hrm.. I think the --binary option at least should be removed, and
subsumed into the platform id - all other binary formats are selected
by the platform name at present.

And I think it's probably best to do that for --fixed-entry as well,
although it's a bit less clear there.

-- 
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] 18+ messages in thread

* Re: [PATCH 7/9] bootwrapper: Only print MAC addresses when the node is actually present.
  2007-08-29 16:47 ` [PATCH 7/9] bootwrapper: Only print MAC addresses when the node is actually present Scott Wood
@ 2007-08-30  0:34   ` David Gibson
  0 siblings, 0 replies; 18+ messages in thread
From: David Gibson @ 2007-08-30  0:34 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Wed, Aug 29, 2007 at 11:47:43AM -0500, Scott Wood wrote:
> Some firmwares (such as PlanetCore) only provide a base MAC address, and
> expect the kernel to set certain bits to generate the addresses for the
> other ports.  As such, MAC addresses are generated that may not correspond
> to actual hardware.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Acked-by: David Gibson <david@gibson.dropbear.id.au>

-- 
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] 18+ messages in thread

* Re: [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target.
  2007-08-30  0:34   ` David Gibson
@ 2007-08-30 14:21     ` Scott Wood
  2007-08-31  3:24       ` David Gibson
  0 siblings, 1 reply; 18+ messages in thread
From: Scott Wood @ 2007-08-30 14:21 UTC (permalink / raw)
  To: paulus, linuxppc-dev

On Thu, Aug 30, 2007 at 10:34:09AM +1000, David Gibson wrote:
> Hrm.. I think the --binary option at least should be removed, and
> subsumed into the platform id - all other binary formats are selected
> by the platform name at present.
> 
> And I think it's probably best to do that for --fixed-entry as well,
> although it's a bit less clear there.

I'm not particularly fond of having huge platform switch blocks in the
wrapper script -- if it can be reasonably parameterized, why not do so?

-Scott

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

* Re: [PATCH 2/9] bootwrapper: Add strtoull().
  2007-08-29 16:46 ` [PATCH 2/9] bootwrapper: Add strtoull() Scott Wood
  2007-08-30  0:30   ` David Gibson
@ 2007-08-30 15:52   ` Milton Miller
  2007-08-30 16:16     ` Scott Wood
  1 sibling, 1 reply; 18+ messages in thread
From: Milton Miller @ 2007-08-30 15:52 UTC (permalink / raw)
  To: Scott Wood; +Cc: ppcdev

On Thu Aug 30 02:46:38 EST 2007, Scott Wood wrote:

> +               if (*ptr >= '0' && *ptr <= '9' && *ptr < '0' + base)
> +                       digit = *ptr - '0';
> +               else if (*ptr >= 'A' && *ptr < 'A' + base - 10)
> +                       digit = *ptr - 'A' + 10;
> +               else if (*ptr >= 'a' && *ptr < 'z' + base - 10)
> +                       digit = *ptr - 'a' + 10;
> +               else
> +                       break;

'z' should also be 'a' like the 'A' case.

Should we add <= 'Z' like we do '9', or do we not care about bases > 
36?  (It really breaks above base 42).

milton

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

* Re: [PATCH 2/9] bootwrapper: Add strtoull().
  2007-08-30 15:52   ` Milton Miller
@ 2007-08-30 16:16     ` Scott Wood
  0 siblings, 0 replies; 18+ messages in thread
From: Scott Wood @ 2007-08-30 16:16 UTC (permalink / raw)
  To: Milton Miller; +Cc: ppcdev

On Thu, Aug 30, 2007 at 10:52:22AM -0500, Milton Miller wrote:
> On Thu Aug 30 02:46:38 EST 2007, Scott Wood wrote:
> 
> >+               if (*ptr >= '0' && *ptr <= '9' && *ptr < '0' + base)
> >+                       digit = *ptr - '0';
> >+               else if (*ptr >= 'A' && *ptr < 'A' + base - 10)
> >+                       digit = *ptr - 'A' + 10;
> >+               else if (*ptr >= 'a' && *ptr < 'z' + base - 10)
> >+                       digit = *ptr - 'a' + 10;
> >+               else
> >+                       break;
> 
> 'z' should also be 'a' like the 'A' case.

Oops.

> Should we add <= 'Z' like we do '9', or do we not care about bases > 
> 36?  (It really breaks above base 42).

I personally don't care about bases > 16; I only supported up to 36
because it was easy to do so.

-Scott

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

* Re: [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target.
  2007-08-30 14:21     ` Scott Wood
@ 2007-08-31  3:24       ` David Gibson
  0 siblings, 0 replies; 18+ messages in thread
From: David Gibson @ 2007-08-31  3:24 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, paulus

On Thu, Aug 30, 2007 at 09:21:15AM -0500, Scott Wood wrote:
> On Thu, Aug 30, 2007 at 10:34:09AM +1000, David Gibson wrote:
> > Hrm.. I think the --binary option at least should be removed, and
> > subsumed into the platform id - all other binary formats are selected
> > by the platform name at present.
> > 
> > And I think it's probably best to do that for --fixed-entry as well,
> > although it's a bit less clear there.
> 
> I'm not particularly fond of having huge platform switch blocks in the
> wrapper script -- if it can be reasonably parameterized, why not do so?

Because I'd prefer to keep as much of the per-platform details (what
binary format is needed and so forth) concentrated in wrapper, rather
than scattered across multiple places.  I agree we're not really doing
it the best way - I had some ideas for a nicer way to rewrite wrapper,
but I haven't had a chance to implement it yet.

-- 
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] 18+ messages in thread

end of thread, other threads:[~2007-08-31  3:24 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-29 16:45 [PATCH 1/9] bootwrapper: flatdevtree fixes Scott Wood
2007-08-29 16:46 ` [PATCH 2/9] bootwrapper: Add strtoull() Scott Wood
2007-08-30  0:30   ` David Gibson
2007-08-30 15:52   ` Milton Miller
2007-08-30 16:16     ` Scott Wood
2007-08-29 16:46 ` [PATCH 3/9] bootwrapper: Add get_path() Scott Wood
2007-08-30  0:30   ` David Gibson
2007-08-29 16:47 ` [PATCH 4/9] bootwrapper: Move strncmp() from flatdevtree_env.h to string.S/string.h Scott Wood
2007-08-30  0:31   ` David Gibson
2007-08-29 16:47 ` [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target Scott Wood
2007-08-30  0:34   ` David Gibson
2007-08-30 14:21     ` Scott Wood
2007-08-31  3:24       ` David Gibson
2007-08-29 16:47 ` [PATCH 7/9] bootwrapper: Only print MAC addresses when the node is actually present Scott Wood
2007-08-30  0:34   ` David Gibson
2007-08-29 16:47 ` [PATCH 8/9] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions Scott Wood
2007-08-29 16:47 ` [PATCH 9/9] bootwrapper: Use fsl_get_immr() in cuboot-pq2.c Scott Wood
2007-08-30  0:28 ` [PATCH 1/9] bootwrapper: flatdevtree fixes David Gibson

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