# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID e7424645152709dfbacd30df4b996db736403408
# Parent 9f1854d679ade42ba5ee5e6356dc67431235e488
[ppc] oops, complete backing out the pmac_zilog changes
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
diff -r 9f1854d679ad -r e74246451527 xen/arch/ppc/boot_of.c
--- a/xen/arch/ppc/boot_of.c Tue May 30 11:31:09 2006 -0500
+++ b/xen/arch/ppc/boot_of.c Tue May 30 12:52:02 2006 -0500
@@ -27,9 +27,6 @@
#include <public/of-devtree.h>
#include <asm/page.h>
#include <asm/io.h>
-#include <xen/string.h>
-#include <xen/serial.h>
-#include <asm-ppc/uart.h>
#include "exceptions.h"
static ulong of_vec;
@@ -39,13 +36,7 @@ static char bootargs[256];
static char bootargs[256];
static char dom0args[256];
-struct uart uarts[] = {
- { .type = ns16550, .uart_name = "ns16550", .p_sign = "isa",
- .gp_sign = "ht", .uart_init_func = ns16550_init },
- { .type = pmac_zilog, .uart_name = "zilog", .p_sign = "escc",
- .gp_sign = "mac-io", .uart_init_func = pmac_zilog_init },
-};
-struct platform_serial_port global_serial_port;
+extern struct ns16550_defaults ns16550;
#undef OF_DEBUG
@@ -57,11 +48,6 @@ struct platform_serial_port global_seria
#define of_panic(MSG...) \
do { of_printf(MSG); of_printf("\nHANG\n"); for (;;); } while (0)
-
-#define _IF_OF_FAILURE_RET(rc) \
- if (unlikely((rc)==OF_FAILURE)) { \
- return OF_FAILURE; \
- }
struct of_service {
u32 ofs_service;
@@ -380,6 +366,7 @@ static void boot_of_probemem(multiboot_i
root = of_finddevice("/");
p = of_getchild(root);
+ /* code is writen to assume sizes of 1 */
of_getprop(root, "#address-cells", &addr_cells, sizeof (addr_cells));
of_getprop(root, "#size-cells", &size_cells, sizeof (size_cells));
DBG("%s: address_cells=%d size_cells=%d\n",
@@ -715,7 +702,7 @@ static ulong find_space(u32 size, ulong
ulong eomem = ((u64)map->length_high << 32) | (u64)map->length_low;
ulong base;
- DBG("%s base=0x%016lx eomem=0x%016lx size=0x%08x align=0x%lx\n",
+ of_printf("%s base=0x%016lx eomem=0x%016lx size=0x%08x align=0x%lx\n",
__func__, space_base, eomem, size, align);
base = ALIGN_UP(space_base, PAGE_SIZE);
if ((base + size) >= 0x4000000) return 0;
@@ -727,7 +714,7 @@ static ulong find_space(u32 size, ulong
return base;
} else {
for(base += 0x100000; (base+size) < 0x4000000; base += 0x100000) {
- DBG("Trying 0x%016lx\n", base);
+ of_printf("Trying 0x%016lx\n", base);
if (of_claim((void*)base, size) != OF_FAILURE) {
space_base = base + size;
return base;
@@ -773,221 +760,20 @@ static void __init boot_of_fix_maple(voi
}
}
-/*
- * from OF_IEEE_1275
- *
- * pg 175, property "ranges"
- *
- * The number of integers in each size entry is
- * determined by the value of the #size-cells property of this node (the node
in which the ranges property appears)
- * or 1 if the #size-cells property is absent.
- *
- *
- * pg 177, property "reg"
- *
- * The number of integers in each size entry is determined by the value of the
"#size-cells" property in the parent node.
- * If the parent node has no such property, the value is one.
- */
-static void boot_of_serial_ns16550(int ofout, int parent, int grandparent)
-{
- u32 addr_cells, size_cells;
-
- /* the struct isa_reg_property is for a value of 2 for #address-cells and a
- * value of 1 for #size-cells (of the parent).
- */
- struct isa_reg_property {
- u32 space;
- u32 address;
- u32 size;
- } isa_reg;
-
- struct of_pci_range64_s {
- u32 flags;
- u32 opa_mid;
- u32 opa_lo;
- u32 opr_phys_hi;
- u32 opr_phys_lo;
- u32 opr_size_hi;
- u32 opr_size_lo;
- } r64;
- u32 clock;
-
- /* note that if a property does not exist, then the 3rd parameter to
- * of_getprop is *not* altered
- */
- addr_cells = 2;
- size_cells = 1;
- of_getprop(grandparent, "#address-cells", &addr_cells, sizeof(addr_cells));
- of_getprop(grandparent, "#size-cells", &size_cells, sizeof(size_cells));
- DBG("In %s: value for grandparent #address-cells %d "
- "and #size-cells %d\n",
- __func__, addr_cells, size_cells);
- of_getprop(grandparent , "ranges", &r64, sizeof(r64));
-
- addr_cells = 2;
- size_cells = 1;
- of_getprop(ofout, "#address-cells", &addr_cells, sizeof(addr_cells));
- of_getprop(parent, "#size-cells", &size_cells, sizeof(size_cells));
- DBG("In %s: value for #address-cells %d "
- "and #size-cells %d\n",
- __func__, addr_cells, size_cells);
-
- of_getprop(ofout, "reg", &isa_reg, sizeof(isa_reg));
-
- of_getprop(ofout, "clock-frequency", &clock, sizeof (clock));
-
- of_printf("reg property address=0x%08x size=0x%08x\n",
- isa_reg.address, isa_reg.size);
- of_printf("ranges property %x:%x %x:%x\n",
- r64.opr_phys_hi, r64.opr_phys_lo,
- r64.opr_size_hi, r64.opr_size_lo);
-
- global_serial_port.uart_io_base = isa_reg.address;
- isa_io_base = r64.opr_phys_hi;
- isa_io_base <<= 32;
- isa_io_base |= r64.opr_phys_lo;
- global_serial_port.clock = clock;
-}
-
-static void boot_of_serial_zilog(int ofout, int parent, int grandparent)
-{
- u32 addr_cells, size_cells;
-
- /* the struct reg_property32 is for a value of 1 for #address-cells and
- * a value of 1 for #size-cells.
- */
- struct reg_property32 {
- u32 address;
- u32 size;
- } reg;
-
- /* the struct of_pic_range32_s is for a value of 1 of #address-cells
- * for ?? and a value of 1 for #size-cells.
- */
- struct of_pci_range32_s {
- u32 flags;
- u32 opa_mid;
- u32 opa_lo;
- u32 opr_phys;
- u32 opr_size;
- } r32;
-
- addr_cells = 2;
- size_cells = 1;
- of_getprop(grandparent, "#address-cells", &addr_cells, sizeof(addr_cells));
- of_getprop(grandparent, "#size-cells", &size_cells, sizeof(size_cells));
- DBG("In %s: value for grandparent #address-cells %d "
- "or #size-cells %d\n",
- __func__, addr_cells, size_cells);
- of_getprop(grandparent , "ranges", &r32, sizeof(r32));
-
- addr_cells = 2;
- size_cells = 1;
- of_getprop(ofout, "#address-cells", &addr_cells, sizeof(addr_cells));
- of_getprop(parent, "#size-cells", &size_cells, sizeof(size_cells));
- DBG("In %s %d: value for #address-cells %d "
- "or #size-cells %d\n",
- __func__, addr_cells, size_cells);
- of_getprop(ofout, "reg", ®, sizeof(reg));
-
- of_printf("reg property address=0x%08x size=0x%08x\n",
- reg.address, reg.size);
- of_printf("ranges property %x %x\n",
- r32.opr_phys, r32.opr_size);
-
- global_serial_port.uart_io_base = reg.address;
- isa_io_base = r32.opr_phys;
-}
-
-/*
- * return OF_FAILURE if it cannot find the serial device
- * the of handle of the serial device otherwise
- */
-static int __init boot_of_serial_simple_probe(void)
-{
- int node;
- char buf[64];
-
- node = of_instance_to_package(of_out);
- if (node == OF_FAILURE) {
- return OF_FAILURE;
- }
-
- buf[0] = '\0';
- of_getprop(node, "device_type", buf, sizeof (buf));
- if (strstr(buf, "serial") == NULL) {
- return OF_FAILURE;
- }
-
- return node;
-}
-
-/*
- * return OF_FAILURE if it cannot find the serial device
- * the of handle of the serial device otherwise
- */
-static int __init boot_of_serial_canonical_probe()
-{
- int p, ofout; /* of handle */
+static int __init boot_of_serial(void *oftree)
+{
+ int n;
+ int p;
int rc;
- char ofout_path[256] = {0,};
- const char serial[] = "serial";
-
- /* copied and adapted from rhype */
- ofout_path[0] = '\0';
- ofout = OF_FAILURE;
-
- /* probe /options tree */
- rc = p = of_finddevice("/options");
- if (p != OF_FAILURE) {
- rc = of_getprop(p, "output-device", ofout_path,
- sizeof(ofout_path));
- }
- if (OF_FAILURE == rc) {
- strncpy(ofout_path, serial, sizeof(serial));
- }
-
- /*
- * if the options are not a path (they do not start with '/')
- * then they are aliases and we must look them up. we look it
- * up in aliases because it is possible that the OF does not
- * support finddevice() of an alias.
- */
- if (ofout_path[0] != '/') {
- p = of_finddevice("/aliases");
- if (p != OF_FAILURE) {
- char alias[256];
- memcpy(alias, ofout_path, sizeof(alias));
- rc = of_getprop(p, alias, ofout_path, sizeof (ofout_path));
- }
- }
-
- if (OF_FAILURE != rc) {
- ofout = of_finddevice(ofout_path);
- } else {
- /*
- * Our last chance is to figure out the package for
- * the current console and hopefully discover it to be
- * a serial device.
- */
- /* of_out is the phandle of the property 'stdout' of
- *'chosen'.
- */
- rc = of_instance_to_path(of_out, ofout_path, sizeof(ofout_path));
- if (rc != OF_FAILURE) {
- ofout = of_finddevice(ofout_path);
- }
- }
-
- return ofout;
-}
-
-static void __init boot_of_serial_prune(void *oftree, int n)
-{
+ u32 val[3];
char buf[128];
- int rc;
-
- /* prune serial device from OF tree */
+
+ n = of_instance_to_package(of_out);
+ 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");
@@ -996,121 +782,54 @@ static void __init boot_of_serial_prune(
" since Xen will be using it for console\n", buf);
rc = ofd_prune_path(oftree, buf);
if (rc < 0) {
- of_panic("prune path \"%s\" failed\n", buf);
- }
-}
-
-/*
- * return 0 is a serial port is found.
- * OF_FAILURE if no serial port can be found
- */
-static int __init boot_of_serial(void *oftree)
-{
- int ofout; /* of handle */
- int rc;
- char of_property[256];
- const char serial[] = "serial";
- u32 interrupts, baud;
-
- memset(&global_serial_port, 0, sizeof(global_serial_port));
-
- ofout = boot_of_serial_simple_probe();
- if (OF_FAILURE == ofout) {
- of_printf("Warning %s: simple probe of serial device failed.\n",
- __func__);
- ofout = boot_of_serial_canonical_probe();
- }
-
- DBG("serial port OF handle=0x%x\n", ofout);
-
- if (OF_FAILURE == ofout) {
- of_printf("Could not find serial device.\n");
- return OF_FAILURE;
- }
-
- /* Now we have the OF handle of the serial device. The device
- * must have type 'serial'.
- */
- rc = of_getprop(ofout, "device_type", of_property, sizeof(of_property));
- if (strncmp(of_property, serial, sizeof(serial))) {
- of_printf("Serial device is not serial\n");
- return OF_FAILURE;
- }
-
- /*
- * Remove the device from the ofd tree
- */
- boot_of_serial_prune(oftree, ofout);
-
- interrupts = 0;
- rc = of_getprop(ofout, "interrupts", &interrupts, sizeof(interrupts));
+ of_panic("prune path \"%s\" failed\n", buf);
+ }
+
+
+ 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_printf("%s: no ISRC\n", __func__);
- global_serial_port.interrupts = 0;
+ 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;
} else {
- of_printf("%s: ISRC 0x%x\n", __func__, interrupts);
- global_serial_port.interrupts = interrupts;
- }
-
- baud = 0;
- rc = of_getprop(ofout, "current-speed", &baud, sizeof(baud));
- if (rc == OF_FAILURE) {
- global_serial_port.baud = 0;
- } else {
- global_serial_port.baud = baud;
- }
-
- /*
- * Look at the name of the grandparent directory and try to match it
- * to known names.
- */
- int parent, grandparent; /* of handles */
- parent = of_getparent(ofout);
- _IF_OF_FAILURE_RET(parent);
- grandparent = of_getparent(parent);
- _IF_OF_FAILURE_RET(grandparent);
-
- of_getprop(grandparent, "name", of_property, sizeof(of_property));
- /*
- * Loop over the known uarts and try and find a match
- */
- int i;
- for (i = 0; i < ARRAY_SIZE(uarts); i++) {
- if (!strcmp(of_property, uarts[i].gp_sign)) {
- of_getprop(parent, "device_type", of_property,
- sizeof(of_property));
- if (strncmp(of_property, uarts[i].p_sign,
- sizeof(uarts[i].p_sign))) {
- of_printf("Serial device parent's type (%s) is not "
- "expected(%s).\n", of_property, uarts[i].p_sign);
- return OF_FAILURE;
- }
-
- of_printf("Found uart of type %s\n", uarts[i].uart_name);
- global_serial_port.uart_p = &(uarts[i]);
-
- if (pmac_zilog == uarts[i].type)
- boot_of_serial_zilog(ofout, parent, grandparent);
- else
- boot_of_serial_ns16550(ofout, parent, grandparent);
-
- of_printf("%s: serial type=%d io base=0x%016lx "
- "isa io@=0x%016lx clock=%d interrupts=0x%x "
- "baud=%d\n",
- __func__, global_serial_port.uart_p->type,
- global_serial_port.uart_io_base,
- isa_io_base,
- global_serial_port.clock,
- global_serial_port.interrupts,
- global_serial_port.baud
- );
-
- return 0;
- }
- }
- of_printf("Warning: boot_of::%s is not aware of this uart type. "
- "%s is:\n", __func__, of_property);
- return OF_FAILURE;
+ ns16550.irq = val[0];
+ of_printf("%s: ISRC=0x%x, but forcing poll mode\n",
+ __func__, ns16550.irq);
+ ns16550.irq = 0;
+ }
+
+ return 1;
}
static void boot_of_module(ulong r3, ulong r4, multiboot_info_t *mbi)
diff -r 9f1854d679ad -r e74246451527 xen/arch/ppc/setup.c
--- a/xen/arch/ppc/setup.c Tue May 30 11:31:09 2006 -0500
+++ b/xen/arch/ppc/setup.c Tue May 30 12:52:02 2006 -0500
@@ -37,7 +37,6 @@
#include <asm/cache.h>
#include <asm/debugger.h>
#include <asm/delay.h>
-#include <asm-ppc/uart.h>
#include "exceptions.h"
#define DEBUG
@@ -62,14 +61,15 @@ cpumask_t cpu_sibling_map[NR_CPUS] __rea
cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
cpumask_t cpu_online_map; /* missing ifdef in schedule.c */
+/* XXX get this from ISA node in device tree */
+ulong isa_io_base;
+struct ns16550_defaults ns16550;
+
struct vcpu *idle_vcpu[NR_CPUS];
extern void idle_loop(void);
/* move us to a header file */
extern void initialize_keytable(void);
-
-extern struct platform_serial_port global_serial_port;
-ulong isa_io_base;
int is_kernel_text(unsigned long addr)
{
@@ -164,22 +164,7 @@ 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. */
- {
- /*
- * the type of device is recorded in the global hardware stuff struct
- */
- struct ns16550_defaults ns16550 = {
- .data_bits = 8,
- .parity = 'n',
- .stop_bits = 1,
- .irq = 0,
- };
- ns16550.io_base = isa_io_base +
- global_serial_port.uart_io_base;
- ns16550.baud = global_serial_port.baud;
- global_serial_port.uart_p->uart_init_func(0, &ns16550);
- }
+ ns16550_init(0, &ns16550);
serial_init_preirq();
init_console();
diff -r 9f1854d679ad -r e74246451527 xen/drivers/char/Makefile
--- a/xen/drivers/char/Makefile Tue May 30 11:31:09 2006 -0500
+++ b/xen/drivers/char/Makefile Tue May 30 12:52:02 2006 -0500
@@ -1,6 +1,5 @@ obj-y += console.o
obj-y += console.o
obj-y += ns16550.o
-obj-y += pmac_zilog.o
obj-y += serial.o
# Object file contains changeset and compiler information.
diff -r 9f1854d679ad -r e74246451527 xen/drivers/char/ns16550.c
--- a/xen/drivers/char/ns16550.c Tue May 30 11:31:09 2006 -0500
+++ b/xen/drivers/char/ns16550.c Tue May 30 12:52:02 2006 -0500
@@ -276,7 +276,7 @@ static struct uart_driver ns16550_driver
.irq = ns16550_irq
};
-int parse_parity_char(int c)
+static int parse_parity_char(int c)
{
switch ( c )
{
diff -r 9f1854d679ad -r e74246451527 xen/include/xen/serial.h
--- a/xen/include/xen/serial.h Tue May 30 11:31:09 2006 -0500
+++ b/xen/include/xen/serial.h Tue May 30 12:52:02 2006 -0500
@@ -8,8 +8,6 @@
#ifndef __XEN_SERIAL_H__
#define __XEN_SERIAL_H__
-
-#include <xen/spinlock.h>
struct cpu_user_regs;
@@ -130,7 +128,6 @@ struct ns16550_defaults {
unsigned long io_base; /* default io_base address */
};
void ns16550_init(int index, struct ns16550_defaults *defaults);
-void pmac_zilog_init(int index, struct ns16550_defaults *defaults);
/* Baud rate was pre-configured before invoking the UART driver. */
#define BAUD_AUTO (-1)
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|