Module Name:    src
Committed By:   mrg
Date:           Wed Oct 26 00:57:00 UTC 2011

Modified Files:
        src/sys/arch/sun2/conf: GENERIC
        src/sys/arch/sun2/dev: zs.c
        src/sys/arch/sun3/dev: zs.c

Log Message:
catch up with other zs ports, original commit was:

>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.78 -r1.79 src/sys/arch/sun2/conf/GENERIC
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/sun2/dev/zs.c
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/sun3/dev/zs.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/sun2/conf/GENERIC
diff -u src/sys/arch/sun2/conf/GENERIC:1.78 src/sys/arch/sun2/conf/GENERIC:1.79
--- src/sys/arch/sun2/conf/GENERIC:1.78	Thu Jun 30 20:09:37 2011
+++ src/sys/arch/sun2/conf/GENERIC	Wed Oct 26 00:56:59 2011
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.78 2011/06/30 20:09:37 wiz Exp $
+# $NetBSD: GENERIC,v 1.79 2011/10/26 00:56:59 mrg Exp $
 #
 # GENERIC machine description file
 # 
@@ -25,7 +25,7 @@ include 	"arch/sun2/conf/std.sun2"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.78 $"
+#ident 		"GENERIC-$Revision: 1.79 $"
 
 makeoptions	COPTS="-Os"	# optimize for size
 
@@ -54,11 +54,12 @@ options 	SYSCTL_INCLUDE_DESCR	# Include 
 # Which kernel debugger?  Uncomment either this:
 options 	DDB
 # ... or these for KGDB (gdb remote target)
-#makeoptions	DEBUG="-g"	# debugging symbols for gdb
+makeoptions	DEBUG="-g"	# debugging symbols for gdb
 #options 	KGDB
 #options 	KGDB_DEV=0x0C00	# ttya=0C00 ttyb=0C01
 
 # Other debugging options
+options 	DDB_COMMANDONENTER="trace"
 #options 	DDB_HISTORY_SIZE=100	# enable history editing in DDB
 #options 	DEBUG		# kernel debugging code
 #options 	DIAGNOSTIC	# extra kernel sanity checking

Index: src/sys/arch/sun2/dev/zs.c
diff -u src/sys/arch/sun2/dev/zs.c:1.19 src/sys/arch/sun2/dev/zs.c:1.20
--- src/sys/arch/sun2/dev/zs.c:1.19	Fri Jun 13 13:11:26 2008
+++ src/sys/arch/sun2/dev/zs.c	Wed Oct 26 00:56:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.19 2008/06/13 13:11:26 cegger Exp $	*/
+/*	$NetBSD: zs.c,v 1.20 2011/10/26 00:56:59 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.19 2008/06/13 13:11:26 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.20 2011/10/26 00:56:59 mrg Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -150,8 +150,9 @@ zs_attach(struct zsc_softc *zsc, struct 
 {
 	struct zsc_attach_args zsc_args;
 	struct zs_chanstate *cs;
-	int s, channel;
+	int channel;
 
+	memset(&zsc_args, 0, sizeof zsc_args);
 	if (zsd == NULL) {
 		aprint_error(": configuration incomplete\n");
 		return;
@@ -172,6 +173,7 @@ zs_attach(struct zsc_softc *zsc, struct 
 		struct device *child;
 
 		zsc_args.channel = channel;
+		zsc_args.hwflags = 0;
 		cs = &zsc->zsc_cs_store[channel];
 		zsc->zsc_cs[channel] = cs;
 
@@ -235,9 +237,9 @@ zs_attach(struct zsc_softc *zsc, struct 
 			/* 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)
 		/* 
@@ -305,12 +307,12 @@ zs_attach(struct zsc_softc *zsc, struct 
 	 * (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);
 
 }
 
@@ -445,7 +447,6 @@ zs_set_speed(struct zs_chanstate *cs, in
 int 
 zs_set_modes(struct zs_chanstate *cs, int cflag	/* bits per second */)
 {
-	int s;
 
 	/*
 	 * Output hardware flow control on the chip is horrendous:
@@ -454,7 +455,7 @@ zs_set_modes(struct zs_chanstate *cs, in
 	 * 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;
@@ -479,7 +480,7 @@ zs_set_modes(struct zs_chanstate *cs, in
 		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/sun3/dev/zs.c
diff -u src/sys/arch/sun3/dev/zs.c:1.85 src/sys/arch/sun3/dev/zs.c:1.86
--- src/sys/arch/sun3/dev/zs.c:1.85	Sat Jun 26 01:48:57 2010
+++ src/sys/arch/sun3/dev/zs.c	Wed Oct 26 00:56:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: zs.c,v 1.85 2010/06/26 01:48:57 tsutsui Exp $	*/
+/*	$NetBSD: zs.c,v 1.86 2011/10/26 00:56:59 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.85 2010/06/26 01:48:57 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: zs.c,v 1.86 2011/10/26 00:56:59 mrg Exp $");
 
 #include "opt_kgdb.h"
 
@@ -259,7 +259,7 @@ zs_attach(device_t parent, device_t self
 	struct zsc_attach_args zsc_args;
 	volatile struct zschan *zc;
 	struct zs_chanstate *cs;
-	int s, zs_unit, channel;
+	int zs_unit, channel;
 
 	zsc->zsc_dev = self;
 	zs_unit = device_unit(self);
@@ -323,9 +323,9 @@ zs_attach(device_t parent, device_t self
 			/* No sub-driver.  Just reset it. */
 			uint8_t reset = (channel == 0) ?
 				ZSWR9_A_RESET : ZSWR9_B_RESET;
-			s = splhigh();
+			zs_lock_chan(cs);
 			zs_write_reg(cs,  9, reset);
-			splx(s);
+			zs_unlock_chan(cs);
 		}
 	}
 
@@ -342,12 +342,12 @@ zs_attach(device_t parent, device_t self
 	 * (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);
 
 	/*
 	 * XXX: L1A hack - We would like to be able to break into
@@ -442,7 +442,6 @@ zs_set_speed(struct zs_chanstate *cs, in
 int 
 zs_set_modes(struct zs_chanstate *cs, int cflag	/* bits per second */)
 {
-	int s;
 
 	/*
 	 * Output hardware flow control on the chip is horrendous:
@@ -451,7 +450,7 @@ zs_set_modes(struct zs_chanstate *cs, in
 	 * 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;
@@ -472,7 +471,7 @@ zs_set_modes(struct zs_chanstate *cs, in
 		cs->cs_wr5_rts = 0;
 		cs->cs_rr0_cts = 0;
 	}
-	splx(s);
+	zs_unlock_chan(cs);
 
 	/* Caller will stuff the pending registers. */
 	return (0);

Reply via email to