changeset: 9961:a99c33054d4ab381259fb59e396f824181091be4
tag: tip
user: jimix@xxxxxxxxxxxxxxxxxxxxx
date: Mon May 1 17:43:09 2006 -0400
files: xen/arch/ppc/boot_of.c xen/arch/ppc/setup.c
description:
[ppc] enough UART auto detection to satisfy our ISA targets
We currently assume the location of the ISA bus.
We also assume that we will takeover the UART that OF is using
diff -r 55a15be14e7c41539fe7d827c4746bf976d2f935 -r
a99c33054d4ab381259fb59e396f824181091be4 xen/arch/ppc/boot_of.c
--- a/xen/arch/ppc/boot_of.c Mon May 1 16:04:05 2006 -0400
+++ b/xen/arch/ppc/boot_of.c Mon May 1 17:43:09 2006 -0400
@@ -22,8 +22,11 @@
#include <xen/lib.h>
#include <xen/multiboot.h>
#include <xen/compile.h>
+#include <xen/spinlock.h>
+#include <xen/serial.h>
#include <public/of-devtree.h>
#include <asm/page.h>
+#include <asm/io.h>
#include "dart.h"
static ulong of_vec;
@@ -33,8 +36,8 @@ static char bootargs[256];
static char bootargs[256];
static char dom0args[256];
-extern unsigned int timebase_freq;
extern unsigned long opic_addr;
+extern struct ns16550_defaults ns16550;
#undef OF_DEBUG
@@ -331,8 +334,6 @@ static int __init of_claim(void * virt,
return rets[0];
}
-#if unused_but_will_be
-
static int __init of_instance_to_package(int ih)
{
int rets[1] = { OF_FAILURE };
@@ -353,8 +354,6 @@ static int __init of_getparent(int ph)
DBG("getparent 0x%x -> 0x%x\n", ph, rets[0]);
return rets[0];
}
-
-#endif
extern char _start[];
extern char _end[];
@@ -830,7 +829,58 @@ static void boot_of_module(ulong r3, ulo
static int __init boot_of_serial(void)
{
- /* fill this in */
+ int n;
+ int p;
+ int rc;
+ u32 val[3];
+ char buf[64];
+
+ n = of_instance_to_package(of_out);
+ if (n == OF_FAILURE) {
+ of_panic("instance-to-package of /chosen/stdout: failed\n");
+ }
+
+ p = of_getparent(n);
+ if (p == OF_FAILURE) {
+ of_panic("no parent for: 0x%x\n", n);
+ }
+
+ buf[0] = '\0';
+ of_getprop(p, "device_type", buf, sizeof (buf));
+ if (strstr(buf, "isa") == NULL) {
+ of_panic("only ISA UARTS supported\n");
+ }
+
+ /* should get this from devtree */
+ isa_io_base = 0xf4000000;
+ of_printf("%s: ISA base: 0x%lx\n", __func__, isa_io_base);
+
+ buf[0] = '\0';
+ of_getprop(n, "device_type", buf, sizeof (buf));
+ if (strstr(buf, "serial") == NULL) {
+ of_panic("only UARTS supported\n");
+ }
+
+ rc = of_getprop(n, "reg", val, sizeof (val));
+ 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;
+ ns16550.parity = 'n';
+ ns16550.stop_bits = 1;
+
+ rc = of_getprop(n, "interrupts", val, sizeof (val));
+ if (rc == OF_FAILURE) {
+ of_printf("%s: no ISRC, forcing poll mode\n", __func__);
+ ns16550.irq = 0;
+ }
+ ns16550.irq = val[0];
+ of_printf("%s: ISRC=0x%x, but forcing poll mode\n", __func__, ns16550.irq);
+ ns16550.irq = 0;
+
return 1;
}
diff -r 55a15be14e7c41539fe7d827c4746bf976d2f935 -r
a99c33054d4ab381259fb59e396f824181091be4 xen/arch/ppc/setup.c
--- a/xen/arch/ppc/setup.c Mon May 1 16:04:05 2006 -0400
+++ b/xen/arch/ppc/setup.c Mon May 1 17:43:09 2006 -0400
@@ -60,7 +60,8 @@ cpumask_t cpu_online_map; /* missing ifd
cpumask_t cpu_online_map; /* missing ifdef in schedule.c */
/* XXX get this from ISA node in device tree */
-ulong isa_io_base = 0xf4000000;
+ulong isa_io_base;
+struct ns16550_defaults ns16550;
struct vcpu *idle_vcpu[NR_CPUS];
extern char _start[];
@@ -166,17 +167,6 @@ 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. */
- /* XXX find this in device tree */
- struct ns16550_defaults ns16550 = {
- .baud = BAUD_AUTO,
- .data_bits = 8,
- .parity = 'n',
- .stop_bits = 1,
- /* On maple this is 10, but we run in poll mode at the moment */
- .irq = 0,
- .io_base = 0x3f8,
- };
ns16550_init(0, &ns16550);
serial_init_preirq();
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|