diff options
author | imp <imp@FreeBSD.org> | 2008-08-16 20:18:40 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2008-08-16 20:18:40 +0000 |
commit | c73cca61188e71c277cf7324bdac792e4df63d27 (patch) | |
tree | ec3005deae5a3950aa122d6578c12be0d8bac35a | |
parent | 0d283f41de78a4d50b4f1e8c376fb3beff51234d (diff) | |
download | FreeBSD-src-c73cca61188e71c277cf7324bdac792e4df63d27.zip FreeBSD-src-c73cca61188e71c277cf7324bdac792e4df63d27.tar.gz |
Add some sysctl reporting for most pci_pci bridges. We now report
domain, pribus (the primary bus, eg the bus that this chip is on),
secbus (the secondary bus, eg the bus immediately behind this chip)
and subbus (the number of the highest bus behind this chip).
Normally, this information is reported via bootverbose parameters, but
that's hard to use for debugging in some cases.
This adds reading of pribus to make this happen. In addition, change
the narrow types to u_int to allow for easier reporting via sysctl for
domain, secbus and subbus. This should have no effect, but if it
does, please let me know.
-rw-r--r-- | sys/dev/pci/pci_pci.c | 17 | ||||
-rw-r--r-- | sys/dev/pci/pcib_private.h | 7 |
2 files changed, 21 insertions, 3 deletions
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c index 13fa065..cb02911 100644 --- a/sys/dev/pci/pci_pci.c +++ b/sys/dev/pci/pci_pci.c @@ -139,6 +139,8 @@ pcib_attach_common(device_t dev) { struct pcib_softc *sc; uint8_t iolow; + struct sysctl_ctx_list *sctx; + struct sysctl_oid *soid; sc = device_get_softc(dev); sc->dev = dev; @@ -148,6 +150,7 @@ pcib_attach_common(device_t dev) */ sc->command = pci_read_config(dev, PCIR_COMMAND, 1); sc->domain = pci_get_domain(dev); + sc->pribus = pci_read_config(dev, PCIR_PRIBUS_1, 1); sc->secbus = pci_read_config(dev, PCIR_SECBUS_1, 1); sc->subbus = pci_read_config(dev, PCIR_SUBBUS_1, 1); sc->secstat = pci_read_config(dev, PCIR_SECSTAT_1, 2); @@ -155,6 +158,20 @@ pcib_attach_common(device_t dev) sc->seclat = pci_read_config(dev, PCIR_SECLAT_1, 1); /* + * Setup sysctl reporting nodes + */ + sctx = device_get_sysctl_ctx(dev); + soid = device_get_sysctl_tree(dev); + SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "domain", + CTLFLAG_RD, &sc->domain, 0, "Domain number"); + SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "pribus", + CTLFLAG_RD, &sc->pribus, 0, "Primary bus number"); + SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "secbus", + CTLFLAG_RD, &sc->secbus, 0, "Secondary bus number"); + SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "subbus", + CTLFLAG_RD, &sc->subbus, 0, "Subordinate bus number"); + + /* * Determine current I/O decode. */ if (sc->command & PCIM_CMD_PORTEN) { diff --git a/sys/dev/pci/pcib_private.h b/sys/dev/pci/pcib_private.h index c375e3e..6159839 100644 --- a/sys/dev/pci/pcib_private.h +++ b/sys/dev/pci/pcib_private.h @@ -48,9 +48,10 @@ struct pcib_softc #define PCIB_SUBTRACTIVE 0x1 #define PCIB_DISABLE_MSI 0x2 uint16_t command; /* command register */ - uint32_t domain; /* domain number */ - uint8_t secbus; /* secondary bus number */ - uint8_t subbus; /* subordinate bus number */ + u_int domain; /* domain number */ + u_int pribus; /* primary bus number */ + u_int secbus; /* secondary bus number */ + u_int subbus; /* subordinate bus number */ pci_addr_t pmembase; /* base address of prefetchable memory */ pci_addr_t pmemlimit; /* topmost address of prefetchable memory */ pci_addr_t membase; /* base address of memory window */ |