aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLey Foon Tan <lftan@altera.com>2015-12-04 17:21:12 -0500
committerBjorn Helgaas <bhelgaas@google.com>2015-12-04 17:21:12 -0500
commit23ec56708af7155414a979675dc8132a5d6e16ef (patch)
treedf80bf595d5dfc1ff564f9453c308f23f715a46d
parent7f52f31443ae9b2e6a71ec54cfc5a2c89006ea27 (diff)
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>
-rw-r--r--drivers/pci/host/pcie-altera.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/host/pcie-altera.c b/drivers/pci/host/pcie-altera.c
index f0820d3fadf6..ed736a94eade 100644
--- a/drivers/pci/host/pcie-altera.c
+++ b/drivers/pci/host/pcie-altera.c
@@ -57,6 +57,7 @@
57#define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn)) 57#define TLP_REQ_ID(bus, devfn) (((bus) << 8) | (devfn))
58#define TLP_HDR_SIZE 3 58#define TLP_HDR_SIZE 3
59#define TLP_LOOP 500 59#define TLP_LOOP 500
60#define RP_DEVFN 0
60 61
61#define INTX_NUM 4 62#define INTX_NUM 4
62 63
@@ -233,7 +234,7 @@ static int tlp_cfg_dword_read(struct altera_pcie *pcie, u8 bus, u32 devfn,
233 else 234 else
234 headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1); 235 headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGRD1);
235 236
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),
237 TLP_READ_TAG, byte_en); 238 TLP_READ_TAG, byte_en);
238 headers[2] = TLP_CFG_DW2(bus, devfn, where); 239 headers[2] = TLP_CFG_DW2(bus, devfn, where);
239 240
@@ -253,7 +254,7 @@ static int tlp_cfg_dword_write(struct altera_pcie *pcie, u8 bus, u32 devfn,
253 else 254 else
254 headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1); 255 headers[0] = TLP_CFG_DW0(TLP_FMTTYPE_CFGWR1);
255 256
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),
257 TLP_WRITE_TAG, byte_en); 258 TLP_WRITE_TAG, byte_en);
258 headers[2] = TLP_CFG_DW2(bus, devfn, where); 259 headers[2] = TLP_CFG_DW2(bus, devfn, where);
259 260