Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pmax Redo interrupt establishment, based in part on...



details:   https://anonhg.NetBSD.org/src/rev/0ea7e97b87d2
branches:  trunk
changeset: 480510:0ea7e97b87d2
user:      simonb <simonb%NetBSD.org@localhost>
date:      Fri Jan 14 13:45:21 2000 +0000

description:
Redo interrupt establishment, based in part on work on the
[nisimura-pmax-wscons] branch and suggestions from Toru Nisimura:
 - Remove bogus tc_slot_info[] name for interrupt handling array
   and replace with simplified struct intrhand  intrtab[] array.
 - Add intr_establish() and intr_disestablish() function pointers
   to struct platform and initialise this in each model-specific
   initialisation, and remove global tc_enable_interrupt function
   pointer.
 - Remove model-specific function declarations from ibus/ibusvar.h.
This is functionally identical to the current scheme, and doesn't
yet try to commonise interrupt establishment by bus type as the
[nisimura-pmax-wscons] branch does.

Also, move cpuspeed variable from autoconf.c to machdep.c

diffstat:

 sys/arch/pmax/ibus/ibus_pmax.c    |   11 +-
 sys/arch/pmax/ibus/ibusvar.h      |   10 +--
 sys/arch/pmax/include/intr.h      |   13 ++-
 sys/arch/pmax/include/sysconf.h   |    7 +-
 sys/arch/pmax/pmax/autoconf.c     |   20 +----
 sys/arch/pmax/pmax/dec_3100.c     |   55 ++++---------
 sys/arch/pmax/pmax/dec_3max.c     |   69 ++++++++---------
 sys/arch/pmax/pmax/dec_3maxplus.c |  114 +++++++++++++++--------------
 sys/arch/pmax/pmax/dec_3min.c     |  146 ++++++++++++++++++-------------------
 sys/arch/pmax/pmax/dec_5100.c     |   49 +++---------
 sys/arch/pmax/pmax/dec_maxine.c   |  125 +++++++++++++++++--------------
 sys/arch/pmax/pmax/machdep.c      |   34 +++++++-
 sys/arch/pmax/pmax/turbochannel.h |  139 ------------------------------------
 sys/arch/pmax/tc/ioasic.c         |    9 +-
 sys/arch/pmax/tc/tcbus.c          |   17 +--
 15 files changed, 328 insertions(+), 490 deletions(-)

diffs (truncated from 1723 to 300 lines):

diff -r cca69ab40308 -r 0ea7e97b87d2 sys/arch/pmax/ibus/ibus_pmax.c
--- a/sys/arch/pmax/ibus/ibus_pmax.c    Fri Jan 14 13:41:45 2000 +0000
+++ b/sys/arch/pmax/ibus/ibus_pmax.c    Fri Jan 14 13:45:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibus_pmax.c,v 1.13 2000/01/10 03:24:35 simonb Exp $ */
+/* $NetBSD: ibus_pmax.c,v 1.14 2000/01/14 13:45:21 simonb Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ibus_pmax.c,v 1.13 2000/01/10 03:24:35 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibus_pmax.c,v 1.14 2000/01/14 13:45:21 simonb Exp $");
 
 #include "opt_dec_3100.h"
 #include "opt_dec_5100.h"
@@ -43,6 +43,7 @@
 
 #include <pmax/ibus/ibusvar.h>
 #include <machine/autoconf.h>
+#include <machine/sysconf.h>
 #include <pmax/pmax/kn01.h>
 #include <pmax/pmax/kn230.h>
 #include <pmax/pmax/pmaxtype.h>
@@ -120,21 +121,19 @@
        ibus_attached = 1;
 
        ida.ida_busname = "ibus";
+       ida.ida_establish = platform.intr_establish;
+       ida.ida_disestablish = platform.intr_disestablish;
        switch (systype) {
 #ifdef DEC_3100
        case DS_PMAX:
                ida.ida_devs = ibus_pmax_devs;
                ida.ida_ndevs = ibus_pmax_ndevs;
-               ida.ida_establish = dec_3100_intr_establish;
-               ida.ida_disestablish = dec_3100_intr_disestablish;
                break;
 #endif
 #ifdef DEC_5100
        case DS_MIPSMATE:
                ida.ida_devs = ibus_mipsmate_devs;
                ida.ida_ndevs = ibus_mipsmate_ndevs;
-               ida.ida_establish = dec_5100_intr_establish;
-               ida.ida_disestablish = dec_5100_intr_disestablish;
                break;
 #endif
        default:
diff -r cca69ab40308 -r 0ea7e97b87d2 sys/arch/pmax/ibus/ibusvar.h
--- a/sys/arch/pmax/ibus/ibusvar.h      Fri Jan 14 13:41:45 2000 +0000
+++ b/sys/arch/pmax/ibus/ibusvar.h      Fri Jan 14 13:45:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibusvar.h,v 1.13 2000/01/09 13:24:16 simonb Exp $ */
+/* $NetBSD: ibusvar.h,v 1.14 2000/01/14 13:45:21 simonb Exp $ */
 
 #ifndef _IBUSVAR_H_
 #define _IBUSVAR_H_ 1
