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>
This commit is contained in:
Ben Hutchings
2008-03-05 16:52:39 +00:00
committed by Greg Kroah-Hartman
parent 5e0d2a6fc0
commit 94e6108803
6 changed files with 297 additions and 14 deletions

View File

@ -20,6 +20,8 @@
/* Include the pci register defines */
#include <linux/pci_regs.h>
struct pci_vpd;
/*
* The PCI interface treats multi-function devices as independent
* devices. The slot/function address of each device is encoded
@ -206,6 +208,7 @@ struct pci_dev {
#ifdef CONFIG_PCI_MSI
struct list_head msi_list;
#endif
struct pci_vpd *vpd;
};
extern struct pci_dev *alloc_pci_dev(void);