Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Don't use void * for chipset tags. Bad hacker, no b...



details:   https://anonhg.NetBSD.org/src/rev/0c7170927a78
branches:  trunk
changeset: 482825:0c7170927a78
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Feb 22 16:04:44 2000 +0000

description:
Don't use void * for chipset tags.  Bad hacker, no biscuit.

diffstat:

 sys/dev/ic/i82365var.h       |   5 +----
 sys/dev/isa/i82365_isa.c     |   7 ++++---
 sys/dev/isa/i82365_isasubr.c |  22 ++++++++++++++--------
 sys/dev/isa/i82365_isavar.h  |   7 ++++++-
 sys/dev/pci/i82365_pci.c     |   7 ++++---
 sys/dev/pci/i82365_pcivar.h  |   7 ++++++-
 6 files changed, 35 insertions(+), 20 deletions(-)

diffs (215 lines):

diff -r b43d4b742243 -r 0c7170927a78 sys/dev/ic/i82365var.h
--- a/sys/dev/ic/i82365var.h    Tue Feb 22 16:03:42 2000 +0000
+++ b/sys/dev/ic/i82365var.h    Tue Feb 22 16:04:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82365var.h,v 1.12 2000/02/08 17:56:58 mycroft Exp $   */
+/*     $NetBSD: i82365var.h,v 1.13 2000/02/22 16:04:46 thorpej Exp $   */
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -117,9 +117,6 @@
        bus_space_tag_t iot;
        bus_space_handle_t ioh;
 
-       /* XXX isa_chipset_tag_t, pci_chipset_tag_t, etc. */
-       void *intr_est;
-
        pcmcia_chipset_tag_t pct;
 
        /* this needs to be large enough to hold PCIC_MEM_PAGES bits */
diff -r b43d4b742243 -r 0c7170927a78 sys/dev/isa/i82365_isa.c
--- a/sys/dev/isa/i82365_isa.c  Tue Feb 22 16:03:42 2000 +0000
+++ b/sys/dev/isa/i82365_isa.c  Tue Feb 22 16:04:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82365_isa.c,v 1.12 2000/02/01 22:39:52 chopps Exp $   */
+/*     $NetBSD: i82365_isa.c,v 1.13 2000/02/22 16:04:44 thorpej Exp $  */
 
 #define        PCICISADEBUG
 
