| From: | Alexander Polakov <polachok@xxxxxxxxx> |
| Date: | Fri, 22 May 2009 16:25:10 +0400 |
I wonder why pcidevs database is not used to make a nice dmesg? It doesn't need many changes to kernel. A diff and a loadable module attached. Result is like this: -pci0: <unknown card> (vendor=0x1002, dev=0x4372) at 20.0 +pci0: <ATI Technologies SB400 SMBus Controller> at 20.0 -isab0: <PCI to ISA bridge (vendor=1002 device=4377)> at device 20.3 on pci0 +isab0: <ATI Technologies SB400 PCI-ISA Bridge> at device 20.3 on pci0
diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c
index 721b258..06475b1 100644
--- a/sys/bus/pci/pci.c
+++ b/sys/bus/pci/pci.c
@@ -63,6 +63,7 @@
devclass_t pci_devclass;
const char *pcib_owner;
+const char* (*pci_db_match)(device_t dev);
static void pci_read_capabilities(device_t dev, pcicfgregs *cfg);
static int pcie_slotimpl(const pcicfgregs *);
@@ -1875,6 +1876,7 @@ pci_probe_nomatch(device_t dev, device_t child)
desc = pci_ata_match(child);
if (!desc) desc = pci_usb_match(child);
if (!desc) desc = pci_vga_match(child);
+ if (!desc && pci_db_match) desc = pci_db_match(child);
if (!desc) desc = pci_chip_match(child);
if (!desc) {
desc = "unknown card";
diff --git a/sys/bus/pci/pcisupport.c b/sys/bus/pci/pcisupport.c
index 903a19d..c3cf1de 100644
--- a/sys/bus/pci/pcisupport.c
+++ b/sys/bus/pci/pcisupport.c
@@ -68,6 +68,7 @@
**
**---------------------------------------------------------
*/
+extern const char* (*pci_db_match)(device_t dev);
static void
fixbushigh_i1225(device_t dev)
@@ -141,9 +142,13 @@ pci_bridge_type(device_t dev)
{
char *descr, tmpbuf[120];
+ descr = NULL;
if (pci_get_class(dev) != PCIC_BRIDGE)
return NULL;
-
+ if (pci_db_match)
+ descr = pci_db_match(dev);
+ if(descr)
+ return descr;
switch (pci_get_subclass(dev)) {
case PCIS_BRIDGE_HOST: strcpy(tmpbuf, "Host to PCI"); break;
case PCIS_BRIDGE_ISA: strcpy(tmpbuf, "PCI to ISA"); break;
Attachment:
pcidb.tgz
Description: application/tar-gz