aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Whitehorn <nwhitehorn@FreeBSD.org>2013-09-09 16:51:35 +0000
committerNathan Whitehorn <nwhitehorn@FreeBSD.org>2013-09-09 16:51:35 +0000
commit22b256dfcbcc52b278934fb9065e6dca8c0653d8 (patch)
treeef959d07875006465906d0fb96ffc27f11bfe421
parent58d839214e6ac0f1ea49260f85dc87e81071121a (diff)
downloadsrc-22b256dfcbcc52b278934fb9065e6dca8c0653d8.tar.gz
src-22b256dfcbcc52b278934fb9065e6dca8c0653d8.zip
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)
Notes
Notes: svn path=/head/; revision=255424
-rw-r--r--sys/dev/ofw/ofw_console.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c
index e71d5c19eb8f..01f86bf7fe84 100644
--- a/sys/dev/ofw/ofw_console.c
+++ b/sys/dev/ofw/ofw_console.c
@@ -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);
}
}