Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys split the sun ms/kbd drivers into frontend/backend parts...
details: https://anonhg.NetBSD.org/src/rev/8b1a68b73635
branches: trunk
changeset: 472958:8b1a68b73635
user: mrg <mrg%NetBSD.org@localhost>
date: Fri May 14 06:42:02 1999 +0000
description:
split the sun ms/kbd drivers into frontend/backend parts at the serial
interface border, so that other serial interfaces can be attached to the
ms/kbd. zero functional changes and mostly involves moving code around
a bit. tested on the SS2.
this is necessary to attach the PCI ultrasparc keyboard/mouse drivers.
diffstat:
sys/arch/sparc/conf/files.sparc | 8 +-
sys/arch/sparc64/conf/files.sparc64 | 8 +-
sys/arch/sun3/conf/files.sun3 | 8 +-
sys/dev/sun/kbd.c | 415 +----------------------------------
sys/dev/sun/kbd_zs.c | 390 +++++++++++++++++++++++++++++++++
sys/dev/sun/ms.c | 316 +---------------------------
sys/dev/sun/ms_zs.c | 307 ++++++++++++++++++++++++++
7 files changed, 728 insertions(+), 724 deletions(-)
diffs (truncated from 1640 to 300 lines):
diff -r 15e5ed11a225 -r 8b1a68b73635 sys/arch/sparc/conf/files.sparc
--- a/sys/arch/sparc/conf/files.sparc Fri May 14 02:11:59 1999 +0000
+++ b/sys/arch/sparc/conf/files.sparc Fri May 14 06:42:02 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.sparc,v 1.74 1999/05/12 12:48:27 mrg Exp $
+# $NetBSD: files.sparc,v 1.75 1999/05/14 06:42:02 mrg Exp $
# @(#)files.sparc 8.1 (Berkeley) 7/19/93
# sparc-specific configuration info
@@ -101,13 +101,15 @@
file dev/sun/event.c zsevent
device kbd: zsevent
-attach kbd at zs
+attach kbd at zs with kbd_zs
+file dev/sun/kbd_zs.c kbd_zs
file dev/sun/kbd.c kbd needs-flag
file dev/sun/kbd_tables.c kbd
file arch/sparc/dev/kd.c kbd
device ms: zsevent
-attach ms at zs
+attach ms at zs with ms_zs
+file dev/sun/ms_zs.c ms_zs
file dev/sun/ms.c ms needs-flag
#
diff -r 15e5ed11a225 -r 8b1a68b73635 sys/arch/sparc64/conf/files.sparc64
--- a/sys/arch/sparc64/conf/files.sparc64 Fri May 14 02:11:59 1999 +0000
+++ b/sys/arch/sparc64/conf/files.sparc64 Fri May 14 06:42:02 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.sparc64,v 1.17 1999/04/17 21:27:00 kleink Exp $
+# $NetBSD: files.sparc64,v 1.18 1999/05/14 06:49:55 mrg Exp $
# @(#)files.sparc64 8.1 (Berkeley) 7/19/93
# sparc64-specific configuration info
@@ -69,13 +69,15 @@
file dev/sun/event.c zsevent
device kbd: zsevent
-attach kbd at zs
+attach kbd at zs with kbd_zs
+file dev/sun/kbd_zs.c kbd_zs
file dev/sun/kbd.c kbd needs-flag
file dev/sun/kbd_tables.c kbd
file arch/sparc64/dev/kd.c kbd
device ms: zsevent
-attach ms at zs
+attach ms at zs with ms_zs
+file dev/sun/ms_zs.c ms_zs
file dev/sun/ms.c ms needs-flag
diff -r 15e5ed11a225 -r 8b1a68b73635 sys/arch/sun3/conf/files.sun3
--- a/sys/arch/sun3/conf/files.sun3 Fri May 14 02:11:59 1999 +0000
+++ b/sys/arch/sun3/conf/files.sun3 Fri May 14 06:42:02 1999 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.sun3,v 1.52 1999/04/19 21:23:01 kleink Exp $
+# $NetBSD: files.sun3,v 1.53 1999/05/14 06:42:02 mrg Exp $
#
# sun3-specific configuration info
@@ -238,13 +238,15 @@
file dev/sun/event.c zsevent
device kbd: zsevent
-attach kbd at zsc
+attach kbd at zsc with kbd_zs
+file dev/sun/kbd_zs.c kbd_zs
file dev/sun/kbd.c kbd needs-flag
file dev/sun/kbd_tables.c kbd
file arch/sun3/dev/kd.c kbd
device ms: zsevent
-attach ms at zsc
+attach ms at zsc with ms_zs
+file dev/sun/ms_zs.c ms_zs
file dev/sun/ms.c ms needs-flag
diff -r 15e5ed11a225 -r 8b1a68b73635 sys/dev/sun/kbd.c
--- a/sys/dev/sun/kbd.c Fri May 14 02:11:59 1999 +0000
+++ b/sys/dev/sun/kbd.c Fri May 14 06:42:02 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kbd.c,v 1.21 1999/02/03 20:22:28 mycroft Exp $ */
+/* $NetBSD: kbd.c,v 1.22 1999/05/14 06:42:02 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -51,8 +51,6 @@
*/
/*
- * Zilog Z8530 Dual UART driver (keyboard interface)
- *
* This is the "slave" driver that will be attached to
* the "zsc" driver for a Sun keyboard.
*/
@@ -76,9 +74,10 @@
#include <machine/vuid_event.h>
#include <machine/kbd.h>
#include <machine/kbio.h>
+#include <dev/sun/event_var.h>
+#include <dev/sun/kbd_xlate.h>
+#include <dev/sun/kbdvar.h>
-#include "event_var.h"
-#include "kbd_xlate.h"
#include "locators.h"
/*
@@ -86,194 +85,18 @@
* /dev/kbd is not a tty (plain device)
*/
-/*
- * How many input characters we can buffer.
- * The port-specific var.h may override this.
- * Note: must be a power of two!
- */
-#define KBD_RX_RING_SIZE 256
-#define KBD_RX_RING_MASK (KBD_RX_RING_SIZE-1)
-/*
- * Output buffer. Only need a few chars.
- */
-#define KBD_TX_RING_SIZE 16
-#define KBD_TX_RING_MASK (KBD_TX_RING_SIZE-1)
-/*
- * Keyboard serial line speed is fixed at 1200 bps.
- */
-#define KBD_BPS 1200
-#define KBD_RESET_TIMO 1000 /* mS. */
-
-/*
- * XXX - Historical comment - no longer quite right...
- * Keyboard driver state. The ascii and kbd links go up and down and
- * we just sit in the middle doing translation. Note that it is possible
- * to get just one of the two links, in which case /dev/kbd is unavailable.
- * The downlink supplies us with `internal' open and close routines which
- * will enable dataflow across the downlink. We promise to call open when
- * we are willing to take keystrokes, and to call close when we are not.
- * If /dev/kbd is not the console tty input source, we do this whenever
- * /dev/kbd is in use; otherwise we just leave it open forever.
- */
-struct kbd_softc {
- struct device k_dev; /* required first: base device */
- struct zs_chanstate *k_cs;
-
- /* Flags to communicate with kbd_softint() */
- volatile int k_intr_flags;
-#define INTR_RX_OVERRUN 1
-#define INTR_TX_EMPTY 2
-#define INTR_ST_CHECK 4
-
- /* Transmit state */
- volatile int k_txflags;
-#define K_TXBUSY 1
-#define K_TXWANT 2
-
- /*
- * State of upper interface.
- */
- int k_isopen; /* set if open has been done */
- int k_evmode; /* set if we should produce events */
- struct evvar k_events; /* event queue state */
-
- /*
- * ACSI translation state
- */
- int k_repeat_start; /* initial delay */
- int k_repeat_step; /* inter-char delay */
- int k_repeatsym; /* repeating symbol */
- int k_repeating; /* we've called timeout() */
- struct kbd_state k_state; /* ASCII translation state */
-
- /*
- * Magic sequence stuff (L1-A)
- */
- char k_isconsole;
- char k_magic1_down;
- u_char k_magic1; /* L1 */
- u_char k_magic2; /* A */
-
- /*
- * The transmit ring buffer.
- */
- volatile u_int k_tbget; /* transmit buffer `get' index */
- volatile u_int k_tbput; /* transmit buffer `put' index */
- u_char k_tbuf[KBD_TX_RING_SIZE]; /* data */
-
- /*
- * The receive ring buffer.
- */
- u_int k_rbget; /* ring buffer `get' index */
- volatile u_int k_rbput; /* ring buffer `put' index */
- u_short k_rbuf[KBD_RX_RING_SIZE]; /* rr1, data pairs */
-
-};
-
/* Prototypes */
static void kbd_new_layout(struct kbd_softc *k);
-static void kbd_output(struct kbd_softc *k, int c);
static void kbd_repeat(void *arg);
static void kbd_set_leds(struct kbd_softc *k, int leds);
-static void kbd_start_tx(struct kbd_softc *k);
static void kbd_update_leds(struct kbd_softc *k);
static void kbd_was_reset(struct kbd_softc *k);
static int kbd_drain_tx(struct kbd_softc *k);
cdev_decl(kbd); /* open, close, read, write, ioctl, stop, ... */
-struct zsops zsops_kbd;
-
-/****************************************************************
- * Definition of the driver for autoconfig.
- ****************************************************************/
-
-static int kbd_match(struct device *, struct cfdata *, void *);
-static void kbd_attach(struct device *, struct device *, void *);
-
-struct cfattach kbd_ca = {
- sizeof(struct kbd_softc), kbd_match, kbd_attach
-};
-
extern struct cfdriver kbd_cd;
-/*
- * kbd_match: how is this zs channel configured?
- */
-int
-kbd_match(parent, cf, aux)
- struct device *parent;
- struct cfdata *cf;
- void *aux;
-{
- struct zsc_attach_args *args = aux;
-
- /* Exact match required for keyboard. */
- if (cf->cf_loc[ZSCCF_CHANNEL] == args->channel)
- return 2;
-
- return 0;
-}
-
-void
-kbd_attach(parent, self, aux)
- struct device *parent, *self;
- void *aux;
-
-{
- struct zsc_softc *zsc = (void *) parent;
- struct kbd_softc *k = (void *) self;
- struct zsc_attach_args *args = aux;
- struct zs_chanstate *cs;
- struct cfdata *cf;
- int channel, kbd_unit;
- int reset, s;
-
- cf = k->k_dev.dv_cfdata;
- kbd_unit = k->k_dev.dv_unit;
- channel = args->channel;
- cs = zsc->zsc_cs[channel];
- cs->cs_private = k;
- cs->cs_ops = &zsops_kbd;
- k->k_cs = cs;
-
- if (args->hwflags & ZS_HWFLAG_CONSOLE) {
- k->k_isconsole = 1;
- printf(" (console)");
- }
- printf("\n");
-
- /* Initialize the speed, etc. */
- s = splzs();
- if (k->k_isconsole == 0) {
- /* Not the console; may need reset. */
- reset = (channel == 0) ?
- ZSWR9_A_RESET : ZSWR9_B_RESET;
- zs_write_reg(cs, 9, reset);
- }
- /* These are OK as set by zscc: WR3, WR4, WR5 */
- /* We don't care about status interrupts. */
- cs->cs_preg[1] = ZSWR1_RIE | ZSWR1_TIE;
- (void) zs_set_speed(cs, KBD_BPS);
- zs_loadchannelregs(cs);
- splx(s);
-
- /* Do this before any calls to kbd_rint(). */
- kbd_xlate_init(&k->k_state);
-
- /* XXX - Do this in open? */
- k->k_repeat_start = hz/2;
- k->k_repeat_step = hz/20;
-
- /* Magic sequence. */
- k->k_magic1 = KBD_L1;
- k->k_magic2 = KBD_A;
-
- /* Now attach the (kd) pseudo-driver. */
Home |
Main Index |
Thread Index |
Old Index