* 2.6 kernel hangs after loading device tree
From: charanya venkatraman @ 2007-08-29 16:38 UTC (permalink / raw)
To: Linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 1064 bytes --]
Hi all
Sorry about the previous mail.Got sent by mistake.
Iam using the 2.6.22.5 kernel on MPC 8560 and MPC8540 on my custom
board.Mykernel hangs after loading the device tree in both the
processors .There is
no output on the serial port after loading the device tree.Am using U-boot
1.2.0 as the bootloader.After enabling debug in u-boot i could see that the
control is getting transferred to the kernel after which it hangs.Earlier i
tried using 2.6.21 which also hangs at the same point.The config files used
were MPC8540ADS_defconfig and MPC8560ADS_defconfig under powerpc directory.
The changes that were made to the device tree are:
1.The reg and ranges properties of the soc node have been changed to account
for the change in CCSRBAR of my board.
2.Removed the PCI,mdio nodes and ethernet nodes since i dont need support
for these as of now.
I have tried the following console arguments:
MPC8540: bootargs root=/dev/ram rw console=ttyS0,115200
MPC8560:bootargs root=/dev/ram rw console=ttyCPM0,115200
Any help on this issue??
Thanks.
Charanya.
[-- Attachment #2: Type: text/html, Size: 1191 bytes --]
^ permalink raw reply
* [PATCH 1/9] bootwrapper: flatdevtree fixes
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
* [PATCH 2/9] bootwrapper: Add strtoull().
From: Scott Wood @ 2007-08-29 16:46 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20070829164534.GA31585@ld0162-tx32.am.freescale.net>
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
* [PATCH 3/9] bootwrapper: Add get_path().
From: Scott Wood @ 2007-08-29 16:46 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20070829164534.GA31585@ld0162-tx32.am.freescale.net>
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
* [PATCH 7/9] bootwrapper: Only print MAC addresses when the node is actually present.
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20070829164534.GA31585@ld0162-tx32.am.freescale.net>
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
* [PATCH 4/9] bootwrapper: Move strncmp() from flatdevtree_env.h to string.S/string.h.
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20070829164534.GA31585@ld0162-tx32.am.freescale.net>
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
* [PATCH 6/9] bootwrapper: Add a zImage.bin.<platform> target.
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20070829164534.GA31585@ld0162-tx32.am.freescale.net>
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
* [PATCH 8/9] bootwrapper: Add fsl_get_immr() and 8xx/pq2 clock functions.
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20070829164534.GA31585@ld0162-tx32.am.freescale.net>
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
* [PATCH 9/9] bootwrapper: Use fsl_get_immr() in cuboot-pq2.c.
From: Scott Wood @ 2007-08-29 16:47 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20070829164534.GA31585@ld0162-tx32.am.freescale.net>
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
* [PATCH] Fix CPM1 uart console
From: Jochen Friedrich @ 2007-08-29 17:04 UTC (permalink / raw)
To: Linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 646 bytes --]
The powerpc version of commproc.c doesn't export cpm_dpram_phys due to
a typo. The ppc version of cpm_dpram_addr returns a usable virtual address
mapped to a physical address at the same location. cpm_dpram_phys returns
complete garbage as it tries to calculate an offset based on an otherwise
unused virtual adress returned by ioremap.
This patch fixes the typo for powerpc and removes the unnecessary ioremap
and corresponding virtual address for ppc.
Signed-off-by: Jochen Friedrich <jochen@scram.de>
---
arch/powerpc/sysdev/commproc.c | 2 +-
arch/ppc/8xx_io/commproc.c | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
[-- Attachment #2: 60d3d5feb1e51a5c0d839c4b7b2b683b82b43fee.diff --]
[-- Type: text/x-patch, Size: 1161 bytes --]
diff --git a/arch/powerpc/sysdev/commproc.c b/arch/powerpc/sysdev/commproc.c
index 4f67b89..dd5417a 100644
--- a/arch/powerpc/sysdev/commproc.c
+++ b/arch/powerpc/sysdev/commproc.c
@@ -395,4 +395,4 @@ uint cpm_dpram_phys(u8* addr)
{
return (dpram_pbase + (uint)(addr - dpram_vbase));
}
-EXPORT_SYMBOL(cpm_dpram_addr);
+EXPORT_SYMBOL(cpm_dpram_phys);
diff --git a/arch/ppc/8xx_io/commproc.c b/arch/ppc/8xx_io/commproc.c
index 7088428..593b939 100644
--- a/arch/ppc/8xx_io/commproc.c
+++ b/arch/ppc/8xx_io/commproc.c
@@ -379,14 +379,12 @@ static rh_block_t cpm_boot_dpmem_rh_block[16];
static rh_info_t cpm_dpmem_info;
#define CPM_DPMEM_ALIGNMENT 8
-static u8* dpram_vbase;
static uint dpram_pbase;
void m8xx_cpm_dpinit(void)
{
spin_lock_init(&cpm_dpmem_lock);
- dpram_vbase = immr_map_size(im_cpm.cp_dpmem, CPM_DATAONLY_BASE + CPM_DATAONLY_SIZE);
dpram_pbase = (uint)&((immap_t *)IMAP_ADDR)->im_cpm.cp_dpmem;
/* Initialize the info header */
@@ -465,6 +463,6 @@ EXPORT_SYMBOL(cpm_dpram_addr);
uint cpm_dpram_phys(u8* addr)
{
- return (dpram_pbase + (uint)(addr - dpram_vbase));
+ return (uint)addr;
}
EXPORT_SYMBOL(cpm_dpram_phys);
^ permalink raw reply related
* Network is blocked till ping is issued
From: DI BACCO ANTONIO - technolabs @ 2007-08-29 17:27 UTC (permalink / raw)
To: linuxppc-embedded
I have two hosts 100.1.0.1 (NotLinux) and 100.1.0.2 (linux-2.6.19.2) on
a vlan.
On the linux box the vlan interface is created with vconfig and is
attached to a Virtual PHY (fixed PHY).
When Linux box starts up, NotLinux wants to setup a TCP connection with
"Linux box" and sends a SYN packet receiving no answer from "Linux box".
If from the console of "Linux box" I issue a ping to NotLinux then,
after a while, the linux box starts responding to Windows.
Bye,
Antonio.
^ permalink raw reply
* Re: [PATCH 2.6.23] ibmebus: Prevent bus_id collisions
From: Nathan Lynch @ 2007-08-29 18:12 UTC (permalink / raw)
To: Joachim Fenkes
Cc: Thomas Klein, Jan-Bernd Themann, LKML, LinuxPPC-Dev,
Christoph Raisch, Paul Mackerras, Stefan Roscher
In-Reply-To: <200708291815.18197.fenkes@de.ibm.com>
Hi-
Joachim Fenkes wrote:
> Previously, ibmebus derived a device's bus_id from its location code. The
> location code is not guaranteed to be unique, so we might get bus_id
> collisions if two devices share the same location code. The OFDT full_name,
> however, is unique, so we use that instead.
This is a userspace-visible change, but I guess it's unavoidable.
Will anything break?
Also, I dislike this approach of duplicating the firmware device tree
path in sysfs. Are GX/ibmebus devices guaranteed to be children of
the same node in the OF device tree? If so, their unit addresses will
be unique, and therefore suitable values for bus_id. I believe this
is what the powerpc vio bus code does.
^ permalink raw reply
* Re: [PATCH 2.6.23] ibmebus: Prevent bus_id collisions
From: jschopp @ 2007-08-29 18:33 UTC (permalink / raw)
To: Joachim Fenkes
Cc: Thomas Klein, Jan-Bernd Themann, Paul Mackerras, LKML,
LinuxPPC-Dev, Christoph Raisch, Paul Mackerras, Nathan Lynch,
Stefan Roscher
In-Reply-To: <200708291815.18197.fenkes@de.ibm.com>
> + len = strlen(dn->full_name + 1);
> + bus_len = min(len, BUS_ID_SIZE - 1);
> + memcpy(dev->ofdev.dev.bus_id, dn->full_name + 1
> + + (len - bus_len), bus_len);
> + for (i = 0; i < bus_len; i++)
> + if (dev->ofdev.dev.bus_id[i] == '/')
> + dev->ofdev.dev.bus_id[i] = '_';
>
> /* Register with generic device framework. */
> if (ibmebus_register_device_common(dev, dn->name) != 0) {
What happens when the full name is > 31 characters? It looks to me that it
will be truncated, which takes away the uniqueness guarantee.
There must be an individual property that is guaranteed to be unique and
less than 32 characters. How about "ibm,my-drc-index"? That looks like a
good candidate.
^ permalink raw reply
* Re: Network is blocked till ping is issued(update)
From: DI BACCO ANTONIO - technolabs @ 2007-08-29 18:34 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <F1F6EC0C8B75034F9E3A79FC85122E8EA18695@aquib01a>
I have two hosts 100.1.0.1 (NotLinux) and 100.1.0.2 (linux-2.6.19.2 on
MPC880) on
a vlan.
On the linux box the vlan interface is created with vconfig on the eth1
and is
attached to a Virtual PHY (fixed PHY).
When Linux box starts up, NotLinux wants to setup a TCP connection with
"Linux box" and sends a SYN packet receiving no answer from "Linux box".
If from the console of "Linux box" I issue a ping to NotLinux then,
after a while, the linux box starts responding to Windows.
Bye,
Antonio.
^ permalink raw reply
* Register MII_SPEED periodically set to 0 (who is it?)
From: DI BACCO ANTONIO - technolabs @ 2007-08-29 18:38 UTC (permalink / raw)
To: linuxppc-embedded
I had to add a setting of mii_speed register of MPC880 in mdio_read and
mdio_write of mii-fec.c because it was periodically set to 0.
My fs_enet is bind to a Virtual PHY and I don't understand who touches
this register.
=20
Bye,
Antonio.
^ permalink raw reply
* Re: wmb vs mmiowb
From: Brent Casavant @ 2007-08-29 18:53 UTC (permalink / raw)
To: Nick Piggin; +Cc: linuxppc-dev, linux-ia64
In-Reply-To: <20070829005904.GB25335@wotan.suse.de>
On Wed, 29 Aug 2007, Nick Piggin wrote:
> On Tue, Aug 28, 2007 at 03:56:28PM -0500, Brent Casavant wrote:
> > The simplistic method to solve this is a lock around the section
> > issuing IOs, thereby ensuring serialization of access to the IO
> > device. However, as SN2 does not enforce an ordering between normal
> > memory transactions and memory-mapped IO transactions, you cannot
> > be sure that an IO transaction will arrive at the IO fabric "on the
> > correct side" of the unlock memory transaction using this scheme.
>
> Hmm. So what if you had the following code executed by a single CPU:
>
> writel(data, ioaddr);
> wmb();
> *mem = 10;
>
> Will the device see the io write before the store to mem?
Not necessarily. There is no guaranteed ordering between the IO write
arriving at the device and the order of the normal memory reference,
regardless of the intervening wmb(), at least on SN2. I believe the
missing component in the mental model is the effect of the platform
chipset.
Perhaps this will help. Uncached writes (i.e. IO writes) are posted
to the SN2 SHub ASIC and placed in their own queue which the SHub chip
then routes to the appropriate target. This uncached write queue is
independent of the NUMA cache-coherency maintained by the SHub ASIC
for system memory; the relative order in which the uncached writes
and the system memory traffic appear at their respective targets is
undefined with respect to eachother.
wmb() does not address this situation as it only guarantees that
the writes issued from the CPU have been posted to the chipset,
not that the chipset itself has posted the write to the final
destination. mmiowb() guarantees that all outstanding IO writes
have been issued to the IO fabric before proceeding.
I like to think of it this way (probably not 100% accurate, but it
helps me wrap my brain around this particular point):
wmb(): Ensures preceding writes have issued from the CPU.
mmiowb(): Ensures preceding IO writes have issued from the
system chipset.
mmiowb() on SN2 polls a register in SHub that reports the length
of the outstanding uncached write queue. When the queue has emptied,
it is known that all subsequent normal memory writes will therefore
arrive at their destination after all preceding IO writes have arrived
at the IO fabric.
Thus, typical mmiowb() usage, for SN2's purpose, is to ensure that
all IO traffic from a CPU has made it out to the IO fabric before
issuing the normal memory transactions which release a RAM-based
lock. The lock in this case is the one used to serialize access
to a particular IO device.
> > mmiowb() causes SN2 to drain the pending IOs from the current CPU's
> > node. Once the IOs are drained the CPU can safely unlock a normal
> > memory based lock without fear of the unlock's memory write passing
> > any outstanding IOs from that CPU.
>
> mmiowb needs to have the disclaimer that it's probably wrong if called
> outside a lock, and it's probably wrong if called between two io writes
> (need a regular wmb() in that case). I think some drivers are getting
> this wrong.
There are situations where mmiowb() can be pressed into service to
some other end, but those are rather rare. The only instance I am
personally familiar with is synchronizing a free-running counter on
a PCI device as closely as possible to the execution of a particular
line of driver code. A write of the new counter value to the device
and subsequent mmiowb() synchronizes that execution point as closely
as practical to the IO write arriving at the device. Not perfect, but
good enough for my purposes. (This was a hack, by the way, pressing
a bit of hardware into a purpose for which it wasn't really designed,
ideally the hardware would have had a better mechanism to accomplish
this goal.)
But in the normal case, I believe you are 100% correct -- wmb() would
ensure that the memory-mapped IO writes arrive at the chipset in a
particular order, and thus should arrive at the IO hardware in a particular
order. mmiowb() would not necessarily accomplish this goal, and is
incorrectly used wherever that is the intention. At least for SN2.
Brent
--
Brent Casavant All music is folk music. I ain't
bcasavan@sgi.com never heard a horse sing a song.
Silicon Graphics, Inc. -- Louis Armstrong
^ permalink raw reply
* Re: [PATCH 3/3] Add early debug console for CPM serial ports.
From: Scott Wood @ 2007-08-29 19:58 UTC (permalink / raw)
To: galak, linuxppc-dev
In-Reply-To: <20070829140239.GC30184@ld0162-tx32.am.freescale.net>
On Wed, Aug 29, 2007 at 09:02:39AM -0500, Scott Wood wrote:
> > > # Temporary hack until we have migrated to asm-powerpc
> > > ifeq ($(ARCH),powerpc)
> > > +obj-$(CONFIG_CPM1)$(CONFIG_CPM2) += cpm_common.o
> >
> > Uh.. I don't think this will work properly. If CONFIG_CPM1 and
> > CONFIG_CPM2 are both enabled, it will set obj-yy rather than obj-y.
>
> The assumption was that CPM1 and CPM2 are never going to both be enabled,
> as CPM1 only exists on hardware with a unique MMU.
>
> I could add an obj-y += $(obj-yy) if you like, though.
On second thought, I'll just add a CONFIG_CPM that CPM1 and CPM2 select;
that'll make things easier for further consolidation.
-Scott
^ permalink raw reply
* spin_lock doesn't work?!?
From: melinda develey @ 2007-08-29 21:26 UTC (permalink / raw)
To: linuxppc-embedded
[-- Attachment #1: Type: text/plain, Size: 317 bytes --]
I discovered that I called spin_lock two times consecutively without calling spin_unlock but my code didn't lock (I was managing an ioctl).
Probably I didn't understand how spin_lock works!!!!
Any help?
---------------------------------
Need a vacation? Get great deals to amazing places on Yahoo! Travel.
[-- Attachment #2: Type: text/html, Size: 468 bytes --]
^ permalink raw reply
* Re: spin_lock doesn't work?!?
From: Scott Wood @ 2007-08-29 21:38 UTC (permalink / raw)
To: melinda develey; +Cc: linuxppc-embedded
In-Reply-To: <177333.15506.qm@web63904.mail.re1.yahoo.com>
On Wed, Aug 29, 2007 at 02:26:15PM -0700, melinda develey wrote: I
> discovered that I called spin_lock two times consecutively without
> calling spin_unlock but my code didn't lock (I was managing an ioctl).
> Probably I didn't understand how spin_lock works!!!!
spinlocks are no-ops on uniprocessor without preemption.
-Scott
^ permalink raw reply
* Re: spin_lock doesn't work?!?
From: Wolfgang Reissnegger @ 2007-08-29 21:40 UTC (permalink / raw)
To: melinda develey; +Cc: linuxppc-embedded
In-Reply-To: <177333.15506.qm@web63904.mail.re1.yahoo.com>
Hi Melinda,
depending on how your kernel is configured spin_locks will compileinto
nothing. For example, if you are compiling a kernel for a single
processor platform without preemptive scheduling then the spin_lock()
calls will be compiled into no-op as they are unnecessary on a non-SMP,
non-preemptive system.
You should still put the spin_lock calls into your code because you
never know if someone else will compile it and for another target. If
someone would, for example, compile the same code for a SMP machine then
the spin_lock will actually lock.
Cheers,
Wolfgang
melinda develey wrote:
> I discovered that I called spin_lock two times consecutively without
> calling spin_unlock but my code didn't lock (I was managing an ioctl).
> Probably I didn't understand how spin_lock works!!!!
>
> Any help?
>
> ------------------------------------------------------------------------
> Need a vacation? Get great deals to amazing places
> <http://us.rd.yahoo.com/evt=48256/*http://travel.yahoo.com/;_ylc=X3oDMTFhN2hucjlpBF9TAzk3NDA3NTg5BHBvcwM1BHNlYwNncm91cHMEc2xrA2VtYWlsLW5jbQ-->on
> Yahoo! Travel.
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
^ permalink raw reply
* Re: Network is blocked till ping is issued
From: Florian A. Voegel @ 2007-08-29 23:07 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <F1F6EC0C8B75034F9E3A79FC85122E8EA18695@aquib01a>
Hi Antonio,
sounds to me like it could be a classical ARP problem. Have you checked the ARP cache on the non-Linux machine?
On Wed, 29 Aug 2007 19:27:19 +0200
"DI BACCO ANTONIO - technolabs" <Antonio.DiBacco@technolabs.it> wrote:
> I have two hosts 100.1.0.1 (NotLinux) and 100.1.0.2 (linux-2.6.19.2) on
> a vlan.
> On the linux box the vlan interface is created with vconfig and is
> attached to a Virtual PHY (fixed PHY).
> When Linux box starts up, NotLinux wants to setup a TCP connection with
> "Linux box" and sends a SYN packet receiving no answer from "Linux box".
> If from the console of "Linux box" I issue a ping to NotLinux then,
> after a while, the linux box starts responding to Windows.
>
> Bye,
> Antonio.
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
^ permalink raw reply
* Please pull from 'for-2.6.23'
From: Kumar Gala @ 2007-08-29 22:27 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
Please pull from 'for-2.6.23' branch of
master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.23
to receive the following updates:
arch/powerpc/configs/linkstation_defconfig | 219 ++----
arch/powerpc/configs/lite5200_defconfig | 191 +----
arch/powerpc/configs/mpc7448_hpc2_defconfig | 202 +-----
arch/powerpc/configs/mpc8272_ads_defconfig | 193 +----
arch/powerpc/configs/mpc8313_rdb_defconfig | 224 ++----
arch/powerpc/configs/mpc832x_mds_defconfig | 209 +-----
arch/powerpc/configs/mpc832x_rdb_defconfig | 211 +-----
arch/powerpc/configs/mpc834x_itx_defconfig | 206 +-----
arch/powerpc/configs/mpc834x_itxgp_defconfig | 203 +-----
arch/powerpc/configs/mpc834x_mds_defconfig | 205 +-----
arch/powerpc/configs/mpc836x_mds_defconfig | 209 +-----
arch/powerpc/configs/mpc8540_ads_defconfig | 183 +----
arch/powerpc/configs/mpc8544_ds_defconfig | 459 ++++++++++++--
arch/powerpc/configs/mpc8560_ads_defconfig | 196 +-----
arch/powerpc/configs/mpc8568mds_defconfig | 43 -
arch/powerpc/configs/mpc85xx_cds_defconfig | 198 +-----
arch/powerpc/configs/mpc8641_hpcn_defconfig | 880 +++++++++++++++++++++------
arch/powerpc/configs/mpc866_ads_defconfig | 174 +----
arch/powerpc/configs/mpc885_ads_defconfig | 174 +----
arch/powerpc/configs/prpmc2800_defconfig | 213 +-----
arch/powerpc/kernel/process.c | 6
21 files changed, 2134 insertions(+), 2664 deletions(-)
Kumar Gala (2):
[POWERPC] Flush registers to proper task context
[POWERPC] Update defconfigs
commit 5cc44e086d7a4e20035997ec612678ca91f426e7
Author: Kumar Gala <galak@kernel.crashing.org>
Date: Tue Aug 28 21:46:53 2007 -0500
[POWERPC] Update defconfigs
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
commit 0ee6c15e7ba7b36a217cdadb292eeaf32a057a59
Author: Kumar Gala <galak@kernel.crashing.org>
Date: Tue Aug 28 21:15:53 2007 -0500
[POWERPC] Flush registers to proper task context
When we flush register state for FP, Altivec, or SPE in flush_*_to_thread
we need to respect the task_struct that the caller has passed to us.
Most cases we are called with current, however sometimes (ptrace) we may
be passed a different task_struct.
This showed up when using gdbserver debugging a simple program that used
floating point. When gdb tried to show the FP regs they all showed up as
0, because the child's FP registers were never properly flushed to memory.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index a83727b..e477c9d 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -83,7 +83,7 @@ void flush_fp_to_thread(struct task_struct *tsk)
*/
BUG_ON(tsk != current);
#endif
- giveup_fpu(current);
+ giveup_fpu(tsk);
}
preempt_enable();
}
@@ -143,7 +143,7 @@ void flush_altivec_to_thread(struct task_struct *tsk)
#ifdef CONFIG_SMP
BUG_ON(tsk != current);
#endif
- giveup_altivec(current);
+ giveup_altivec(tsk);
}
preempt_enable();
}
@@ -182,7 +182,7 @@ void flush_spe_to_thread(struct task_struct *tsk)
#ifdef CONFIG_SMP
BUG_ON(tsk != current);
#endif
- giveup_spe(current);
+ giveup_spe(tsk);
}
preempt_enable();
}
^ permalink raw reply related
* Re: ppc/powerpc, remote debugging (ptrace), floating point variables
From: Kumar Gala @ 2007-08-29 22:31 UTC (permalink / raw)
To: Visser, Udo RD-IS-E23; +Cc: linuxppc-embedded
In-Reply-To: <40D0BF15B1434F469B8639BF3A31D6F20B5F28@wiems02014.ceu.corp.heidelberg.com>
On Aug 28, 2007, at 4:40 AM, Visser, Udo RD-IS-E23 wrote:
>
> Hello world, ;-)
>
> when stepping through my own software, which is using floating =20
> point variables, gdb showed weird results (mostly NAN=B4s) for these =20=
> variables. Running the software without gdb did not show any =20
> problems. The software is compiled with floating point instructions =20=
> and the results (without gdb) are OK.
>
> My setup:
>
> MPC8349 target, "home grown", much like the MPC8349EMDS, running =20
> 2.6.16 (ppc)
> GDB, gdbserver 6.3 connected via ethernet with my Linux Host.
>
>
> What I did to get rid of the described problem:
>
> In module: arch/powerpc/kernel/process.c
> In function: void flush_fp_to_thread(struct tast_struct *tsk)
>
> I changed the line: giveup_fpu(current);
> to: giveup_fpu(tsk);
>
>
> Now my questions: Has anybody else had such problems?
> Have I found a bug, or will I encounter any yet =20
> unknown problems in the near future?
>
> I would appreciate any comment on my changes, especially from the =20
> maintainers.
I have a patch to fix just this issue.
take a look at:
http://patchwork.ozlabs.org/linuxppc/patch?id=3D13219
- k
^ permalink raw reply
* Re: [PATCH] Update mpc7448hpc2 device tree to be compatible for tsi109 chip
From: Kumar Gala @ 2007-08-29 22:32 UTC (permalink / raw)
To: Zang Roy-r61911; +Cc: linuxppc-dev list, Paul Mackerras
In-Reply-To: <1184299081.30789.9.camel@localhost.localdomain>
On Thu, 13 Jul 2007, Zang Roy-r61911 wrote:
> From: Roy Zang <tie-fei.zang@freescale.com>
>
> Update mpc7448hpc2 device tree to be compatible for tsi109 chip.
>
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> ---
> Based on previous patch
> http://ozlabs.org/pipermail/linuxppc-dev/2007-July/038957.html
>
> arch/powerpc/boot/dts/mpc7448hpc2.dts | 15 ++++++++-------
> 1 files changed, 8 insertions(+), 7 deletions(-)
>
applied.
- k
^ permalink raw reply
* Re: [PATCH 1/5] 86xx: Remove unnecessary loops_per_jiffy initialization code.
From: Kumar Gala @ 2007-08-29 22:33 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <1185560676.8055.173.camel@ld0161-tx32>
On Fri, 27 Jul 2007, Jon Loeliger wrote:
> Signed-off-by: Jon Loeliger <jdl@freescale.com>
> ---
>
> Note -- This is a rebased version of an earlier patch
> from July 17. That one can be dropped.
>
> arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 14 ++------------
> 1 files changed, 2 insertions(+), 12 deletions(-)
>
applied.
- k
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox