summaryrefslogtreecommitdiffstats
path: root/sys/dev/pccbb
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-12-13 01:28:00 +0000
committermsmith <msmith@FreeBSD.org>2000-12-13 01:28:00 +0000
commitac4f44c24e80fa2aed5a82cfeeafffe9ff6d77a0 (patch)
treebd2eb0fac4b03e311819e6ee929a404176a819a0 /sys/dev/pccbb
parentc3cf005c4b085a81c7bb2627adf508c5190d8cab (diff)
downloadFreeBSD-src-ac4f44c24e80fa2aed5a82cfeeafffe9ff6d77a0.zip
FreeBSD-src-ac4f44c24e80fa2aed5a82cfeeafffe9ff6d77a0.tar.gz
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.
Diffstat (limited to 'sys/dev/pccbb')
-rw-r--r--sys/dev/pccbb/pccbb.c30
-rw-r--r--sys/dev/pccbb/pccbbvar.h4
2 files changed, 33 insertions, 1 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c
index b54cc02..0615a32 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),
diff --git a/sys/dev/pccbb/pccbbvar.h b/sys/dev/pccbb/pccbbvar.h
index 1270ec2..2e4ef7c 100644
--- a/sys/dev/pccbb/pccbbvar.h
+++ b/sys/dev/pccbb/pccbbvar.h
@@ -65,8 +65,10 @@ struct pccbb_softc {
struct resource *sc_irq_res;
void *sc_intrhand;
struct pccbb_socketreg *sc_socketreg;
- u_int32_t sc_flags;
+ u_int8_t sc_secbus;
+ u_int8_t sc_subbus;
struct mtx sc_mtx;
+ u_int32_t sc_flags;
#define PCCBB_PCIC_IO_RELOC 0x01
#define PCCBB_PCIC_MEM_32 0x02
#define PCCBB_CARDATTACHED 0x01000000
OpenPOWER on IntegriCloud