Skip to content

Commit 23ec567

Browse files
Ley Foon Tanbjorn-helgaas
authored andcommitted
PCI: altera: Fix Requester ID for config accesses
The Requester ID should use the Root Port devfn and it should be always 0. Previously we constructed the Requester ID using the *Completer* devfn, i.e., the devfn of the Function we expect to respond to the config access. This causes issues when accessing configuration space for devices other than the Root Port. Build the Requester ID using the Root Port devfn. Tested on Ethernet adapter card with multi-functions. Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 7f52f31 commit 23ec567

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/pci/host/pcie-altera.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
#define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn))
5858
#define TLP_HDR_SIZE 3
5959
#define TLP_LOOP 500
60+
#define RP_DEVFN 0
6061

6162
#define INTX_NUM 4
6263

@@ -233,7 +234,7 @@ static int tlp_cfg_dword_read(struct altera_pcie *pcie, u8 bus, u32 devfn,
233234
else
234235
headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1);
235236

236-
headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn),
237+
headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN),
237238
TLP_READ_TAG, byte_en);
238239
headers[2] = TLP_CFG_DW2(bus, devfn, where);
239240

@@ -253,7 +254,7 @@ static int tlp_cfg_dword_write(struct altera_pcie *pcie, u8 bus, u32 devfn,
253254
else
254255
headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1);
255256

256-
headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, devfn),
257+
headers[1] = TLP_CFG_DW1(TLP_REQ_ID(pcie->root_bus_nr, RP_DEVFN),
257258
TLP_WRITE_TAG, byte_en);
258259
headers[2] = TLP_CFG_DW2(bus, devfn, where);
259260

0 commit comments

Comments
 (0)