Author: nwhitehorn
Date: Mon Sep  9 16:51:35 2013
New Revision: 255424
URL: http://svnweb.freebsd.org/changeset/base/255424

Log:
  Make the primary name of the OF console device /dev/ofwcons, and only
  alias it to the contents of the output property if it is defined. This
  avoids a panic when booting machines (QEMU) where the output-device
  property is not defined.
  
  Since output-device is free-form and potentially conflicts with other
  entries in /dev, I also am not sure we should be doing the aliasing at
  all, but this at least makes things work again.
  
  Approved by:  re (kib)

Modified:
  head/sys/dev/ofw/ofw_console.c

Modified: head/sys/dev/ofw/ofw_console.c
==============================================================================
--- head/sys/dev/ofw/ofw_console.c      Mon Sep  9 15:38:51 2013        
(r255423)
+++ head/sys/dev/ofw/ofw_console.c      Mon Sep  9 16:51:35 2013        
(r255424)
@@ -88,17 +88,19 @@ cn_drvinit(void *unused)
 
        if (ofw_consdev.cn_pri != CN_DEAD &&
            ofw_consdev.cn_name[0] != '\0') {
-               if ((options = OF_finddevice("/options")) == -1 ||
-                   OF_getprop(options, "output-device", output,
-                   sizeof(output)) == -1)
-                       return;
+               tp = tty_alloc(&ofw_ttydevsw, NULL);
+               tty_makedev(tp, NULL, "%s", "ofwcons");
+
                /*
                 * XXX: This is a hack and it may result in two /dev/ttya
                 * XXX: devices on platforms where the sab driver works.
                 */
-               tp = tty_alloc(&ofw_ttydevsw, NULL);
-               tty_makedev(tp, NULL, "%s", output);
-               tty_makealias(tp, "ofwcons");
+               if ((options = OF_finddevice("/options")) == -1 ||
+                   OF_getprop(options, "output-device", output,
+                   sizeof(output)) == -1)
+                       return;
+               if (strlen(output) > 0)
+                       tty_makealias(tp, output);
        }
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to