PCI: Support PCIe devices with short cfg_size
commit884740187257c03adae546c2bd9ca2b851785924
authorJason S. McMullan <jason.mcmullan@netronome.com>
Wed, 30 Sep 2015 06:35:05 +0000 (30 15:35 +0900)
committerSasha Levin <alexander.levin@verizon.com>
Sat, 3 Sep 2016 03:39:11 +0000 (2 23:39 -0400)
tree1e8ad7bf41321e1005cd8ad4137cd3c61dfc7924
parentf7bb9ba34f4697790b144368377a268f3f2634e0
PCI: Support PCIe devices with short cfg_size

[ Upstream commit c20aecf6963d1273d8f6d61c042b4845441ca592 ]

If a device quirk modifies the pci_dev->cfg_size to be less than
PCI_CFG_SPACE_EXP_SIZE (4096), but greater than PCI_CFG_SPACE_SIZE (256),
the PCI sysfs interface truncates the readable size to PCI_CFG_SPACE_SIZE.

Allow sysfs access to config space up to cfg_size, even if the device
doesn't support the entire 4096-byte PCIe config space.

Note that pci_read_config() and pci_write_config() limit access to
dev->cfg_size even though pcie_config_attr contains 4096 (the maximum
size).

Signed-off-by: Jason S. McMullan <jason.mcmullan@netronome.com>
[simon: edited changelog]
Signed-off-by: Simon Horman <simon.horman@netronome.com>
[bhelgaas: more changelog edits]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/pci/pci-sysfs.c