Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/sbus Switch to softintr(9).



details:   https://anonhg.NetBSD.org/src/rev/aa0f7267bc21
branches:  trunk
changeset: 540341:aa0f7267bc21
user:      pk <pk%NetBSD.org@localhost>
date:      Tue Dec 10 12:17:35 2002 +0000

description:
Switch to softintr(9).

diffstat:

 sys/dev/sbus/magma.c    |  51 +++++++++++++-----------------------------------
 sys/dev/sbus/magmareg.h |   6 +++-
 2 files changed, 18 insertions(+), 39 deletions(-)

diffs (176 lines):

diff -r b0e7f648fd9b -r aa0f7267bc21 sys/dev/sbus/magma.c
--- a/sys/dev/sbus/magma.c      Tue Dec 10 12:16:25 2002 +0000
+++ b/sys/dev/sbus/magma.c      Tue Dec 10 12:17:35 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: magma.c,v 1.21 2002/10/23 09:13:42 jdolecek Exp $      */
+/*     $NetBSD: magma.c,v 1.22 2002/12/10 12:17:35 pk Exp $    */
 /*
  * magma.c
  *
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.21 2002/10/23 09:13:42 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.22 2002/12/10 12:17:35 pk Exp $");
 
 #if 0
 #define MAGMA_DEBUG
@@ -73,19 +73,6 @@
 #include <dev/sbus/mbppio.h>
 #include <dev/sbus/magmareg.h>
 
-/*
- * Select tty soft interrupt bit based on TTY ipl. (stole from zs.c)
- */
-#if PIL_TTY == 1
-# define IE_MSOFT IE_L1
-#elif PIL_TTY == 4
-# define IE_MSOFT IE_L4
-#elif PIL_TTY == 6
-# define IE_MSOFT IE_L6
-#else
-# error "no suitable software interrupt bit"
-#endif
-
 /* supported cards
  *
  *  The table below lists the cards that this driver is likely to
@@ -402,7 +389,7 @@
        }
 
        dprintf((" addr %p", sc));
-       printf(" softpri %d: %s\n", PIL_TTY, card->mb_realname);
+       printf(": %s\n", card->mb_realname);
 
        sc->ms_board = card;
        sc->ms_ncd1400 = card->mb_ncd1400;
@@ -502,9 +489,12 @@
 
        (void)bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_TTY,
                                 0, magma_hard, sc);
-       (void)bus_intr_establish(sa->sa_bustag, PIL_TTY, IPL_SOFTSERIAL,
-                                BUS_INTR_ESTABLISH_SOFTINTR,
-                                magma_soft, sc);
+       sc->ms_sicookie = softintr_establish(IPL_SOFTSERIAL, magma_soft, sc);
+       if (sc->ms_sicookie == NULL) {
+               printf("\n%s: cannot establish soft int handler\n",
+                       sc->ms_dev.dv_xname);
+               return;
+       }
        evcnt_attach_dynamic(&sc->ms_intrcnt, EVCNT_TYPE_INTR, NULL,
            sc->ms_dev.dv_xname, "intr");
 }
@@ -725,14 +715,9 @@
        }
        */
 
-       if( needsoftint ) {     /* trigger the soft interrupt */
-#if defined(SUN4M)
-               if( CPU_ISSUN4M )
-                       raise(0, PIL_TTY);
-               else
-#endif
-                       ienab_bis(IE_MSOFT);
-       }
+       if (needsoftint)
+               /* trigger the soft interrupt */
+               softintr_schedule(sc->ms_sicookie);
 
        return(serviced);
 }
@@ -744,7 +729,7 @@
  *
  *  runs at spltty()
  */
-int
+void
 magma_soft(arg)
        void *arg;
 {
@@ -752,7 +737,6 @@
        struct mtty_softc *mtty = sc->ms_mtty;
        struct mbpp_softc *mbpp = sc->ms_mbpp;
        int port;
-       int serviced = 0;
        int s, flags;
 
        if (mtty == NULL)
@@ -790,7 +774,6 @@
                                    mtty->ms_dev.dv_xname, port);
 
                        (*tp->t_linesw->l_rint)(data, tp);
-                       serviced = 1;
                }
 
                s = splhigh();  /* block out hard interrupt routine */
@@ -802,20 +785,17 @@
                        dprintf(("%s%x: cd %s\n", mtty->ms_dev.dv_xname,
                                port, mp->mp_carrier ? "on" : "off"));
                        (*tp->t_linesw->l_modem)(tp, mp->mp_carrier);
-                       serviced = 1;
                }
 
                if( ISSET(flags, MTTYF_RING_OVERFLOW) ) {
                        log(LOG_WARNING, "%s%x: ring buffer overflow\n",
                            mtty->ms_dev.dv_xname, port);
-                       serviced = 1;
                }
 
                if( ISSET(flags, MTTYF_DONE) ) {
                        ndflush(&tp->t_outq, mp->mp_txp - tp->t_outq.c_cf);
                        CLR(tp->t_state, TS_BUSY);
                        (*tp->t_linesw->l_start)(tp);   /* might be some more */
-                       serviced = 1;
                }
        } /* for(each mtty...) */
 
@@ -825,7 +805,7 @@
         * Check the bpp ports (if any) to see what needs doing
         */
        if (mbpp == NULL)
-               return (serviced);
+               return;
 
        for( port = 0 ; port < mbpp->ms_nports ; port++ ) {
                struct mbpp_port *mp = &mbpp->ms_port[port];
@@ -840,12 +820,9 @@
 
                if( ISSET(flags, MBPPF_WAKEUP) ) {
                        wakeup(mp);
-                       serviced = 1;
                }
 
        } /* for(each mbpp...) */
-
-       return(serviced);
 }
 
 /************************************************************************
diff -r b0e7f648fd9b -r aa0f7267bc21 sys/dev/sbus/magmareg.h
--- a/sys/dev/sbus/magmareg.h   Tue Dec 10 12:16:25 2002 +0000
+++ b/sys/dev/sbus/magmareg.h   Tue Dec 10 12:17:35 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: magmareg.h,v 1.5 2002/09/06 13:18:43 gehenna Exp $     */
+/*     $NetBSD: magmareg.h,v 1.6 2002/12/10 12:17:36 pk Exp $  */
 /* magmareg.h
  *
  *  Copyright (c) 1998 Iain Hibbert
@@ -123,6 +123,8 @@
        struct mtty_softc *ms_mtty;
        struct mbpp_softc *ms_mbpp;
 
+       /* softintr(9) cookie */
+       void    *ms_sicookie;
 };
 
 #define MTTY_RBUF_SIZE         (2 * 512)
@@ -210,7 +212,7 @@
 int magma_match __P((struct device *, struct cfdata *, void *));
 void magma_attach __P((struct device *, struct device *, void *));
 int magma_hard __P((void *));
-int magma_soft __P((void *));
+void magma_soft __P((void *));
 
 int mtty_match __P((struct device *, struct cfdata *, void *));
 void mtty_attach __P((struct device *, struct device *, void *));



Home | Main Index | Thread Index | Old Index