Author: jhibbits
Date: Fri Jul 20 16:18:24 2018
New Revision: 336555
URL: https://svnweb.freebsd.org/changeset/base/336555

Log:
  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).

Modified:
  head/sys/dev/vt/hw/ofwfb/ofwfb.c

Modified: head/sys/dev/vt/hw/ofwfb/ofwfb.c
==============================================================================
--- head/sys/dev/vt/hw/ofwfb/ofwfb.c    Fri Jul 20 16:08:14 2018        
(r336554)
+++ head/sys/dev/vt/hw/ofwfb/ofwfb.c    Fri Jul 20 16:18:24 2018        
(r336555)
@@ -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 */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to