Skip to content

Commit 67e6587

Browse files
Hariprasad Shenaibjorn-helgaas
authored andcommitted
cxgb4: Set VPD size so we can read both VPD structures
Chelsio adapters have two VPD structures stored in the VPD: - offset 0x000: an abbreviated VPD, and - offset 0x400: the complete VPD. After 104daa7 ("PCI: Determine actual VPD size on first access"), the PCI core computes the valid VPD size by parsing the VPD starting at offset 0x0. That size only includes the abbreviated VPD structure, so reads of the complete VPD at 0x400 fail. Explicitly set the VPD size with pci_set_vpd_size() so the driver can read both VPD structures. [bhelgaas: changelog, split patches, rename to pci_set_vpd_size() and return int (not ssize_t)] Fixes: 104daa7 ("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>
1 parent cb92148 commit 67e6587

File tree

1 file changed

+10
-0
lines changed
  • drivers/net/ethernet/chelsio/cxgb4

1 file changed

+10
-0
lines changed

drivers/net/ethernet/chelsio/cxgb4/t4_hw.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,6 +2557,7 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size)
25572557
}
25582558

25592559
#define EEPROM_STAT_ADDR 0x7bfc
2560+
#define VPD_SIZE 0x800
25602561
#define VPD_BASE 0x400
25612562
#define VPD_BASE_OLD 0
25622563
#define VPD_LEN 1024
@@ -2594,6 +2595,15 @@ int t4_get_raw_vpd_params(struct adapter *adapter, struct vpd_params *p)
25942595
if (!vpd)
25952596
return -ENOMEM;
25962597

2598+
/* We have two VPD data structures stored in the adapter VPD area.
2599+
* By default, Linux calculates the size of the VPD area by traversing
2600+
* the first VPD area at offset 0x0, so we need to tell the OS what
2601+
* our real VPD size is.
2602+
*/
2603+
ret = pci_set_vpd_size(adapter->pdev, VPD_SIZE);
2604+
if (ret < 0)
2605+
goto out;
2606+
25972607
/* Card information normally starts at VPD_BASE but early cards had
25982608
* it at 0.
25992609
*/

0 commit comments

Comments
 (0)