Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hp700 This cleans up interrupts with respect to GSC...



details:   https://anonhg.NetBSD.org/src/rev/5f20c37a9fa9
branches:  trunk
changeset: 535373:5f20c37a9fa9
user:      fredette <fredette%NetBSD.org@localhost>
date:      Fri Aug 16 15:02:39 2002 +0000

description:
This cleans up interrupts with respect to GSC bus chips and the devices
they contain.  IRQ information for these has been removed from the
kernel configuration file.  GSC bus chips now choose an available CPU
IRQ for themselves, and know IRQ information for all of the devices
they may contain.  Minor autoconfiguration changes support this.

Renamed the old-style vmstat interrupt counters to say "ipl" and not
"irq", since they've been disconnected from irq numbers.  Also provide
a function to allocate an irq bit from an interrupt register, and a
function to report the next ipl bit that will be allocated.

diffstat:

 sys/arch/hp700/conf/GENERIC       |   37 ++--
 sys/arch/hp700/dev/asp.c          |   50 ++++++-
 sys/arch/hp700/dev/cpu.c          |   12 +-
 sys/arch/hp700/dev/lasi.c         |   50 ++++++-
 sys/arch/hp700/gsc/com_gsc.c      |   22 ++-
 sys/arch/hp700/gsc/gscbus.c       |  263 +++++++------------------------------
 sys/arch/hp700/gsc/gscbusvar.h    |   42 +----
 sys/arch/hp700/gsc/if_ie_gsc.c    |    7 +-
 sys/arch/hp700/gsc/lpt_gsc.c      |    7 +-
 sys/arch/hp700/gsc/osiop_gsc.c    |   23 +-
 sys/arch/hp700/hp700/autoconf.c   |   12 +-
 sys/arch/hp700/hp700/intr.c       |   57 ++++++-
 sys/arch/hp700/hp700/intr.h       |    9 +-
 sys/arch/hp700/hp700/mainbus.c    |   40 +++--
 sys/arch/hp700/include/autoconf.h |    8 +-
 15 files changed, 292 insertions(+), 347 deletions(-)

diffs (truncated from 1124 to 300 lines):

diff -r 9ab8b4339af5 -r 5f20c37a9fa9 sys/arch/hp700/conf/GENERIC
--- a/sys/arch/hp700/conf/GENERIC       Fri Aug 16 13:59:39 2002 +0000
+++ b/sys/arch/hp700/conf/GENERIC       Fri Aug 16 15:02:39 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.3 2002/07/06 15:41:38 fredette Exp $
+# $NetBSD: GENERIC,v 1.4 2002/08/16 15:02:39 fredette Exp $
 #
 # GENERIC machine description file
 # 
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.3 $"
+#ident                 "GENERIC-$Revision: 1.4 $"
 
 maxusers       32              # estimated number of users
 
@@ -188,9 +188,9 @@
 sti*   at mainbus0 irq ?       # [H]CRX-{8,24,48}[Z] graphics
 
 # Basic Bus Support
-lasi*  at mainbus0 irq 28      # LASI host adapter (LSI PN??? )
-asp*   at mainbus0 irq 28      # this one comes w/ Viper and leds
-#wax*  at mainbus0 irq 28      # Wax may host EISA as well
+lasi*  at mainbus0             # LASI host adapter (LSI PN??? )
+asp0   at mainbus0             # this one comes w/ Viper and leds
+#wax*  at mainbus0             # Wax may host EISA as well
 mongoose* at mainbus0 irq 17   # EISA Bus Adapter (i82350 or TI??? )
 #vmeb* at mainbus0 irq ?       # VME bus adapter
 #dino* at mainbus0 irq ?       # PCI bus bridge
@@ -221,12 +221,12 @@
 # Console Devices
 
 # Human Interface Loop
-#hil*          at gsc? irq 1
+#hil*          at gsc? 
 #hkbd*         at hil? code 0  # keyboard
 #hms*          at hil? code 1  # mice & trackballs
 
 # wscons
