From 8958bacd2b1d4b226ab5fd86f57b0fbcdbbb0acf Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 12 Oct 2004 21:23:33 +0000 Subject: Add a couple of XXX comments and fix a couple of fine points. I have not tried to make this a "canonical tty driver". --- sys/dev/ofw/ofw_console.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sys/dev/ofw') diff --git a/sys/dev/ofw/ofw_console.c b/sys/dev/ofw/ofw_console.c index 5b3b285..22bed0f 100644 --- a/sys/dev/ofw/ofw_console.c +++ b/sys/dev/ofw/ofw_console.c @@ -95,6 +95,10 @@ cn_drvinit(void *unused) OF_getprop(options, "output-device", output, sizeof(output)) == -1) return; + /* + * XXX: This is a hack and it may result in two /dev/ttya + * XXX: devices on platforms where the sab driver works. + */ dev = make_dev(&ofw_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "%s", output); make_dev_alias(dev, "ofwcons"); @@ -117,7 +121,15 @@ ofw_dev_open(struct cdev *dev, int flag, int mode, struct thread *td) setuptimeout = 0; unit = minor(dev); - tp = ofw_tp = dev->si_tty = ttymalloc(ofw_tp); + /* + * XXX: BAD, should happen at attach time + */ + if (dev->si_tty == NULL) { + ofw_tp = ttyalloc(); + dev->si_tty = ofw_tp; + ofw_tp->t_dev = dev; + } + tp = dev->si_tty; tp->t_oproc = ofw_tty_start; tp->t_param = ofw_tty_param; @@ -160,7 +172,7 @@ ofw_dev_close(struct cdev *dev, int flag, int mode, struct thread *td) struct tty *tp; unit = minor(dev); - tp = ofw_tp; + tp = dev->si_tty; if (unit != 0) { return (ENXIO); -- cgit v1.1