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.
This commit is contained in:
mrg 2011-06-02 00:16:22 +00:00
parent 705a46009a
commit 0d643fd11f

View File

@ -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 @@ com_ebus_match(device_t parent, cfdata_t match, void *aux)
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 @@ com_ebus_attach(device_t parent, device_t self, void *aux)
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 @@ com_ebus_attach(device_t parent, device_t self, void *aux)
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 @@ com_ebus_attach(device_t parent, device_t self, void *aux)
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);