@@ -65,7 +65,7 @@
 void   pcic_isa_attach __P((struct device *, struct device *, void *));
 
 struct cfattach pcic_isa_ca = {
-       sizeof(struct pcic_softc), pcic_isa_probe, pcic_isa_attach
+       sizeof(struct pcic_isa_softc), pcic_isa_probe, pcic_isa_attach
 };
 
 static struct pcmcia_chip_functions pcic_isa_functions = {
@@ -166,6 +166,7 @@
        void *aux;
 {
        struct pcic_softc *sc = (void *) self;
+       struct pcic_isa_softc *isc = (void *) self;
        struct isa_attach_args *ia = aux;
        isa_chipset_tag_t ic = ia->ia_ic;
        bus_space_tag_t iot = ia->ia_iot;
@@ -188,7 +189,7 @@
        sc->membase = ia->ia_maddr;
        sc->subregionmask = (1 << (ia->ia_msize / PCIC_MEM_PAGESIZE)) - 1;
 
-       sc->intr_est = ic;
+       isc->sc_ic = ic;
        sc->pct = (pcmcia_chipset_tag_t) & pcic_isa_functions;
 
        sc->iot = iot;
diff -r b43d4b742243 -r 0c7170927a78 sys/dev/isa/i82365_isasubr.c
--- a/sys/dev/isa/i82365_isasubr.c      Tue Feb 22 16:03:42 2000 +0000
+++ b/sys/dev/isa/i82365_isasubr.c      Tue Feb 22 16:04:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82365_isasubr.c,v 1.14 2000/02/08 17:53:48 mycroft Exp $      */
+/*     $NetBSD: i82365_isasubr.c,v 1.15 2000/02/22 16:04:44 thorpej Exp $      */
 
 #define        PCICISADEBUG
 
@@ -134,11 +134,13 @@
        void *arg;
 {
        struct pcic_softc *sc;
+       struct pcic_isa_softc *isc;
        struct pcic_handle *h;
        int cscreg;
 
        h = arg;
        sc = (struct pcic_softc *)h->ph_parent;
+       isc = (struct pcic_isa_softc *)h->ph_parent;
 
        cscreg = pcic_read(h, PCIC_CSC);
        if (cscreg & PCIC_CSC_CD) {
@@ -157,7 +159,7 @@
                pcic_write(h, PCIC_CSC_INTR, 0);
                delay(10);
 
-               isa_intr_disestablish(sc->intr_est, sc->ih);
+               isa_intr_disestablish(isc->sc_ic, sc->ih);
                sc->ih = 0;
        }
 
@@ -179,11 +181,12 @@
        struct pcic_softc *sc;
        struct pcic_handle *h;
 {
+       struct pcic_isa_softc *isc = (void *) sc;
        isa_chipset_tag_t ic;
        int i, j, mask, irq;
        int cd, cscintr, intr, csc;
 
-       ic = sc->intr_est;
+       ic = isc->sc_ic;
 
        printf("%s: controller %d detecting irqs with mask 0x%04x:",
            sc->dev.dv_xname, h->chip, sc->intr_mask[h->chip]);
@@ -270,12 +273,14 @@
        struct device *self;
 {
        struct pcic_softc *sc;
+       struct pcic_isa_softc *isc;
        struct pcic_handle *h;
        isa_chipset_tag_t ic;
        int s, i, chipmask, chipuniq;
 
-       sc = (struct pcic_softc *)self;
-       ic = sc->intr_est;
+       sc = (struct pcic_softc *) self;
+       isc = (struct pcic_isa_softc *) self;
+       ic = isc->sc_ic;
 
        /* probe each controller */
        chipmask = 0xffff;
@@ -470,7 +475,8 @@
 {
        struct pcic_handle *h = (struct pcic_handle *) pch;
        struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
-       isa_chipset_tag_t ic = sc->intr_est;
+       struct pcic_isa_softc *isc = (struct pcic_isa_softc *)(h->ph_parent);
+       isa_chipset_tag_t ic = isc->sc_ic;
        int irq, ist;
        void *ih;
        int reg;
@@ -506,8 +512,8 @@
        void *ih;
 {
        struct pcic_handle *h = (struct pcic_handle *) pch;
-       struct pcic_softc *sc = (struct pcic_softc *)(h->ph_parent);
-       isa_chipset_tag_t ic = sc->intr_est;
+       struct pcic_isa_softc *isc = (struct pcic_isa_softc *)(h->ph_parent);
+       isa_chipset_tag_t ic = isc->sc_ic;
        int reg;
 
        h->ih_irq = 0;
diff -r b43d4b742243 -r 0c7170927a78 sys/dev/isa/i82365_isavar.h
--- a/sys/dev/isa/i82365_isavar.h       Tue Feb 22 16:03:42 2000 +0000
+++ b/sys/dev/isa/i82365_isavar.h       Tue Feb 22 16:04:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82365_isavar.h,v 1.2 2000/02/01 22:39:52 chopps Exp $ */
+/*     $NetBSD: i82365_isavar.h,v 1.3 2000/02/22 16:04:45 thorpej Exp $        */
 
 /*
  * Copyright (c) 1998 Bill Sommerfeld.  All rights reserved.
@@ -30,6 +30,11 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+struct pcic_isa_softc {
+       struct pcic_softc sc_pcic;      /* real pcic softc */
+       isa_chipset_tag_t sc_ic;        /* ISA chipset tag */
+};
+
 extern int pcic_isa_intr_alloc_mask;
 
 /* 
diff -r b43d4b742243 -r 0c7170927a78 sys/dev/pci/i82365_pci.c
--- a/sys/dev/pci/i82365_pci.c  Tue Feb 22 16:03:42 2000 +0000
+++ b/sys/dev/pci/i82365_pci.c  Tue Feb 22 16:04:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82365_pci.c,v 1.8 2000/02/01 22:39:53 chopps Exp $    */
+/*     $NetBSD: i82365_pci.c,v 1.9 2000/02/22 16:04:47 thorpej Exp $   */
 
 /*
  * Copyright (c) 1997 Marc Horowitz.  All rights reserved.
@@ -57,7 +57,7 @@
 void   pcic_pci_attach __P((struct device *, struct device *, void *));
 
 struct cfattach pcic_pci_ca = {
-       sizeof(struct pcic_softc), pcic_pci_match, pcic_pci_attach
+       sizeof(struct pcic_pci_softc), pcic_pci_match, pcic_pci_attach
 };
 
 static struct pcmcia_chip_functions pcic_pci_functions = {
@@ -112,6 +112,7 @@
        void *aux;
 {
        struct pcic_softc *sc = (void *) self;
+       struct pcic_pci_softc *psc = (void *) self;
        struct pci_attach_args *pa = aux;
        pci_chipset_tag_t pc = pa->pa_pc;
        bus_space_tag_t memt = pa->pa_memt;
@@ -186,7 +187,7 @@
                return;
        }
 
-       sc->intr_est = pcic_pci_machdep_intr_est(pc);
+       psc->intr_est = pcic_pci_machdep_intr_est(pc);
        sc->irq = -1;
 
 #if 0
diff -r b43d4b742243 -r 0c7170927a78 sys/dev/pci/i82365_pcivar.h
--- a/sys/dev/pci/i82365_pcivar.h       Tue Feb 22 16:03:42 2000 +0000
+++ b/sys/dev/pci/i82365_pcivar.h       Tue Feb 22 16:04:44 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: i82365_pcivar.h,v 1.1 1998/12/20 17:53:28 nathanw Exp $        */
+/*     $NetBSD: i82365_pcivar.h,v 1.2 2000/02/22 16:04:47 thorpej Exp $        */
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -33,6 +33,11 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+struct pcic_pci_softc {
+       struct pcic_softc sc_pcic;      /* real pcic softc */
+       void *intr_est;                 /* XXX */
+};
+
 /* 
  * Establish/disestablish interrupts for PCMCIA functions.
  */



Home | Main Index | Thread Index | Old Index