diff options
author | mdodd <mdodd@FreeBSD.org> | 1999-07-27 04:28:14 +0000 |
---|---|---|
committer | mdodd <mdodd@FreeBSD.org> | 1999-07-27 04:28:14 +0000 |
commit | 6911e1bc28963d6d6b92dd7f7d3a08a6528f2f45 (patch) | |
tree | aea257ec6c133497892caddc6426957500f883fe | |
parent | 59d886ea36d01bc356084ffc456561f7b6083efa (diff) | |
download | FreeBSD-src-6911e1bc28963d6d6b92dd7f7d3a08a6528f2f45.zip FreeBSD-src-6911e1bc28963d6d6b92dd7f7d3a08a6528f2f45.tar.gz |
Implement the BUS_PROBE_NOMATCH method for the PCI bus.
This function is called for each device for which no driver
was found.
Output is similar to the eisa_probe_nomatch() function but with the
added benefit of displaying the assigned IRQ (since PCI gives us
this information up front.)
Output is like so:
pci0: unknown card CPQ0508 (vendor=0x0e11, dev=0x0508) at 11.0 irq 9
pci0: unknown card DFZ0508 (vendor=0x10da, dev=0x0508) at 11.0 irq 9
pci0: unknown card DBL0508 (vendor=0x104c, dev=0x0508) at 11.0 irq 9
pci0: unknown card DDM0011 (vendor=0x108d, dev=0x0011) at 11.0 irq 9
I'm not happy with the 3 lines of macro cruft that got added but
I consider it a temporary annoyance as those bits will be moved to
some place where PCI, EISA and ISAPNP code will be able to use them.
(Not surprisingly, this message is longer than the code in question.)
Reviewed by: peter, dfr
-rw-r--r-- | sys/dev/pci/pci.c | 33 | ||||
-rw-r--r-- | sys/pci/pci.c | 33 |
2 files changed, 64 insertions, 2 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 9de789b..98f76c6 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci.c,v 1.109 1999/07/01 22:58:03 peter Exp $ + * $Id: pci.c,v 1.110 1999/07/03 20:17:07 peter Exp $ * */ @@ -68,6 +68,10 @@ static STAILQ_HEAD(devlist, pci_devinfo) pci_devq; u_int32_t pci_numdevs = 0; static u_int32_t pci_generation = 0; +#define PCI_MFCTR_CHAR0(ID) (char)(((ID>>10) & 0x1F) | '@') /* Bits 10-14 */ +#define PCI_MFCTR_CHAR1(ID) (char)(((ID>>5 ) & 0x1F) | '@') /* Bits 5-9 */ +#define PCI_MFCTR_CHAR2(ID) (char)(( ID & 0x1F) | '@') /* Bits 0-4 */ + /* return base address of memory or port map */ static int @@ -1126,6 +1130,32 @@ pci_print_child(device_t dev, device_t child) printf(" on %s%d", device_get_name(dev), device_get_unit(dev)); } +static void +pci_probe_nomatch(device_t dev, device_t child) +{ + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; + + device_printf(dev, "unknown card %c%c%c%04x (vendor=0x%04x, dev=0x%04x) at %d.$d", + PCI_MFCTR_CHAR0(cfg->vendor), + PCI_MFCTR_CHAR1(cfg->vendor), + PCI_MFCTR_CHAR2(cfg->vendor), + cfg->device, + cfg->vendor, + cfg->device, + pci_get_slot(child), + pci_get_function(child)); + if (cfg->intpin > 0 && cfg->intline != 255) { + printf(" irq %d", cfg->intline); + } + printf("\n"); + + return; +} + static int pci_read_ivar(device_t dev, device_t child, int which, u_long *result) { @@ -1442,6 +1472,7 @@ static device_method_t pci_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, pci_print_child), + DEvMETHOD(bus_probe_nomatch, pci_probe_nomatch), DEVMETHOD(bus_read_ivar, pci_read_ivar), DEVMETHOD(bus_write_ivar, pci_write_ivar), DEVMETHOD(bus_driver_added, bus_generic_driver_added), diff --git a/sys/pci/pci.c b/sys/pci/pci.c index 9de789b..98f76c6 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pci.c,v 1.109 1999/07/01 22:58:03 peter Exp $ + * $Id: pci.c,v 1.110 1999/07/03 20:17:07 peter Exp $ * */ @@ -68,6 +68,10 @@ static STAILQ_HEAD(devlist, pci_devinfo) pci_devq; u_int32_t pci_numdevs = 0; static u_int32_t pci_generation = 0; +#define PCI_MFCTR_CHAR0(ID) (char)(((ID>>10) & 0x1F) | '@') /* Bits 10-14 */ +#define PCI_MFCTR_CHAR1(ID) (char)(((ID>>5 ) & 0x1F) | '@') /* Bits 5-9 */ +#define PCI_MFCTR_CHAR2(ID) (char)(( ID & 0x1F) | '@') /* Bits 0-4 */ + /* return base address of memory or port map */ static int @@ -1126,6 +1130,32 @@ pci_print_child(device_t dev, device_t child) printf(" on %s%d", device_get_name(dev), device_get_unit(dev)); } +static void +pci_probe_nomatch(device_t dev, device_t child) +{ + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; + + device_printf(dev, "unknown card %c%c%c%04x (vendor=0x%04x, dev=0x%04x) at %d.$d", + PCI_MFCTR_CHAR0(cfg->vendor), + PCI_MFCTR_CHAR1(cfg->vendor), + PCI_MFCTR_CHAR2(cfg->vendor), + cfg->device, + cfg->vendor, + cfg->device, + pci_get_slot(child), + pci_get_function(child)); + if (cfg->intpin > 0 && cfg->intline != 255) { + printf(" irq %d", cfg->intline); + } + printf("\n"); + + return; +} + static int pci_read_ivar(device_t dev, device_t child, int which, u_long *result) { @@ -1442,6 +1472,7 @@ static device_method_t pci_methods[] = { /* Bus interface */ DEVMETHOD(bus_print_child, pci_print_child), + DEvMETHOD(bus_probe_nomatch, pci_probe_nomatch), DEVMETHOD(bus_read_ivar, pci_read_ivar), DEVMETHOD(bus_write_ivar, pci_write_ivar), DEVMETHOD(bus_driver_added, bus_generic_driver_added), |