Try even harder to find a console before giving up.

This commit is contained in:
nwhitehorn 2013-10-26 20:06:50 +00:00
parent 177593dc9c
commit a363f4bb09

View File

@ -139,14 +139,19 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di)
/*
* Retrieve /chosen/std{in,out}.
*/
if ((chosen = OF_finddevice("/chosen")) == -1)
return (ENXIO);
for (name = propnames; *name != NULL; name++) {
if (phandle_chosen_propdev(chosen, *name, &node) == 0)
break;
node = -1;
if ((chosen = OF_finddevice("/chosen")) != -1) {
for (name = propnames; *name != NULL; name++) {
if (phandle_chosen_propdev(chosen, *name, &node) == 0)
break;
}
}
if (*name == NULL)
if (chosen == -1 || *name == NULL)
node = OF_finddevice("serial0"); /* Last ditch */
if (node == -1) /* Can't find anything */
return (ENXIO);
/*
* Retrieve serial attributes.
*/