aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/vt/hw/ofwfb/ofwfb.c
diff options
context:
space:
mode:
authorJustin Hibbits <jhibbits@FreeBSD.org>2018-07-20 16:18:24 +0000
committerJustin Hibbits <jhibbits@FreeBSD.org>2018-07-20 16:18:24 +0000
commit529f0e6c7477ad08e90f0293af5ab32fd0cb4c11 (patch)
tree9d6ab7fe3c8972cd9abf4be723fa0ec4f9d7e17e /sys/dev/vt/hw/ofwfb/ofwfb.c
parent2cc27fc0694270e7fb0d84e6de90a4a6922f831f (diff)
downloadsrc-529f0e6c7477ad08e90f0293af5ab32fd0cb4c11.tar.gz
src-529f0e6c7477ad08e90f0293af5ab32fd0cb4c11.zip
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).
Notes
Notes: svn path=/head/; revision=336555
Diffstat (limited to 'sys/dev/vt/hw/ofwfb/ofwfb.c')
-rw-r--r--sys/dev/vt/hw/ofwfb/ofwfb.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sys/dev/vt/hw/ofwfb/ofwfb.c b/sys/dev/vt/hw/ofwfb/ofwfb.c
index 73fcb9e0d65f..98be07fb4620 100644
--- a/sys/dev/vt/hw/ofwfb/ofwfb.c
+++ b/sys/dev/vt/hw/ofwfb/ofwfb.c
@@ -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 */