-#pckbc*                at gsc? irq 26          # pc keyboard controller
+#pckbc*                at gsc?                 # pc keyboard controller
 #pckbd*                at pckbc?               # PC keyboard
 #pms*          at pckbc?               # PS/2 mouse for wsmouse
 #vga0          at isa?
@@ -243,8 +243,7 @@
 # Serial Devices
 
 # GSC serial interfaces
-com0   at gsc? irq 5                   # RS/232 serial port
-com1   at gsc? irq 6                   # RS/232 serial port
+com*   at gsc?                         # RS/232 serial port
 
 # ISA serial interfaces
 #options       COM_HAYESP              # adds Hayes ESP serial board support
@@ -271,7 +270,7 @@
 # Parallel Printer Interfaces
 
 # GSC parallel printer interface
-lpt0   at gsc? irq 7
+lpt*   at gsc?
 
 # ISA parallel printer interfaces
 #lpt0  at isa? port 0x378 irq 7        # standard PC parallel ports
@@ -281,9 +280,8 @@
 # SCSI Controllers and Devices
 
 # GSC SCSI controllers
-osiop0 at gsc? irq 9 flags 0xffff      # NCR 53c700 or NCR 53c710
-#siop0 at gsc? irq 9                   # NCR 53c720 (Fast/Wide)
-#siop1 at gsc? irq 3                   # NCR 53c720 (Fast/Wide)
+osiop* at gsc? flags 0xffff            # NCR 53c700 or NCR 53c710
+#siop* at gsc?                         # NCR 53c720 (Fast/Wide)
 
 # EISA SCSI controllers
 ahb*   at eisa? slot ?                 # Adaptec 174[02] SCSI
@@ -385,7 +383,7 @@
 # Miscellaneous mass storage devices
 
 # GSC floppy
-#fdc*  at gsc? irq 20                  # PC floppy controller (WD37C65C)
+#fdc*  at gsc?                         # PC floppy controller (WD37C65C)
 #options       FD_DEBUG
 
 # ISA floppy
@@ -408,8 +406,8 @@
 # Network Interfaces
 
 # GSC network interfaces
-#medusa* at gsc? irq 4                 # FDDI
-ie0    at gsc? irq 8                   # 82C5[89]6 ether
+#medusa* at gsc?                       # FDDI
+ie*    at gsc?                         # 82C5[89]6 ether
 
 # EISA network interfaces
 ep*    at eisa? slot ?                 # 3Com 3c579 Ethernet
@@ -457,10 +455,9 @@
 # Audio Devices
 
 # GSC audio devices
-#aone* at gsc? irq 13                  # Audio Type 1 (PSB 2160-N)
-#harmony* at gsc? irq 13               # Audio Type 2 (CS4215)
-#com2  at harmony? irq 16              # Telephone add-in card #0
-#com3  at harmony? irq 17              # Telephone add-in card #1
+#aone* at gsc?                         # Audio Type 1 (PSB 2160-N)
+#harmony* at gsc?                      # Audio Type 2 (CS4215)
+#com*  at harmony?                     # Telephone add-in card
 
 # ISA audio devices
 # the "aria" probe might give false hits
diff -r 9ab8b4339af5 -r 5f20c37a9fa9 sys/arch/hp700/dev/asp.c
--- a/sys/arch/hp700/dev/asp.c  Fri Aug 16 13:59:39 2002 +0000
+++ b/sys/arch/hp700/dev/asp.c  Fri Aug 16 15:02:39 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: asp.c,v 1.1 2002/06/06 19:48:03 fredette Exp $ */
+/*     $NetBSD: asp.c,v 1.2 2002/08/16 15:02:39 fredette Exp $ */
 
 /*     $OpenBSD: asp.c,v 1.5 2000/02/09 05:04:22 mickey Exp $  */
 
@@ -120,7 +120,8 @@
 
 struct asp_softc {
        struct  device sc_dev;
-       struct gscbus_ic sc_ic;
+
+       struct hp700_int_reg sc_int_reg;
 
        volatile struct asp_hwr *sc_hw;
        volatile struct asp_trs *sc_trs;
@@ -136,6 +137,31 @@
        sizeof(struct asp_softc), aspmatch, aspattach
 };
 
