aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sfc/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/sfc/io.h')
-rw-r--r--drivers/net/ethernet/sfc/io.h43
1 files changed, 14 insertions, 29 deletions
diff --git a/drivers/net/ethernet/sfc/io.h b/drivers/net/ethernet/sfc/io.h
index 751d1ec112cc..96759aee1c6c 100644
--- a/drivers/net/ethernet/sfc/io.h
+++ b/drivers/net/ethernet/sfc/io.h
@@ -22,22 +22,21 @@
22 * 22 *
23 * Notes on locking strategy: 23 * Notes on locking strategy:
24 * 24 *
25 * Most CSRs are 128-bit (oword) and therefore cannot be read or 25 * Many CSRs are very wide and cannot be read or written atomically.
26 * written atomically. Access from the host is buffered by the Bus 26 * Writes from the host are buffered by the Bus Interface Unit (BIU)
27 * Interface Unit (BIU). Whenever the host reads from the lowest 27 * up to 128 bits. Whenever the host writes part of such a register,
28 * address of such a register, or from the address of a different such 28 * the BIU collects the written value and does not write to the
29 * register, the BIU latches the register's value. Subsequent reads 29 * underlying register until all 4 dwords have been written. A
30 * from higher addresses of the same register will read the latched 30 * similar buffering scheme applies to host access to the NIC's 64-bit
31 * value. Whenever the host writes part of such a register, the BIU 31 * SRAM.
32 * collects the written value and does not write to the underlying
33 * register until all 4 dwords have been written. A similar buffering
34 * scheme applies to host access to the NIC's 64-bit SRAM.
35 * 32 *
36 * Access to different CSRs and 64-bit SRAM words must be serialised, 33 * Writes to different CSRs and 64-bit SRAM words must be serialised,
37 * since interleaved access can result in lost writes or lost 34 * since interleaved access can result in lost writes. We use
38 * information from read-to-clear fields. We use efx_nic::biu_lock 35 * efx_nic::biu_lock for this.
39 * for this. (We could use separate locks for read and write, but 36 *
40 * this is not normally a performance bottleneck.) 37 * We also serialise reads from 128-bit CSRs and SRAM with the same
38 * spinlock. This may not be necessary, but it doesn't really matter
39 * as there are no such reads on the fast path.
41 * 40 *
42 * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are 41 * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are
43 * 128-bit but are special-cased in the BIU to avoid the need for 42 * 128-bit but are special-cased in the BIU to avoid the need for
@@ -204,20 +203,6 @@ static inline void efx_reado_table(struct efx_nic *efx, efx_oword_t *value,
204 efx_reado(efx, value, reg + index * sizeof(efx_oword_t)); 203 efx_reado(efx, value, reg + index * sizeof(efx_oword_t));
205} 204}
206 205
207/* Write a 32-bit CSR forming part of a table, or 32-bit SRAM */
208static inline void efx_writed_table(struct efx_nic *efx, efx_dword_t *value,
209 unsigned int reg, unsigned int index)
210{
211 efx_writed(efx, value, reg + index * sizeof(efx_oword_t));
212}
213
214/* Read a 32-bit CSR forming part of a table, or 32-bit SRAM */
215static inline void efx_readd_table(struct efx_nic *efx, efx_dword_t *value,
216 unsigned int reg, unsigned int index)
217{
218 efx_readd(efx, value, reg + index * sizeof(efx_dword_t));
219}
220
221/* Page-mapped register block size */ 206/* Page-mapped register block size */
222#define EFX_PAGE_BLOCK_SIZE 0x2000 207#define EFX_PAGE_BLOCK_SIZE 0x2000
223 208