Allow sparc64-style attachment of mouse and keyboard via zstty, needed for

wscons support.
Reviewed by uwe.
This commit is contained in:
macallan 2005-06-30 12:07:51 +00:00
parent b2d2e5d059
commit 754d79402b
5 changed files with 81 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files.sparc,v 1.130 2004/09/14 16:51:58 jdolecek Exp $ # $NetBSD: files.sparc,v 1.131 2005/06/30 12:07:51 macallan Exp $
# @(#)files.sparc 8.1 (Berkeley) 7/19/93 # @(#)files.sparc 8.1 (Berkeley) 7/19/93
# sparc-specific configuration info # sparc-specific configuration info
@ -174,8 +174,9 @@ file dev/sun/kbd_zs.c kbd_zs # kbd lower layer
# sun keyboard at a tty line discipline # sun keyboard at a tty line discipline
# only used by sparc64, but we can test-compile it here # only used by sparc64, but we can test-compile it here
#attach kbd at zstty with kbd_tty attach kbd at zstty with kbd_tty
#file dev/sun/sunkbd.c kbd_tty # kbd lower layer file dev/sun/sunkbd.c kbd_tty # kbd lower layer
# shared middle layer for serial keyboard # shared middle layer for serial keyboard
file dev/sun/kbdsun.c kbd_zs | kbd_tty # kbd middle layer file dev/sun/kbdsun.c kbd_zs | kbd_tty # kbd middle layer
@ -191,8 +192,8 @@ file dev/sun/ms_zs.c ms_zs # mouse lower layer
# sun (mouse systems) mouse at a tty line discipline # sun (mouse systems) mouse at a tty line discipline
# only used by sparc64, but we can test-compile it here # only used by sparc64, but we can test-compile it here
#attach ms at zstty with ms_tty attach ms at zstty with ms_tty
#file dev/sun/sunms.c ms_tty # mouse lower layer file dev/sun/sunms.c ms_tty # mouse lower layer
# XXX: middle layer for sun (mouse systems) serial mice consists of # XXX: middle layer for sun (mouse systems) serial mice consists of
# just one function in dev/sun/ms.c (upper layer). Split it out? # just one function in dev/sun/ms.c (upper layer). Split it out?

View File

@ -1,4 +1,4 @@
# $NetBSD: majors.sparc,v 1.21 2005/06/03 13:15:04 blymn Exp $ # $NetBSD: majors.sparc,v 1.22 2005/06/30 12:07:51 macallan Exp $
# #
# Device majors for sparc # Device majors for sparc
# #
@ -16,7 +16,7 @@ device-major swap char 7 block 4
device-major xy char 9 block 3 xy device-major xy char 9 block 3 xy
device-major zstty char 12 zstty device-major zstty char 12 zstty
device-major ms char 13 ms device-major ms char 13 ms | sunms
device-major log char 16 device-major log char 16
device-major sd char 17 block 7 sd device-major sd char 17 block 7 sd

View File

