diff options
author | jhb <jhb@FreeBSD.org> | 2014-02-17 22:19:49 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2014-02-17 22:19:49 +0000 |
commit | 6e1e8b0ada39b25a62d9235c22cfc2d2f9a63072 (patch) | |
tree | 813983fd35b494e0597706a51217b6688b64e517 /sys/dev/pci/pci.c | |
parent | 547b2fb503640e47551e78e30d597c6075b3529f (diff) | |
download | FreeBSD-src-6e1e8b0ada39b25a62d9235c22cfc2d2f9a63072.zip FreeBSD-src-6e1e8b0ada39b25a62d9235c22cfc2d2f9a63072.tar.gz |
MFC 260926:
Add support for displaying VPD for PCI devices via pciconf.
- Store the length of each read-only VPD value since not all values are
guaranteed to be ASCII values (though most are).
- Add a new pciio ioctl to fetch VPD for a single PCI device. The values
are returned as a list of variable length records, one for the device
name and each keyword.
- Add a new -V flag to pciconf's list mode which displays VPD data for
each device.
Diffstat (limited to 'sys/dev/pci/pci.c')
-rw-r--r-- | sys/dev/pci/pci.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 4d8837f..84aab9d 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -985,7 +985,7 @@ pci_read_vpd(device_t pcib, pcicfgregs *cfg) state = -2; break; } - dflen = byte2; + cfg->vpd.vpd_ros[off].len = dflen = byte2; if (dflen == 0 && strncmp(cfg->vpd.vpd_ros[off].keyword, "RV", 2) == 0) { @@ -1179,6 +1179,17 @@ pci_get_vpd_readonly_method(device_t dev, device_t child, const char *kw, return (ENXIO); } +struct pcicfg_vpd * +pci_fetch_vpd_list(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + pcicfgregs *cfg = &dinfo->cfg; + + if (!cfg->vpd.vpd_cached && cfg->vpd.vpd_reg != 0) + pci_read_vpd(device_get_parent(device_get_parent(dev)), cfg); + return (&cfg->vpd); +} + /* * Find the requested HyperTransport capability and return the offset * in configuration space via the pointer provided. The function |