From 4656497567e4bdef0ac78d98c27a55be9e2e4b2f Mon Sep 17 00:00:00 2001 From: jake Date: Mon, 18 Nov 2002 06:19:12 +0000 Subject: 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. --- sys/dev/ofw/ofw_console.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'sys/dev/ofw') 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 -- cgit v1.1