aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.h
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-03-05 11:52:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-21 00:47:07 -0400
commit94e6108803469a37ee1e3c92dafdd1d59298602f (patch)
tree7f3ee30721411cca238f8eea5971d5bebbb70a55 /drivers/pci/pci.h
parent5e0d2a6fc094a9b5047998deefeb1254c66856ee (diff)
PCI: Expose PCI VPD through sysfs
Vital Product Data (VPD) may be exposed by PCI devices in several ways. It is generally unsafe to read this information through the existing interfaces to user-land because of stateful interfaces. This adds: - abstract operations for VPD access (struct pci_vpd_ops) - VPD state information in struct pci_dev (struct pci_vpd) - an implementation of the VPD access method specified in PCI 2.2 (in access.c) - a 'vpd' binary file in sysfs directories for PCI devices with VPD operations defined It adds a probe for PCI 2.2 VPD in pci_scan_device() and release of VPD state in pci_release_dev(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/pci.h')
-rw-r--r--drivers/pci/pci.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index eabeb1f2ec99..0a497c1b4227 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -18,6 +18,25 @@ extern int pci_user_write_config_byte(struct pci_dev *dev, int where, u8 val);
18extern int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val); 18extern int pci_user_write_config_word(struct pci_dev *dev, int where, u16 val);
19extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val); 19extern int pci_user_write_config_dword(struct pci_dev *dev, int where, u32 val);
20 20
21struct pci_vpd_ops {
22 int (*read)(struct pci_dev *dev, int pos, int size, char *buf);
23 int (*write)(struct pci_dev *dev, int pos, int size, const char *buf);
24 int (*get_size)(struct pci_dev *dev);
25 void (*release)(struct pci_dev *dev);
26};
27
28struct pci_vpd {
29 struct pci_vpd_ops *ops;
30 struct bin_attribute *attr; /* descriptor for sysfs VPD entry */
31};
32
33extern int pci_vpd_pci22_init(struct pci_dev *dev);
34static inline void pci_vpd_release(struct pci_dev *dev)
35{
36 if (dev->vpd)
37 dev->vpd->ops->release(dev);
38}
39
21/* PCI /proc functions */ 40/* PCI /proc functions */
22#ifdef CONFIG_PROC_FS 41#ifdef CONFIG_PROC_FS
23extern int pci_proc_attach_device(struct pci_dev *dev); 42extern int pci_proc_attach_device(struct pci_dev *dev);