Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/dev The `fast trap' handlers are now pssed as...



details:   https://anonhg.NetBSD.org/src/rev/0df3ca0ef833
branches:  trunk
changeset: 540338:0df3ca0ef833
user:      pk <pk%NetBSD.org@localhost>
date:      Tue Dec 10 12:11:21 2002 +0000

description:
The `fast trap' handlers are now pssed as an optional argument to
bus_intr_establish(). Allow fall-back on a regular interrupt handler if
the interrupt level must be shared with another device.

diffstat:

 sys/arch/sparc/dev/audioamd.c |  31 ++++++++++---------------------
 sys/arch/sparc/dev/fd.c       |  28 +++++++++++++---------------
 2 files changed, 23 insertions(+), 36 deletions(-)

diffs (144 lines):

diff -r b03049cfac5d -r 0df3ca0ef833 sys/arch/sparc/dev/audioamd.c
--- a/sys/arch/sparc/dev/audioamd.c     Tue Dec 10 12:04:51 2002 +0000
+++ b/sys/arch/sparc/dev/audioamd.c     Tue Dec 10 12:11:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audioamd.c,v 1.14 2002/12/09 16:11:50 pk Exp $ */
+/*     $NetBSD: audioamd.c,v 1.15 2002/12/10 12:11:22 pk Exp $ */
 /*     NetBSD: am7930_sparc.c,v 1.44 1999/03/14 22:29:00 jonathan Exp  */
 
 /*
@@ -62,12 +62,13 @@
 
 
 /* interrupt interfaces */
-#ifdef AUDIO_C_HANDLER
 int    am7930hwintr __P((void *));
-#endif /* AUDIO_C_HANDLER */
 struct auio *auiop;
 void   am7930swintr __P((void *));
 
+/* from amd7930intr.s: */
+void   amd7930_trap(void);
+
 /*
  * interrupt-handler status 
  */
@@ -304,14 +305,12 @@
        am7930_init(&sc->sc_am7930, AUDIOAMD_POLL_MODE);
 
        auiop = &sc->sc_au;
-#ifndef AUDIO_C_HANDLER
-       (void)bus_intr_establish(sc->sc_bt, pri, IPL_AUDIO,
-                                BUS_INTR_ESTABLISH_FASTTRAP,
-                                (int (*) __P((void *)))amd7930_trap, NULL);
-#else
-       (void)bus_intr_establish(sc->sc_bt, pri, IPL_AUDIO, 0,
-                                am7930hwintr, sc);
-#endif
+
+       /* Copy bus tag & handle for use by am7930_trap */
+       sc->sc_au.au_bt = sc->sc_bt;
+       sc->sc_au.au_bh = sc->sc_bh;
+       (void)bus_intr_establish2(sc->sc_bt, pri, IPL_AUDIO, 0,
+                                 am7930hwintr, sc, amd7930_trap);
 
        sc->sc_sicookie = softintr_establish(IPL_SOFTAUDIO, am7930swintr, sc);
        if (sc->sc_sicookie == NULL) {
@@ -376,10 +375,6 @@
        }
        sc->sc_pintr = intr;
        sc->sc_parg = arg;
-#ifndef AUDIO_C_HANDLER
-       sc->sc_au.au_bt = sc->sc_bt;
-       sc->sc_au.au_bh = sc->sc_bh;
-#endif
        sc->sc_au.au_pdata = p;
        sc->sc_au.au_pend = (char *)p + cc - 1;
        return(0);
@@ -405,10 +400,6 @@
        }
        sc->sc_rintr = intr;
        sc->sc_rarg = arg;
-#ifndef AUDIO_C_HANDLER
-       sc->sc_au.au_bt = sc->sc_bt;
-       sc->sc_au.au_bh = sc->sc_bh;
-#endif
        sc->sc_au.au_rdata = p;
        sc->sc_au.au_rend = (char *)p + cc -1;
        return(0);
@@ -419,7 +410,6 @@
  * Pseudo-DMA support: either C or locore assember.
  */
 
-#ifdef AUDIO_C_HANDLER
 int
 am7930hwintr(v)
        void *v;
@@ -462,7 +452,6 @@
        au->au_intrcnt.ev_count++;
        return (1);
 }
-#endif /* AUDIO_C_HANDLER */
 
 void
 am7930swintr(sc0)
diff -r b03049cfac5d -r 0df3ca0ef833 sys/arch/sparc/dev/fd.c
--- a/sys/arch/sparc/dev/fd.c   Tue Dec 10 12:04:51 2002 +0000
+++ b/sys/arch/sparc/dev/fd.c   Tue Dec 10 12:11:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.97 2002/12/09 16:11:50 pk Exp $       */
+/*     $NetBSD: fd.c,v 1.98 2002/12/10 12:11:21 pk Exp $       */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -620,21 +620,14 @@
        }
 
        fdciop = &fdc->sc_io;
-       if (bus_intr_establish(fdc->sc_bustag, pri, IPL_BIO,
-                        BUS_INTR_ESTABLISH_FASTTRAP,
-                        (int (*) __P((void *)))fdchwintr, NULL) == NULL) {
-
-               printf("%s: notice: no fast trap handler slot available\n",
+       if (bus_intr_establish2(fdc->sc_bustag, pri, 0, 0,
+                               fdc_c_hwintr, fdc, fdchwintr) == NULL) {
+               printf("\n%s: cannot register interrupt handler\n",
                        fdc->sc_dev.dv_xname);
-               if (bus_intr_establish(fdc->sc_bustag, pri, IPL_BIO, 0,
-                                fdc_c_hwintr, fdc) == NULL) {
-                       printf("%s: cannot register interrupt handler\n",
-                               fdc->sc_dev.dv_xname);
-                       return (-1);
-               }
+               return (-1);
        }
 
-       fdc->sc_sicookie = softintr_establish(IPL_SOFTFDC, fdcswintr, fdc);
+       fdc->sc_sicookie = softintr_establish(IPL_BIO, fdcswintr, fdc);
        if (fdc->sc_sicookie == NULL) {
                printf("\n%s: cannot register soft interrupt handler\n",
                        fdc->sc_dev.dv_xname);
@@ -1305,6 +1298,13 @@
                        fdc->sc_istatus = FDC_ISTATUS_DONE;
                softintr_schedule(fdc->sc_sicookie);
                return (1);
+       case FDC_ITASK_RESULT:
+               if (fdcresult(fdc) == -1)
+                       fdc->sc_istatus = FDC_ISTATUS_ERROR;
+               else
+                       fdc->sc_istatus = FDC_ISTATUS_DONE;
+               softintr_schedule(fdc->sc_sicookie);
+               return (1);
        case FDC_ITASK_DMA:
                /* Proceed with pseudo-dma below */
                break;
@@ -1378,9 +1378,7 @@
                break;
        }
 
-       s = splbio();
        fdcstate(fdc);
-       splx(s);
        return;
 }
 



Home | Main Index | Thread Index | Old Index