diff options
author | imp <imp@FreeBSD.org> | 2003-02-17 21:20:35 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2003-02-17 21:20:35 +0000 |
commit | 583fcf1070d55ddcf8c7a9561385a8e8ff0c53e0 (patch) | |
tree | 4f68d03a384b1cde118e6478644bb9e14b4ab201 /sys/dev/pci/pci.c | |
parent | 80e27851f2afb65a95c749d65636a67daacc2309 (diff) | |
download | FreeBSD-src-583fcf1070d55ddcf8c7a9561385a8e8ff0c53e0.zip FreeBSD-src-583fcf1070d55ddcf8c7a9561385a8e8ff0c53e0.tar.gz |
Move the pnp and location info into the common pci bus. Make all known
pci busses implement this.
Also minor comment smithing in cardbus. Fix copyright to this year
with my name on it since I've been doing a lot to this file.
Reviewed by: jhb
Diffstat (limited to 'sys/dev/pci/pci.c')
-rw-r--r-- | sys/dev/pci/pci.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index ef9893f..39ab54c 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -107,6 +107,8 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_release_resource, bus_generic_rl_release_resource), DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_child_pnpinfo_str, pci_child_pnpinfo_str_method), + DEVMETHOD(bus_child_location_str, pci_child_location_str_method), /* PCI interface */ DEVMETHOD(pci_read_config, pci_read_config_method), @@ -1390,6 +1392,35 @@ pci_write_config_method(device_t dev, device_t child, int reg, cfg->bus, cfg->slot, cfg->func, reg, val, width); } +int +pci_child_location_str_method(device_t cbdev, device_t child, char *buf, + size_t buflen) +{ + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; + snprintf(buf, buflen, "slot=%d function=%d", pci_get_slot(child), + pci_get_function(child)); + return (0); +} + +int +pci_child_pnpinfo_str_method(device_t cbdev, device_t child, char *buf, + size_t buflen) +{ + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + + dinfo = device_get_ivars(child); + cfg = &dinfo->cfg; + snprintf(buf, buflen, "vendor=0x%04x device=0x%04x subvendor=0x%04x " + "subdevice=0x%04x", cfg->vendor, cfg->device, cfg->subvendor, + cfg->subdevice); + return (0); +} + static int pci_modevent(module_t mod, int what, void *arg) { |