diff options
author | Hariprasad Shenai <hariprasad@chelsio.com> | 2014-06-27 09:53:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-01 21:56:10 -0400 |
commit | 0abfd1524b655f00597d419c8e63d06ebf637372 (patch) | |
tree | 73926f15767feeea4bd036f12a6ce6da553c5193 /drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |
parent | 35b1de5579704be0e03454f713dddd6f86eccb7e (diff) |
cxgb4: Use FW interface to get BAR0 value
Use the firmware interface to get the BAR0 value since we really don't want
to use the PCI-E Configuration Space Backdoor access which is owned by the
firmware.
Set up PCI-E Memory Window registers using the true values programmed into
BAR registers. When the PF4 "Master Function" is exported to a Virtual
Machine, the values returned by pci_resource_start() will be for the
synthetic PCI-E Configuration Space and not the real addresses. But we need
to program the PCI-E Memory Window address decoders with the real addresses
that we're going to be using in order to have accesses through the Memory
Windows work.
Based on origninal work by Casey Leedom <leedom@chelsio.com>
Signed-off-by: Casey Leedom <leedom@chelsio.com>
Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/chelsio/cxgb4/t4_hw.c')
-rw-r--r-- | drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c index 4536ea9f7018..2c3d00d77ef6 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb4/t4_hw.c | |||
@@ -144,6 +144,30 @@ void t4_write_indirect(struct adapter *adap, unsigned int addr_reg, | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /* | 146 | /* |
147 | * Read a 32-bit PCI Configuration Space register via the PCI-E backdoor | ||
148 | * mechanism. This guarantees that we get the real value even if we're | ||
149 | * operating within a Virtual Machine and the Hypervisor is trapping our | ||
150 | * Configuration Space accesses. | ||
151 | */ | ||
152 | void t4_hw_pci_read_cfg4(struct adapter *adap, int reg, u32 *val) | ||
153 | { | ||
154 | u32 req = ENABLE | FUNCTION(adap->fn) | reg; | ||
155 | |||
156 | if (is_t4(adap->params.chip)) | ||
157 | req |= F_LOCALCFG; | ||
158 | |||
159 | t4_write_reg(adap, PCIE_CFG_SPACE_REQ, req); | ||
160 | *val = t4_read_reg(adap, PCIE_CFG_SPACE_DATA); | ||
161 | |||
162 | /* Reset ENABLE to 0 so reads of PCIE_CFG_SPACE_DATA won't cause a | ||
163 | * Configuration Space read. (None of the other fields matter when | ||
164 | * ENABLE is 0 so a simple register write is easier than a | ||
165 | * read-modify-write via t4_set_reg_field().) | ||
166 | */ | ||
167 | t4_write_reg(adap, PCIE_CFG_SPACE_REQ, 0); | ||
168 | } | ||
169 | |||
170 | /* | ||
147 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. | 171 | * Get the reply to a mailbox command and store it in @rpl in big-endian order. |
148 | */ | 172 | */ |
149 | static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, | 173 | static void get_mbox_rpl(struct adapter *adap, __be64 *rpl, int nflit, |