+/*
+ * Before a module is matched, this fixes up its gsc_attach_args.
+ */
+static void asp_fix_args __P((void *, struct gsc_attach_args *)); 
+static void
+asp_fix_args(void *_sc, struct gsc_attach_args *ga)
+{
+       hppa_hpa_t module_offset;
+       struct asp_softc *sc = _sc;
+
+       /*  
+        * Determine this module's interrupt bit.
+        */
+       module_offset = ga->ga_hpa - (hppa_hpa_t) sc->sc_trs;
+       ga->ga_irq = HP700CF_IRQ_UNDEF;
+#define ASP_IRQ(off, irq) if (module_offset == off) ga->ga_irq = irq
+       ASP_IRQ(0x22000, 6);    /* com1 */
+       ASP_IRQ(0x23000, 5);    /* com0 */
+       ASP_IRQ(0x24000, 7);    /* lpt */
+       ASP_IRQ(0x25000, 9);    /* osiop */
+       ASP_IRQ(0x26000, 8);    /* ie */
+       ASP_IRQ(0x30000, 3);    /* siop */
+#undef ASP_IRQ
+}      
+
 int
 aspmatch(parent, cf, aux)   
        struct device *parent;
@@ -148,6 +174,10 @@
            ca->ca_type.iodc_sv_model != HPPA_BHA_ASP)
                return 0;
 
+       /* Make sure we have an IRQ. */
+       if (ca->ca_irq == HP700CF_IRQ_UNDEF)
+               ca->ca_irq = hp700_intr_allocate_bit(&int_reg_cpu);
+
        return 1;
 }
 
@@ -193,14 +223,18 @@
            asp_spus[sc->sc_trs->asp_spu].name, sc->sc_hw->asp_version,
            sc->sc_trs->asp_lan, sc->sc_trs->asp_scsi);
 
-       sc->sc_ic.gsc_type = gsc_asp;
-       sc->sc_ic.gsc_dv = sc;
-       hp700_intr_reg_establish(&sc->sc_ic.gsc_int_reg);
-       sc->sc_ic.gsc_int_reg.int_reg_mask = &sc->sc_trs->asp_imr;
-       sc->sc_ic.gsc_int_reg.int_reg_req = &sc->sc_trs->asp_irr;
+       /* Establish the interrupt register. */
+       hp700_intr_reg_establish(&sc->sc_int_reg);
+       sc->sc_int_reg.int_reg_mask = &sc->sc_trs->asp_imr;
+       sc->sc_int_reg.int_reg_req = &sc->sc_trs->asp_irr;
 
+       /* Attach the GSC bus. */
        ga.ga_ca = *ca; /* clone from us */
        ga.ga_name = "gsc";
-       ga.ga_ic = &sc->sc_ic;
+       ga.ga_hpa = ASP_CHPA;
+       ga.ga_int_reg = &sc->sc_int_reg;
+       ga.ga_fix_args = asp_fix_args;
+       ga.ga_fix_args_cookie = sc;
+       ga.ga_scsi_target = sc->sc_trs->asp_scsi;
        config_found(self, &ga, gscprint);
 }
diff -r 9ab8b4339af5 -r 5f20c37a9fa9 sys/arch/hp700/dev/cpu.c
--- a/sys/arch/hp700/dev/cpu.c  Fri Aug 16 13:59:39 2002 +0000
+++ b/sys/arch/hp700/dev/cpu.c  Fri Aug 16 15:02:39 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.2 2002/08/05 20:58:36 fredette Exp $ */
+/*     $NetBSD: cpu.c,v 1.3 2002/08/16 15:02:40 fredette Exp $ */
 
 /*     $OpenBSD: cpu.c,v 1.8 2000/08/15 20:38:24 mickey Exp $  */
 
@@ -168,4 +168,14 @@
                printf ("%s: bad irq number %d\n", sc->sc_dev.dv_xname,
                        ca->ca_irq);
        }
