summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-02-17 21:20:35 +0000
committerimp <imp@FreeBSD.org>2003-02-17 21:20:35 +0000
commit583fcf1070d55ddcf8c7a9561385a8e8ff0c53e0 (patch)
tree4f68d03a384b1cde118e6478644bb9e14b4ab201 /sys/dev/pci
parent80e27851f2afb65a95c749d65636a67daacc2309 (diff)
downloadFreeBSD-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')
-rw-r--r--sys/dev/pci/pci.c31
-rw-r--r--sys/dev/pci/pci_private.h4
2 files changed, 35 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)
{
diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h
index c01e416..1064997 100644
--- a/sys/dev/pci/pci_private.h
+++ b/sys/dev/pci/pci_private.h
@@ -68,4 +68,8 @@ struct pci_devinfo *pci_read_device(device_t pcib, int b, int s, int f,
size_t size);
void pci_print_verbose(struct pci_devinfo *dinfo);
int pci_freecfg(struct pci_devinfo *dinfo);
+int pci_child_location_str_method(device_t cbdev, device_t child,
+ char *buf, size_t buflen);
+int pci_child_pnpinfo_str_method(device_t cbdev, device_t child,
+ char *buf, size_t buflen);
#endif /* _PCI_PRIVATE_H_ */
OpenPOWER on IntegriCloud