@ -1,4 +1,4 @@
/* $NetBSD: kd.c,v 1.33 2005/06/03 22:17:18 martin Exp $ */ /* $NetBSD: kd.c,v 1.34 2005/06/30 12:07:51 macallan Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.33 2005/06/03 22:17:18 martin Exp $"); __KERNEL_RCSID(0, "$NetBSD: kd.c,v 1.34 2005/06/30 12:07:51 macallan Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "fb.h" #include "fb.h"
@ -553,7 +553,7 @@ char prom_stdout_args[16];
extern void prom_cnprobe(struct consdev *); extern void prom_cnprobe(struct consdev *);
static void prom_cninit(struct consdev *); static void prom_cninit(struct consdev *);
static int prom_cngetc(dev_t); int prom_cngetc(dev_t);
static void prom_cnputc(dev_t, int); static void prom_cnputc(dev_t, int);
extern void prom_cnpollc(dev_t, int); extern void prom_cnpollc(dev_t, int);
@ -609,7 +609,7 @@ prom_cnpollc(dev, on)
/* /*
* PROM console input putchar. * PROM console input putchar.
*/ */
static int int
prom_cngetc(dev) prom_cngetc(dev)
dev_t dev; dev_t dev;
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: zs.c,v 1.101 2004/04/03 17:43:50 chs Exp $ */ /* $NetBSD: zs.c,v 1.102 2005/06/30 12:07:51 macallan Exp $ */
/*- /*-
* Copyright (c) 1996 The NetBSD Foundation, Inc. * Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -45,7 +45,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.101 2004/04/03 17:43:50 chs Exp $"); __KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.102 2005/06/30 12:07:51 macallan Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_kgdb.h" #include "opt_kgdb.h"
@ -77,6 +77,10 @@ __KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.101 2004/04/03 17:43:50 chs Exp $");
#include <sparc/sparc/auxreg.h> #include <sparc/sparc/auxreg.h>
#include <sparc/sparc/auxiotwo.h> #include <sparc/sparc/auxiotwo.h>
#include <sparc/dev/cons.h> #include <sparc/dev/cons.h>
#include <dev/sun/kbd_ms_ttyvar.h>
#include "kbd.h"
#include "ms.h"
/* /*
* Some warts needed by z8530tty.c - * Some warts needed by z8530tty.c -
@ -190,6 +194,9 @@ int zs_enable __P((struct zs_chanstate *));
void zs_disable __P((struct zs_chanstate *)); void zs_disable __P((struct zs_chanstate *));
/* XXX from dev/ic/z8530tty.c */
extern struct tty *zstty_get_tty_from_dev(struct device *);
/* /*
* Is the zs chip present? * Is the zs chip present?
*/ */
@ -434,6 +441,7 @@ zs_attach(zsc, zsd, pri)
*/ */
for (channel = 0; channel < 2; channel++) { for (channel = 0; channel < 2; channel++) {
struct zschan *zc; struct zschan *zc;
struct device *child;
zsc_args.channel = channel; zsc_args.channel = channel;
cs = &zsc->zsc_cs_store[channel]; cs = &zsc->zsc_cs_store[channel];
@ -493,7 +501,9 @@ zs_attach(zsc, zsd, pri)
* Look for a child driver for this channel. * Look for a child driver for this channel.
* The child attach will setup the hardware. * The child attach will setup the hardware.
*/ */
if (!config_found(&zsc->zsc_dev, (void *)&zsc_args, zs_print)) {
child = config_found(&zsc->zsc_dev, &zsc_args, zs_print);
if (child == NULL) {
/* No sub-driver. Just reset it. */ /* No sub-driver. Just reset it. */
u_char reset = (channel == 0) ? u_char reset = (channel == 0) ?
ZSWR9_A_RESET : ZSWR9_B_RESET; ZSWR9_A_RESET : ZSWR9_B_RESET;
@ -501,6 +511,37 @@ zs_attach(zsc, zsd, pri)
zs_write_reg(cs, 9, reset); zs_write_reg(cs, 9, reset);
splx(s); 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 != NULL)
&& (strcmp(child->dv_cfdata->cf_name, "zstty") == 0)
&& (prom_getproplen(zsc->zsc_node, "keyboard") == 0))
{
struct kbd_ms_tty_attach_args kma;
struct tty *tp = zstty_get_tty_from_dev(child);
kma.kmta_tp = tp;
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, &kma, NULL);
}
#endif
#if (NMS > 0)
if (channel == 1) {
kma.kmta_name = "mouse";
config_found(child, &kma, NULL);
}
#endif
}
#endif
} }
/* /*
@ -543,6 +584,7 @@ zs_attach(zsc, zsd, pri)
(void)splfd(); /* XXX: splzs - 1 */ (void)splfd(); /* XXX: splzs - 1 */
} }
#endif #endif
} }
static int static int
@ -1033,3 +1075,9 @@ zs_disable(cs)
auxiotwoserialendis (ZS_DISABLE); auxiotwoserialendis (ZS_DISABLE);
cs->enabled = 0; cs->enabled = 0;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: z8530tty.c,v 1.98 2005/05/31 00:45:52 christos Exp $ */ /* $NetBSD: z8530tty.c,v 1.99 2005/06/30 12:07:51 macallan Exp $ */
/*- /*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999 * Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@ -137,7 +137,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.98 2005/05/31 00:45:52 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.99 2005/06/30 12:07:51 macallan Exp $");
#include "opt_kgdb.h" #include "opt_kgdb.h"
#include "opt_ntp.h" #include "opt_ntp.h"
@ -291,6 +291,22 @@ static void zstty_softint(struct zs_chanstate *);
#define ZSUNIT(x) (minor(x) & 0x7ffff) #define ZSUNIT(x) (minor(x) & 0x7ffff)
#define ZSDIALOUT(x) (minor(x) & 0x80000) #define ZSDIALOUT(x) (minor(x) & 0x80000)
struct tty *zstty_get_tty_from_dev(struct device *);
/*
* XXX get the (struct tty *) out of a (struct device *) we trust to be a
* (struct zstty_softc *) - needed by sparc/dev/zs.c, sparc64/dev/zs.c,
* sun3/dev/zs.c and sun2/dev/zs.c will probably need it at some point
*/
struct tty *
zstty_get_tty_from_dev(struct device *dev)
{
struct zstty_softc *sc = (struct zstty_softc *)dev;
return sc->zst_tty;
}
/* /*
* zstty_match: how is this zs channel configured? * zstty_match: how is this zs channel configured?
*/ */