Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/dev also look for "FJSV, su" as found on PRI...



details:   https://anonhg.NetBSD.org/src/rev/b2a0e07c91b5
branches:  trunk
changeset: 765666:b2a0e07c91b5
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu Jun 02 00:16:22 2011 +0000

description:
also look for "FJSV,su" as found on PRIMEPOWER machines.
while here, copy some code from openbsd that should allow this to work
on the Fujitsu SPARC Enterprise Mx000 systems.

diffstat:

 sys/arch/sparc64/dev/com_ebus.c |  52 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 6 deletions(-)

diffs (94 lines):

diff -r 5221879af024 -r b2a0e07c91b5 sys/arch/sparc64/dev/com_ebus.c
--- a/sys/arch/sparc64/dev/com_ebus.c   Wed Jun 01 23:41:04 2011 +0000
+++ b/sys/arch/sparc64/dev/com_ebus.c   Thu Jun 02 00:16:22 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com_ebus.c,v 1.31 2011/03/15 11:22:18 mrg Exp $        */
+/*     $NetBSD: com_ebus.c,v 1.32 2011/06/02 00:16:22 mrg Exp $        */
 
 /*
  * Copyright (c) 1999, 2000 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com_ebus.c,v 1.31 2011/03/15 11:22:18 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com_ebus.c,v 1.32 2011/06/02 00:16:22 mrg Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -84,7 +84,8 @@
                compat = prom_getpropstring(ea->ea_node, "compatible");
                if (strcmp(compat, "su16550") == 0 ||
                    strcmp(compat, "su16552") == 0 ||
-                   strcmp(compat, "su") == 0) {
+                   strcmp(compat, "su") == 0 ||
+                   strcmp(compat, "FJSV,su") == 0) {
                        return (1);
                }
        }
@@ -109,6 +110,8 @@
        bus_space_handle_t ioh;
        bus_space_tag_t iot;
        bus_addr_t iobase;
+       int node, port;
+       char buf[32];
 
        sc->sc_dev = self;
        iot = ea->ea_bustag;
@@ -145,9 +148,34 @@
 
        kma.kmta_consdev = NULL;
 
-       /* Figure out if we're the console. */
-       com_is_input = (ea->ea_node == prom_instance_to_package(prom_stdin()));
-       com_is_output = (ea->ea_node == prom_instance_to_package(prom_stdout()));
+       /*
+        * Figure out if we're the console.
+        *
+        * The Fujitsu SPARC Enterprise M4000/M5000/M8000/M9000 has a
+        * serial port on each I/O board and a pseudo console that is
+        * redirected to one of these serial ports.  The board number
+        * of the serial port in question is encoded in the "tty-port#"
+        * property of the pseudo console, so we figure out what our
+        * board number is by walking up the device tree, and check
+        * for a match.
+        */
+       node = prom_instance_to_package(prom_stdin());
+       com_is_input = (ea->ea_node == node);
+       if (OF_getprop(node, "name", buf, sizeof(buf)) > 0 &&
+           strcmp(buf, "pseudo-console") == 0) {
+               port = prom_getpropint(node, "tty-port#", -1);
+               node = OF_parent(OF_parent(ea->ea_node));
+               com_is_input = (prom_getpropint(node, "board#", -2) == port);
+       }
+
+       node = prom_instance_to_package(prom_stdout());
+       com_is_output = (ea->ea_node == node);
+       if (OF_getprop(node, "name", buf, sizeof(buf)) > 0 &&
+          strcmp(buf, "pseudo-console") == 0) {
+               port = prom_getpropint(node, "tty-port#", -1);
+               node = OF_parent(OF_parent(ea->ea_node));
+               com_is_output = (prom_getpropint(node, "board#", -2) == port);
+       }
 
        if (com_is_input || com_is_output) {
                struct consdev *cn_orig;
@@ -178,6 +206,18 @@
                cn_tab = cn_orig;
                kma.kmta_consdev = cn_tab;
        }
+
+       /*
+        * Apparently shoving too much data down the TX FIFO on the
+        * Fujitsu SPARC Enterprise M4000/M5000 causes a hardware
+        * fault.  Avoid this issue by setting the FIFO depth to 1.
+        * This will effectively disable the TX FIFO, but will still
+        * enable the RX FIFO, which is what we really care about.
+        */
+       if (OF_getprop(ea->ea_node, "compatible", buf, sizeof(buf)) > 0 &&
+           strcmp(buf, "FJSV,su") == 0)
+               sc->sc_fifolen = 1;
+
        /* Now attach the driver */
        com_attach_subr(sc);
 



Home | Main Index | Thread Index | Old Index