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)
This commit is contained in:
parent
aa14b5ab89
commit
ccf6415e82
@ -78,6 +78,27 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||||||
return (uart_getenv(devtype, di, class));
|
return (uart_getenv(devtype, di, class));
|
||||||
}
|
}
|
||||||
#else
|
#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
|
int
|
||||||
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
||||||
{
|
{
|
||||||
@ -94,15 +115,17 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
|
|||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
switch (devtype) {
|
switch (devtype) {
|
||||||
case UART_DEV_CONSOLE:
|
case UART_DEV_CONSOLE:
|
||||||
if (OF_getprop(opts, "input-device", buf, sizeof(buf)) == -1)
|
if (ofw_get_uart_console(opts, &input, "input-device",
|
||||||
return (ENXIO);
|
"output-device")) {
|
||||||
input = OF_finddevice(buf);
|
/*
|
||||||
if (input == -1)
|
* At least some G5 Xserves require that we
|
||||||
return (ENXIO);
|
* probe input-device-1 as well
|
||||||
if (OF_getprop(opts, "output-device", buf, sizeof(buf)) == -1)
|
*/
|
||||||
return (ENXIO);
|
|
||||||
if (OF_finddevice(buf) != input)
|
if (ofw_get_uart_console(opts, &input, "input-device-1",
|
||||||
return (ENXIO);
|
"output-device-1"))
|
||||||
|
return (ENXIO);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case UART_DEV_DBGPORT:
|
case UART_DEV_DBGPORT:
|
||||||
if (!getenv_string("hw.uart.dbgport", buf, sizeof(buf)))
|
if (!getenv_string("hw.uart.dbgport", buf, sizeof(buf)))
|
||||||
|
Loading…
Reference in New Issue
Block a user