@@ -45,12 +45,4 @@
            int (*handler)(void *), void *arg));
 void   ibus_intr_disestablish __P((struct device *, void *));
 
-void   dec_3100_intr_establish __P((struct device *, void *,
-           int, int (*)(void *), void *));
-void   dec_3100_intr_disestablish __P((struct device *, void *));
-
-void   dec_5100_intr_establish __P((struct device *, void *,
-           int, int (*)(void *), void *));
-void   dec_5100_intr_disestablish __P((struct device *, void *));
-
 #endif /* _IBUSVAR_H_ */
diff -r cca69ab40308 -r 0ea7e97b87d2 sys/arch/pmax/include/intr.h
--- a/sys/arch/pmax/include/intr.h      Fri Jan 14 13:41:45 2000 +0000
+++ b/sys/arch/pmax/include/intr.h      Fri Jan 14 13:45:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.h,v 1.10 2000/01/09 15:34:43 ad Exp $     */
+/*     $NetBSD: intr.h,v 1.11 2000/01/14 13:45:22 simonb Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -47,6 +47,7 @@
 #ifndef _LOCORE
 
 #include <mips/cpuregs.h>
+#include <mips/intr.h>
 
 int    _splraise __P((int));
 int    _spllower __P((int));
@@ -119,8 +120,14 @@
 #define        FLOPPY_INTR     15
 #define        STRAY_INTR      16
 
-/* handle i/o device interrupts */
-extern int (*mips_hardware_intr) __P((unsigned, unsigned, unsigned, unsigned));
+
+struct intrhand {
+       int     (*ih_func) __P((void *));
+       void    *ih_arg;
+};
+extern struct intrhand intrtab[];
+
+#define        MAX_INTR_COOKIES        16
 
 #endif /* !_LOCORE */
 #endif /* _KERNEL */
diff -r cca69ab40308 -r 0ea7e97b87d2 sys/arch/pmax/include/sysconf.h
--- a/sys/arch/pmax/include/sysconf.h   Fri Jan 14 13:41:45 2000 +0000
+++ b/sys/arch/pmax/include/sysconf.h   Fri Jan 14 13:45:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysconf.h,v 1.6 2000/01/09 15:34:44 ad Exp $   */
+/*     $NetBSD: sysconf.h,v 1.7 2000/01/14 13:45:22 simonb Exp $       */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -62,12 +62,17 @@
         *      cons_init       -       console initialization
         *      device_register -       boot configuration aid
         *      iointr          -       I/O interrupt handler
+        *      intr_establish  -       establish interrupt handler
+        *      intr_disestablish -     disestablish interrupt handler
         *      clkread         -       interporate HZ with hi-resolution timer
         */
        void    (*bus_reset) __P((void));
        void    (*cons_init) __P((void));
        void    (*device_register) __P((struct device *, void *));
        int     (*iointr) __P((unsigned, unsigned, unsigned, unsigned));
+       void    (*intr_establish) __P((struct device *, void *, int,
+                   int (*)(void *), void *));
+       void    (*intr_disestablish) __P((struct device *, void *));
        int     (*memsize) __P((caddr_t));
        unsigned (*clkread) __P((void));
 };
diff -r cca69ab40308 -r 0ea7e97b87d2 sys/arch/pmax/pmax/autoconf.c
--- a/sys/arch/pmax/pmax/autoconf.c     Fri Jan 14 13:41:45 2000 +0000
+++ b/sys/arch/pmax/pmax/autoconf.c     Fri Jan 14 13:45:21 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.45 2000/01/10 03:24:36 simonb Exp $     */
+/*     $NetBSD: autoconf.c,v 1.46 2000/01/14 13:45:23 simonb Exp $     */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.45 2000/01/10 03:24:36 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.46 2000/01/14 13:45:23 simonb Exp $");
 
 /*
  * Setup the system to run on the current machine.
@@ -61,25 +61,13 @@
 #include <sys/device.h>
 
 #include <machine/autoconf.h>
+#include <machine/intr.h>
 #include <machine/sysconf.h>
 
 #include <pmax/dev/device.h>
-#include <pmax/pmax/turbochannel.h>
 
 
-/*
- * The following several variables are related to
- * the configuration process, and are used in initializing
- * the machine.
- */
-int    cpuspeed = 30;  /* approx # instr per usec. */
-
-/*
- * XXX This should really be in a tcasic driver, or something.
- * XXX But right now even the 3100 code uses it.
- */
-tc_option_t tc_slot_info[TC_MAX_LOGICAL_SLOTS];
-
+struct intrhand intrtab[MAX_INTR_COOKIES];
 
 static void    findroot __P((struct device **, int *));
 
