From 17b69d1833aadfbf9c37fe27537c7d586483ccc8 Mon Sep 17 00:00:00 2001 From: eeh Date: Thu, 9 Nov 2000 00:02:54 +0000 Subject: [PATCH] Attach the sunkbd line discipline to zstty. --- sys/arch/sparc64/dev/kd.c | 3 +- sys/arch/sparc64/dev/zs.c | 60 ++++++++++++++++++++++++++++++--------- 2 files changed, 48 insertions(+), 15 deletions(-) diff --git a/sys/arch/sparc64/dev/kd.c b/sys/arch/sparc64/dev/kd.c index d402155f4f08..fa4ac9a29f2c 100644 --- a/sys/arch/sparc64/dev/kd.c +++ b/sys/arch/sparc64/dev/kd.c @@ -1,4 +1,4 @@ -/* $NetBSD: kd.c,v 1.14 2000/11/02 00:21:03 eeh Exp $ */ +/* $NetBSD: kd.c,v 1.15 2000/11/09 00:02:54 eeh Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -512,6 +512,7 @@ cons_attach_input(cc, cn) cc->cc_upstream = kd_cons_input; /* Attach lower level. */ + cn_hw->cn_dev = cn->cn_dev; cn_hw->cn_pollc = cn->cn_pollc; cn_hw->cn_getc = cn->cn_getc; diff --git a/sys/arch/sparc64/dev/zs.c b/sys/arch/sparc64/dev/zs.c index 520dd432568a..6bfd7377bfe4 100644 --- a/sys/arch/sparc64/dev/zs.c +++ b/sys/arch/sparc64/dev/zs.c @@ -1,4 +1,4 @@ -/* $NetBSD: zs.c,v 1.25 2000/07/10 01:11:14 eeh Exp $ */ +/* $NetBSD: zs.c,v 1.26 2000/11/09 00:02:54 eeh Exp $ */ /*- * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -69,11 +69,13 @@ #include #include +#include #include #include #include "kbd.h" /* NKBD */ +#include "ms.h" /* NMS */ #include "zs.h" /* NZS */ /* Make life easier for the initialized arrays here. */ @@ -288,6 +290,8 @@ zs_attach(zsc, zsd, pri) */ for (channel = 0; channel < 2; channel++) { struct zschan *zc; + struct device *child; + extern struct cfdriver zstty_cd; /* in ioconf.c */ zsc_args.channel = channel; cs = &zsc->zsc_cs_store[channel]; @@ -300,6 +304,7 @@ zs_attach(zsc, zsd, pri) zc = (channel == 0) ? &zsd->zs_chan_a : &zsd->zs_chan_b; + zsc_args.consdev = NULL; zsc_args.hwflags = zs_console_flags(zsc->zsc_promunit, zsc->zsc_node, channel); @@ -346,14 +351,53 @@ zs_attach(zsc, zsd, pri) * Look for a child driver for this channel. * The child attach will setup the hardware. */ - if (!config_found(&zsc->zsc_dev, (void *)&zsc_args, zs_print)) { + if (!(child = + config_found(&zsc->zsc_dev, (void *)&zsc_args, zs_print))) { /* No sub-driver. Just reset it. */ u_char reset = (channel == 0) ? ZSWR9_A_RESET : ZSWR9_B_RESET; s = splzs(); zs_write_reg(cs, 9, reset); splx(s); + } +#if (NKBD > 0) || (NMS > 0) + /* + * If this was a zstty it has a keyboard + * property on it we need to attach the + * sunkbd and sunms line disciplines. + */ + if (child + && (child->dv_cfdata->cf_driver == &zstty_cd) + && (getproplen(zsc->zsc_node, "keyboard") == 0)) { + struct kbd_ms_tty_attach_args kma; + struct zstty_softc { + /* The following are the only fields we need here */ + struct device zst_dev; + struct tty *zst_tty; + struct zs_chanstate *zst_cs; + } *zst = (struct zstty_softc *)child; + struct tty *tp; + int maj; + + kma.kmta_tp = tp = zst->zst_tty; + kma.kmta_dev = tp->t_dev; + kma.kmta_consdev = zsc_args.consdev; + + /* Attach 'em if we got 'em. */ +#if (NKBD > 0) + if (channel == 0) { + kma.kmta_name = "keyboard"; + config_found(child, (void *)&kma, NULL); + } +#endif +#if (NMS > 0) + if (channel == 1) { + kma.kmta_name = "mouse"; + config_found(child, (void *)&kma, NULL); + } +#endif } +#endif } /* @@ -381,18 +425,6 @@ zs_attach(zsc, zsd, pri) zs_write_reg(cs, 9, zs_init_reg[9]); splx(s); -#if 0 - /* - * XXX: L1A hack - We would like to be able to break into - * the debugger during the rest of autoconfiguration, so - * lower interrupts just enough to let zs interrupts in. - * This is done after both zs devices are attached. - */ - if (zsc->zsc_promunit == 1) { - printf("zs1: enabling zs interrupts\n"); - (void)splfd(); /* XXX: splzs - 1 */ - } -#endif } static int