]> git.baikalelectronics.ru Git - kernel.git/commit
PCI: Add pci_set_vpd_size() to set VPD size
authorHariprasad Shenai <hariprasad@chelsio.com>
Fri, 15 Apr 2016 18:00:11 +0000 (13:00 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 15 Apr 2016 18:00:11 +0000 (13:00 -0500)
commitfa85fc2e94fc75e3d1850442133d70f5860732f3
tree0da42a2722827d2b530fdf771d06af7b17cc0ec6
parent6d8b4c64f4ecd3e96f7e6ffdc2b20f2b870023c0
PCI: Add pci_set_vpd_size() to set VPD size

After d3afef2eae86 ("PCI: Determine actual VPD size on first access"), the
PCI core computes the valid VPD size by parsing the VPD starting at offset
0x0.  We don't attempt to read past that valid size because that causes
some devices to crash.

However, some devices do have data past that valid size.  For example,
Chelsio adapters contain two VPD structures, and the driver needs both of
them.

Add pci_set_vpd_size().  If a driver knows it is safe to read past the end
of the VPD data structure at offset 0, it can use pci_set_vpd_size() to
allow access to as much data as it needs.

[bhelgaas: changelog, split patches, rename to pci_set_vpd_size() and
return int (not ssize_t)]
Fixes: d3afef2eae86 ("PCI: Determine actual VPD size on first access")
Tested-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/access.c
drivers/pci/pci.h
include/linux/pci.h