+
+       /*
+        * Set the allocatable bits in the CPU interrupt registers.
+        * These should only be used by major chipsets, like ASP and
+        * LASI, and the bits used appear to be important - the
+        * ASP doesn't seem to like to use interrupt bits above 28
+        * or below 27.
+        */
+       int_reg_cpu.int_reg_allocatable_bits =
+               (1 << 28) | (1 << 27);
 }
diff -r 9ab8b4339af5 -r 5f20c37a9fa9 sys/arch/hp700/dev/lasi.c
--- a/sys/arch/hp700/dev/lasi.c Fri Aug 16 13:59:39 2002 +0000
+++ b/sys/arch/hp700/dev/lasi.c Fri Aug 16 15:02:39 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lasi.c,v 1.1 2002/06/06 19:48:04 fredette Exp $        */
+/*     $NetBSD: lasi.c,v 1.2 2002/08/16 15:02:40 fredette Exp $        */
 
 /*     $OpenBSD: lasi.c,v 1.4 2001/06/09 03:57:19 mickey Exp $ */
 
@@ -65,7 +65,8 @@
 
 struct lasi_softc {
        struct device sc_dev;
-       struct gscbus_ic sc_ic;
+       
+       struct hp700_int_reg sc_int_reg;
 
        struct lasi_hwr volatile *sc_hw;
        struct lasi_trs volatile *sc_trs;
@@ -78,7 +79,33 @@
        sizeof(struct lasi_softc), lasimatch, lasiattach
 };
 
+/*
+ * Before a module is matched, this fixes up its gsc_attach_args.
+ */
+static void lasi_fix_args __P((void *, struct gsc_attach_args *));
+static void
+lasi_fix_args(void *_sc, struct gsc_attach_args *ga)
+{
+       struct lasi_softc *sc = _sc;
+       hppa_hpa_t module_offset;
 
+       /*
+        * Determine this module's interrupt bit.
+        */
+       module_offset = ga->ga_hpa - (hppa_hpa_t) sc->sc_trs;
+       ga->ga_irq = HP700CF_IRQ_UNDEF;
+#define LASI_IRQ(off, irq) if (module_offset == off) ga->ga_irq = irq
+       LASI_IRQ(0x2000, 7);    /* lpt */
+       LASI_IRQ(0x4000, 13);   /* harmony */
+       LASI_IRQ(0x4040, 16);   /* harmony telephone0 */
+       LASI_IRQ(0x4060, 17);   /* harmony telephone1 */
+       LASI_IRQ(0x5000, 5);    /* com */
+       LASI_IRQ(0x6000, 9);    /* osiop */
+       LASI_IRQ(0x7000, 8);    /* ie */
+       LASI_IRQ(0x8000, 26);   /* pckbc */
+       LASI_IRQ(0xa000, 20);   /* fdc */
+#undef LASI_IRQ
+}
 
 int
 lasimatch(parent, cf, aux)   
@@ -92,6 +119,10 @@
            ca->ca_type.iodc_sv_model != HPPA_BHA_LASI)
                return 0;
 
+       /* Make sure we have an IRQ. */
+       if (ca->ca_irq == HP700CF_IRQ_UNDEF)
+               ca->ca_irq = hp700_intr_allocate_bit(&int_reg_cpu);
+
        return 1;
 }
 
@@ -132,14 +163,17 @@
        sc->sc_trs->lasi_imr = 0;
        splx(s);
 
-       sc->sc_ic.gsc_type = gsc_lasi;
-       sc->sc_ic.gsc_dv = sc;
-       hp700_intr_reg_establish(&sc->sc_ic.gsc_int_reg);
-       sc->sc_ic.gsc_int_reg.int_reg_mask = &sc->sc_trs->lasi_imr;
-       sc->sc_ic.gsc_int_reg.int_reg_req = &sc->sc_trs->lasi_irr;
+       /* Establish the interrupt register. */
+       hp700_intr_reg_establish(&sc->sc_int_reg);
+       sc->sc_int_reg.int_reg_mask = &sc->sc_trs->lasi_imr;
+       sc->sc_int_reg.int_reg_req = &sc->sc_trs->lasi_irr;
 



Home | Main Index | Thread Index | Old Index