Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/atari Split the ISA common attachment stuff and the...



details:   https://anonhg.NetBSD.org/src/rev/cfee3c6c3774
branches:  trunk
changeset: 509003:cfee3c6c3774
user:      leo <leo%NetBSD.org@localhost>
date:      Tue Apr 24 06:39:47 2001 +0000

description:
Split the ISA common attachment stuff and the interrupt handling.
There are too many differences between the Hades and Milan in this area.

diffstat:

 sys/arch/atari/conf/files.atari  |    4 +-
 sys/arch/atari/isa/isa_hades.c   |  221 +++++++++++++++++++++++++++++++++
 sys/arch/atari/isa/isa_machdep.c |  179 +--------------------------
 sys/arch/atari/isa/isa_milan.c   |  254 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 483 insertions(+), 175 deletions(-)

diffs (truncated from 728 to 300 lines):

diff -r 374d793f387b -r cfee3c6c3774 sys/arch/atari/conf/files.atari
--- a/sys/arch/atari/conf/files.atari   Tue Apr 24 06:27:58 2001 +0000
+++ b/sys/arch/atari/conf/files.atari   Tue Apr 24 06:39:47 2001 +0000
@@ -1,5 +1,5 @@
 #
-#      $NetBSD: files.atari,v 1.79 2001/04/10 06:37:08 leo Exp $
+#      $NetBSD: files.atari,v 1.80 2001/04/24 06:39:47 leo Exp $
 
 maxpartitions 16
 
@@ -153,6 +153,8 @@
 # ISA-devices
 #
 file   arch/atari/isa/isa_machdep.c    isa
+file   arch/atari/isa/isa_hades.c      _atarihw_
+file   arch/atari/isa/isa_milan.c      _milanhw_
 file   arch/atari/isa/isa_dma.c        isadma
 
 device isabus
