summaryrefslogtreecommitdiffstats
path: root/sys/dev/uart/uart_cpu_sparc64.c
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2003-11-11 06:52:04 +0000
committerjake <jake@FreeBSD.org>2003-11-11 06:52:04 +0000
commit035780bafdea135ec73766993507c204a585d87a (patch)
treee1e3c9ce9706ae83a8941063493337de523380c8 /sys/dev/uart/uart_cpu_sparc64.c
parent300d10ae0a3a5b835f2176d586541f84f97b0df0 (diff)
downloadFreeBSD-src-035780bafdea135ec73766993507c204a585d87a.zip
FreeBSD-src-035780bafdea135ec73766993507c204a585d87a.tar.gz
Allow uart to attach to keyboards that are not the firmware's notion of
stdin, such as when using a serial console. We must recognize these devices here so that we can override the tty attach routine.
Diffstat (limited to 'sys/dev/uart/uart_cpu_sparc64.c')
-rw-r--r--sys/dev/uart/uart_cpu_sparc64.c47
1 files changed, 34 insertions, 13 deletions
diff --git a/sys/dev/uart/uart_cpu_sparc64.c b/sys/dev/uart/uart_cpu_sparc64.c
index 477c173..0cada13 100644
--- a/sys/dev/uart/uart_cpu_sparc64.c
+++ b/sys/dev/uart/uart_cpu_sparc64.c
@@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$");
#include <dev/uart/uart.h>
#include <dev/uart/uart_cpu.h>
+static phandle_t uart_cpu_getdev_keyboard(phandle_t root);
+
static struct bus_space_tag bst_store[3];
static int
@@ -65,6 +67,25 @@ uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
return ((b1->bsh == b2->bsh) ? 1 : 0);
}
+static phandle_t
+uart_cpu_getdev_keyboard(phandle_t root)
+{
+ phandle_t child;
+ phandle_t node;
+ char buf[32];
+
+ for (child = OF_child(root); child != 0 && child != -1;
+ child = OF_peer(child)) {
+ if (OF_getprop(child, "device_type", buf, sizeof(buf)) != -1 &&
+ !strcmp(buf, "serial") &&
+ OF_getprop(child, "keyboard", buf, sizeof(buf)) != -1)
+ return (child);
+ if ((node = uart_cpu_getdev_keyboard(child)) != -1)
+ return (node);
+ }
+ return (-1);
+}
+
int
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
{
@@ -86,20 +107,17 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
* I would assume that the user expects that FreeBSD uses the new
* console setting. There's choice choice, really.
*/
- if ((options = OF_finddevice("/options")) == -1)
- return (ENXIO);
- if (OF_getprop(options, "input-device", dev, sizeof(dev)) == -1)
- return (ENXIO);
- if ((input = OF_finddevice(dev)) == -1)
- return (ENXIO);
- if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1)
- return (ENXIO);
- if (strcmp(buf, "serial"))
- return (ENODEV);
- if (devtype == UART_DEV_KEYBOARD) {
- if (OF_getprop(input, "keyboard", buf, sizeof(buf)) == -1)
+ if ((options = OF_finddevice("/options")) == -1)
+ return (ENXIO);
+ if (devtype == UART_DEV_CONSOLE) {
+ if (OF_getprop(options, "input-device", dev, sizeof(dev)) == -1)
return (ENXIO);
- } else if (devtype == UART_DEV_CONSOLE) {
+ if ((input = OF_finddevice(dev)) == -1)
+ return (ENXIO);
+ if (OF_getprop(input, "device_type", buf, sizeof(buf)) == -1)
+ return (ENXIO);
+ if (strcmp(buf, "serial"))
+ return (ENODEV);
if (OF_getprop(options, "output-device", buf, sizeof(buf))
== -1)
return (ENXIO);
@@ -107,6 +125,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
return (ENXIO);
if (input != output)
return (ENXIO);
+ } else if (devtype == UART_DEV_KEYBOARD) {
+ if ((input = uart_cpu_getdev_keyboard(OF_peer(0))) == -1)
+ return (ENXIO);
} else
return (ENODEV);
OpenPOWER on IntegriCloud