summaryrefslogtreecommitdiff
path: root/sys/dev/sun
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1997-08-08 08:17:21 +0000
committerJason Downs <downsj@cvs.openbsd.org>1997-08-08 08:17:21 +0000
commit7821f17fddb4a6d07986dcec35b5853ba97a0d1b (patch)
tree4ab17be4cb15f5a7b51aaba09e01828619e6c736 /sys/dev/sun
parent19e72f4e42c523b94256ffd89b7ab9ac14bab51f (diff)
Mostly sync to NetBSD-current 970804 + tags.
Diffstat (limited to 'sys/dev/sun')
-rw-r--r--sys/dev/sun/event.c1
-rw-r--r--sys/dev/sun/event_var.h1
-rw-r--r--sys/dev/sun/files.sun6
-rw-r--r--sys/dev/sun/kbd.c118
-rw-r--r--sys/dev/sun/kbd_tables.c58
-rw-r--r--sys/dev/sun/kbd_tables.h16
-rw-r--r--sys/dev/sun/kbd_xlate.h5
-rw-r--r--sys/dev/sun/ms.c60
8 files changed, 142 insertions, 123 deletions
diff --git a/sys/dev/sun/event.c b/sys/dev/sun/event.c
index 079e012ef8c..b159ce0b5b2 100644
--- a/sys/dev/sun/event.c
+++ b/sys/dev/sun/event.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: event.c,v 1.3 1997/08/08 08:17:11 downsj Exp $ */
/* $NetBSD: event.c,v 1.2 1996/05/29 21:24:41 pk Exp $ */
/*
diff --git a/sys/dev/sun/event_var.h b/sys/dev/sun/event_var.h
index 0f29b0d9d67..77ba4542d8c 100644
--- a/sys/dev/sun/event_var.h
+++ b/sys/dev/sun/event_var.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: event_var.h,v 1.2 1997/08/08 08:17:13 downsj Exp $ */
/* $NetBSD: event_var.h,v 1.1.1.1 1996/01/24 01:15:34 gwr Exp $ */
/*
diff --git a/sys/dev/sun/files.sun b/sys/dev/sun/files.sun
new file mode 100644
index 00000000000..a7440281c9e
--- /dev/null
+++ b/sys/dev/sun/files.sun
@@ -0,0 +1,6 @@
+# $OpenBSD: files.sun,v 1.1 1997/08/08 08:17:14 downsj Exp $
+# $NetBSD: files.sun,v 1.1 1996/05/29 21:54:34 pk Exp $
+#
+# Configuration file for devices found on Sun machines.
+#
+file dev/sun/event.c
diff --git a/sys/dev/sun/kbd.c b/sys/dev/sun/kbd.c
index e730df0e5d5..ba522659602 100644
--- a/sys/dev/sun/kbd.c
+++ b/sys/dev/sun/kbd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kbd.c,v 1.6 1997/01/15 07:09:29 kstailey Exp $ */
-/* $NetBSD: kbd.c,v 1.8 1996/05/17 19:32:06 gwr Exp $ */
+/* $OpenBSD: kbd.c,v 1.7 1997/08/08 08:17:15 downsj Exp $ */
+/* $NetBSD: kbd.c,v 1.14 1997/07/17 01:17:45 jtk Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -60,15 +60,17 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/device.h>
#include <sys/conf.h>
-#include <sys/file.h>
+#include <sys/device.h>
#include <sys/ioctl.h>
+#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/time.h>
-#include <sys/kernel.h>
#include <sys/syslog.h>
+#include <sys/select.h>
+#include <sys/poll.h>
#include <dev/ic/z8530reg.h>
#include <machine/z8530var.h>
@@ -78,6 +80,7 @@
#include "event_var.h"
#include "kbd_xlate.h"
+#include "locators.h"
/*
* Ideas:
@@ -169,17 +172,14 @@ struct kbd_softc {
};
/* Prototypes */
-int kbd_docmd(struct kbd_softc *k, int cmd);
-int kbd_iopen(int unit);
-void kbd_new_layout(struct kbd_softc *k);
-void kbd_output(struct kbd_softc *k, int c);
-void kbd_repeat(void *arg);
-void kbd_set_leds(struct kbd_softc *k, int leds);
-void kbd_start_tx(struct kbd_softc *k);
-void kbd_update_leds(struct kbd_softc *k);
-void kbd_was_reset(struct kbd_softc *k);
-
-extern void kd_input(int ascii);
+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, ... */
@@ -189,18 +189,8 @@ struct zsops zsops_kbd;
* Definition of the driver for autoconfig.
****************************************************************/
-static int kbd_match __P((struct device *, void *, void *));
-static void kbd_attach __P((struct device *, struct device *, void *));
-
-static int kbd_drain_tx __P((struct kbd_softc *));
-static void kbd_input_string __P((struct kbd_softc *, char *str));
-static void kbd_input_funckey __P((struct kbd_softc *,register int));
-static void kbd_input_keysym __P((struct kbd_softc *,register int));
-static void kbd_input_raw __P((struct kbd_softc *,register int));
-static void kbd_rxint __P((register struct zs_chanstate *));
-static void kbd_txint __P((register struct zs_chanstate *));
-static void kbd_stint __P((register struct zs_chanstate *));
-static void kbd_softint __P((register struct zs_chanstate *));
+static int kbd_match(struct device *, void *, void *);
+static void kbd_attach(struct device *, struct device *, void *);
struct cfattach kbd_ca = {
sizeof(struct kbd_softc), kbd_match, kbd_attach
@@ -215,15 +205,15 @@ struct cfdriver kbd_cd = {
* kbd_match: how is this zs channel configured?
*/
int
-kbd_match(parent, match, aux)
+kbd_match(parent, vcf, aux)
struct device *parent;
- void *match, *aux;
+ void *vcf, *aux;
{
- struct cfdata *cf = match;
+ struct cfdata *cf = vcf;
struct zsc_attach_args *args = aux;
/* Exact match required for keyboard. */
- if (cf->cf_loc[0] == args->channel)
+ if (cf->cf_loc[ZSCCF_CHANNEL] == args->channel)
return 2;
return 0;
@@ -241,12 +231,12 @@ kbd_attach(parent, self, aux)
struct zs_chanstate *cs;
struct cfdata *cf;
int channel, kbd_unit;
- int reset, s, tconst;
+ 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 = zsc->zsc_cs[channel];
cs->cs_private = k;
cs->cs_ops = &zsops_kbd;
k->k_cs = cs;
@@ -258,7 +248,6 @@ kbd_attach(parent, self, aux)
printf("\n");
/* Initialize the speed, etc. */
- tconst = BPS_TO_TCONST(cs->cs_brg_clk, KBD_BPS);
s = splzs();
if (k->k_isconsole == 0) {
/* Not the console; may need reset. */
@@ -267,9 +256,9 @@ kbd_attach(parent, self, aux)
zs_write_reg(cs, 9, reset);
}
/* These are OK as set by zscc: WR3, WR4, WR5 */
- cs->cs_preg[5] |= ZSWR5_DTR | ZSWR5_RTS;
- cs->cs_preg[12] = tconst;
- cs->cs_preg[13] = tconst >> 8;
+ /* 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);
@@ -505,7 +494,7 @@ kbd_iockeymap(ks, cmd, kio)
u_long cmd;
struct kiockeymap *kio;
{
- struct keymap *km;
+ u_short *km;
u_int station;
switch (kio->kio_tablemask) {
@@ -534,11 +523,11 @@ kbd_iockeymap(ks, cmd, kio)
switch (cmd) {
case KIOCGKEY: /* Get keymap entry */
- kio->kio_entry = km->keymap[station];
+ kio->kio_entry = km[station];
break;
case KIOCSKEY: /* Set keymap entry */
- km->keymap[station] = kio->kio_entry;
+ km[station] = kio->kio_entry;
break;
default:
@@ -659,6 +648,10 @@ kbd_iocsled(k, data)
* - raw key codes to keysym
****************************************************************/
+static void kbd_input_string __P((struct kbd_softc *, char *));
+static void kbd_input_funckey __P((struct kbd_softc *, int));
+static void kbd_input_keysym __P((struct kbd_softc *, int));
+static void kbd_input_raw __P((struct kbd_softc *k, int));
/*
* Initialization done by either kdcninit or kbd_iopen
@@ -690,7 +683,7 @@ kbd_code_to_keysym(ks, c)
register struct kbd_state *ks;
register int c;
{
- struct keymap *km;
+ u_short *km;
int keysym;
/*
@@ -713,7 +706,7 @@ kbd_code_to_keysym(ks, c)
*/
return (KEYSYM_NOP);
}
- keysym = km->keymap[KEY_CODE(c)];
+ keysym = km[KEY_CODE(c)];
/*
* Post-processing for Caps-lock
@@ -737,7 +730,7 @@ kbd_code_to_keysym(ks, c)
return (keysym);
}
-static void
+void
kbd_input_string(k, str)
struct kbd_softc *k;
char *str;
@@ -748,7 +741,7 @@ kbd_input_string(k, str)
}
}
-static void
+void
kbd_input_funckey(k, keysym)
struct kbd_softc *k;
register int keysym;
@@ -769,7 +762,7 @@ kbd_input_funckey(k, keysym)
* This is called by kbd_input_raw() or by kb_repeat()
* to deliver ASCII input. Called at spltty().
*/
-static void
+void
kbd_input_keysym(k, keysym)
struct kbd_softc *k;
register int keysym;
@@ -830,7 +823,7 @@ kbd_input_keysym(k, keysym)
* This is the autorepeat timeout function.
* Called at splsoftclock().
*/
-void
+static void
kbd_repeat(void *arg)
{
struct kbd_softc *k = (struct kbd_softc *)arg;
@@ -961,6 +954,11 @@ kbd_input_raw(k, c)
* Interface to the lower layer (zscc)
****************************************************************/
+static void kbd_rxint __P((struct zs_chanstate *));
+static void kbd_txint __P((struct zs_chanstate *));
+static void kbd_stint __P((struct zs_chanstate *));
+static void kbd_softint __P((struct zs_chanstate *));
+
static void
kbd_rxint(cs)
register struct zs_chanstate *cs;
@@ -993,7 +991,7 @@ kbd_rxint(cs)
k->k_magic1_down = 0;
if ((c == k->k_magic2) && k->k_isconsole) {
/* Magic "L1-A" sequence; enter debugger. */
- zs_abort();
+ zs_abort(cs);
/* Debugger done. Fake L1-up to finish it. */
c = k->k_magic1 | KBD_UP;
}
@@ -1050,11 +1048,18 @@ kbd_stint(cs)
#if 0
if (rr0 & ZSRR0_BREAK) {
/* Keyboard unplugged? */
- zs_abort();
+ zs_abort(cs);
return (0);
}
#endif
+ /*
+ * We have to accumulate status line changes here.
+ * Otherwise, if we get multiple status interrupts
+ * before the softint runs, we could fail to notice
+ * some status line changes in the softint routine.
+ * Fix from Bill Studenmund, October 1996.
+ */
cs->cs_rr0_delta |= (cs->cs_rr0 ^ rr0);
cs->cs_rr0 = rr0;
k->k_intr_flags |= INTR_ST_CHECK;
@@ -1230,7 +1235,7 @@ out:
/*
* Called by kbd_input_raw, at spltty()
*/
-void
+static void
kbd_was_reset(k)
struct kbd_softc *k;
{
@@ -1275,7 +1280,7 @@ kbd_was_reset(k)
/*
* Called by kbd_input_raw, at spltty()
*/
-void
+static void
kbd_new_layout(k)
struct kbd_softc *k;
{
@@ -1316,7 +1321,7 @@ kbd_drain_tx(k)
* Enqueue some output for the keyboard
* Called at spltty().
*/
-void
+static void
kbd_output(k, c)
struct kbd_softc *k;
int c; /* the data */
@@ -1341,7 +1346,7 @@ kbd_output(k, c)
* Start the sending data from the output queue
* Called at spltty().
*/
-void
+static void
kbd_start_tx(k)
struct kbd_softc *k;
{
@@ -1379,7 +1384,7 @@ kbd_start_tx(k)
* Called at spltty by:
* kbd_update_leds, kbd_iocsled
*/
-void
+static void
kbd_set_leds(k, new_leds)
struct kbd_softc *k;
int new_leds;
@@ -1405,7 +1410,7 @@ kbd_set_leds(k, new_leds)
* Called at spltty by:
* kbd_input_keysym
*/
-void
+static void
kbd_update_leds(k)
struct kbd_softc *k;
{
@@ -1422,3 +1427,4 @@ kbd_update_leds(k)
kbd_set_leds(k, leds);
}
+
diff --git a/sys/dev/sun/kbd_tables.c b/sys/dev/sun/kbd_tables.c
index 7b22797591a..52e1b92c0ed 100644
--- a/sys/dev/sun/kbd_tables.c
+++ b/sys/dev/sun/kbd_tables.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kbd_tables.c,v 1.3 1997/01/15 07:00:19 kstailey Exp $ */
-/* $NetBSD: kbd_tables.c,v 1.2 1996/02/29 19:32:18 gwr Exp $ */
+/* $OpenBSD: kbd_tables.c,v 1.4 1997/08/08 08:17:16 downsj Exp $ */
+/* $NetBSD: kbd_tables.c,v 1.4 1997/05/02 17:41:37 gwr Exp $ */
/*
* Copyright (c) 1996 Gordon W. Ross
@@ -35,26 +35,20 @@
* Keyboard translation tables. (See kbd_tables.h)
*/
-#define _KERNEL 1
-#include "kbd_tables.h"
+#include <sys/types.h>
+#define _KERNEL 1 /* XXX */
+#include "kbd_tables.h"
-/*
- * Toggle keys are not yet supported, but could be with
- * fairly simple changes. Both CapsLock and NumLock
- * could be easily done with "post-translation" on the
- * keysymbols from these tables (WITHOUT new tables).
- *
- * The "compose" operations are not implemented.
- */
+/* The "compose" operations are not implemented. */
#define KEYSYM_COMPOSE KEYSYM_NOP
/*
* Key release codes are decoded in this map.
*/
-struct keymap keymap_release = {{
+u_short keymap_release[KEYMAP_SIZE] = {
/* 0: */ KEYSYM_HOLE,
/* 1: L1/Stop */ KEYSYM_NOP,
/* 2: */ KEYSYM_HOLE,
@@ -183,14 +177,14 @@ struct keymap keymap_release = {{
/* 125: KP_Add */ KEYSYM_NOP,
/* 126: */ KEYSYM_LAYOUT, /* layout next */
/* 127: */ KEYSYM_RESET, /* kbd ID next */
-}};
+};
/*
* This map is used when a control key is down.
*/
#define CTL(c) ((c)&0x1F)
-struct keymap keymap_control = {{
+u_short keymap_control[KEYMAP_SIZE] = {
/* 0: */ KEYSYM_HOLE,
/* 1: L1/Stop */ KEYSYM_NOP,
/* 2: */ KEYSYM_HOLE,
@@ -319,7 +313,7 @@ struct keymap keymap_control = {{
/* 125: KP_Add */ KEYSYM_NOP,
/* 126: */ KEYSYM_HW_ERR,
/* 127: */ KEYSYM_ALL_UP,
-}};
+};
#undef CTL
@@ -328,7 +322,7 @@ struct keymap keymap_control = {{
* (lower-case, upper-case)
*/
-struct keymap keymap_s3_lc = {{
+u_short keymap_s3_lc[KEYMAP_SIZE] = {
/* 0: */ KEYSYM_HOLE,
/* 1: L1/Stop */ KEYSYM_FUNC_L(1),
/* 2: */ KEYSYM_HOLE,
@@ -457,10 +451,10 @@ struct keymap keymap_s3_lc = {{
/* 125: KP_Add */ KEYSYM_HOLE,
/* 126: */ KEYSYM_HW_ERR,
/* 127: */ KEYSYM_ALL_UP,
-}};
+};
-struct keymap keymap_s3_uc = {{
+u_short keymap_s3_uc[KEYMAP_SIZE] = {
/* 0: */ KEYSYM_HOLE,
/* 1: L1/Stop */ KEYSYM_FUNC_L(1),
/* 2: */ KEYSYM_HOLE,
@@ -589,7 +583,7 @@ struct keymap keymap_s3_uc = {{
/* 125: KP_Add */ KEYSYM_HOLE,
/* 126: */ KEYSYM_HW_ERR,
/* 127: */ KEYSYM_ALL_UP,
-}};
+};
/*
@@ -597,7 +591,7 @@ struct keymap keymap_s3_uc = {{
* (lower-case, upper-case)
*/
-struct keymap keymap_s4_lc = {{
+u_short keymap_s4_lc[KEYMAP_SIZE] = {
/* 0: */ KEYSYM_HOLE,
/* 1: L1/Stop */ KEYSYM_FUNC_L(1),
/* 2: */ KEYSYM_HOLE,
@@ -726,10 +720,10 @@ struct keymap keymap_s4_lc = {{
/* 125: KP_Add */ KEYSYM_FUNC_N(14),
/* 126: */ KEYSYM_HW_ERR,
/* 127: */ KEYSYM_ALL_UP,
-}};
+};
-struct keymap keymap_s4_uc = {{
+u_short keymap_s4_uc[KEYMAP_SIZE] = {
/* 0: */ KEYSYM_HOLE,
/* 1: L1/Stop */ KEYSYM_FUNC_L(1),
/* 2: */ KEYSYM_HOLE,
@@ -858,7 +852,7 @@ struct keymap keymap_s4_uc = {{
/* 125: KP_Add */ KEYSYM_FUNC_N(14),
/* 126: */ KEYSYM_HW_ERR,
/* 127: */ KEYSYM_ALL_UP,
-}};
+};
@@ -908,17 +902,17 @@ unsigned short kbd_numlock_map[64] = {
#define kbd_type2 kbd_type3
static struct keyboard kbd_type3 = {
- &keymap_release,
- &keymap_control,
- &keymap_s3_lc,
- &keymap_s3_uc,
+ keymap_release,
+ keymap_control,
+ keymap_s3_lc,
+ keymap_s3_uc,
};
static struct keyboard kbd_type4 = {
- &keymap_release,
- &keymap_control,
- &keymap_s4_lc,
- &keymap_s4_uc,
+ keymap_release,
+ keymap_control,
+ keymap_s4_lc,
+ keymap_s4_uc,
};
/* Treat type 5 as type 4 (close enough) */
diff --git a/sys/dev/sun/kbd_tables.h b/sys/dev/sun/kbd_tables.h
index 3cc6d8a7ca7..831b993316c 100644
--- a/sys/dev/sun/kbd_tables.h
+++ b/sys/dev/sun/kbd_tables.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: kbd_tables.h,v 1.2 1996/04/18 23:48:17 niklas Exp $ */
-/* $NetBSD: kbd_tables.h,v 1.3 1996/02/29 19:37:53 gwr Exp $ */
+/* $OpenBSD: kbd_tables.h,v 1.3 1997/08/08 08:17:17 downsj Exp $ */
+/* $NetBSD: kbd_tables.h,v 1.4 1996/12/17 20:46:14 gwr Exp $ */
/*
* Copyright (c) 1996 Gordon W. Ross
@@ -130,15 +130,11 @@
#define KEYMAP_SIZE 128
-struct keymap {
- unsigned short keymap[KEYMAP_SIZE];
-};
-
struct keyboard {
- struct keymap *k_release; /* Key released */
- struct keymap *k_control; /* Ctrl is down */
- struct keymap *k_normal; /* No shifts */
- struct keymap *k_shifted; /* Shift is down */
+ u_short *k_release; /* Key released */
+ u_short *k_control; /* Ctrl is down */
+ u_short *k_normal; /* No shifts */
+ u_short *k_shifted; /* Shift is down */
};
extern char kbd_stringtab[16][10];
diff --git a/sys/dev/sun/kbd_xlate.h b/sys/dev/sun/kbd_xlate.h
index 4a84b3542aa..ac6fd00d346 100644
--- a/sys/dev/sun/kbd_xlate.h
+++ b/sys/dev/sun/kbd_xlate.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: kbd_xlate.h,v 1.2 1997/01/15 07:09:31 kstailey Exp $ */
-/* $NetBSD: kbd_xlate.h,v 1.1.1.1 1996/01/24 01:15:35 gwr Exp $ */
+/* $OpenBSD: kbd_xlate.h,v 1.3 1997/08/08 08:17:19 downsj Exp $ */
+/* $NetBSD: kbd_xlate.h,v 1.2 1996/12/17 20:46:15 gwr Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -90,3 +90,4 @@ extern int kbd_code_to_keysym __P((struct kbd_state *ks, int c));
extern int kbd_iopen __P((int unit));
extern void kd_init __P((int unit));
extern void kd_input __P((int c));
+
diff --git a/sys/dev/sun/ms.c b/sys/dev/sun/ms.c
index f8c18c78adc..c75f6f9d244 100644
--- a/sys/dev/sun/ms.c
+++ b/sys/dev/sun/ms.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ms.c,v 1.6 1997/01/15 07:09:33 kstailey Exp $ */
-/* $NetBSD: ms.c,v 1.6 1996/05/17 19:32:09 gwr Exp $ */
+/* $OpenBSD: ms.c,v 1.7 1997/08/08 08:17:20 downsj Exp $ */
+/* $NetBSD: ms.c,v 1.12 1997/07/17 01:17:47 jtk Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -58,19 +58,25 @@
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/proc.h>
-#include <sys/device.h>
#include <sys/conf.h>
+#include <sys/device.h>
#include <sys/ioctl.h>
#include <sys/kernel.h>
+#include <sys/proc.h>
+#include <sys/signal.h>
#include <sys/signalvar.h>
+#include <sys/time.h>
#include <sys/syslog.h>
+#include <sys/select.h>
+#include <sys/poll.h>
+
+#include <machine/vuid_event.h>
#include <dev/ic/z8530reg.h>
#include <machine/z8530var.h>
-#include <machine/vuid_event.h>
#include "event_var.h"
+#include "locators.h"
/*
* How many input characters we can buffer.
@@ -141,14 +147,8 @@ struct zsops zsops_ms;
* Definition of the driver for autoconfig.
****************************************************************/
-static int ms_match __P((struct device *, void *, void *));
-static void ms_attach __P((struct device *, struct device *, void *));
-
-static void ms_input __P((register struct ms_softc *, register int));
-static void ms_rxint __P((register struct zs_chanstate *));
-static void ms_txint __P((register struct zs_chanstate *));
-static void ms_stint __P((register struct zs_chanstate *));
-static void ms_softint __P((struct zs_chanstate *));
+static int ms_match(struct device *, void *, void *);
+static void ms_attach(struct device *, struct device *, void *);
struct cfattach ms_ca = {
sizeof(struct ms_softc), ms_match, ms_attach
@@ -163,15 +163,15 @@ struct cfdriver ms_cd = {
* ms_match: how is this zs channel configured?
*/
int
-ms_match(parent, match, aux)
+ms_match(parent, vcf, aux)
struct device *parent;
- void *match, *aux;
+ void *vcf, *aux;
{
- struct cfdata *cf = match;
+ struct cfdata *cf = vcf;
struct zsc_attach_args *args = aux;
/* Exact match required for keyboard. */
- if (cf->cf_loc[0] == args->channel)
+ if (cf->cf_loc[ZSCCF_CHANNEL] == args->channel)
return 2;
return 0;
@@ -189,12 +189,12 @@ ms_attach(parent, self, aux)
struct zs_chanstate *cs;
struct cfdata *cf;
int channel, ms_unit;
- int reset, s, tconst;
+ int reset, s;
cf = ms->ms_dev.dv_cfdata;
ms_unit = ms->ms_dev.dv_unit;
channel = args->channel;
- cs = &zsc->zsc_cs[channel];
+ cs = zsc->zsc_cs[channel];
cs->cs_private = ms;
cs->cs_ops = &zsops_ms;
ms->ms_cs = cs;
@@ -202,16 +202,15 @@ ms_attach(parent, self, aux)
printf("\n");
/* Initialize the speed, etc. */
- tconst = BPS_TO_TCONST(cs->cs_brg_clk, MS_BPS);
s = splzs();
/* 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 */
- cs->cs_preg[5] |= ZSWR5_DTR | ZSWR5_RTS;
- cs->cs_preg[12] = tconst;
- cs->cs_preg[13] = tconst >> 8;
+ /* We don't care about status or tx interrupts. */
+ cs->cs_preg[1] = ZSWR1_RIE;
+ (void) zs_set_speed(cs, MS_BPS);
zs_loadchannelregs(cs);
splx(s);
@@ -345,6 +344,9 @@ msselect(dev, rw, p)
* Middle layer (translator)
****************************************************************/
+static void ms_input __P((struct ms_softc *, int c));
+
+
/*
* Called by our ms_softint() routine on input.
*/
@@ -486,6 +488,11 @@ out:
* Interface to the lower layer (zscc)
****************************************************************/
+static void ms_rxint __P((struct zs_chanstate *));
+static void ms_txint __P((struct zs_chanstate *));
+static void ms_stint __P((struct zs_chanstate *));
+static void ms_softint __P((struct zs_chanstate *));
+
static void
ms_rxint(cs)
register struct zs_chanstate *cs;
@@ -554,6 +561,13 @@ ms_stint(cs)
rr0 = zs_read_csr(cs);
zs_write_csr(cs, ZSWR0_RESET_STATUS);
+ /*
+ * We have to accumulate status line changes here.
+ * Otherwise, if we get multiple status interrupts
+ * before the softint runs, we could fail to notice
+ * some status line changes in the softint routine.
+ * Fix from Bill Studenmund, October 1996.
+ */
cs->cs_rr0_delta |= (cs->cs_rr0 ^ rr0);
cs->cs_rr0 = rr0;
ms->ms_intr_flags |= INTR_ST_CHECK;