diff -r 374d793f387b -r cfee3c6c3774 sys/arch/atari/isa/isa_hades.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/atari/isa/isa_hades.c    Tue Apr 24 06:39:47 2001 +0000
@@ -0,0 +1,221 @@
+/*     $NetBSD: isa_hades.c,v 1.1 2001/04/24 06:39:48 leo Exp $        */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Leo Weppelman.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <dev/isa/isavar.h>
+#include <dev/isa/isareg.h>
+
+#include <m68k/asm_single.h>
+
+#include <machine/iomap.h>
+#include <machine/mfp.h>
+
+void   isa_bus_init(void);
+
+void
+isa_bus_init()
+{
+}
+
+/*
+ * The interrupt stuff is rather ugly. On the Hades, all interrupt lines
+ * for a slot are wired together and connected to either IO3 (slot1) or
+ * IO7 (slot2). Since no info can be obtained about the slot position
+ * at isa_intr_establish() time, the following assumption is made:
+ *   - irq <= 6 -> slot 1
+ *   - irq >  6 -> slot 2
+ */
+
+#define        SLOTNR(irq)     ((irq <= 6) ? 0 : 1)
+
+static isa_intr_info_t iinfo[2] = { { -1 }, { -1 } };
+
+static int     iifun __P((int, int));
+
+static int
+iifun(slot, sr)
+int    slot;
+int    sr;
+{
+       isa_intr_info_t *iinfo_p;
+       int             s;
+
+       iinfo_p = &iinfo[slot];
+
+       /*
+        * Disable the interrupts
+        */
+       if (slot == 0) {
+               single_inst_bclr_b(MFP->mf_imrb, IB_ISA1);
+       }
+       else {
+               single_inst_bclr_b(MFP->mf_imra, IA_ISA2);
+       }
+
+       if ((sr & PSL_IPL) >= (iinfo_p->ipl & PSL_IPL)) {
+               /*
+                * We're running at a too high priority now.
+                */
+               add_sicallback((si_farg)iifun, (void*)slot, 0);
+       }
+       else {
+               s = splx(iinfo_p->ipl);
+               if (slot == 0) {
+                       do {
+                               MFP->mf_iprb = (u_int8_t)~IB_ISA1;
+                               (void) (iinfo_p->ifunc)(iinfo_p->iarg);
+                       } while (MFP->mf_iprb & IB_ISA1);
+                       single_inst_bset_b(MFP->mf_imrb, IB_ISA1);
+               }
+               else {
+                       do {
+                               MFP->mf_ipra = (u_int8_t)~IA_ISA2;
+                               (void) (iinfo_p->ifunc)(iinfo_p->iarg);
+                       } while (MFP->mf_ipra & IA_ISA2);
+                       single_inst_bset_b(MFP->mf_imra, IA_ISA2);
+               }
+               splx(s);
+       }
+       return 1;
+}
+
+
+/*
+ * XXXX
+ * XXXX Note that this function is not really working yet! The big problem is
+ * XXXX to only generate interrupts for the slot the card is in...
+ */
+int
+isa_intr_alloc(ic, mask, type, irq)
+       isa_chipset_tag_t ic;
+       int mask;
+       int type;
+       int *irq;
+{
+       isa_intr_info_t *iinfo_p;
+       int             slot, i;
+
+
+       /*
+        * The Hades only supports edge triggered interrupts!
+        */
+       if (type != IST_EDGE)
+               return 1;
+
+#define        MAXIRQ          10      /* XXX: Pure fiction    */
+       for (i = 0; i < MAXIRQ; i++) {
+               if (mask & (1<<i)) {
+                   slot    = SLOTNR(i);
+                   iinfo_p = &iinfo[slot];
+
+                   if (iinfo_p->slot < 0) {
+                       *irq = i;
+                       printf("WARNING: isa_intr_alloc is not yet ready!\n"
+                              "         make sure the card is in slot %d!\n",
+                               slot);
+                       return 0;
+                   }
+               }
+       }
+       return (1);
+}
+void *
+isa_intr_establish(ic, irq, type, level, ih_fun, ih_arg)
+       isa_chipset_tag_t ic;
+       int               irq, type, level;
+       int               (*ih_fun) __P((void *));
+       void              *ih_arg;
+{
+       isa_intr_info_t *iinfo_p;
+       struct intrhand *ihand;
+       int             slot;
+
+       /*
+        * The Hades only supports edge triggered interrupts!
+        */
+       if (type != IST_EDGE)
+               return NULL;
+
+       slot    = SLOTNR(irq);
+       iinfo_p = &iinfo[slot];
+
+       if (iinfo_p->slot >= 0)
+           panic("isa_intr_establish: interrupt was already established\n");
+
+       ihand = intr_establish((slot == 0) ? 3 : 15, USER_VEC, 0,
+                               (hw_ifun_t)iifun, (void *)slot);
+       if (ihand != NULL) {
+               iinfo_p->slot  = slot;
+               iinfo_p->ipl   = level;
+               iinfo_p->ifunc = ih_fun;
+               iinfo_p->iarg  = ih_arg;
+               iinfo_p->ihand = ihand;
+
+               /*
+                * Enable (unmask) the interrupt
+                */
+               if (slot == 0) {
+                       single_inst_bset_b(MFP->mf_imrb, IB_ISA1);
+                       single_inst_bset_b(MFP->mf_ierb, IB_ISA1);
+               }
+               else {
+                       single_inst_bset_b(MFP->mf_imra, IA_ISA2);
+                       single_inst_bset_b(MFP->mf_iera, IA_ISA2);
+               }
+               return(iinfo_p);
+       }
+       return NULL;
+}
+
+void
+isa_intr_disestablish(ic, handler)
+       isa_chipset_tag_t       ic;
+       void                    *handler;
+{
+       isa_intr_info_t *iinfo_p = (isa_intr_info_t *)handler;
+
+       if (iinfo_p->slot < 0)
+           panic("isa_intr_disestablish: interrupt was not established\n");
+
+       (void) intr_disestablish(iinfo_p->ihand);
+       iinfo_p->slot = -1;
+}
diff -r 374d793f387b -r cfee3c6c3774 sys/arch/atari/isa/isa_machdep.c
--- a/sys/arch/atari/isa/isa_machdep.c  Tue Apr 24 06:27:58 2001 +0000
+++ b/sys/arch/atari/isa/isa_machdep.c  Tue Apr 24 06:39:47 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: isa_machdep.c,v 1.21 2001/03/09 20:55:47 leo Exp $     */
+/*     $NetBSD: isa_machdep.c,v 1.22 2001/04/24 06:39:48 leo Exp $     */
 
 /*
  * Copyright (c) 1997 Leo Weppelman.  All rights reserved.
@@ -33,21 +33,14 @@
 
 #include <sys/types.h>
 #include <sys/param.h>
-#include <sys/time.h>
 #include <sys/systm.h>
-#include <sys/errno.h>
 #include <sys/device.h>
 
-#include <uvm/uvm_extern.h>
-
 #define _ATARI_BUS_DMA_PRIVATE
 #include <machine/bus.h>
 #include <dev/isa/isavar.h>
 #include <dev/isa/isareg.h>
 
-#include <m68k/asm_single.h>
-
-#include <machine/cpu.h>
 #include <machine/iomap.h>
 #include <machine/mfp.h>
 #include <atari/atari/device.h>
@@ -112,6 +105,7 @@
        struct isabus_softc *sc = (struct isabus_softc *)dp;
        struct isabus_attach_args       iba;
        extern struct atari_bus_dma_tag isa_bus_dma_tag;
+       extern void isa_bus_init(void);
 
        iba.iba_busname = "isa";
        iba.iba_dmat    = &isa_bus_dma_tag;
@@ -125,7 +119,9 @@
        iba.iba_iot->base  = ISA_IOSTART;
        iba.iba_memt->base = ISA_MEMSTART;
 
-       MFP->mf_aer |= (IO_ISA1|IO_ISA2); /* ISA interrupts: LOW->HIGH */
+       if (machineid & ATARI_HADES)
+           MFP->mf_aer |= (IO_ISA1|IO_ISA2); /* ISA interrupts: LOW->HIGH */
+       isa_bus_init();
 
        printf("\n");
        config_found(dp, &iba, isabusprint);
@@ -148,109 +144,6 @@
 {
 }
 
-/*
- * The interrupt stuff is rather ugly. On the Hades, all interrupt lines



Home | Main Index | Thread Index | Old Index