The below patch allows Xen/PPC to support the console=comX option
that Xen/x86 uses. With this patch applied, one need simply
supply CMDLINE="console=com2" on the make invocation to get proper use
of the physical serial port on a JS21.
I will soon split out the pieces for submission, but I am posting this
for now for review of the basic approach. I'd also like to ask that
someone with a Maple-D apply this patch, undefine BROKEN_SLOF, and tell
me whether they see a panic because we try to prune a path we have just
pruned. That is, sucessive calls of `p = of_getpeer(p)' on the SLOF I
have flashed on my JS21 produce a handle which when turned into a path
is identical to the previous, so I see this before the loop exits:
pruning `/ht/isa@8/serial@3f8' from devtree
pruning `/ht/isa@8/serial@3f8' from devtree
pruning `/ht/isa@8/serial@3f8' from devtree
pruning `/ht/isa@8/serial@3f8' from devtree
Note that this patch supercedes the "Command line option for serial port"
patch I posted earlier.
Signed-off-by: Amos Waterland <apw@xxxxxxxxxx>
---
Makefile | 6 ++++--
boot_of.c | 45 ++++++++++++++++++++++++++++++++-------------
setup.c | 4 ++++
3 files changed, 40 insertions(+), 15 deletions(-)
diff -r 058f2e27476d xen/arch/powerpc/Makefile
--- a/xen/arch/powerpc/Makefile Mon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/Makefile Wed Aug 09 18:38:39 2006 -0400
@@ -83,8 +83,10 @@ physdev.o: ../x86/physdev.c
HDRS += $(wildcard *.h)
-CMDLINE = "xen"
-boot_of.o: CFLAGS += -DCMDLINE="\"$(CMDLINE)\""
+# The first token in the arguments will be silently dropped.
+IMAGENAME = xen
+CMDLINE = ""
+boot_of.o: CFLAGS += -DCMDLINE="\"$(IMAGENAME) $(CMDLINE)\""
start.o: boot/start.S
$(CC) $(CFLAGS) -D__ASSEMBLY__ -c $< -o $@
diff -r 058f2e27476d xen/arch/powerpc/boot_of.c
--- a/xen/arch/powerpc/boot_of.c Mon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/boot_of.c Wed Aug 09 19:16:20 2006 -0400
@@ -747,6 +747,8 @@ static void __init boot_of_fix_maple(voi
}
}
}
+
+#define BROKEN_SLOF
static int __init boot_of_serial(void *oftree)
{
@@ -760,19 +762,37 @@ static int __init boot_of_serial(void *o
if (n == OF_FAILURE) {
of_panic("instance-to-package of /chosen/stdout: failed\n");
}
-
- /* prune this from the oftree */
- rc = of_package_to_path(n, buf, sizeof(buf));
- if (rc == OF_FAILURE) {
- of_panic("package-to-path of /chosen/stdout: failed\n");
- }
- of_printf("Pruning from devtree: %s\n"
- " since Xen will be using it for console\n", buf);
+
+ for (p = of_getpeer(n); p; p = of_getpeer(p)) {
+ rc = of_package_to_path(n, buf, sizeof(buf));
+
+ if (rc == OF_FAILURE) of_panic("package-to-path failed\n");
+
+ of_printf("pruning `%s' from devtree\n", buf);
+#ifndef BROKEN_SLOF
+ rc = ofd_prune_path(oftree, buf);
+#endif
+
+ if (rc < 0) of_panic("prune of `%s' failed\n", buf);
+ }
+
+#ifdef BROKEN_SLOF
+ of_printf("(workaround) pruning `%s' from device tree\n", buf);
rc = ofd_prune_path(oftree, buf);
- if (rc < 0) {
- of_panic("prune path \"%s\" failed\n", buf);
- }
-
+ if (rc < 0) of_panic("prune of `%s' failed\n", buf);
+
+ {
+ int len = strlen(buf);
+ char *str = buf + len - sizeof("3f8") + 1;
+
+ if (!strcmp(str, "3f8")) {
+ str[0] = '2';
+ of_printf("(workaround) pruning `%s' from device tree\n", buf);
+ rc = ofd_prune_path(oftree, buf);
+ if (rc < 0) of_panic("prune of `%s' failed\n", buf);
+ }
+ }
+#endif
p = of_getparent(n);
if (p == OF_FAILURE) {
@@ -799,7 +819,6 @@ static int __init boot_of_serial(void *o
if (rc == OF_FAILURE) {
of_panic("%s: no location for serial port\n", __func__);
}
- ns16550.io_base = val[1];
ns16550.baud = BAUD_AUTO;
ns16550.data_bits = 8;
diff -r 058f2e27476d xen/arch/powerpc/setup.c
--- a/xen/arch/powerpc/setup.c Mon Aug 07 17:49:16 2006 -0500
+++ b/xen/arch/powerpc/setup.c Wed Aug 09 18:47:08 2006 -0400
@@ -214,7 +214,11 @@ static void __init __start_xen(multiboot
if ((mbi->flags & MBI_CMDLINE) && (mbi->cmdline != 0))
cmdline_parse(__va((ulong)mbi->cmdline));
+ /* We initialise the serial devices very early so we can get debugging. */
+ ns16550.io_base = 0x3f8;
ns16550_init(0, &ns16550);
+ ns16550.io_base = 0x2f8;
+ ns16550_init(1, &ns16550);
serial_init_preirq();
init_console();
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|