aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/pccbb/pccbb.c
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>2000-12-13 01:28:00 +0000
committerMike Smith <msmith@FreeBSD.org>2000-12-13 01:28:00 +0000
commit84c6b37d745b2bb8b7f7d5c36af293c28785cb3d (patch)
treec0a4803a6859183745a777f5c67f44995109567a /sys/dev/pccbb/pccbb.c
parent8983cfbf278ba9c211d639409c4373eeb08f41e9 (diff)
downloadsrc-84c6b37d745b2bb8b7f7d5c36af293c28785cb3d.tar.gz
src-84c6b37d745b2bb8b7f7d5c36af293c28785cb3d.zip
Updates to match changes elsewhere in the PCI subsystem:
- Remove redundant header-type-specific support in the cardbus pcibus clone. The bridges don't need this anymore. - Use pcib_get_bus instead of the deprecated pci_get_secondarybus. - Implement read/write ivar support for the pccbb, and teach it how to report its secondary bus number. Save the subsidiary bus number as well, although we don't use it yet.
Notes
Notes: svn path=/head/; revision=69954
Diffstat (limited to 'sys/dev/pccbb/pccbb.c')
-rw-r--r--sys/dev/pccbb/pccbb.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c
index b54cc0260095..0615a321b095 100644
--- a/sys/dev/pccbb/pccbb.c
+++ b/sys/dev/pccbb/pccbb.c
@@ -392,6 +392,8 @@ pccbb_attach(device_t dev)
sc->sc_flags = 0;
sc->sc_cbdev = NULL;
sc->sc_pccarddev = NULL;
+ sc->sc_secbus = pci_read_config(dev, PCIR_SECBUS_2, 1);
+ sc->sc_subbus = pci_read_config(dev, PCIR_SUBBUS_2, 1);
sc->memalloc = 0;
sc->ioalloc = 0;
SLIST_INIT(&sc->rl);
@@ -1779,6 +1781,32 @@ pccbb_release_resource(device_t self, device_t child, int type, int rid,
rid, r);
}
+static int
+pccbb_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
+{
+ struct pccbb_softc *sc = device_get_softc(dev);
+
+ switch (which) {
+ case PCIB_IVAR_BUS:
+ *result = sc->sc_secbus;
+ return(0);
+ }
+ return(ENOENT);
+}
+
+static int
+pccbb_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
+{
+ struct pccbb_softc *sc = device_get_softc(dev);
+
+ switch (which) {
+ case PCIB_IVAR_BUS:
+ sc->sc_secbus = value;
+ break;
+ }
+ return(ENOENT);
+}
+
/************************************************************************/
/* PCI compat methods */
/************************************************************************/
@@ -1820,6 +1848,8 @@ static device_method_t pccbb_methods[] = {
/* bus methods */
DEVMETHOD(bus_print_child, bus_generic_print_child),
+ DEVMETHOD(bus_read_ivar, pccbb_read_ivar),
+ DEVMETHOD(bus_write_ivar, pccbb_write_ivar),
DEVMETHOD(bus_alloc_resource, pccbb_alloc_resource),
DEVMETHOD(bus_release_resource, pccbb_release_resource),
DEVMETHOD(bus_activate_resource, pccbb_activate_resource),