diff options
author | jake <jake@FreeBSD.org> | 2002-11-18 06:19:12 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2002-11-18 06:19:12 +0000 |
commit | 4656497567e4bdef0ac78d98c27a55be9e2e4b2f (patch) | |
tree | 5ad38abd783623fc32aab1b7b44a042a4daeea5d /sys/dev/ofw | |
parent | 2c26b044049ba01123469a033021bf285611fc8a (diff) | |
download | FreeBSD-src-4656497567e4bdef0ac78d98c27a55be9e2e4b2f.zip FreeBSD-src-4656497567e4bdef0ac78d98c27a55be9e2e4b2f.tar.gz |
Create the ofwcons device at SI_SUB_CONFIGURE instead of SI_SUB_DRIVERS,
after configure() has run. Only create the device if ofwcons is the
highest priority console. Make a dev alias with the same name as the
firmware output-device property.
Diffstat (limited to 'sys/dev/ofw')
-rw-r--r-- | sys/dev/ofw/ofw_console.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index cce7fb8..aebc109 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -85,11 +85,20 @@ CONS_DRIVER(ofw, ofw_cons_probe, ofw_cons_init, NULL, ofw_cons_getc, static void cn_drvinit(void *unused) { - - make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "ofwcons"); + phandle_t options; + char output[32]; + + if (ofw_consdev.cn_dev != NULL) { + if ((options = OF_finddevice("/options")) == -1 || + OF_getprop(options, "output-device", output, + sizeof(output)) == -1) + return; + make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "ofwcons"); + make_dev_alias(ofw_consdev.cn_dev, "%s", output); + } } -SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL) +SYSINIT(cndev, SI_SUB_CONFIGURE, SI_ORDER_MIDDLE + CDEV_MAJOR, cn_drvinit, NULL) static int stdin; static int stdout; @@ -260,16 +269,16 @@ ofw_cons_probe(struct consdev *cp) return; } - cp->cn_dev = makedev(CDEV_MAJOR, 0); + cp->cn_dev = NULL; cp->cn_pri = CN_INTERNAL; - cp->cn_tp = ofw_tp; } static void ofw_cons_init(struct consdev *cp) { - return; + cp->cn_dev = makedev(CDEV_MAJOR, 0); + cp->cn_tp = ofw_tp; } static int |