diff -r cca69ab40308 -r 0ea7e97b87d2 sys/arch/pmax/pmax/dec_3100.c
--- a/sys/arch/pmax/pmax/dec_3100.c     Fri Jan 14 13:41:45 2000 +0000
+++ b/sys/arch/pmax/pmax/dec_3100.c     Fri Jan 14 13:45:21 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3100.c,v 1.22 2000/01/10 03:24:37 simonb Exp $ */
+/* $NetBSD: dec_3100.c,v 1.23 2000/01/14 13:45:23 simonb Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -81,7 +81,6 @@
 
 #include <mips/mips/mips_mcclock.h>    /* mcclock CPUspeed estimation */
 
-#include <pmax/pmax/turbochannel.h>
 #include <pmax/pmax/machdep.h>
 #include <pmax/pmax/kn01.h>
 
@@ -94,13 +93,13 @@
 void           dec_3100_init __P((void));              /* XXX */
 static void    dec_3100_bus_reset __P((void));
 
-static void    dec_3100_enable_intr __P((unsigned slotno,
-                   int (*handler)(void *), void *sc, int onoff));
-static int     dec_3100_intr __P((unsigned, unsigned, unsigned, unsigned));
 static void    dec_3100_cons_init __P((void));
 static void    dec_3100_device_register __P((struct device *, void *));
-
 static void    dec_3100_errintr __P((void));
+static int     dec_3100_intr __P((unsigned, unsigned, unsigned, unsigned));
+static void    dec_3100_intr_disestablish __P((struct device *, void *));
+static void    dec_3100_intr_establish __P((struct device *, void *,
+                   int, int (*)(void *), void *));
 
 #define        kn01_wbflush()  mips1_wbflush() /* XXX to be corrected XXX */
 
@@ -112,11 +111,12 @@
        platform.cons_init = dec_3100_cons_init;
        platform.device_register = dec_3100_device_register;
        platform.iointr = dec_3100_intr;
+       platform.intr_establish = dec_3100_intr_establish;
+       platform.intr_disestablish = dec_3100_intr_disestablish;
        platform.memsize = memsize_scan;
        /* no high resolution timer available */
 
        mips_hardware_intr = dec_3100_intr;
-       tc_enable_interrupt = dec_3100_enable_intr;
 
        splvec.splbio = MIPS_SPL0;
        splvec.splnet = MIPS_SPL_0_1;
@@ -144,6 +144,7 @@
 static void
 dec_3100_cons_init()
 {
+       /* notyet */
 }
 
 
@@ -157,31 +158,6 @@
 
 
 /*
- * Enable an interrupt from a slot on the KN01 internal bus.
- *
- * The 4.4bsd kn01 interrupt handler hard-codes r3000 CAUSE register
- * bits to particular device interrupt handlers.  We may choose to store
- * function and softc pointers at some future point.
- */
-static void
-dec_3100_enable_intr(slotno, handler, sc, on)
-       unsigned int slotno;
-       int (*handler) __P((void* softc));
-       void *sc;
-       int on;
-{
-       /*
-        */
-       if (on)  {
-               tc_slot_info[slotno].intr = handler;
-               tc_slot_info[slotno].sc = sc;
-       } else {
-               tc_slot_info[slotno].intr = 0;
-               tc_slot_info[slotno].sc = 0;
-       }
-}
-
-/*
  * Handle pmax (DECstation 2100/3100) interrupts.
  */
 static int
@@ -212,7 +188,7 @@
 #if NSII > 0
        if (mask & MIPS_INT_MASK_0) {
                intrcnt[SCSI_INTR]++;
-               (*tc_slot_info[3].intr)(tc_slot_info[3].sc);
+               (*intrtab[3].ih_func)(intrtab[3].ih_arg);
        }
 #endif /* NSII */
 
@@ -224,14 +200,14 @@
                 * manipulating if queues should have called splimp(),
                 * which would mask out MIPS_INT_MASK_1.
                 */
-               (*tc_slot_info[2].intr)(tc_slot_info[2].sc);
+               (*intrtab[2].ih_func)(intrtab[2].ih_arg);
                intrcnt[LANCE_INTR]++;
        }
 #endif /* NLE_PMAX */
 
 #if NDC > 0
        if (mask & MIPS_INT_MASK_2) {
-               (*tc_slot_info[1].intr)(tc_slot_info[1].sc);
+               (*intrtab[1].ih_func)(intrtab[1].ih_arg);
                intrcnt[SERIAL0_INTR]++;
        }
 #endif /* NDC */
@@ -243,7 +219,7 @@
        return (MIPS_SR_INT_IE | (status & ~cause & MIPS_HARD_INT_MASK));
 }
 
-void
+static void



Home | Main Index | Thread Index | Old Index