Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch catch up with other zs ports, original commit was:



details:   https://anonhg.NetBSD.org/src/rev/593b972f3fc0
branches:  trunk
changeset: 770626:593b972f3fc0
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed Oct 26 00:56:59 2011 +0000

description:
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.

diffstat:

 sys/arch/sun2/conf/GENERIC |   7 ++++---
 sys/arch/sun2/dev/zs.c     |  21 +++++++++++----------
 sys/arch/sun3/dev/zs.c     |  19 +++++++++----------
 3 files changed, 24 insertions(+), 23 deletions(-)

diffs (202 lines):

diff -r ace7f4f3eabc -r 593b972f3fc0 sys/arch/sun2/conf/GENERIC
--- a/sys/arch/sun2/conf/GENERIC        Wed Oct 26 00:14:12 2011 +0000
+++ b/sys/arch/sun2/conf/GENERIC        Wed Oct 26 00:56:59 2011 +0000
@@ -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 @@
 
 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 @@
 # 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
diff -r ace7f4f3eabc -r 593b972f3fc0 sys/arch/sun2/dev/zs.c
--- a/sys/arch/sun2/dev/zs.c    Wed Oct 26 00:14:12 2011 +0000
+++ b/sys/arch/sun2/dev/zs.c    Wed Oct 26 00:56:59 2011 +0000
@@ -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 @@
 {
        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 @@
                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 @@
                        /* 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 @@
         * (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 @@
 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 @@
         * 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 @@
                cs->cs_wr5_rts = 0;
                cs->cs_rr0_cts = 0;
        }
-       splx(s);
+       zs_unlock_chan(cs);
 
        /* Caller will stuff the pending registers. */
        return (0);
diff -r ace7f4f3eabc -r 593b972f3fc0 sys/arch/sun3/dev/zs.c
--- a/sys/arch/sun3/dev/zs.c    Wed Oct 26 00:14:12 2011 +0000
+++ b/sys/arch/sun3/dev/zs.c    Wed Oct 26 00:56:59 2011 +0000
@@ -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 @@
        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 @@
                        /* 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 @@
         * (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 @@
 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 @@
         * 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 @@
                cs->cs_wr5_rts = 0;
                cs->cs_rr0_cts = 0;
        }
-       splx(s);
+       zs_unlock_chan(cs);
 
        /* Caller will stuff the pending registers. */
        return (0);



Home | Main Index | Thread Index | Old Index