diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-09-15 07:20:52 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-09-15 07:20:52 +0000 |
commit | e103abb1bcdf6b09458d7051b678f5d858a96bed (patch) | |
tree | 817e8f4d77de660cef27f8c27c8d7f9c53a2a3bb /sys | |
parent | 778edc2149a6fd24310cbd5d8c185b305b2a5beb (diff) |
Properly fill in some of the pci information the driver uses internally.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/cardbus/if_bwi_cardbus.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/bwi.c | 11 | ||||
-rw-r--r-- | sys/dev/ic/bwivar.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/if_bwi_pci.c | 10 |
4 files changed, 26 insertions, 10 deletions
diff --git a/sys/dev/cardbus/if_bwi_cardbus.c b/sys/dev/cardbus/if_bwi_cardbus.c index 2165fefc4e7..bbde1ceef84 100644 --- a/sys/dev/cardbus/if_bwi_cardbus.c +++ b/sys/dev/cardbus/if_bwi_cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bwi_cardbus.c,v 1.3 2007/09/13 09:09:26 mglocker Exp $ */ +/* $OpenBSD: if_bwi_cardbus.c,v 1.4 2007/09/15 07:20:51 jsg Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -101,6 +101,9 @@ bwi_cardbus_attach(struct device *parent, struct device *self, void *aux) struct cardbus_attach_args *ca = aux; struct bwi_softc *sc = &csc->csc_bwi; cardbus_devfunc_t ct = ca->ca_ct; + cardbus_chipset_tag_t cc = ct->ct_cc; + cardbus_function_tag_t cf = ct->ct_cf; + cardbusreg_t reg; bus_addr_t base; int error; @@ -133,6 +136,13 @@ bwi_cardbus_attach(struct device *parent, struct device *self, void *aux) sc->sc_conf_read = bwi_cardbus_conf_read; sc->sc_conf_write = bwi_cardbus_conf_write; + reg = cardbus_conf_read(cc, cf, ca->ca_tag, PCI_SUBSYS_ID_REG); + + sc->sc_pci_revid = PCI_REVISION(ca->ca_class); + sc->sc_pci_did = PCI_PRODUCT(ca->ca_id); + sc->sc_pci_subvid = PCI_VENDOR(reg); + sc->sc_pci_subdid = PCI_PRODUCT(reg); + error = bwi_attach(sc); if (error != 0) bwi_cardbus_detach(&sc->sc_dev, 0); diff --git a/sys/dev/ic/bwi.c b/sys/dev/ic/bwi.c index 41b679661e6..50ac333812f 100644 --- a/sys/dev/ic/bwi.c +++ b/sys/dev/ic/bwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bwi.c,v 1.15 2007/09/15 05:47:53 jsg Exp $ */ +/* $OpenBSD: bwi.c,v 1.16 2007/09/15 07:20:51 jsg Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -91,9 +91,6 @@ int bwi_debug = 1; #include <dev/pci/pcivar.h> #include <dev/pci/pcidevs.h> -#define pci_get_device(dev) (0) -#define pci_get_revid(dev) (0) - /* * Contention window (slots). */ @@ -2392,7 +2389,7 @@ bwi_mac_attach(struct bwi_softc *sc, int id, uint8_t rev) * More than one MAC is only supported by BCM4309 */ if (sc->sc_nmac != 0 && - pci_get_device(sc->sc_dev) != PCI_PRODUCT_BROADCOM_BCM4309) { + sc->sc_pci_did != PCI_PRODUCT_BROADCOM_BCM4309) { DPRINTF(1, "%s: ignore second MAC\n", sc->sc_dev.dv_xname); return (0); } @@ -5935,8 +5932,8 @@ bwi_bbp_attach(struct bwi_softc *sc) sc->sc_cap = CSR_READ_4(sc, BWI_CAPABILITY); } else { - uint16_t did = pci_get_device(sc->sc_dev); - uint8_t revid = pci_get_revid(sc->sc_dev); + uint16_t did = sc->sc_pci_did; + uint8_t revid = sc->sc_pci_revid; for (i = 0; i < N(bwi_bbpid_map); ++i) { if (did >= bwi_bbpid_map[i].did_min && diff --git a/sys/dev/ic/bwivar.h b/sys/dev/ic/bwivar.h index d3dd4e3a7da..321e5e93b9d 100644 --- a/sys/dev/ic/bwivar.h +++ b/sys/dev/ic/bwivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bwivar.h,v 1.6 2007/09/14 20:26:04 mglocker Exp $ */ +/* $OpenBSD: bwivar.h,v 1.7 2007/09/15 07:20:51 jsg Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. @@ -446,6 +446,7 @@ struct bwi_softc { uint8_t sc_bbp_pkg; uint8_t sc_pci_revid; + uint16_t sc_pci_did; uint16_t sc_pci_subvid; uint16_t sc_pci_subdid; diff --git a/sys/dev/pci/if_bwi_pci.c b/sys/dev/pci/if_bwi_pci.c index 1b03a390a96..abcb1fa4b02 100644 --- a/sys/dev/pci/if_bwi_pci.c +++ b/sys/dev/pci/if_bwi_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bwi_pci.c,v 1.3 2007/09/13 12:31:47 mglocker Exp $ */ +/* $OpenBSD: if_bwi_pci.c,v 1.4 2007/09/15 07:20:51 jsg Exp $ */ /* * Copyright (c) 2007 Marcus Glocker <mglocker@openbsd.org> @@ -104,6 +104,7 @@ bwi_pci_attach(struct device *parent, struct device *self, void *aux) struct bwi_softc *sc = &psc->psc_bwi; const char *intrstr = NULL; pci_intr_handle_t ih; + pcireg_t reg; int error; sc->sc_dmat = pa->pa_dmat; @@ -142,6 +143,13 @@ bwi_pci_attach(struct device *parent, struct device *self, void *aux) sc->sc_conf_write = bwi_pci_conf_write; sc->sc_conf_read = bwi_pci_conf_read; + reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG); + + sc->sc_pci_revid = PCI_REVISION(pa->pa_class); + sc->sc_pci_did = PCI_PRODUCT(pa->pa_id); + sc->sc_pci_subvid = PCI_VENDOR(reg); + sc->sc_pci_subdid = PCI_PRODUCT(reg); + bwi_attach(sc); } |