Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-6]: src/sys/arch/luna68k/dev Pull up following revision(s) (reque...
details: https://anonhg.NetBSD.org/src/rev/44b5c3cd862d
branches: netbsd-6
changeset: 776544:44b5c3cd862d
user: bouyer <bouyer%NetBSD.org@localhost>
date: Sun Jan 12 12:21:16 2014 +0000
description:
Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/arch/luna68k/dev/siotty.c: revision 1.35
sys/arch/luna68k/dev/siotty.c: revision 1.36
sys/arch/luna68k/dev/siotty.c: revision 1.37
sys/arch/luna68k/dev/siotty.c: revision 1.38
sys/arch/luna68k/dev/lunaws.c: revision 1.25
sys/arch/luna68k/dev/lunaws.c: revision 1.26
sys/arch/luna68k/dev/lunaws.c: revision 1.27
sys/arch/luna68k/dev/siovar.h: revision 1.7
sys/arch/luna68k/dev/siotty.c: revision 1.34
struct device * -> device_t, use device_xname() (from chs@)
Whitespace cleanup.
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
Tab/space cleanup.
Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.
Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler
Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
Remove initialization of unused t_softc in struct tty (to make pullup easier).
diffstat:
sys/arch/luna68k/dev/lunaws.c | 124 +++++++++++-------
sys/arch/luna68k/dev/siotty.c | 278 ++++++++++++++++++++++++++++++++---------
sys/arch/luna68k/dev/siovar.h | 4 +-
3 files changed, 291 insertions(+), 115 deletions(-)
diffs (truncated from 748 to 300 lines):
diff -r 2e21c2c4c846 -r 44b5c3cd862d sys/arch/luna68k/dev/lunaws.c
--- a/sys/arch/luna68k/dev/lunaws.c Sun Jan 12 12:16:51 2014 +0000
+++ b/sys/arch/luna68k/dev/lunaws.c Sun Jan 12 12:21:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lunaws.c,v 1.23.8.1 2012/07/25 21:30:35 martin Exp $ */
+/* $NetBSD: lunaws.c,v 1.23.8.2 2014/01/12 12:21:16 bouyer Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.23.8.1 2012/07/25 21:30:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lunaws.c,v 1.23.8.2 2014/01/12 12:21:16 bouyer Exp $");
#include "wsmouse.h"
@@ -51,6 +51,10 @@
#include "ioconf.h"
+#define OMKBD_RXQ_LEN 64
+#define OMKBD_RXQ_LEN_MASK (OMKBD_RXQ_LEN - 1)
+#define OMKBD_NEXTRXQ(x) (((x) + 1) & OMKBD_RXQ_LEN_MASK)
+
static const uint8_t ch1_regs[6] = {
WR0_RSTINT, /* Reset E/S Interrupt */
WR1_RXALLS, /* Rx per char, No Tx */
@@ -64,12 +68,16 @@
device_t sc_dev;
struct sioreg *sc_ctl;
uint8_t sc_wr[6];
- struct device *sc_wskbddev;
+ device_t sc_wskbddev;
+ uint8_t sc_rxq[OMKBD_RXQ_LEN];
+ u_int sc_rxqhead;
+ u_int sc_rxqtail;
#if NWSMOUSE > 0
- struct device *sc_wsmousedev;
+ device_t sc_wsmousedev;
int sc_msreport;
- int buttons, dx, dy;
+ int sc_msbuttons, sc_msdx, sc_msdy;
#endif
+ void *sc_si;
};
static void omkbd_input(void *, int);
@@ -111,6 +119,7 @@
#endif
static void wsintr(int);
+static void wssoftintr(void *);
static int wsmatch(device_t, cfdata_t, void *);
static void wsattach(device_t, device_t, void *);
@@ -143,7 +152,7 @@
sc->sc_ctl = (struct sioreg *)scp->scp_ctl + 1;
memcpy(sc->sc_wr, ch1_regs, sizeof(ch1_regs));
scp->scp_intr[1] = wsintr;
-
+
setsioreg(sc->sc_ctl, WR0, sc->sc_wr[WR0]);
setsioreg(sc->sc_ctl, WR4, sc->sc_wr[WR4]);
setsioreg(sc->sc_ctl, WR3, sc->sc_wr[WR3]);
@@ -153,6 +162,11 @@
syscnputc((dev_t)1, 0x20); /* keep quiet mouse */
+ sc->sc_rxqhead = 0;
+ sc->sc_rxqtail = 0;
+
+ sc->sc_si = softint_establish(SOFTINT_SERIAL, wssoftintr, sc);
+
aprint_normal("\n");
a.console = (args->hwflags == 1);
@@ -165,7 +179,7 @@
{
struct wsmousedev_attach_args b;
b.accessops = &omms_accessops;
- b.accesscookie = (void *)sc;
+ b.accesscookie = (void *)sc;
sc->sc_wsmousedev =
config_found_ia(self, "wsmousedev", &b, wsmousedevprint);
sc->sc_msreport = 0;
@@ -179,7 +193,7 @@
{
struct ws_softc *sc = device_lookup_private(&ws_cd, 0);
struct sioreg *sio = sc->sc_ctl;
- u_int code;
+ uint8_t code;
int rr;
rr = getsiocsr(sio);
@@ -190,43 +204,10 @@
sio->sio_cmd = WR0_ERRRST;
continue;
}
-#if NWSMOUSE > 0
- /*
- * if (code >= 0x80 && code <= 0x87), then
- * it's the first byte of 3 byte long mouse report
- * code[0] & 07 -> LMR button condition
- * code[1], [2] -> x,y delta
- * otherwise, key press or release event.
- */
- if (sc->sc_msreport == 0) {
- if (code < 0x80 || code > 0x87) {
- omkbd_input(sc, code);
- continue;
- }
- code = (code & 07) ^ 07;
- /* LMR->RML: wsevent counts 0 for leftmost */
- sc->buttons = (code & 02);
- if (code & 01)
- sc->buttons |= 04;
- if (code & 04)
- sc->buttons |= 01;
- sc->sc_msreport = 1;
- } else if (sc->sc_msreport == 1) {
- sc->dx = (signed char)code;
- sc->sc_msreport = 2;
- } else if (sc->sc_msreport == 2) {
- sc->dy = (signed char)code;
- wsmouse_input(sc->sc_wsmousedev,
- sc->buttons,
- sc->dx, sc->dy, 0, 0,
- WSMOUSE_INPUT_DELTA);
-
- sc->sc_msreport = 0;
- }
-#else
- omkbd_input(sc, code);
-#endif
+ sc->sc_rxq[sc->sc_rxqtail] = code;
+ sc->sc_rxqtail = OMKBD_NEXTRXQ(sc->sc_rxqtail);
} while ((rr = getsiocsr(sio)) & RR_RXRDY);
+ softint_schedule(sc->sc_si);
}
if (rr & RR_TXRDY)
sio->sio_cmd = WR0_RSTPEND;
@@ -234,6 +215,53 @@
}
static void
+wssoftintr(void *arg)
+{
+ struct ws_softc *sc = arg;
+ uint8_t code;
+
+ while (sc->sc_rxqhead != sc->sc_rxqtail) {
+ code = sc->sc_rxq[sc->sc_rxqhead];
+ sc->sc_rxqhead = OMKBD_NEXTRXQ(sc->sc_rxqhead);
+#if NWSMOUSE > 0
+ /*
+ * if (code >= 0x80 && code <= 0x87), then
+ * it's the first byte of 3 byte long mouse report
+ * code[0] & 07 -> LMR button condition
+ * code[1], [2] -> x,y delta
+ * otherwise, key press or release event.
+ */
+ if (sc->sc_msreport == 0) {
+ if (code < 0x80 || code > 0x87) {
+ omkbd_input(sc, code);
+ continue;
+ }
+ code = (code & 07) ^ 07;
+ /* LMR->RML: wsevent counts 0 for leftmost */
+ sc->sc_msbuttons = (code & 02);
+ if (code & 01)
+ sc->sc_msbuttons |= 04;
+ if (code & 04)
+ sc->sc_msbuttons |= 01;
+ sc->sc_msreport = 1;
+ } else if (sc->sc_msreport == 1) {
+ sc->sc_msdx = (int8_t)code;
+ sc->sc_msreport = 2;
+ } else if (sc->sc_msreport == 2) {
+ sc->sc_msdy = (int8_t)code;
+ wsmouse_input(sc->sc_wsmousedev,
+ sc->sc_msbuttons, sc->sc_msdx, sc->sc_msdy, 0, 0,
+ WSMOUSE_INPUT_DELTA);
+
+ sc->sc_msreport = 0;
+ }
+#else
+ omkbd_input(sc, code);
+#endif
+ }
+}
+
+static void
omkbd_input(void *v, int data)
{
struct ws_softc *sc = v;
@@ -241,7 +269,7 @@
int key;
if (omkbd_decode(v, data, &type, &key))
- wskbd_input(sc->sc_wskbddev, type, key);
+ wskbd_input(sc->sc_wskbddev, type, key);
}
static int
@@ -257,8 +285,8 @@
static const keysym_t omkbd_keydesc_1[] = {
/* pos command normal shifted */
- KC(0x9), KS_Tab,
- KC(0xa), KS_Control_L,
+ KC(0x9), KS_Tab,
+ KC(0xa), KS_Control_L,
KC(0xb), KS_Mode_switch, /* Kana */
KC(0xc), KS_Shift_R,
KC(0xd), KS_Shift_L,
@@ -281,7 +309,7 @@
KC(0x1f), KS_KP_Down,
/* KC(0x20), KS_f11, */
/* KC(0x21), KS_f12, */
- KC(0x22), KS_1, KS_exclam,
+ KC(0x22), KS_1, KS_exclam,
KC(0x23), KS_2, KS_quotedbl,
KC(0x24), KS_3, KS_numbersign,
KC(0x25), KS_4, KS_dollar,
diff -r 2e21c2c4c846 -r 44b5c3cd862d sys/arch/luna68k/dev/siotty.c
--- a/sys/arch/luna68k/dev/siotty.c Sun Jan 12 12:16:51 2014 +0000
+++ b/sys/arch/luna68k/dev/siotty.c Sun Jan 12 12:21:16 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: siotty.c,v 1.33 2011/11/26 04:40:50 tsutsui Exp $ */
+/* $NetBSD: siotty.c,v 1.33.4.1 2014/01/12 12:21:16 bouyer Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.33 2011/11/26 04:40:50 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: siotty.c,v 1.33.4.1 2014/01/12 12:21:16 bouyer Exp $");
#include "opt_ddb.h"
@@ -47,6 +47,7 @@
#include <sys/fcntl.h>
#include <dev/cons.h>
#include <sys/kauth.h>
+#include <sys/kmem.h>
#include <machine/cpu.h>
@@ -59,7 +60,7 @@
static const uint8_t ch0_regs[6] = {
WR0_RSTINT, /* reset E/S interrupt */
- WR1_RXALLS | WR1_TXENBL, /* Rx per char, Tx */
+ WR1_RXALLS | WR1_TXENBL, /* Rx per char, Tx */
0, /* */
WR3_RX8BIT | WR3_RXENBL, /* Rx */
WR4_BAUD96 | WR4_STOP1, /* Tx/Rx */
@@ -77,14 +78,38 @@
device_t sc_dev;
struct tty *sc_tty;
struct sioreg *sc_ctl;
- u_int sc_flags;
+ u_int sc_flags;
uint8_t sc_wr[6];
+ void *sc_si; /* software interrupt handler */
+ u_int sc_hwflags;
+#define SIOTTY_HW_CONSOLE 0x0001
+
+ uint8_t *sc_rbuf;
+ uint8_t *sc_rbufend;
+ uint8_t * volatile sc_rbget;
+ uint8_t * volatile sc_rbput;
+ volatile u_int sc_rbavail;
+
+ uint8_t *sc_tba;
+ u_int sc_tbc;
+
+ bool sc_rx_ready;
+ bool sc_tx_busy;
+ bool sc_tx_done;
};
+#define SIOTTY_RING_SIZE 2048
+u_int siotty_rbuf_size = SIOTTY_RING_SIZE;
+
+static struct cnm_state siotty_cnm_state;
+
#include "siotty.h"
static void siostart(struct tty *);
static int sioparam(struct tty *, struct termios *);
static void siottyintr(int);
+static void siottysoft(void *);
+static void siotty_rxsoft(struct siotty_softc *, struct tty *);
+static void siotty_txsoft(struct siotty_softc *, struct tty *);
static int siomctl(struct siotty_softc *, int, int);
Home |
Main Index |
Thread Index |
Old Index