Module Name: src
Committed By: bouyer
Date: Sun Jan 16 12:54:43 UTC 2011
Modified Files:
src/sys/arch/sparc/dev [netbsd-5]: zs.c
src/sys/arch/sparc64/dev [netbsd-5]: zs.c
src/sys/dev/ic [netbsd-5]: z8530sc.c z8530sc.h z8530tty.c
Log Message:
Pull up following revision(s) (requested by mrg in ticket #1526):
sys/arch/sparc/dev/zs.c: revision 1.115
sys/dev/ic/z8530sc.h: revision 1.26
sys/dev/ic/z8530sc.c: revision 1.30
sys/dev/ic/z8530tty.c: revision 1.127
sys/arch/sparc64/dev/zs.c: revision 1.68
add two new functions for z8530tty: zs_chan_lock() and zs_chan_unlock(),
and use them instead of various spl's in the zs.c's.
reviewed by ad and martin.
To generate a diff of this commit:
cvs rdiff -u -r1.111.6.2 -r1.111.6.3 src/sys/arch/sparc/dev/zs.c
cvs rdiff -u -r1.67 -r1.67.6.1 src/sys/arch/sparc64/dev/zs.c
cvs rdiff -u -r1.28 -r1.28.14.1 src/sys/dev/ic/z8530sc.c
cvs rdiff -u -r1.25 -r1.25.12.1 src/sys/dev/ic/z8530sc.h
cvs rdiff -u -r1.123 -r1.123.12.1 src/sys/dev/ic/z8530tty.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/sparc/dev/zs.c
diff -u src/sys/arch/sparc/dev/zs.c:1.111.6.2 src/sys/arch/sparc/dev/zs.c:1.111.6.3
--- src/sys/arch/sparc/dev/zs.c:1.111.6.2 Tue Jun 9 17:50:34 2009
+++ src/sys/arch/sparc/dev/zs.c Sun Jan 16 12:54:42 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: zs.c,v 1.111.6.2 2009/06/09 17:50:34 snj Exp $ */
+/* $NetBSD: zs.c,v 1.111.6.3 2011/01/16 12:54:42 bouyer Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.111.6.2 2009/06/09 17:50:34 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.111.6.3 2011/01/16 12:54:42 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -395,7 +395,7 @@
{
struct zsc_attach_args zsc_args;
struct zs_chanstate *cs;
- int s, channel;
+ int channel;
static int didintr, prevpri;
#if (NKBD > 0) || (NMS > 0)
int ch0_is_cons = 0;
@@ -509,9 +509,9 @@
/* No sub-driver. Just reset it. */
uint8_t reset = (channel == 0) ?
ZSWR9_A_RESET : ZSWR9_B_RESET;
- s = splzs();
+ zs_lock_chan(cs);
zs_write_reg(cs, 9, reset);
- splx(s);
+ zs_unlock_chan(cs);
}
#if (NKBD > 0) || (NMS > 0)
/*
@@ -571,12 +571,12 @@
* (common to both channels, do it on A)
*/
cs = zsc->zsc_cs[0];
- s = splhigh();
+ zs_lock_chan(cs);
/* interrupt vector */
zs_write_reg(cs, 2, zs_init_reg[2]);
/* master interrupt control (enable) */
zs_write_reg(cs, 9, zs_init_reg[9]);
- splx(s);
+ zs_unlock_chan(cs);
#if 0
/*
@@ -653,7 +653,7 @@
zssoft(void *arg)
{
struct zsc_softc *zsc;
- int s, unit;
+ int unit;
/* This is not the only ISR on this IPL. */
if (zssoftpending == 0)
@@ -668,15 +668,19 @@
/* ienab_bic(IE_ZSSOFT); */
zssoftpending = 0;
- /* Make sure we call the tty layer at spltty. */
- s = spltty();
+#if 0 /* not yet */
+ /* Make sure we call the tty layer with tty_lock held. */
+ mutex_spin_enter(&tty_lock);
+#endif
for (unit = 0; unit < zs_cd.cd_ndevs; unit++) {
zsc = device_lookup_private(&zs_cd, unit);
if (zsc == NULL)
continue;
(void)zsc_intr_soft(zsc);
}
- splx(s);
+#if 0 /* not yet */
+ mutex_spin_exit(&tty_lock);
+#endif
}
@@ -731,7 +735,6 @@
int
zs_set_modes(struct zs_chanstate *cs, int cflag)
{
- int s;
/*
* Output hardware flow control on the chip is horrendous:
@@ -740,7 +743,7 @@
* Therefore, NEVER set the HFC bit, and instead use the
* status interrupt to detect CTS changes.
*/
- s = splzs();
+ zs_lock_chan(cs);
cs->cs_rr0_pps = 0;
if ((cflag & (CLOCAL | MDMBUF)) != 0) {
cs->cs_rr0_dcd = 0;
@@ -765,7 +768,7 @@
cs->cs_wr5_rts = 0;
cs->cs_rr0_cts = 0;
}
- splx(s);
+ zs_unlock_chan(cs);
/* Caller will stuff the pending registers. */
return (0);
Index: src/sys/arch/sparc64/dev/zs.c
diff -u src/sys/arch/sparc64/dev/zs.c:1.67 src/sys/arch/sparc64/dev/zs.c:1.67.6.1
--- src/sys/arch/sparc64/dev/zs.c:1.67 Fri Jun 13 13:10:49 2008
+++ src/sys/arch/sparc64/dev/zs.c Sun Jan 16 12:54:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: zs.c,v 1.67 2008/06/13 13:10:49 cegger Exp $ */
+/* $NetBSD: zs.c,v 1.67.6.1 2011/01/16 12:54:43 bouyer Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.67 2008/06/13 13:10:49 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.67.6.1 2011/01/16 12:54:43 bouyer Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -254,7 +254,7 @@
{
struct zsc_attach_args zsc_args;
struct zs_chanstate *cs;
- int s, channel;
+ int channel;
if (zsd == NULL) {
aprint_error(": configuration incomplete\n");
@@ -333,9 +333,9 @@
/* No sub-driver. Just reset it. */
uint8_t reset = (channel == 0) ?
ZSWR9_A_RESET : ZSWR9_B_RESET;
- s = splzs();
+ zs_lock_chan(cs);
zs_write_reg(cs, 9, reset);
- splx(s);
+ zs_unlock_chan(cs);
}
#if (NKBD > 0) || (NMS > 0)
/*
@@ -388,13 +388,12 @@
* (common to both channels, do it on A)
*/
cs = zsc->zsc_cs[0];
- s = splhigh();
+ zs_lock_chan(cs);
/* interrupt vector */
zs_write_reg(cs, 2, zs_init_reg[2]);
/* master interrupt control (enable) */
zs_write_reg(cs, 9, zs_init_reg[9]);
- splx(s);
-
+ zs_unlock_chan(cs);
}
static int
@@ -460,10 +459,11 @@
zssoft(void *arg)
{
struct zsc_softc *zsc = arg;
- int s;
- /* Make sure we call the tty layer at spltty. */
- s = spltty();
+#if 0 /* not yet */
+ /* Make sure we call the tty layer with tty_lock held. */
+ mutex_spin_enter(&tty_lock);
+#endif
zssoftpending = 0;
(void)zsc_intr_soft(zsc);
#ifdef TTY_DEBUG
@@ -478,7 +478,9 @@
}
}
#endif
- splx(s);
+#if 0 /* not yet */
+ mutex_spin_exit(&tty_lock);
+#endif
}
@@ -532,7 +534,6 @@
int
zs_set_modes(struct zs_chanstate *cs, int cflag)
{
- int s;
/*
* Output hardware flow control on the chip is horrendous:
@@ -541,7 +542,7 @@
* Therefore, NEVER set the HFC bit, and instead use the
* status interrupt to detect CTS changes.
*/
- s = splzs();
+ zs_lock_chan(cs);
cs->cs_rr0_pps = 0;
if ((cflag & (CLOCAL | MDMBUF)) != 0) {
cs->cs_rr0_dcd = 0;
@@ -566,7 +567,7 @@
cs->cs_wr5_rts = 0;
cs->cs_rr0_cts = 0;
}
- splx(s);
+ zs_unlock_chan(cs);
/* Caller will stuff the pending registers. */
return (0);
Index: src/sys/dev/ic/z8530sc.c
diff -u src/sys/dev/ic/z8530sc.c:1.28 src/sys/dev/ic/z8530sc.c:1.28.14.1
--- src/sys/dev/ic/z8530sc.c:1.28 Sat Mar 29 19:15:36 2008
+++ src/sys/dev/ic/z8530sc.c Sun Jan 16 12:54:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: z8530sc.c,v 1.28 2008/03/29 19:15:36 tsutsui Exp $ */
+/* $NetBSD: z8530sc.c,v 1.28.14.1 2011/01/16 12:54:43 bouyer Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: z8530sc.c,v 1.28 2008/03/29 19:15:36 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: z8530sc.c,v 1.28.14.1 2011/01/16 12:54:43 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -274,6 +274,20 @@
mutex_init(&cs->cs_lock, MUTEX_NODEBUG, IPL_ZS);
}
+void
+zs_lock_chan(struct zs_chanstate *cs)
+{
+
+ mutex_spin_enter(&cs->cs_lock);
+}
+
+void
+zs_unlock_chan(struct zs_chanstate *cs)
+{
+
+ mutex_spin_exit(&cs->cs_lock);
+}
+
/*
* ZS hardware interrupt. Scan all ZS channels. NB: we know here that
* channels are kept in (A,B) pairs.
Index: src/sys/dev/ic/z8530sc.h
diff -u src/sys/dev/ic/z8530sc.h:1.25 src/sys/dev/ic/z8530sc.h:1.25.12.1
--- src/sys/dev/ic/z8530sc.h:1.25 Sun Apr 20 15:42:47 2008
+++ src/sys/dev/ic/z8530sc.h Sun Jan 16 12:54:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: z8530sc.h,v 1.25 2008/04/20 15:42:47 tsutsui Exp $ */
+/* $NetBSD: z8530sc.h,v 1.25.12.1 2011/01/16 12:54:43 bouyer Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -203,6 +203,8 @@
int zs_set_speed(struct zs_chanstate *, int);
int zs_set_modes(struct zs_chanstate *, int);
void zs_lock_init(struct zs_chanstate *);
+void zs_lock_chan(struct zs_chanstate *);
+void zs_unlock_chan(struct zs_chanstate *);
int zs_check_kgdb(struct zs_chanstate *, int);
Index: src/sys/dev/ic/z8530tty.c
diff -u src/sys/dev/ic/z8530tty.c:1.123 src/sys/dev/ic/z8530tty.c:1.123.12.1
--- src/sys/dev/ic/z8530tty.c:1.123 Mon Apr 21 12:56:31 2008
+++ src/sys/dev/ic/z8530tty.c Sun Jan 16 12:54:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: z8530tty.c,v 1.123 2008/04/21 12:56:31 ad Exp $ */
+/* $NetBSD: z8530tty.c,v 1.123.12.1 2011/01/16 12:54:43 bouyer Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -137,7 +137,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.123 2008/04/21 12:56:31 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: z8530tty.c,v 1.123.12.1 2011/01/16 12:54:43 bouyer Exp $");
#include "opt_kgdb.h"
#include "opt_ntp.h"
@@ -937,11 +937,10 @@
zsstop(struct tty *tp, int flag)
{
struct zstty_softc *zst;
- int s;
zst = device_lookup_private(&zstty_cd, ZSUNIT(tp->t_dev));
- s = splzs();
+ mutex_spin_enter(&zst->zst_cs->cs_lock);
if (ISSET(tp->t_state, TS_BUSY)) {
/* Stop transmitting at the next chunk. */
zst->zst_tbc = 0;
@@ -949,7 +948,7 @@
if (!ISSET(tp->t_state, TS_TTSTOP))
SET(tp->t_state, TS_FLUSH);
}
- splx(s);
+ mutex_spin_exit(&zst->zst_cs->cs_lock);
}
/*
@@ -1519,15 +1518,14 @@
{
struct zstty_softc *zst = arg;
int overflows, floods;
- int s;
- s = splzs();
+ mutex_spin_enter(&zst->zst_cs->cs_lock);
overflows = zst->zst_overflows;
zst->zst_overflows = 0;
floods = zst->zst_floods;
zst->zst_floods = 0;
zst->zst_errors = 0;
- splx(s);
+ mutex_spin_exit(&zst->zst_cs->cs_lock);
log(LOG_WARNING, "%s: %d silo overflow%s, %d ibuf flood%s\n",
device_xname(zst->zst_dev),