vt/ofwfb: Fix brain-o from r336514, use the correct form of /chosen/stdout-path

/chosen/stdout-path is a string, not ihandle.  Treat it as such.

With this, ofwfb now starts correctly on a POWER9 system when launched from
the local console (not serial).
This commit is contained in:
Justin Hibbits 2018-07-20 16:18:24 +00:00
parent 2cc27fc069
commit 529f0e6c74

View File

@ -92,7 +92,7 @@ ofwfb_probe(struct vt_device *vd)
{
phandle_t chosen, node;
ihandle_t stdout;
char type[64];
char buf[64];
chosen = OF_finddevice("/chosen");
if (chosen == -1)
@ -103,9 +103,8 @@ ofwfb_probe(struct vt_device *vd)
sizeof(stdout))
node = OF_instance_to_package(stdout);
if (node == -1)
if (OF_getprop(chosen, "stdout-path", &stdout, sizeof(stdout)) ==
sizeof(stdout))
node = OF_instance_to_package(stdout);
if (OF_getprop(chosen, "stdout-path", buf, sizeof(buf)) > 0)
node = OF_finddevice(buf);
if (node == -1) {
/*
* The "/chosen/stdout" does not exist try
@ -113,8 +112,8 @@ ofwfb_probe(struct vt_device *vd)
*/
node = OF_finddevice("screen");
}
OF_getprop(node, "device_type", type, sizeof(type));
if (strcmp(type, "display") != 0)
OF_getprop(node, "device_type", buf, sizeof(buf));
if (strcmp(buf, "display") != 0)
return (CN_DEAD);
/* Looks OK... */
@ -355,7 +354,7 @@ static int
ofwfb_init(struct vt_device *vd)
{
struct ofwfb_softc *sc;
char type[64];
char buf[64];
phandle_t chosen;
phandle_t node;
uint32_t depth, height, width, stride;
@ -375,6 +374,13 @@ ofwfb_init(struct vt_device *vd)
if (OF_getprop(chosen, "stdout", &sc->sc_handle,
sizeof(ihandle_t)) == sizeof(ihandle_t))
node = OF_instance_to_package(sc->sc_handle);
if (node == -1)
/* Try "/chosen/stdout-path" now */
if (OF_getprop(chosen, "stdout-path", buf, sizeof(buf)) > 0) {
node = OF_finddevice(buf);
if (node != -1)
sc->sc_handle = OF_open(buf);
}
if (node == -1) {
/*
* The "/chosen/stdout" does not exist try
@ -383,8 +389,8 @@ ofwfb_init(struct vt_device *vd)
node = OF_finddevice("screen");
sc->sc_handle = OF_open("screen");
}
OF_getprop(node, "device_type", type, sizeof(type));
if (strcmp(type, "display") != 0)
OF_getprop(node, "device_type", buf, sizeof(buf));
if (strcmp(buf, "display") != 0)
return (CN_DEAD);
/* Keep track of the OF node */