|
17 | 17 | * |
18 | 18 | ************************************************************************** |
19 | 19 | * |
20 | | - * Notes on locking strategy for the Falcon architecture: |
21 | | - * |
22 | | - * Many CSRs are very wide and cannot be read or written atomically. |
23 | | - * Writes from the host are buffered by the Bus Interface Unit (BIU) |
24 | | - * up to 128 bits. Whenever the host writes part of such a register, |
25 | | - * the BIU collects the written value and does not write to the |
26 | | - * underlying register until all 4 dwords have been written. A |
27 | | - * similar buffering scheme applies to host access to the NIC's 64-bit |
28 | | - * SRAM. |
29 | | - * |
30 | | - * Writes to different CSRs and 64-bit SRAM words must be serialised, |
31 | | - * since interleaved access can result in lost writes. We use |
32 | | - * efx_nic::biu_lock for this. |
33 | | - * |
34 | | - * We also serialise reads from 128-bit CSRs and SRAM with the same |
35 | | - * spinlock. This may not be necessary, but it doesn't really matter |
36 | | - * as there are no such reads on the fast path. |
| 20 | + * The EF10 architecture exposes very few registers to the host and |
| 21 | + * most of them are only 32 bits wide. The only exceptions are the MC |
| 22 | + * doorbell register pair, which has its own latching, and |
| 23 | + * TX_DESC_UPD. |
37 | 24 | * |
38 | | - * The DMA descriptor pointers (RX_DESC_UPD and TX_DESC_UPD) are |
39 | | - * 128-bit but are special-cased in the BIU to avoid the need for |
40 | | - * locking in the host: |
| 25 | + * The TX_DESC_UPD DMA descriptor pointer is 128-bits but is a special |
| 26 | + * case in the BIU to avoid the need for locking in the host: |
41 | 27 | * |
42 | | - * - They are write-only. |
43 | | - * - The semantics of writing to these registers are such that |
| 28 | + * - It is write-only. |
| 29 | + * - The semantics of writing to this register is such that |
44 | 30 | * replacing the low 96 bits with zero does not affect functionality. |
45 | | - * - If the host writes to the last dword address of such a register |
| 31 | + * - If the host writes to the last dword address of the register |
46 | 32 | * (i.e. the high 32 bits) the underlying register will always be |
47 | 33 | * written. If the collector and the current write together do not |
48 | 34 | * provide values for all 128 bits of the register, the low 96 bits |
49 | 35 | * will be written as zero. |
50 | | - * - If the host writes to the address of any other part of such a |
51 | | - * register while the collector already holds values for some other |
52 | | - * register, the write is discarded and the collector maintains its |
53 | | - * current state. |
54 | | - * |
55 | | - * The EF10 architecture exposes very few registers to the host and |
56 | | - * most of them are only 32 bits wide. The only exceptions are the MC |
57 | | - * doorbell register pair, which has its own latching, and |
58 | | - * TX_DESC_UPD, which works in a similar way to the Falcon |
59 | | - * architecture. |
60 | 36 | */ |
61 | 37 |
|
62 | 38 | #if BITS_PER_LONG == 64 |
@@ -125,27 +101,6 @@ static inline void efx_writeo(struct efx_nic *efx, const efx_oword_t *value, |
125 | 101 | spin_unlock_irqrestore(&efx->biu_lock, flags); |
126 | 102 | } |
127 | 103 |
|
128 | | -/* Write 64-bit SRAM through the supplied mapping, locking as appropriate. */ |
129 | | -static inline void efx_sram_writeq(struct efx_nic *efx, void __iomem *membase, |
130 | | - const efx_qword_t *value, unsigned int index) |
131 | | -{ |
132 | | - unsigned int addr = index * sizeof(*value); |
133 | | - unsigned long flags __attribute__ ((unused)); |
134 | | - |
135 | | - netif_vdbg(efx, hw, efx->net_dev, |
136 | | - "writing SRAM address %x with " EFX_QWORD_FMT "\n", |
137 | | - addr, EFX_QWORD_VAL(*value)); |
138 | | - |
139 | | - spin_lock_irqsave(&efx->biu_lock, flags); |
140 | | -#ifdef EFX_USE_QWORD_IO |
141 | | - __raw_writeq((__force u64)value->u64[0], membase + addr); |
142 | | -#else |
143 | | - __raw_writel((__force u32)value->u32[0], membase + addr); |
144 | | - __raw_writel((__force u32)value->u32[1], membase + addr + 4); |
145 | | -#endif |
146 | | - spin_unlock_irqrestore(&efx->biu_lock, flags); |
147 | | -} |
148 | | - |
149 | 104 | /* Write a 32-bit CSR or the last dword of a special 128-bit CSR */ |
150 | 105 | static inline void efx_writed(struct efx_nic *efx, const efx_dword_t *value, |
151 | 106 | unsigned int reg) |
@@ -176,27 +131,6 @@ static inline void efx_reado(struct efx_nic *efx, efx_oword_t *value, |
176 | 131 | EFX_OWORD_VAL(*value)); |
177 | 132 | } |
178 | 133 |
|
179 | | -/* Read 64-bit SRAM through the supplied mapping, locking as appropriate. */ |
180 | | -static inline void efx_sram_readq(struct efx_nic *efx, void __iomem *membase, |
181 | | - efx_qword_t *value, unsigned int index) |
182 | | -{ |
183 | | - unsigned int addr = index * sizeof(*value); |
184 | | - unsigned long flags __attribute__ ((unused)); |
185 | | - |
186 | | - spin_lock_irqsave(&efx->biu_lock, flags); |
187 | | -#ifdef EFX_USE_QWORD_IO |
188 | | - value->u64[0] = (__force __le64)__raw_readq(membase + addr); |
189 | | -#else |
190 | | - value->u32[0] = (__force __le32)__raw_readl(membase + addr); |
191 | | - value->u32[1] = (__force __le32)__raw_readl(membase + addr + 4); |
192 | | -#endif |
193 | | - spin_unlock_irqrestore(&efx->biu_lock, flags); |
194 | | - |
195 | | - netif_vdbg(efx, hw, efx->net_dev, |
196 | | - "read from SRAM address %x, got "EFX_QWORD_FMT"\n", |
197 | | - addr, EFX_QWORD_VAL(*value)); |
198 | | -} |
199 | | - |
200 | 134 | /* Read a 32-bit CSR or SRAM */ |
201 | 135 | static inline void efx_readd(struct efx_nic *efx, efx_dword_t *value, |
202 | 136 | unsigned int reg) |
|
0 commit comments