diff options
author | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-03-04 00:43:27 +0000 |
---|---|---|
committer | Marcus Glocker <mglocker@cvs.openbsd.org> | 2007-03-04 00:43:27 +0000 |
commit | 865f72917b01e2d97cb6068f0a86b01f3380ee93 (patch) | |
tree | ecdae84b355884d04987c690bb7833986168aff1 | |
parent | 35c9fbff0123ea9fc48345484df79a96ae9a76e3 (diff) |
Kill a cardbus dependency which breaked kernel compilation e.g. for
sparc*.
OK deraadt
-rw-r--r-- | sys/dev/cardbus/if_bcw_cardbus.c | 21 | ||||
-rw-r--r-- | sys/dev/ic/bcw.c | 29 | ||||
-rw-r--r-- | sys/dev/ic/bcwvar.h | 10 | ||||
-rw-r--r-- | sys/dev/pci/if_bcw_pci.c | 29 |
4 files changed, 45 insertions, 44 deletions
diff --git a/sys/dev/cardbus/if_bcw_cardbus.c b/sys/dev/cardbus/if_bcw_cardbus.c index 296127b9b08..9782db0cdb5 100644 --- a/sys/dev/cardbus/if_bcw_cardbus.c +++ b/sys/dev/cardbus/if_bcw_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bcw_cardbus.c,v 1.10 2007/02/26 14:36:11 mglocker Exp $ */ +/* $OpenBSD: if_bcw_cardbus.c,v 1.11 2007/03/04 00:43:25 mglocker Exp $ */ /* * Copyright (c) 2006 Jon Simola <jsimola@gmail.com> @@ -64,8 +64,8 @@ void bcw_cardbus_power(struct bcw_softc *, int); void bcw_cardbus_setup(struct bcw_cardbus_softc *); int bcw_cardbus_enable(struct bcw_softc *); void bcw_cardbus_disable(struct bcw_softc *); -void bcw_cardbus_conf_write(struct bcw_softc *, uint32_t, uint32_t); -uint32_t bcw_cardbus_conf_read(struct bcw_softc *, uint32_t); +void bcw_cardbus_conf_write(void *, uint32_t, uint32_t); +uint32_t bcw_cardbus_conf_read(void *, uint32_t); struct cfattach bcw_cardbus_ca = { sizeof (struct bcw_cardbus_softc), bcw_cardbus_match, @@ -107,8 +107,7 @@ bcw_cardbus_attach(struct device *parent, struct device *self, void *aux) csc->sc_ct = ct; csc->sc_tag = ca->ca_tag; csc->sc_intrline = ca->ca_intrline; - sc->sc_ca.ca_tag = ca->ca_tag; - sc->sc_ca.ca_ct = ca->ca_ct; + sc->sc_dev_softc = csc; /* power management hooks */ sc->sc_enable = bcw_cardbus_enable; @@ -258,13 +257,17 @@ bcw_cardbus_disable(struct bcw_softc *sc) } void -bcw_cardbus_conf_write(struct bcw_softc *sc, uint32_t reg, uint32_t val) +bcw_cardbus_conf_write(void *self, uint32_t reg, uint32_t val) { - Cardbus_conf_write(sc->sc_ca.ca_ct, sc->sc_ca.ca_tag, reg, val); + struct bcw_cardbus_softc *csc = (struct bcw_cardbus_softc *)self; + + Cardbus_conf_write(csc->sc_ct, csc->sc_tag, reg, val); } uint32_t -bcw_cardbus_conf_read(struct bcw_softc *sc, uint32_t reg) +bcw_cardbus_conf_read(void *self, uint32_t reg) { - return (Cardbus_conf_read(sc->sc_ca.ca_ct, sc->sc_ca.ca_tag, reg)); + struct bcw_cardbus_softc *csc = (struct bcw_cardbus_softc *)self; + + return (Cardbus_conf_read(csc->sc_ct, csc->sc_tag, reg)); } diff --git a/sys/dev/ic/bcw.c b/sys/dev/ic/bcw.c index 370539f67dc..a50b0cada85 100644 --- a/sys/dev/ic/bcw.c +++ b/sys/dev/ic/bcw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcw.c,v 1.63 2007/03/01 19:48:00 mglocker Exp $ */ +/* $OpenBSD: bcw.c,v 1.64 2007/03/04 00:43:26 mglocker Exp $ */ /* * Copyright (c) 2006 Jon Simola <jsimola@gmail.com> @@ -56,7 +56,6 @@ #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> #include <dev/pci/pcidevs.h> -#include <dev/cardbus/cardbusvar.h> #include <dev/ic/bcwreg.h> #include <dev/ic/bcwvar.h> @@ -1450,7 +1449,7 @@ bcw_intr(void *xsc) sc = xsc; for (wantinit = 0; wantinit == 0;) { - intstatus = (sc->sc_conf_read)(sc, BCW_INT_STS); + intstatus = (sc->sc_conf_read)(sc->sc_dev_softc, BCW_INT_STS); /* ignore if not ours, or unsolicited interrupts */ intstatus &= sc->sc_intmask; @@ -1460,7 +1459,7 @@ bcw_intr(void *xsc) handled = 1; /* Ack interrupt */ - (sc->sc_conf_write)(sc, BCW_INT_STS, intstatus); + (sc->sc_conf_write)(sc->sc_dev_softc, BCW_INT_STS, intstatus); /* Receive interrupts. */ if (intstatus & I_RI) @@ -2603,15 +2602,15 @@ bcw_powercontrol_crystal_on(struct bcw_softc *sc) { uint32_t sbval; - sbval = (sc->sc_conf_read)(sc, BCW_GPIOI); + sbval = (sc->sc_conf_read)(sc->sc_dev_softc, BCW_GPIOI); if ((sbval & BCW_XTALPOWERUP) != BCW_XTALPOWERUP) { - sbval = (sc->sc_conf_read)(sc, BCW_GPIOO); + sbval = (sc->sc_conf_read)(sc->sc_dev_softc, BCW_GPIOO); sbval |= (BCW_XTALPOWERUP & BCW_PLLPOWERDOWN); - (sc->sc_conf_write)(sc, BCW_GPIOO, sbval); + (sc->sc_conf_write)(sc->sc_dev_softc, BCW_GPIOO, sbval); delay(1000); - sbval = (sc->sc_conf_read)(sc, BCW_GPIOO); + sbval = (sc->sc_conf_read)(sc->sc_dev_softc, BCW_GPIOO); sbval &= ~BCW_PLLPOWERDOWN; - (sc->sc_conf_write)(sc, BCW_GPIOO, sbval); + (sc->sc_conf_write)(sc->sc_dev_softc, BCW_GPIOO, sbval); delay(5000); } } @@ -2629,13 +2628,13 @@ bcw_powercontrol_crystal_off(struct bcw_softc *sc) /* XXX bcw_powercontrol_clock_slow() */ - sbval = (sc->sc_conf_read)(sc, BCW_GPIOO); + sbval = (sc->sc_conf_read)(sc->sc_dev_softc, BCW_GPIOO); sbval |= BCW_PLLPOWERDOWN; sbval &= ~BCW_XTALPOWERUP; - (sc->sc_conf_write)(sc, BCW_GPIOO, sbval); - sbval = (sc->sc_conf_read)(sc, BCW_GPIOE); + (sc->sc_conf_write)(sc->sc_dev_softc, BCW_GPIOO, sbval); + sbval = (sc->sc_conf_read)(sc->sc_dev_softc, BCW_GPIOE); sbval |= BCW_PLLPOWERDOWN | BCW_XTALPOWERUP; - (sc->sc_conf_write)(sc, BCW_GPIOE, sbval); + (sc->sc_conf_write)(sc->sc_dev_softc, BCW_GPIOE, sbval); } int @@ -2644,11 +2643,11 @@ bcw_change_core(struct bcw_softc *sc, int changeto) uint32_t sbval; int i; - (sc->sc_conf_write)(sc, BCW_ADDR_SPACE0, + (sc->sc_conf_write)(sc->sc_dev_softc, BCW_ADDR_SPACE0, BCW_CORE_SELECT(changeto)); /* loop to see if the selected core shows up */ for (i = 0; i < 10; i++) { - sbval = (sc->sc_conf_read)(sc, BCW_ADDR_SPACE0); + sbval = (sc->sc_conf_read)(sc->sc_dev_softc, BCW_ADDR_SPACE0); if (sbval == BCW_CORE_SELECT(changeto)) break; delay(10); diff --git a/sys/dev/ic/bcwvar.h b/sys/dev/ic/bcwvar.h index e24c0977e82..7baa47c1622 100644 --- a/sys/dev/ic/bcwvar.h +++ b/sys/dev/ic/bcwvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bcwvar.h,v 1.26 2007/03/01 19:48:00 mglocker Exp $ */ +/* $OpenBSD: bcwvar.h,v 1.27 2007/03/04 00:43:26 mglocker Exp $ */ /* * Copyright (c) 2006 Jon Simola <jsimola@gmail.com> @@ -200,9 +200,8 @@ struct bcw_softc { int (*sc_enable)(struct bcw_softc *); void (*sc_disable)(struct bcw_softc *); void (*sc_power)(struct bcw_softc *, int); - void (*sc_conf_write)(struct bcw_softc *, - uint32_t, uint32_t); - uint32_t (*sc_conf_read)(struct bcw_softc *, uint32_t); + void (*sc_conf_write)(void *, uint32_t, uint32_t); + uint32_t (*sc_conf_read)(void *, uint32_t); struct timeout sc_scan_to; @@ -212,8 +211,7 @@ struct bcw_softc { void *bcw_intrhand; const char *bcw_intrstr; /* interrupt description */ - struct pci_attach_args sc_pa; - struct cardbus_attach_args sc_ca; + void *sc_dev_softc; uint32_t sc_phy; /* eeprom indicated phy */ struct bcw_dma_slot *bcw_rx_ring; /* receive ring */ struct bcw_dma_slot *bcw_tx_ring; /* transmit ring */ diff --git a/sys/dev/pci/if_bcw_pci.c b/sys/dev/pci/if_bcw_pci.c index 2caa93e9b05..56decc5835a 100644 --- a/sys/dev/pci/if_bcw_pci.c +++ b/sys/dev/pci/if_bcw_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bcw_pci.c,v 1.12 2007/02/26 14:36:11 mglocker Exp $ */ +/* $OpenBSD: if_bcw_pci.c,v 1.13 2007/03/04 00:43:26 mglocker Exp $ */ /* * Copyright (c) 2006 Jon Simola <jsimola@gmail.com> @@ -60,7 +60,6 @@ #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> #include <dev/pci/pcidevs.h> -#include <dev/cardbus/cardbusvar.h> #include <dev/ic/bcwreg.h> #include <dev/ic/bcwvar.h> @@ -91,8 +90,8 @@ struct bcw_pci_softc { int bcw_pci_match(struct device *, void *, void *); void bcw_pci_attach(struct device *, struct device *, void *); -void bcw_pci_conf_write(struct bcw_softc *, uint32_t, uint32_t); -uint32_t bcw_pci_conf_read(struct bcw_softc *, uint32_t); +void bcw_pci_conf_write(void *, uint32_t, uint32_t); +uint32_t bcw_pci_conf_read(void *, uint32_t); struct cfattach bcw_pci_ca = { sizeof(struct bcw_pci_softc), bcw_pci_match, bcw_pci_attach @@ -108,9 +107,9 @@ bcw_pci_match(struct device *parent, void *match, void *aux) void bcw_pci_attach(struct device *parent, struct device *self, void *aux) { - struct bcw_pci_softc *psc = (void *) self; - struct bcw_softc *sc = &psc->psc_bcw; + struct bcw_pci_softc *psc = (void *)self; struct pci_attach_args *pa = (struct pci_attach_args *)aux; + struct bcw_softc *sc = &psc->psc_bcw; pci_chipset_tag_t pc = pa->pa_pc; pcireg_t memtype; bus_addr_t memaddr; @@ -118,10 +117,10 @@ bcw_pci_attach(struct device *parent, struct device *self, void *aux) int pmreg; pcireg_t pmode; + sc->sc_dmat = pa->pa_dmat; psc->psc_pc = pa->pa_pc; psc->psc_pcitag = pa->pa_tag; - sc->sc_pa.pa_pc = pa->pa_pc; - sc->sc_pa.pa_tag = pa->pa_tag; + sc->sc_dev_softc = psc; /* Get it out of power save mode if needed. */ if (pci_get_capability(pc, pa->pa_tag, PCI_CAP_PWRMGMT, &pmreg, 0)) { @@ -159,8 +158,6 @@ bcw_pci_attach(struct device *parent, struct device *self, void *aux) return; } - sc->sc_dmat = pa->pa_dmat; - /* Map the PCI interrupt */ if (pci_intr_map(pa, &psc->psc_ih)) { printf("%s: couldn't map interrupt\n", @@ -219,13 +216,17 @@ bcw_pci_attach(struct device *parent, struct device *self, void *aux) } void -bcw_pci_conf_write(struct bcw_softc *sc, uint32_t reg, uint32_t val) +bcw_pci_conf_write(void *self, uint32_t reg, uint32_t val) { - pci_conf_write(sc->sc_pa.pa_pc, sc->sc_pa.pa_tag, reg, val); + struct bcw_pci_softc *psc = (struct bcw_pci_softc *)self; + + pci_conf_write(psc->psc_pc, psc->psc_pcitag, reg, val); } uint32_t -bcw_pci_conf_read(struct bcw_softc *sc, uint32_t reg) +bcw_pci_conf_read(void *self, uint32_t reg) { - return (pci_conf_read(sc->sc_pa.pa_pc, sc->sc_pa.pa_tag, reg)); + struct bcw_pci_softc *psc = (struct bcw_pci_softc *)self; + + return (pci_conf_read(psc->psc_pc, psc->psc_pcitag, reg)); } |