summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2009-07-23 12:51:27 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2009-07-23 12:51:27 +0000
commit28f5cdcb2a9e30a281f1e58946fa9f1710f07cad (patch)
treeb66ff8d4a53957f7b10baedc9acbd4b816efa1a4 /sys/dev
parent33ab52b1d12b8eca2d2f75a0e466029e0b41b7da (diff)
downloadFreeBSD-src-28f5cdcb2a9e30a281f1e58946fa9f1710f07cad.zip
FreeBSD-src-28f5cdcb2a9e30a281f1e58946fa9f1710f07cad.tar.gz
Fix serial console on Apple Xserve G5 by falling back to input-device-1
if input-device is unavailable. The Xserve G5 defaults to using screen/keyboard for output-device/input-device even if these are not installed, and then falls back to serial ports at boot time. Reviewed by: marcel Hardware from: grehan Approved by: re (kib)
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/uart/uart_cpu_powerpc.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/sys/dev/uart/uart_cpu_powerpc.c b/sys/dev/uart/uart_cpu_powerpc.c
index f97eda0..8e4c1da 100644
--- a/sys/dev/uart/uart_cpu_powerpc.c
+++ b/sys/dev/uart/uart_cpu_powerpc.c
@@ -78,6 +78,27 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
return (uart_getenv(devtype, di, class));
}
#else
+static int
+ofw_get_uart_console(phandle_t opts, phandle_t *result, const char *inputdev,
+ const char *outputdev)
+{
+ char buf[64];
+ phandle_t input;
+
+ if (OF_getprop(opts, inputdev, buf, sizeof(buf)) == -1)
+ return (ENXIO);
+ input = OF_finddevice(buf);
+ if (input == -1)
+ return (ENXIO);
+ if (OF_getprop(opts, outputdev, buf, sizeof(buf)) == -1)
+ return (ENXIO);
+ if (OF_finddevice(buf) != input)
+ return (ENXIO);
+
+ *result = input;
+ return (0);
+}
+
int
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
{
@@ -94,15 +115,17 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
return (ENXIO);
switch (devtype) {
case UART_DEV_CONSOLE:
- if (OF_getprop(opts, "input-device", buf, sizeof(buf)) == -1)
- return (ENXIO);
- input = OF_finddevice(buf);
- if (input == -1)
- return (ENXIO);
- if (OF_getprop(opts, "output-device", buf, sizeof(buf)) == -1)
- return (ENXIO);
- if (OF_finddevice(buf) != input)
- return (ENXIO);
+ if (ofw_get_uart_console(opts, &input, "input-device",
+ "output-device")) {
+ /*
+ * At least some G5 Xserves require that we
+ * probe input-device-1 as well
+ */
+
+ if (ofw_get_uart_console(opts, &input, "input-device-1",
+ "output-device-1"))
+ return (ENXIO);
+ }
break;
case UART_DEV_DBGPORT:
if (!getenv_string("hw.uart.dbgport", buf, sizeof(buf)))
OpenPOWER on IntegriCloud