]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - drivers/net/bna/bna_hw.h
be2net: Move the Emulex driver
[mirror_ubuntu-artful-kernel.git] / drivers / net / bna / bna_hw.h
1 /*
2 * Linux network driver for Brocade Converged Network Adapter.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License (GPL) Version 2 as
6 * published by the Free Software Foundation
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 */
13 /*
14 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
15 * All rights reserved
16 * www.brocade.com
17 */
18
19 /**
20 * File for interrupt macros and functions
21 */
22
23 #ifndef __BNA_HW_H__
24 #define __BNA_HW_H__
25
26 #include "bfi_reg.h"
27
28 /**
29 *
30 * SW imposed limits
31 *
32 */
33
34 #ifndef BNA_BIOS_BUILD
35
36 #define BFI_MAX_TXQ 64
37 #define BFI_MAX_RXQ 64
38 #define BFI_MAX_RXF 64
39 #define BFI_MAX_IB 128
40 #define BFI_MAX_RIT_SIZE 256
41 #define BFI_RSS_RIT_SIZE 64
42 #define BFI_NONRSS_RIT_SIZE 1
43 #define BFI_MAX_UCMAC 256
44 #define BFI_MAX_MCMAC 512
45 #define BFI_IBIDX_SIZE 4
46 #define BFI_MAX_VLAN 4095
47
48 /**
49 * There are 2 free IB index pools:
50 * pool1: 120 segments of 1 index each
51 * pool8: 1 segment of 8 indexes
52 */
53 #define BFI_IBIDX_POOL1_SIZE 116
54 #define BFI_IBIDX_POOL1_ENTRY_SIZE 1
55 #define BFI_IBIDX_POOL2_SIZE 2
56 #define BFI_IBIDX_POOL2_ENTRY_SIZE 2
57 #define BFI_IBIDX_POOL8_SIZE 1
58 #define BFI_IBIDX_POOL8_ENTRY_SIZE 8
59 #define BFI_IBIDX_TOTAL_POOLS 3
60 #define BFI_IBIDX_TOTAL_SEGS 119 /* (POOL1 + POOL2 + POOL8)_SIZE */
61 #define BFI_IBIDX_MAX_SEGSIZE 8
62 #define init_ibidx_pool(name) \
63 static struct bna_ibidx_pool name[BFI_IBIDX_TOTAL_POOLS] = \
64 { \
65 { BFI_IBIDX_POOL1_SIZE, BFI_IBIDX_POOL1_ENTRY_SIZE }, \
66 { BFI_IBIDX_POOL2_SIZE, BFI_IBIDX_POOL2_ENTRY_SIZE }, \
67 { BFI_IBIDX_POOL8_SIZE, BFI_IBIDX_POOL8_ENTRY_SIZE } \
68 }
69
70 /**
71 * There are 2 free RIT segment pools:
72 * Pool1: 192 segments of 1 RIT entry each
73 * Pool2: 1 segment of 64 RIT entry
74 */
75 #define BFI_RIT_SEG_POOL1_SIZE 192
76 #define BFI_RIT_SEG_POOL1_ENTRY_SIZE 1
77 #define BFI_RIT_SEG_POOLRSS_SIZE 1
78 #define BFI_RIT_SEG_POOLRSS_ENTRY_SIZE 64
79 #define BFI_RIT_SEG_TOTAL_POOLS 2
80 #define BFI_RIT_TOTAL_SEGS 193 /* POOL1_SIZE + POOLRSS_SIZE */
81 #define init_ritseg_pool(name) \
82 static struct bna_ritseg_pool_cfg name[BFI_RIT_SEG_TOTAL_POOLS] = \
83 { \
84 { BFI_RIT_SEG_POOL1_SIZE, BFI_RIT_SEG_POOL1_ENTRY_SIZE }, \
85 { BFI_RIT_SEG_POOLRSS_SIZE, BFI_RIT_SEG_POOLRSS_ENTRY_SIZE } \
86 }
87
88 #else /* BNA_BIOS_BUILD */
89
90 #define BFI_MAX_TXQ 1
91 #define BFI_MAX_RXQ 1
92 #define BFI_MAX_RXF 1
93 #define BFI_MAX_IB 2
94 #define BFI_MAX_RIT_SIZE 2
95 #define BFI_RSS_RIT_SIZE 64
96 #define BFI_NONRSS_RIT_SIZE 1
97 #define BFI_MAX_UCMAC 1
98 #define BFI_MAX_MCMAC 8
99 #define BFI_IBIDX_SIZE 4
100 #define BFI_MAX_VLAN 4095
101 /* There is one free pool: 2 segments of 1 index each */
102 #define BFI_IBIDX_POOL1_SIZE 2
103 #define BFI_IBIDX_POOL1_ENTRY_SIZE 1
104 #define BFI_IBIDX_TOTAL_POOLS 1
105 #define BFI_IBIDX_TOTAL_SEGS 2 /* POOL1_SIZE */
106 #define BFI_IBIDX_MAX_SEGSIZE 1
107 #define init_ibidx_pool(name) \
108 static struct bna_ibidx_pool name[BFI_IBIDX_TOTAL_POOLS] = \
109 { \
110 { BFI_IBIDX_POOL1_SIZE, BFI_IBIDX_POOL1_ENTRY_SIZE } \
111 }
112
113 #define BFI_RIT_SEG_POOL1_SIZE 1
114 #define BFI_RIT_SEG_POOL1_ENTRY_SIZE 1
115 #define BFI_RIT_SEG_TOTAL_POOLS 1
116 #define BFI_RIT_TOTAL_SEGS 1 /* POOL1_SIZE */
117 #define init_ritseg_pool(name) \
118 static struct bna_ritseg_pool_cfg name[BFI_RIT_SEG_TOTAL_POOLS] = \
119 { \
120 { BFI_RIT_SEG_POOL1_SIZE, BFI_RIT_SEG_POOL1_ENTRY_SIZE } \
121 }
122
123 #endif /* BNA_BIOS_BUILD */
124
125 #define BFI_RSS_HASH_KEY_LEN 10
126
127 #define BFI_COALESCING_TIMER_UNIT 5 /* 5us */
128 #define BFI_MAX_COALESCING_TIMEO 0xFF /* in 5us units */
129 #define BFI_MAX_INTERPKT_COUNT 0xFF
130 #define BFI_MAX_INTERPKT_TIMEO 0xF /* in 0.5us units */
131 #define BFI_TX_COALESCING_TIMEO 20 /* 20 * 5 = 100us */
132 #define BFI_TX_INTERPKT_COUNT 32
133 #define BFI_RX_COALESCING_TIMEO 12 /* 12 * 5 = 60us */
134 #define BFI_RX_INTERPKT_COUNT 6 /* Pkt Cnt = 6 */
135 #define BFI_RX_INTERPKT_TIMEO 3 /* 3 * 0.5 = 1.5us */
136
137 #define BFI_TXQ_WI_SIZE 64 /* bytes */
138 #define BFI_RXQ_WI_SIZE 8 /* bytes */
139 #define BFI_CQ_WI_SIZE 16 /* bytes */
140 #define BFI_TX_MAX_WRR_QUOTA 0xFFF
141
142 #define BFI_TX_MAX_VECTORS_PER_WI 4
143 #define BFI_TX_MAX_VECTORS_PER_PKT 0xFF
144 #define BFI_TX_MAX_DATA_PER_VECTOR 0xFFFF
145 #define BFI_TX_MAX_DATA_PER_PKT 0xFFFFFF
146
147 /* Small Q buffer size */
148 #define BFI_SMALL_RXBUF_SIZE 128
149
150 /* Defined separately since BFA_FLASH_DMA_BUF_SZ is in bfa_flash.c */
151 #define BFI_FLASH_DMA_BUF_SZ 0x010000 /* 64K DMA */
152 #define BFI_HW_STATS_SIZE 0x4000 /* 16K DMA */
153
154 /**
155 *
156 * HW register offsets, macros
157 *
158 */
159
160 /* DMA Block Register Host Window Start Address */
161 #define DMA_BLK_REG_ADDR 0x00013000
162
163 /* DMA Block Internal Registers */
164 #define DMA_CTRL_REG0 (DMA_BLK_REG_ADDR + 0x000)
165 #define DMA_CTRL_REG1 (DMA_BLK_REG_ADDR + 0x004)
166 #define DMA_ERR_INT_STATUS (DMA_BLK_REG_ADDR + 0x008)
167 #define DMA_ERR_INT_ENABLE (DMA_BLK_REG_ADDR + 0x00c)
168 #define DMA_ERR_INT_STATUS_SET (DMA_BLK_REG_ADDR + 0x010)
169
170 /* APP Block Register Address Offset from BAR0 */
171 #define APP_BLK_REG_ADDR 0x00014000
172
173 /* Host Function Interrupt Mask Registers */
174 #define HOSTFN0_INT_MASK (APP_BLK_REG_ADDR + 0x004)
175 #define HOSTFN1_INT_MASK (APP_BLK_REG_ADDR + 0x104)
176 #define HOSTFN2_INT_MASK (APP_BLK_REG_ADDR + 0x304)
177 #define HOSTFN3_INT_MASK (APP_BLK_REG_ADDR + 0x404)
178
179 /**
180 * Host Function PCIe Error Registers
181 * Duplicates "Correctable" & "Uncorrectable"
182 * registers in PCIe Config space.
183 */
184 #define FN0_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x014)
185 #define FN1_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x114)
186 #define FN2_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x314)
187 #define FN3_PCIE_ERR_REG (APP_BLK_REG_ADDR + 0x414)
188
189 /* Host Function Error Type Status Registers */
190 #define FN0_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x018)
191 #define FN1_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x118)
192 #define FN2_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x318)
193 #define FN3_ERR_TYPE_STATUS_REG (APP_BLK_REG_ADDR + 0x418)
194
195 /* Host Function Error Type Mask Registers */
196 #define FN0_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x01c)
197 #define FN1_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x11c)
198 #define FN2_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x31c)
199 #define FN3_ERR_TYPE_MSK_STATUS_REG (APP_BLK_REG_ADDR + 0x41c)
200
201 /* Catapult Host Semaphore Status Registers (App block) */
202 #define HOST_SEM_STS0_REG (APP_BLK_REG_ADDR + 0x630)
203 #define HOST_SEM_STS1_REG (APP_BLK_REG_ADDR + 0x634)
204 #define HOST_SEM_STS2_REG (APP_BLK_REG_ADDR + 0x638)
205 #define HOST_SEM_STS3_REG (APP_BLK_REG_ADDR + 0x63c)
206 #define HOST_SEM_STS4_REG (APP_BLK_REG_ADDR + 0x640)
207 #define HOST_SEM_STS5_REG (APP_BLK_REG_ADDR + 0x644)
208 #define HOST_SEM_STS6_REG (APP_BLK_REG_ADDR + 0x648)
209 #define HOST_SEM_STS7_REG (APP_BLK_REG_ADDR + 0x64c)
210
211 /* PCIe Misc Register */
212 #define PCIE_MISC_REG (APP_BLK_REG_ADDR + 0x200)
213
214 /* Temp Sensor Control Registers */
215 #define TEMPSENSE_CNTL_REG (APP_BLK_REG_ADDR + 0x250)
216 #define TEMPSENSE_STAT_REG (APP_BLK_REG_ADDR + 0x254)
217
218 /* APP Block local error registers */
219 #define APP_LOCAL_ERR_STAT (APP_BLK_REG_ADDR + 0x258)
220 #define APP_LOCAL_ERR_MSK (APP_BLK_REG_ADDR + 0x25c)
221
222 /* PCIe Link Error registers */
223 #define PCIE_LNK_ERR_STAT (APP_BLK_REG_ADDR + 0x260)
224 #define PCIE_LNK_ERR_MSK (APP_BLK_REG_ADDR + 0x264)
225
226 /**
227 * FCoE/FIP Ethertype Register
228 * 31:16 -- Chip wide value for FIP type
229 * 15:0 -- Chip wide value for FCoE type
230 */
231 #define FCOE_FIP_ETH_TYPE (APP_BLK_REG_ADDR + 0x280)
232
233 /**
234 * Reserved Ethertype Register
235 * 31:16 -- Reserved
236 * 15:0 -- Other ethertype
237 */
238 #define RESV_ETH_TYPE (APP_BLK_REG_ADDR + 0x284)
239
240 /**
241 * Host Command Status Registers
242 * Each set consists of 3 registers :
243 * clear, set, cmd
244 * 16 such register sets in all
245 * See catapult_spec.pdf for detailed functionality
246 * Put each type in a single macro accessed by _num ?
247 */
248 #define HOST_CMDSTS0_CLR_REG (APP_BLK_REG_ADDR + 0x500)
249 #define HOST_CMDSTS0_SET_REG (APP_BLK_REG_ADDR + 0x504)
250 #define HOST_CMDSTS0_REG (APP_BLK_REG_ADDR + 0x508)
251 #define HOST_CMDSTS1_CLR_REG (APP_BLK_REG_ADDR + 0x510)
252 #define HOST_CMDSTS1_SET_REG (APP_BLK_REG_ADDR + 0x514)
253 #define HOST_CMDSTS1_REG (APP_BLK_REG_ADDR + 0x518)
254 #define HOST_CMDSTS2_CLR_REG (APP_BLK_REG_ADDR + 0x520)
255 #define HOST_CMDSTS2_SET_REG (APP_BLK_REG_ADDR + 0x524)
256 #define HOST_CMDSTS2_REG (APP_BLK_REG_ADDR + 0x528)
257 #define HOST_CMDSTS3_CLR_REG (APP_BLK_REG_ADDR + 0x530)
258 #define HOST_CMDSTS3_SET_REG (APP_BLK_REG_ADDR + 0x534)
259 #define HOST_CMDSTS3_REG (APP_BLK_REG_ADDR + 0x538)
260 #define HOST_CMDSTS4_CLR_REG (APP_BLK_REG_ADDR + 0x540)
261 #define HOST_CMDSTS4_SET_REG (APP_BLK_REG_ADDR + 0x544)
262 #define HOST_CMDSTS4_REG (APP_BLK_REG_ADDR + 0x548)
263 #define HOST_CMDSTS5_CLR_REG (APP_BLK_REG_ADDR + 0x550)
264 #define HOST_CMDSTS5_SET_REG (APP_BLK_REG_ADDR + 0x554)
265 #define HOST_CMDSTS5_REG (APP_BLK_REG_ADDR + 0x558)
266 #define HOST_CMDSTS6_CLR_REG (APP_BLK_REG_ADDR + 0x560)
267 #define HOST_CMDSTS6_SET_REG (APP_BLK_REG_ADDR + 0x564)
268 #define HOST_CMDSTS6_REG (APP_BLK_REG_ADDR + 0x568)
269 #define HOST_CMDSTS7_CLR_REG (APP_BLK_REG_ADDR + 0x570)
270 #define HOST_CMDSTS7_SET_REG (APP_BLK_REG_ADDR + 0x574)
271 #define HOST_CMDSTS7_REG (APP_BLK_REG_ADDR + 0x578)
272 #define HOST_CMDSTS8_CLR_REG (APP_BLK_REG_ADDR + 0x580)
273 #define HOST_CMDSTS8_SET_REG (APP_BLK_REG_ADDR + 0x584)
274 #define HOST_CMDSTS8_REG (APP_BLK_REG_ADDR + 0x588)
275 #define HOST_CMDSTS9_CLR_REG (APP_BLK_REG_ADDR + 0x590)
276 #define HOST_CMDSTS9_SET_REG (APP_BLK_REG_ADDR + 0x594)
277 #define HOST_CMDSTS9_REG (APP_BLK_REG_ADDR + 0x598)
278 #define HOST_CMDSTS10_CLR_REG (APP_BLK_REG_ADDR + 0x5A0)
279 #define HOST_CMDSTS10_SET_REG (APP_BLK_REG_ADDR + 0x5A4)
280 #define HOST_CMDSTS10_REG (APP_BLK_REG_ADDR + 0x5A8)
281 #define HOST_CMDSTS11_CLR_REG (APP_BLK_REG_ADDR + 0x5B0)
282 #define HOST_CMDSTS11_SET_REG (APP_BLK_REG_ADDR + 0x5B4)
283 #define HOST_CMDSTS11_REG (APP_BLK_REG_ADDR + 0x5B8)
284 #define HOST_CMDSTS12_CLR_REG (APP_BLK_REG_ADDR + 0x5C0)
285 #define HOST_CMDSTS12_SET_REG (APP_BLK_REG_ADDR + 0x5C4)
286 #define HOST_CMDSTS12_REG (APP_BLK_REG_ADDR + 0x5C8)
287 #define HOST_CMDSTS13_CLR_REG (APP_BLK_REG_ADDR + 0x5D0)
288 #define HOST_CMDSTS13_SET_REG (APP_BLK_REG_ADDR + 0x5D4)
289 #define HOST_CMDSTS13_REG (APP_BLK_REG_ADDR + 0x5D8)
290 #define HOST_CMDSTS14_CLR_REG (APP_BLK_REG_ADDR + 0x5E0)
291 #define HOST_CMDSTS14_SET_REG (APP_BLK_REG_ADDR + 0x5E4)
292 #define HOST_CMDSTS14_REG (APP_BLK_REG_ADDR + 0x5E8)
293 #define HOST_CMDSTS15_CLR_REG (APP_BLK_REG_ADDR + 0x5F0)
294 #define HOST_CMDSTS15_SET_REG (APP_BLK_REG_ADDR + 0x5F4)
295 #define HOST_CMDSTS15_REG (APP_BLK_REG_ADDR + 0x5F8)
296
297 /**
298 * LPU0 Block Register Address Offset from BAR0
299 * Range 0x18000 - 0x18033
300 */
301 #define LPU0_BLK_REG_ADDR 0x00018000
302
303 /**
304 * LPU0 Registers
305 * Should they be directly used from host,
306 * except for diagnostics ?
307 * CTL_REG : Control register
308 * CMD_REG : Triggers exec. of cmd. in
309 * Mailbox memory
310 */
311 #define LPU0_MBOX_CTL_REG (LPU0_BLK_REG_ADDR + 0x000)
312 #define LPU0_MBOX_CMD_REG (LPU0_BLK_REG_ADDR + 0x004)
313 #define LPU0_MBOX_LINK_0REG (LPU0_BLK_REG_ADDR + 0x008)
314 #define LPU1_MBOX_LINK_0REG (LPU0_BLK_REG_ADDR + 0x00c)
315 #define LPU0_MBOX_STATUS_0REG (LPU0_BLK_REG_ADDR + 0x010)
316 #define LPU1_MBOX_STATUS_0REG (LPU0_BLK_REG_ADDR + 0x014)
317 #define LPU0_ERR_STATUS_REG (LPU0_BLK_REG_ADDR + 0x018)
318 #define LPU0_ERR_SET_REG (LPU0_BLK_REG_ADDR + 0x020)
319
320 /**
321 * LPU1 Block Register Address Offset from BAR0
322 * Range 0x18400 - 0x18433
323 */
324 #define LPU1_BLK_REG_ADDR 0x00018400
325
326 /**
327 * LPU1 Registers
328 * Same as LPU0 registers above
329 */
330 #define LPU1_MBOX_CTL_REG (LPU1_BLK_REG_ADDR + 0x000)
331 #define LPU1_MBOX_CMD_REG (LPU1_BLK_REG_ADDR + 0x004)
332 #define LPU0_MBOX_LINK_1REG (LPU1_BLK_REG_ADDR + 0x008)
333 #define LPU1_MBOX_LINK_1REG (LPU1_BLK_REG_ADDR + 0x00c)
334 #define LPU0_MBOX_STATUS_1REG (LPU1_BLK_REG_ADDR + 0x010)
335 #define LPU1_MBOX_STATUS_1REG (LPU1_BLK_REG_ADDR + 0x014)
336 #define LPU1_ERR_STATUS_REG (LPU1_BLK_REG_ADDR + 0x018)
337 #define LPU1_ERR_SET_REG (LPU1_BLK_REG_ADDR + 0x020)
338
339 /**
340 * PSS Block Register Address Offset from BAR0
341 * Range 0x18800 - 0x188DB
342 */
343 #define PSS_BLK_REG_ADDR 0x00018800
344
345 /**
346 * PSS Registers
347 * For details, see catapult_spec.pdf
348 * ERR_STATUS_REG : Indicates error in PSS module
349 * RAM_ERR_STATUS_REG : Indicates RAM module that detected error
350 */
351 #define ERR_STATUS_SET (PSS_BLK_REG_ADDR + 0x018)
352 #define PSS_RAM_ERR_STATUS_REG (PSS_BLK_REG_ADDR + 0x01C)
353
354 /**
355 * PSS Semaphore Lock Registers, total 16
356 * First read when unlocked returns 0,
357 * and is set to 1, atomically.
358 * Subsequent reads returns 1.
359 * To clear set the value to 0.
360 * Range : 0x20 to 0x5c
361 */
362 #define PSS_SEM_LOCK_REG(_num) \
363 (PSS_BLK_REG_ADDR + 0x020 + ((_num) << 2))
364
365 /**
366 * PSS Semaphore Status Registers,
367 * corresponding to the lock registers above
368 */
369 #define PSS_SEM_STATUS_REG(_num) \
370 (PSS_BLK_REG_ADDR + 0x060 + ((_num) << 2))
371
372 /**
373 * Catapult CPQ Registers
374 * Defines for Mailbox Registers
375 * Used to send mailbox commands to firmware from
376 * host. The data part is written to the MBox
377 * memory, registers are used to indicate that
378 * a commnad is resident in memory.
379 *
380 * Note : LPU0<->LPU1 mailboxes are not listed here
381 */
382 #define CPQ_BLK_REG_ADDR 0x00019000
383
384 #define HOSTFN0_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x130)
385 #define HOSTFN0_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x134)
386 #define LPU0_HOSTFN0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x138)
387 #define LPU1_HOSTFN0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x13C)
388
389 #define HOSTFN1_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x140)
390 #define HOSTFN1_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x144)
391 #define LPU0_HOSTFN1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x148)
392 #define LPU1_HOSTFN1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x14C)
393
394 #define HOSTFN2_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x170)
395 #define HOSTFN2_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x174)
396 #define LPU0_HOSTFN2_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x178)
397 #define LPU1_HOSTFN2_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x17C)
398
399 #define HOSTFN3_LPU0_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x180)
400 #define HOSTFN3_LPU1_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x184)
401 #define LPU0_HOSTFN3_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x188)
402 #define LPU1_HOSTFN3_MBOX1_CMD_STAT (CPQ_BLK_REG_ADDR + 0x18C)
403
404 /* Host Function Force Parity Error Registers */
405 #define HOSTFN0_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x120)
406 #define HOSTFN1_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x124)
407 #define HOSTFN2_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x128)
408 #define HOSTFN3_LPU_FORCE_PERR (CPQ_BLK_REG_ADDR + 0x12C)
409
410 /* LL Port[0|1] Halt Mask Registers */
411 #define LL_HALT_MSK_P0 (CPQ_BLK_REG_ADDR + 0x1A0)
412 #define LL_HALT_MSK_P1 (CPQ_BLK_REG_ADDR + 0x1B0)
413
414 /* LL Port[0|1] Error Mask Registers */
415 #define LL_ERR_MSK_P0 (CPQ_BLK_REG_ADDR + 0x1D0)
416 #define LL_ERR_MSK_P1 (CPQ_BLK_REG_ADDR + 0x1D4)
417
418 /* EMC FLI (Flash Controller) Block Register Address Offset from BAR0 */
419 #define FLI_BLK_REG_ADDR 0x0001D000
420
421 /* EMC FLI Registers */
422 #define FLI_CMD_REG (FLI_BLK_REG_ADDR + 0x000)
423 #define FLI_ADDR_REG (FLI_BLK_REG_ADDR + 0x004)
424 #define FLI_CTL_REG (FLI_BLK_REG_ADDR + 0x008)
425 #define FLI_WRDATA_REG (FLI_BLK_REG_ADDR + 0x00C)
426 #define FLI_RDDATA_REG (FLI_BLK_REG_ADDR + 0x010)
427 #define FLI_DEV_STATUS_REG (FLI_BLK_REG_ADDR + 0x014)
428 #define FLI_SIG_WD_REG (FLI_BLK_REG_ADDR + 0x018)
429
430 /**
431 * RO register
432 * 31:16 -- Vendor Id
433 * 15:0 -- Device Id
434 */
435 #define FLI_DEV_VENDOR_REG (FLI_BLK_REG_ADDR + 0x01C)
436 #define FLI_ERR_STATUS_REG (FLI_BLK_REG_ADDR + 0x020)
437
438 /**
439 * RAD (RxAdm) Block Register Address Offset from BAR0
440 * RAD0 Range : 0x20000 - 0x203FF
441 * RAD1 Range : 0x20400 - 0x207FF
442 */
443 #define RAD0_BLK_REG_ADDR 0x00020000
444 #define RAD1_BLK_REG_ADDR 0x00020400
445
446 /* RAD0 Registers */
447 #define RAD0_CTL_REG (RAD0_BLK_REG_ADDR + 0x000)
448 #define RAD0_PE_PARM_REG (RAD0_BLK_REG_ADDR + 0x004)
449 #define RAD0_BCN_REG (RAD0_BLK_REG_ADDR + 0x008)
450
451 /* Default function ID register */
452 #define RAD0_DEFAULT_REG (RAD0_BLK_REG_ADDR + 0x00C)
453
454 /* Default promiscuous ID register */
455 #define RAD0_PROMISC_REG (RAD0_BLK_REG_ADDR + 0x010)
456
457 #define RAD0_BCNQ_REG (RAD0_BLK_REG_ADDR + 0x014)
458
459 /*
460 * This register selects 1 of 8 PM Q's using
461 * VLAN pri, for non-BCN packets without a VLAN tag
462 */
463 #define RAD0_DEFAULTQ_REG (RAD0_BLK_REG_ADDR + 0x018)
464
465 #define RAD0_ERR_STS (RAD0_BLK_REG_ADDR + 0x01C)
466 #define RAD0_SET_ERR_STS (RAD0_BLK_REG_ADDR + 0x020)
467 #define RAD0_ERR_INT_EN (RAD0_BLK_REG_ADDR + 0x024)
468 #define RAD0_FIRST_ERR (RAD0_BLK_REG_ADDR + 0x028)
469 #define RAD0_FORCE_ERR (RAD0_BLK_REG_ADDR + 0x02C)
470
471 #define RAD0_IF_RCVD (RAD0_BLK_REG_ADDR + 0x030)
472 #define RAD0_IF_RCVD_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x034)
473 #define RAD0_IF_RCVD_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x038)
474 #define RAD0_IF_RCVD_VLAN (RAD0_BLK_REG_ADDR + 0x03C)
475 #define RAD0_IF_RCVD_UCAST (RAD0_BLK_REG_ADDR + 0x040)
476 #define RAD0_IF_RCVD_UCAST_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x044)
477 #define RAD0_IF_RCVD_UCAST_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x048)
478 #define RAD0_IF_RCVD_UCAST_VLAN (RAD0_BLK_REG_ADDR + 0x04C)
479 #define RAD0_IF_RCVD_MCAST (RAD0_BLK_REG_ADDR + 0x050)
480 #define RAD0_IF_RCVD_MCAST_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x054)
481 #define RAD0_IF_RCVD_MCAST_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x058)
482 #define RAD0_IF_RCVD_MCAST_VLAN (RAD0_BLK_REG_ADDR + 0x05C)
483 #define RAD0_IF_RCVD_BCAST (RAD0_BLK_REG_ADDR + 0x060)
484 #define RAD0_IF_RCVD_BCAST_OCTETS_HIGH (RAD0_BLK_REG_ADDR + 0x064)
485 #define RAD0_IF_RCVD_BCAST_OCTETS_LOW (RAD0_BLK_REG_ADDR + 0x068)
486 #define RAD0_IF_RCVD_BCAST_VLAN (RAD0_BLK_REG_ADDR + 0x06C)
487 #define RAD0_DROPPED_FRAMES (RAD0_BLK_REG_ADDR + 0x070)
488
489 #define RAD0_MAC_MAN_1H (RAD0_BLK_REG_ADDR + 0x080)
490 #define RAD0_MAC_MAN_1L (RAD0_BLK_REG_ADDR + 0x084)
491 #define RAD0_MAC_MAN_2H (RAD0_BLK_REG_ADDR + 0x088)
492 #define RAD0_MAC_MAN_2L (RAD0_BLK_REG_ADDR + 0x08C)
493 #define RAD0_MAC_MAN_3H (RAD0_BLK_REG_ADDR + 0x090)
494 #define RAD0_MAC_MAN_3L (RAD0_BLK_REG_ADDR + 0x094)
495 #define RAD0_MAC_MAN_4H (RAD0_BLK_REG_ADDR + 0x098)
496 #define RAD0_MAC_MAN_4L (RAD0_BLK_REG_ADDR + 0x09C)
497
498 #define RAD0_LAST4_IP (RAD0_BLK_REG_ADDR + 0x100)
499
500 /* RAD1 Registers */
501 #define RAD1_CTL_REG (RAD1_BLK_REG_ADDR + 0x000)
502 #define RAD1_PE_PARM_REG (RAD1_BLK_REG_ADDR + 0x004)
503 #define RAD1_BCN_REG (RAD1_BLK_REG_ADDR + 0x008)
504
505 /* Default function ID register */
506 #define RAD1_DEFAULT_REG (RAD1_BLK_REG_ADDR + 0x00C)
507
508 /* Promiscuous function ID register */
509 #define RAD1_PROMISC_REG (RAD1_BLK_REG_ADDR + 0x010)
510
511 #define RAD1_BCNQ_REG (RAD1_BLK_REG_ADDR + 0x014)
512
513 /*
514 * This register selects 1 of 8 PM Q's using
515 * VLAN pri, for non-BCN packets without a VLAN tag
516 */
517 #define RAD1_DEFAULTQ_REG (RAD1_BLK_REG_ADDR + 0x018)
518
519 #define RAD1_ERR_STS (RAD1_BLK_REG_ADDR + 0x01C)
520 #define RAD1_SET_ERR_STS (RAD1_BLK_REG_ADDR + 0x020)
521 #define RAD1_ERR_INT_EN (RAD1_BLK_REG_ADDR + 0x024)
522
523 /**
524 * TXA Block Register Address Offset from BAR0
525 * TXA0 Range : 0x21000 - 0x213FF
526 * TXA1 Range : 0x21400 - 0x217FF
527 */
528 #define TXA0_BLK_REG_ADDR 0x00021000
529 #define TXA1_BLK_REG_ADDR 0x00021400
530
531 /* TXA Registers */
532 #define TXA0_CTRL_REG (TXA0_BLK_REG_ADDR + 0x000)
533 #define TXA1_CTRL_REG (TXA1_BLK_REG_ADDR + 0x000)
534
535 /**
536 * TSO Sequence # Registers (RO)
537 * Total 8 (for 8 queues)
538 * Holds the last seq.# for TSO frames
539 * See catapult_spec.pdf for more details
540 */
541 #define TXA0_TSO_TCP_SEQ_REG(_num) \
542 (TXA0_BLK_REG_ADDR + 0x020 + ((_num) << 2))
543
544 #define TXA1_TSO_TCP_SEQ_REG(_num) \
545 (TXA1_BLK_REG_ADDR + 0x020 + ((_num) << 2))
546
547 /**
548 * TSO IP ID # Registers (RO)
549 * Total 8 (for 8 queues)
550 * Holds the last IP ID for TSO frames
551 * See catapult_spec.pdf for more details
552 */
553 #define TXA0_TSO_IP_INFO_REG(_num) \
554 (TXA0_BLK_REG_ADDR + 0x040 + ((_num) << 2))
555
556 #define TXA1_TSO_IP_INFO_REG(_num) \
557 (TXA1_BLK_REG_ADDR + 0x040 + ((_num) << 2))
558
559 /**
560 * RXA Block Register Address Offset from BAR0
561 * RXA0 Range : 0x21800 - 0x21BFF
562 * RXA1 Range : 0x21C00 - 0x21FFF
563 */
564 #define RXA0_BLK_REG_ADDR 0x00021800
565 #define RXA1_BLK_REG_ADDR 0x00021C00
566
567 /* RXA Registers */
568 #define RXA0_CTL_REG (RXA0_BLK_REG_ADDR + 0x040)
569 #define RXA1_CTL_REG (RXA1_BLK_REG_ADDR + 0x040)
570
571 /**
572 * PPLB Block Register Address Offset from BAR0
573 * PPLB0 Range : 0x22000 - 0x223FF
574 * PPLB1 Range : 0x22400 - 0x227FF
575 */
576 #define PLB0_BLK_REG_ADDR 0x00022000
577 #define PLB1_BLK_REG_ADDR 0x00022400
578
579 /**
580 * PLB Registers
581 * Holds RL timer used time stamps in RLT tagged frames
582 */
583 #define PLB0_ECM_TIMER_REG (PLB0_BLK_REG_ADDR + 0x05C)
584 #define PLB1_ECM_TIMER_REG (PLB1_BLK_REG_ADDR + 0x05C)
585
586 /* Controls the rate-limiter on each of the priority class */
587 #define PLB0_RL_CTL (PLB0_BLK_REG_ADDR + 0x060)
588 #define PLB1_RL_CTL (PLB1_BLK_REG_ADDR + 0x060)
589
590 /**
591 * Max byte register, total 8, 0-7
592 * see catapult_spec.pdf for details
593 */
594 #define PLB0_RL_MAX_BC(_num) \
595 (PLB0_BLK_REG_ADDR + 0x064 + ((_num) << 2))
596 #define PLB1_RL_MAX_BC(_num) \
597 (PLB1_BLK_REG_ADDR + 0x064 + ((_num) << 2))
598
599 /**
600 * RL Time Unit Register for priority 0-7
601 * 4 bits per priority
602 * (2^rl_unit)*1us is the actual time period
603 */
604 #define PLB0_RL_TU_PRIO (PLB0_BLK_REG_ADDR + 0x084)
605 #define PLB1_RL_TU_PRIO (PLB1_BLK_REG_ADDR + 0x084)
606
607 /**
608 * RL byte count register,
609 * bytes transmitted in (rl_unit*1)us time period
610 * 1 per priority, 8 in all, 0-7.
611 */
612 #define PLB0_RL_BYTE_CNT(_num) \
613 (PLB0_BLK_REG_ADDR + 0x088 + ((_num) << 2))
614 #define PLB1_RL_BYTE_CNT(_num) \
615 (PLB1_BLK_REG_ADDR + 0x088 + ((_num) << 2))
616
617 /**
618 * RL Min factor register
619 * 2 bits per priority,
620 * 4 factors possible: 1, 0.5, 0.25, 0
621 * 2'b00 - 0; 2'b01 - 0.25; 2'b10 - 0.5; 2'b11 - 1
622 */
623 #define PLB0_RL_MIN_REG (PLB0_BLK_REG_ADDR + 0x0A8)
624 #define PLB1_RL_MIN_REG (PLB1_BLK_REG_ADDR + 0x0A8)
625
626 /**
627 * RL Max factor register
628 * 2 bits per priority,
629 * 4 factors possible: 1, 0.5, 0.25, 0
630 * 2'b00 - 0; 2'b01 - 0.25; 2'b10 - 0.5; 2'b11 - 1
631 */
632 #define PLB0_RL_MAX_REG (PLB0_BLK_REG_ADDR + 0x0AC)
633 #define PLB1_RL_MAX_REG (PLB1_BLK_REG_ADDR + 0x0AC)
634
635 /* MAC SERDES Address Paging register */
636 #define PLB0_EMS_ADD_REG (PLB0_BLK_REG_ADDR + 0xD0)
637 #define PLB1_EMS_ADD_REG (PLB1_BLK_REG_ADDR + 0xD0)
638
639 /* LL EMS Registers */
640 #define LL_EMS0_BLK_REG_ADDR 0x00026800
641 #define LL_EMS1_BLK_REG_ADDR 0x00026C00
642
643 /**
644 * BPC Block Register Address Offset from BAR0
645 * BPC0 Range : 0x23000 - 0x233FF
646 * BPC1 Range : 0x23400 - 0x237FF
647 */
648 #define BPC0_BLK_REG_ADDR 0x00023000
649 #define BPC1_BLK_REG_ADDR 0x00023400
650
651 /**
652 * PMM Block Register Address Offset from BAR0
653 * PMM0 Range : 0x23800 - 0x23BFF
654 * PMM1 Range : 0x23C00 - 0x23FFF
655 */
656 #define PMM0_BLK_REG_ADDR 0x00023800
657 #define PMM1_BLK_REG_ADDR 0x00023C00
658
659 /**
660 * HQM Block Register Address Offset from BAR0
661 * HQM0 Range : 0x24000 - 0x243FF
662 * HQM1 Range : 0x24400 - 0x247FF
663 */
664 #define HQM0_BLK_REG_ADDR 0x00024000
665 #define HQM1_BLK_REG_ADDR 0x00024400
666
667 /**
668 * HQM Control Register
669 * Controls some aspects of IB
670 * See catapult_spec.pdf for details
671 */
672 #define HQM0_CTL_REG (HQM0_BLK_REG_ADDR + 0x000)
673 #define HQM1_CTL_REG (HQM1_BLK_REG_ADDR + 0x000)
674
675 /**
676 * HQM Stop Q Semaphore Registers.
677 * Only one Queue resource can be stopped at
678 * any given time. This register controls access
679 * to the single stop Q resource.
680 * See catapult_spec.pdf for details
681 */
682 #define HQM0_RXQ_STOP_SEM (HQM0_BLK_REG_ADDR + 0x028)
683 #define HQM0_TXQ_STOP_SEM (HQM0_BLK_REG_ADDR + 0x02C)
684 #define HQM1_RXQ_STOP_SEM (HQM1_BLK_REG_ADDR + 0x028)
685 #define HQM1_TXQ_STOP_SEM (HQM1_BLK_REG_ADDR + 0x02C)
686
687 /**
688 * LUT Block Register Address Offset from BAR0
689 * LUT0 Range : 0x25800 - 0x25BFF
690 * LUT1 Range : 0x25C00 - 0x25FFF
691 */
692 #define LUT0_BLK_REG_ADDR 0x00025800
693 #define LUT1_BLK_REG_ADDR 0x00025C00
694
695 /**
696 * LUT Registers
697 * See catapult_spec.pdf for details
698 */
699 #define LUT0_ERR_STS (LUT0_BLK_REG_ADDR + 0x000)
700 #define LUT1_ERR_STS (LUT1_BLK_REG_ADDR + 0x000)
701 #define LUT0_SET_ERR_STS (LUT0_BLK_REG_ADDR + 0x004)
702 #define LUT1_SET_ERR_STS (LUT1_BLK_REG_ADDR + 0x004)
703
704 /**
705 * TRC (Debug/Trace) Register Offset from BAR0
706 * Range : 0x26000 -- 0x263FFF
707 */
708 #define TRC_BLK_REG_ADDR 0x00026000
709
710 /**
711 * TRC Registers
712 * See catapult_spec.pdf for details of each
713 */
714 #define TRC_CTL_REG (TRC_BLK_REG_ADDR + 0x000)
715 #define TRC_MODS_REG (TRC_BLK_REG_ADDR + 0x004)
716 #define TRC_TRGC_REG (TRC_BLK_REG_ADDR + 0x008)
717 #define TRC_CNT1_REG (TRC_BLK_REG_ADDR + 0x010)
718 #define TRC_CNT2_REG (TRC_BLK_REG_ADDR + 0x014)
719 #define TRC_NXTS_REG (TRC_BLK_REG_ADDR + 0x018)
720 #define TRC_DIRR_REG (TRC_BLK_REG_ADDR + 0x01C)
721
722 /**
723 * TRC Trigger match filters, total 10
724 * Determines the trigger condition
725 */
726 #define TRC_TRGM_REG(_num) \
727 (TRC_BLK_REG_ADDR + 0x040 + ((_num) << 2))
728
729 /**
730 * TRC Next State filters, total 10
731 * Determines the next state conditions
732 */
733 #define TRC_NXTM_REG(_num) \
734 (TRC_BLK_REG_ADDR + 0x080 + ((_num) << 2))
735
736 /**
737 * TRC Store Match filters, total 10
738 * Determines the store conditions
739 */
740 #define TRC_STRM_REG(_num) \
741 (TRC_BLK_REG_ADDR + 0x0C0 + ((_num) << 2))
742
743 /* DOORBELLS ACCESS */
744
745 /**
746 * Catapult doorbells
747 * Each doorbell-queue set has
748 * 1 RxQ, 1 TxQ, 2 IBs in that order
749 * Size of each entry in 32 bytes, even though only 1 word
750 * is used. For Non-VM case each doorbell-q set is
751 * separated by 128 bytes, for VM case it is separated
752 * by 4K bytes
753 * Non VM case Range : 0x38000 - 0x39FFF
754 * VM case Range : 0x100000 - 0x11FFFF
755 * The range applies to both HQMs
756 */
757 #define HQM_DOORBELL_BLK_BASE_ADDR 0x00038000
758 #define HQM_DOORBELL_VM_BLK_BASE_ADDR 0x00100000
759
760 /* MEMORY ACCESS */
761
762 /**
763 * Catapult H/W Block Memory Access Address
764 * To the host a memory space of 32K (page) is visible
765 * at a time. The address range is from 0x08000 to 0x0FFFF
766 */
767 #define HW_BLK_HOST_MEM_ADDR 0x08000
768
769 /**
770 * Catapult LUT Memory Access Page Numbers
771 * Range : LUT0 0xa0-0xa1
772 * LUT1 0xa2-0xa3
773 */
774 #define LUT0_MEM_BLK_BASE_PG_NUM 0x000000A0
775 #define LUT1_MEM_BLK_BASE_PG_NUM 0x000000A2
776
777 /**
778 * Catapult RxFn Database Memory Block Base Offset
779 *
780 * The Rx function database exists in LUT block.
781 * In PCIe space this is accessible as a 256x32
782 * bit block. Each entry in this database is 4
783 * (4 byte) words. Max. entries is 64.
784 * Address of an entry corresponding to a function
785 * = base_addr + (function_no. * 16)
786 */
787 #define RX_FNDB_RAM_BASE_OFFSET 0x0000B400
788
789 /**
790 * Catapult TxFn Database Memory Block Base Offset Address
791 *
792 * The Tx function database exists in LUT block.
793 * In PCIe space this is accessible as a 64x32
794 * bit block. Each entry in this database is 1
795 * (4 byte) word. Max. entries is 64.
796 * Address of an entry corresponding to a function
797 * = base_addr + (function_no. * 4)
798 */
799 #define TX_FNDB_RAM_BASE_OFFSET 0x0000B800
800
801 /**
802 * Catapult Unicast CAM Base Offset Address
803 *
804 * Exists in LUT memory space.
805 * Shared by both the LL & FCoE driver.
806 * Size is 256x48 bits; mapped to PCIe space
807 * 512x32 bit blocks. For each address, bits
808 * are written in the order : [47:32] and then
809 * [31:0].
810 */
811 #define UCAST_CAM_BASE_OFFSET 0x0000A800
812
813 /**
814 * Catapult Unicast RAM Base Offset Address
815 *
816 * Exists in LUT memory space.
817 * Shared by both the LL & FCoE driver.
818 * Size is 256x9 bits.
819 */
820 #define UCAST_RAM_BASE_OFFSET 0x0000B000
821
822 /**
823 * Catapult Mulicast CAM Base Offset Address
824 *
825 * Exists in LUT memory space.
826 * Shared by both the LL & FCoE driver.
827 * Size is 256x48 bits; mapped to PCIe space
828 * 512x32 bit blocks. For each address, bits
829 * are written in the order : [47:32] and then
830 * [31:0].
831 */
832 #define MCAST_CAM_BASE_OFFSET 0x0000A000
833
834 /**
835 * Catapult VLAN RAM Base Offset Address
836 *
837 * Exists in LUT memory space.
838 * Size is 4096x66 bits; mapped to PCIe space as
839 * 8192x32 bit blocks.
840 * All the 4K entries are within the address range
841 * 0x0000 to 0x8000, so in the first LUT page.
842 */
843 #define VLAN_RAM_BASE_OFFSET 0x00000000
844
845 /**
846 * Catapult Tx Stats RAM Base Offset Address
847 *
848 * Exists in LUT memory space.
849 * Size is 1024x33 bits;
850 * Each Tx function has 64 bytes of space
851 */
852 #define TX_STATS_RAM_BASE_OFFSET 0x00009000
853
854 /**
855 * Catapult Rx Stats RAM Base Offset Address
856 *
857 * Exists in LUT memory space.
858 * Size is 1024x33 bits;
859 * Each Rx function has 64 bytes of space
860 */
861 #define RX_STATS_RAM_BASE_OFFSET 0x00008000
862
863 /* Catapult RXA Memory Access Page Numbers */
864 #define RXA0_MEM_BLK_BASE_PG_NUM 0x0000008C
865 #define RXA1_MEM_BLK_BASE_PG_NUM 0x0000008D
866
867 /**
868 * Catapult Multicast Vector Table Base Offset Address
869 *
870 * Exists in RxA memory space.
871 * Organized as 512x65 bit block.
872 * However for each entry 16 bytes allocated (power of 2)
873 * Total size 512*16 bytes.
874 * There are two logical divisions, 256 entries each :
875 * a) Entries 0x00 to 0xff (256) -- Approx. MVT
876 * Offset 0x000 to 0xFFF
877 * b) Entries 0x100 to 0x1ff (256) -- Exact MVT
878 * Offsets 0x1000 to 0x1FFF
879 */
880 #define MCAST_APPROX_MVT_BASE_OFFSET 0x00000000
881 #define MCAST_EXACT_MVT_BASE_OFFSET 0x00001000
882
883 /**
884 * Catapult RxQ Translate Table (RIT) Base Offset Address
885 *
886 * Exists in RxA memory space
887 * Total no. of entries 64
888 * Each entry is 1 (4 byte) word.
889 * 31:12 -- Reserved
890 * 11:0 -- Two 6 bit RxQ Ids
891 */
892 #define FUNCTION_TO_RXQ_TRANSLATE 0x00002000
893
894 /* Catapult RxAdm (RAD) Memory Access Page Numbers */
895 #define RAD0_MEM_BLK_BASE_PG_NUM 0x00000086
896 #define RAD1_MEM_BLK_BASE_PG_NUM 0x00000087
897
898 /**
899 * Catapult RSS Table Base Offset Address
900 *
901 * Exists in RAD memory space.
902 * Each entry is 352 bits, but aligned on
903 * 64 byte (512 bit) boundary. Accessed
904 * 4 byte words, the whole entry can be
905 * broken into 11 word accesses.
906 */
907 #define RSS_TABLE_BASE_OFFSET 0x00000800
908
909 /**
910 * Catapult CPQ Block Page Number
911 * This value is written to the page number registers
912 * to access the memory associated with the mailboxes.
913 */
914 #define CPQ_BLK_PG_NUM 0x00000005
915
916 /**
917 * Clarification :
918 * LL functions are 2 & 3; can HostFn0/HostFn1
919 * <-> LPU0/LPU1 memories be used ?
920 */
921 /**
922 * Catapult HostFn0/HostFn1 to LPU0/LPU1 Mbox memory
923 * Per catapult_spec.pdf, the offset of the mbox
924 * memory is in the register space at an offset of 0x200
925 */
926 #define CPQ_BLK_REG_MBOX_ADDR (CPQ_BLK_REG_ADDR + 0x200)
927
928 #define HOSTFN_LPU_MBOX (CPQ_BLK_REG_MBOX_ADDR + 0x000)
929
930 /* Catapult LPU0/LPU1 to HostFn0/HostFn1 Mbox memory */
931 #define LPU_HOSTFN_MBOX (CPQ_BLK_REG_MBOX_ADDR + 0x080)
932
933 /**
934 * Catapult HQM Block Page Number
935 * This is written to the page number register for
936 * the appropriate function to access the memory
937 * associated with HQM
938 */
939 #define HQM0_BLK_PG_NUM 0x00000096
940 #define HQM1_BLK_PG_NUM 0x00000097
941
942 /**
943 * Note that TxQ and RxQ entries are interlaced
944 * the HQM memory, i.e RXQ0, TXQ0, RXQ1, TXQ1.. etc.
945 */
946
947 #define HQM_RXTX_Q_RAM_BASE_OFFSET 0x00004000
948
949 /**
950 * CQ Memory
951 * Exists in HQM Memory space
952 * Each entry is 16 (4 byte) words of which
953 * only 12 words are used for configuration
954 * Total 64 entries per HQM memory space
955 */
956 #define HQM_CQ_RAM_BASE_OFFSET 0x00006000
957
958 /**
959 * Interrupt Block (IB) Memory
960 * Exists in HQM Memory space
961 * Each entry is 8 (4 byte) words of which
962 * only 5 words are used for configuration
963 * Total 128 entries per HQM memory space
964 */
965 #define HQM_IB_RAM_BASE_OFFSET 0x00001000
966
967 /**
968 * Index Table (IT) Memory
969 * Exists in HQM Memory space
970 * Each entry is 1 (4 byte) word which
971 * is used for configuration
972 * Total 128 entries per HQM memory space
973 */
974 #define HQM_INDX_TBL_RAM_BASE_OFFSET 0x00002000
975
976 /**
977 * PSS Block Memory Page Number
978 * This is written to the appropriate page number
979 * register to access the CPU memory.
980 * Also known as the PSS secondary memory (SMEM).
981 * Range : 0x180 to 0x1CF
982 * See catapult_spec.pdf for details
983 */
984 #define PSS_BLK_PG_NUM 0x00000180
985
986 /**
987 * Offsets of different instances of PSS SMEM
988 * 2.5M of continuous 1T memory space : 2 blocks
989 * of 1M each (32 pages each, page=32KB) and 4 smaller
990 * blocks of 128K each (4 pages each, page=32KB)
991 * PSS_LMEM_INST0 is used for firmware download
992 */
993 #define PSS_LMEM_INST0 0x00000000
994 #define PSS_LMEM_INST1 0x00100000
995 #define PSS_LMEM_INST2 0x00200000
996 #define PSS_LMEM_INST3 0x00220000
997 #define PSS_LMEM_INST4 0x00240000
998 #define PSS_LMEM_INST5 0x00260000
999
1000 #define BNA_PCI_REG_CT_ADDRSZ (0x40000)
1001
1002 #define BNA_GET_PAGE_NUM(_base_page, _offset) \
1003 ((_base_page) + ((_offset) >> 15))
1004
1005 #define BNA_GET_PAGE_OFFSET(_offset) \
1006 ((_offset) & 0x7fff)
1007
1008 #define BNA_GET_MEM_BASE_ADDR(_bar0, _base_offset) \
1009 ((_bar0) + HW_BLK_HOST_MEM_ADDR \
1010 + BNA_GET_PAGE_OFFSET((_base_offset)))
1011
1012 #define BNA_GET_VLAN_MEM_ENTRY_ADDR(_bar0, _fn_id, _vlan_id)\
1013 (_bar0 + (HW_BLK_HOST_MEM_ADDR) \
1014 + (BNA_GET_PAGE_OFFSET(VLAN_RAM_BASE_OFFSET)) \
1015 + (((_fn_id) & 0x3f) << 9) \
1016 + (((_vlan_id) & 0xfe0) >> 3))
1017
1018 /**
1019 *
1020 * Interrupt related bits, flags and macros
1021 *
1022 */
1023
1024 #define __LPU02HOST_MBOX0_STATUS_BITS 0x00100000
1025 #define __LPU12HOST_MBOX0_STATUS_BITS 0x00200000
1026 #define __LPU02HOST_MBOX1_STATUS_BITS 0x00400000
1027 #define __LPU12HOST_MBOX1_STATUS_BITS 0x00800000
1028
1029 #define __LPU02HOST_MBOX0_MASK_BITS 0x00100000
1030 #define __LPU12HOST_MBOX0_MASK_BITS 0x00200000
1031 #define __LPU02HOST_MBOX1_MASK_BITS 0x00400000
1032 #define __LPU12HOST_MBOX1_MASK_BITS 0x00800000
1033
1034 #define __LPU2HOST_MBOX_MASK_BITS \
1035 (__LPU02HOST_MBOX0_MASK_BITS | __LPU02HOST_MBOX1_MASK_BITS | \
1036 __LPU12HOST_MBOX0_MASK_BITS | __LPU12HOST_MBOX1_MASK_BITS)
1037
1038 #define __LPU2HOST_IB_STATUS_BITS 0x0000ffff
1039
1040 #define BNA_IS_LPU0_MBOX_INTR(_intr_status) \
1041 ((_intr_status) & (__LPU02HOST_MBOX0_STATUS_BITS | \
1042 __LPU02HOST_MBOX1_STATUS_BITS))
1043
1044 #define BNA_IS_LPU1_MBOX_INTR(_intr_status) \
1045 ((_intr_status) & (__LPU12HOST_MBOX0_STATUS_BITS | \
1046 __LPU12HOST_MBOX1_STATUS_BITS))
1047
1048 #define BNA_IS_MBOX_INTR(_intr_status) \
1049 ((_intr_status) & \
1050 (__LPU02HOST_MBOX0_STATUS_BITS | \
1051 __LPU02HOST_MBOX1_STATUS_BITS | \
1052 __LPU12HOST_MBOX0_STATUS_BITS | \
1053 __LPU12HOST_MBOX1_STATUS_BITS))
1054
1055 #define __EMC_ERROR_STATUS_BITS 0x00010000
1056 #define __LPU0_ERROR_STATUS_BITS 0x00020000
1057 #define __LPU1_ERROR_STATUS_BITS 0x00040000
1058 #define __PSS_ERROR_STATUS_BITS 0x00080000
1059
1060 #define __HALT_STATUS_BITS 0x01000000
1061
1062 #define __EMC_ERROR_MASK_BITS 0x00010000
1063 #define __LPU0_ERROR_MASK_BITS 0x00020000
1064 #define __LPU1_ERROR_MASK_BITS 0x00040000
1065 #define __PSS_ERROR_MASK_BITS 0x00080000
1066
1067 #define __HALT_MASK_BITS 0x01000000
1068
1069 #define __ERROR_MASK_BITS \
1070 (__EMC_ERROR_MASK_BITS | __LPU0_ERROR_MASK_BITS | \
1071 __LPU1_ERROR_MASK_BITS | __PSS_ERROR_MASK_BITS | \
1072 __HALT_MASK_BITS)
1073
1074 #define BNA_IS_ERR_INTR(_intr_status) \
1075 ((_intr_status) & \
1076 (__EMC_ERROR_STATUS_BITS | \
1077 __LPU0_ERROR_STATUS_BITS | \
1078 __LPU1_ERROR_STATUS_BITS | \
1079 __PSS_ERROR_STATUS_BITS | \
1080 __HALT_STATUS_BITS))
1081
1082 #define BNA_IS_MBOX_ERR_INTR(_intr_status) \
1083 (BNA_IS_MBOX_INTR((_intr_status)) | \
1084 BNA_IS_ERR_INTR((_intr_status)))
1085
1086 #define BNA_IS_INTX_DATA_INTR(_intr_status) \
1087 ((_intr_status) & __LPU2HOST_IB_STATUS_BITS)
1088
1089 #define BNA_INTR_STATUS_MBOX_CLR(_intr_status) \
1090 do { \
1091 (_intr_status) &= ~(__LPU02HOST_MBOX0_STATUS_BITS | \
1092 __LPU02HOST_MBOX1_STATUS_BITS | \
1093 __LPU12HOST_MBOX0_STATUS_BITS | \
1094 __LPU12HOST_MBOX1_STATUS_BITS); \
1095 } while (0)
1096
1097 #define BNA_INTR_STATUS_ERR_CLR(_intr_status) \
1098 do { \
1099 (_intr_status) &= ~(__EMC_ERROR_STATUS_BITS | \
1100 __LPU0_ERROR_STATUS_BITS | \
1101 __LPU1_ERROR_STATUS_BITS | \
1102 __PSS_ERROR_STATUS_BITS | \
1103 __HALT_STATUS_BITS); \
1104 } while (0)
1105
1106 #define bna_intx_disable(_bna, _cur_mask) \
1107 { \
1108 (_cur_mask) = readl((_bna)->regs.fn_int_mask);\
1109 writel(0xffffffff, (_bna)->regs.fn_int_mask);\
1110 }
1111
1112 #define bna_intx_enable(bna, new_mask) \
1113 writel((new_mask), (bna)->regs.fn_int_mask)
1114
1115 #define bna_mbox_intr_disable(bna) \
1116 writel((readl((bna)->regs.fn_int_mask) | \
1117 (__LPU2HOST_MBOX_MASK_BITS | __ERROR_MASK_BITS)), \
1118 (bna)->regs.fn_int_mask)
1119
1120 #define bna_mbox_intr_enable(bna) \
1121 writel((readl((bna)->regs.fn_int_mask) & \
1122 ~(__LPU2HOST_MBOX_MASK_BITS | __ERROR_MASK_BITS)), \
1123 (bna)->regs.fn_int_mask)
1124
1125 #define bna_intr_status_get(_bna, _status) \
1126 { \
1127 (_status) = readl((_bna)->regs.fn_int_status); \
1128 if ((_status)) { \
1129 writel((_status) & ~(__LPU02HOST_MBOX0_STATUS_BITS |\
1130 __LPU02HOST_MBOX1_STATUS_BITS |\
1131 __LPU12HOST_MBOX0_STATUS_BITS |\
1132 __LPU12HOST_MBOX1_STATUS_BITS), \
1133 (_bna)->regs.fn_int_status);\
1134 } \
1135 }
1136
1137 #define bna_intr_status_get_no_clr(_bna, _status) \
1138 (_status) = readl((_bna)->regs.fn_int_status)
1139
1140 #define bna_intr_mask_get(bna, mask) \
1141 (*mask) = readl((bna)->regs.fn_int_mask)
1142
1143 #define bna_intr_ack(bna, intr_bmap) \
1144 writel((intr_bmap), (bna)->regs.fn_int_status)
1145
1146 #define bna_ib_intx_disable(bna, ib_id) \
1147 writel(readl((bna)->regs.fn_int_mask) | \
1148 (1 << (ib_id)), \
1149 (bna)->regs.fn_int_mask)
1150
1151 #define bna_ib_intx_enable(bna, ib_id) \
1152 writel(readl((bna)->regs.fn_int_mask) & \
1153 ~(1 << (ib_id)), \
1154 (bna)->regs.fn_int_mask)
1155
1156 #define bna_mbox_msix_idx_set(_device) \
1157 do {\
1158 writel(((_device)->vector & 0x000001FF), \
1159 (_device)->bna->pcidev.pci_bar_kva + \
1160 reg_offset[(_device)->bna->pcidev.pci_func].msix_idx);\
1161 } while (0)
1162
1163 /**
1164 *
1165 * TxQ, RxQ, CQ related bits, offsets, macros
1166 *
1167 */
1168
1169 #define BNA_Q_IDLE_STATE 0x00008001
1170
1171 #define BNA_GET_DOORBELL_BASE_ADDR(_bar0) \
1172 ((_bar0) + HQM_DOORBELL_BLK_BASE_ADDR)
1173
1174 #define BNA_GET_DOORBELL_ENTRY_OFFSET(_entry) \
1175 ((HQM_DOORBELL_BLK_BASE_ADDR) \
1176 + (_entry << 7))
1177
1178 #define BNA_DOORBELL_IB_INT_ACK(_timeout, _events) \
1179 (0x80000000 | ((_timeout) << 16) | (_events))
1180
1181 #define BNA_DOORBELL_IB_INT_DISABLE (0x40000000)
1182
1183 /* TxQ Entry Opcodes */
1184 #define BNA_TXQ_WI_SEND (0x402) /* Single Frame Transmission */
1185 #define BNA_TXQ_WI_SEND_LSO (0x403) /* Multi-Frame Transmission */
1186 #define BNA_TXQ_WI_EXTENSION (0x104) /* Extension WI */
1187
1188 /* TxQ Entry Control Flags */
1189 #define BNA_TXQ_WI_CF_FCOE_CRC (1 << 8)
1190 #define BNA_TXQ_WI_CF_IPID_MODE (1 << 5)
1191 #define BNA_TXQ_WI_CF_INS_PRIO (1 << 4)
1192 #define BNA_TXQ_WI_CF_INS_VLAN (1 << 3)
1193 #define BNA_TXQ_WI_CF_UDP_CKSUM (1 << 2)
1194 #define BNA_TXQ_WI_CF_TCP_CKSUM (1 << 1)
1195 #define BNA_TXQ_WI_CF_IP_CKSUM (1 << 0)
1196
1197 #define BNA_TXQ_WI_L4_HDR_N_OFFSET(_hdr_size, _offset) \
1198 (((_hdr_size) << 10) | ((_offset) & 0x3FF))
1199
1200 /*
1201 * Completion Q defines
1202 */
1203 /* CQ Entry Flags */
1204 #define BNA_CQ_EF_MAC_ERROR (1 << 0)
1205 #define BNA_CQ_EF_FCS_ERROR (1 << 1)
1206 #define BNA_CQ_EF_TOO_LONG (1 << 2)
1207 #define BNA_CQ_EF_FC_CRC_OK (1 << 3)
1208
1209 #define BNA_CQ_EF_RSVD1 (1 << 4)
1210 #define BNA_CQ_EF_L4_CKSUM_OK (1 << 5)
1211 #define BNA_CQ_EF_L3_CKSUM_OK (1 << 6)
1212 #define BNA_CQ_EF_HDS_HEADER (1 << 7)
1213
1214 #define BNA_CQ_EF_UDP (1 << 8)
1215 #define BNA_CQ_EF_TCP (1 << 9)
1216 #define BNA_CQ_EF_IP_OPTIONS (1 << 10)
1217 #define BNA_CQ_EF_IPV6 (1 << 11)
1218
1219 #define BNA_CQ_EF_IPV4 (1 << 12)
1220 #define BNA_CQ_EF_VLAN (1 << 13)
1221 #define BNA_CQ_EF_RSS (1 << 14)
1222 #define BNA_CQ_EF_RSVD2 (1 << 15)
1223
1224 #define BNA_CQ_EF_MCAST_MATCH (1 << 16)
1225 #define BNA_CQ_EF_MCAST (1 << 17)
1226 #define BNA_CQ_EF_BCAST (1 << 18)
1227 #define BNA_CQ_EF_REMOTE (1 << 19)
1228
1229 #define BNA_CQ_EF_LOCAL (1 << 20)
1230
1231 /**
1232 *
1233 * Data structures
1234 *
1235 */
1236
1237 enum txf_flags {
1238 BFI_TXF_CF_ENABLE = 1 << 0,
1239 BFI_TXF_CF_VLAN_FILTER = 1 << 8,
1240 BFI_TXF_CF_VLAN_ADMIT = 1 << 9,
1241 BFI_TXF_CF_VLAN_INSERT = 1 << 10,
1242 BFI_TXF_CF_RSVD1 = 1 << 11,
1243 BFI_TXF_CF_MAC_SA_CHECK = 1 << 12,
1244 BFI_TXF_CF_VLAN_WI_BASED = 1 << 13,
1245 BFI_TXF_CF_VSWITCH_MCAST = 1 << 14,
1246 BFI_TXF_CF_VSWITCH_UCAST = 1 << 15,
1247 BFI_TXF_CF_RSVD2 = 0x7F << 1
1248 };
1249
1250 enum ib_flags {
1251 BFI_IB_CF_MASTER_ENABLE = (1 << 0),
1252 BFI_IB_CF_MSIX_MODE = (1 << 1),
1253 BFI_IB_CF_COALESCING_MODE = (1 << 2),
1254 BFI_IB_CF_INTER_PKT_ENABLE = (1 << 3),
1255 BFI_IB_CF_INT_ENABLE = (1 << 4),
1256 BFI_IB_CF_INTER_PKT_DMA = (1 << 5),
1257 BFI_IB_CF_ACK_PENDING = (1 << 6),
1258 BFI_IB_CF_RESERVED1 = (1 << 7)
1259 };
1260
1261 enum rss_hash_type {
1262 BFI_RSS_T_V4_TCP = (1 << 11),
1263 BFI_RSS_T_V4_IP = (1 << 10),
1264 BFI_RSS_T_V6_TCP = (1 << 9),
1265 BFI_RSS_T_V6_IP = (1 << 8)
1266 };
1267 enum hds_header_type {
1268 BNA_HDS_T_V4_TCP = (1 << 11),
1269 BNA_HDS_T_V4_UDP = (1 << 10),
1270 BNA_HDS_T_V6_TCP = (1 << 9),
1271 BNA_HDS_T_V6_UDP = (1 << 8),
1272 BNA_HDS_FORCED = (1 << 7),
1273 };
1274 enum rxf_flags {
1275 BNA_RXF_CF_SM_LG_RXQ = (1 << 15),
1276 BNA_RXF_CF_DEFAULT_VLAN = (1 << 14),
1277 BNA_RXF_CF_DEFAULT_FUNCTION_ENABLE = (1 << 13),
1278 BNA_RXF_CF_VLAN_STRIP = (1 << 12),
1279 BNA_RXF_CF_RSS_ENABLE = (1 << 8)
1280 };
1281 struct bna_chip_regs_offset {
1282 u32 page_addr;
1283 u32 fn_int_status;
1284 u32 fn_int_mask;
1285 u32 msix_idx;
1286 };
1287
1288 struct bna_chip_regs {
1289 void __iomem *page_addr;
1290 void __iomem *fn_int_status;
1291 void __iomem *fn_int_mask;
1292 };
1293
1294 struct bna_txq_mem {
1295 u32 pg_tbl_addr_lo;
1296 u32 pg_tbl_addr_hi;
1297 u32 cur_q_entry_lo;
1298 u32 cur_q_entry_hi;
1299 u32 reserved1;
1300 u32 reserved2;
1301 u32 pg_cnt_n_prd_ptr; /* 31:16->total page count */
1302 /* 15:0 ->producer pointer (index?) */
1303 u32 entry_n_pg_size; /* 31:16->entry size */
1304 /* 15:0 ->page size */
1305 u32 int_blk_n_cns_ptr; /* 31:24->Int Blk Id; */
1306 /* 23:16->Int Blk Offset */
1307 /* 15:0 ->consumer pointer(index?) */
1308 u32 cns_ptr2_n_q_state; /* 31:16->cons. ptr 2; 15:0-> Q state */
1309 u32 nxt_qid_n_fid_n_pri; /* 17:10->next */
1310 /* QId;9:3->FID;2:0->Priority */
1311 u32 wvc_n_cquota_n_rquota; /* 31:24->WI Vector Count; */
1312 /* 23:12->Cfg Quota; */
1313 /* 11:0 ->Run Quota */
1314 u32 reserved3[4];
1315 };
1316
1317 struct bna_rxq_mem {
1318 u32 pg_tbl_addr_lo;
1319 u32 pg_tbl_addr_hi;
1320 u32 cur_q_entry_lo;
1321 u32 cur_q_entry_hi;
1322 u32 reserved1;
1323 u32 reserved2;
1324 u32 pg_cnt_n_prd_ptr; /* 31:16->total page count */
1325 /* 15:0 ->producer pointer (index?) */
1326 u32 entry_n_pg_size; /* 31:16->entry size */
1327 /* 15:0 ->page size */
1328 u32 sg_n_cq_n_cns_ptr; /* 31:28->reserved; 27:24->sg count */
1329 /* 23:16->CQ; */
1330 /* 15:0->consumer pointer(index?) */
1331 u32 buf_sz_n_q_state; /* 31:16->buffer size; 15:0-> Q state */
1332 u32 next_qid; /* 17:10->next QId */
1333 u32 reserved3;
1334 u32 reserved4[4];
1335 };
1336
1337 struct bna_rxtx_q_mem {
1338 struct bna_rxq_mem rxq;
1339 struct bna_txq_mem txq;
1340 };
1341
1342 struct bna_cq_mem {
1343 u32 pg_tbl_addr_lo;
1344 u32 pg_tbl_addr_hi;
1345 u32 cur_q_entry_lo;
1346 u32 cur_q_entry_hi;
1347
1348 u32 reserved1;
1349 u32 reserved2;
1350 u32 pg_cnt_n_prd_ptr; /* 31:16->total page count */
1351 /* 15:0 ->producer pointer (index?) */
1352 u32 entry_n_pg_size; /* 31:16->entry size */
1353 /* 15:0 ->page size */
1354 u32 int_blk_n_cns_ptr; /* 31:24->Int Blk Id; */
1355 /* 23:16->Int Blk Offset */
1356 /* 15:0 ->consumer pointer(index?) */
1357 u32 q_state; /* 31:16->reserved; 15:0-> Q state */
1358 u32 reserved3[2];
1359 u32 reserved4[4];
1360 };
1361
1362 struct bna_ib_blk_mem {
1363 u32 host_addr_lo;
1364 u32 host_addr_hi;
1365 u32 clsc_n_ctrl_n_msix; /* 31:24->coalescing; */
1366 /* 23:16->coalescing cfg; */
1367 /* 15:8 ->control; */
1368 /* 7:0 ->msix; */
1369 u32 ipkt_n_ent_n_idxof;
1370 u32 ipkt_cnt_cfg_n_unacked;
1371
1372 u32 reserved[3];
1373 };
1374
1375 struct bna_idx_tbl_mem {
1376 u32 idx; /* !< 31:16->res;15:0->idx; */
1377 };
1378
1379 struct bna_doorbell_qset {
1380 u32 rxq[0x20 >> 2];
1381 u32 txq[0x20 >> 2];
1382 u32 ib0[0x20 >> 2];
1383 u32 ib1[0x20 >> 2];
1384 };
1385
1386 struct bna_rx_fndb_ram {
1387 u32 rss_prop;
1388 u32 size_routing_props;
1389 u32 rit_hds_mcastq;
1390 u32 control_flags;
1391 };
1392
1393 struct bna_tx_fndb_ram {
1394 u32 vlan_n_ctrl_flags;
1395 };
1396
1397 /**
1398 * @brief
1399 * Structure which maps to RxFn Indirection Table (RIT)
1400 * Size : 1 word
1401 * See catapult_spec.pdf, RxA for details
1402 */
1403 struct bna_rit_mem {
1404 u32 rxq_ids; /* !< 31:12->res;11:0->two 6 bit RxQ Ids */
1405 };
1406
1407 /**
1408 * @brief
1409 * Structure which maps to RSS Table entry
1410 * Size : 16 words
1411 * See catapult_spec.pdf, RAD for details
1412 */
1413 struct bna_rss_mem {
1414 /*
1415 * 31:12-> res
1416 * 11:8 -> protocol type
1417 * 7:0 -> hash index
1418 */
1419 u32 type_n_hash;
1420 u32 hash_key[10]; /* !< 40 byte Toeplitz hash key */
1421 u32 reserved[5];
1422 };
1423
1424 /* TxQ Vector (a.k.a. Tx-Buffer Descriptor) */
1425 struct bna_dma_addr {
1426 u32 msb;
1427 u32 lsb;
1428 };
1429
1430 struct bna_txq_wi_vector {
1431 u16 reserved;
1432 u16 length; /* Only 14 LSB are valid */
1433 struct bna_dma_addr host_addr; /* Tx-Buf DMA addr */
1434 };
1435
1436 typedef u16 bna_txq_wi_opcode_t;
1437
1438 typedef u16 bna_txq_wi_ctrl_flag_t;
1439
1440 /**
1441 * TxQ Entry Structure
1442 *
1443 * BEWARE: Load values into this structure with correct endianess.
1444 */
1445 struct bna_txq_entry {
1446 union {
1447 struct {
1448 u8 reserved;
1449 u8 num_vectors; /* number of vectors present */
1450 bna_txq_wi_opcode_t opcode; /* Either */
1451 /* BNA_TXQ_WI_SEND or */
1452 /* BNA_TXQ_WI_SEND_LSO */
1453 bna_txq_wi_ctrl_flag_t flags; /* OR of all the flags */
1454 u16 l4_hdr_size_n_offset;
1455 u16 vlan_tag;
1456 u16 lso_mss; /* Only 14 LSB are valid */
1457 u32 frame_length; /* Only 24 LSB are valid */
1458 } wi;
1459
1460 struct {
1461 u16 reserved;
1462 bna_txq_wi_opcode_t opcode; /* Must be */
1463 /* BNA_TXQ_WI_EXTENSION */
1464 u32 reserved2[3]; /* Place holder for */
1465 /* removed vector (12 bytes) */
1466 } wi_ext;
1467 } hdr;
1468 struct bna_txq_wi_vector vector[4];
1469 };
1470 #define wi_hdr hdr.wi
1471 #define wi_ext_hdr hdr.wi_ext
1472
1473 /* RxQ Entry Structure */
1474 struct bna_rxq_entry { /* Rx-Buffer */
1475 struct bna_dma_addr host_addr; /* Rx-Buffer DMA address */
1476 };
1477
1478 typedef u32 bna_cq_e_flag_t;
1479
1480 /* CQ Entry Structure */
1481 struct bna_cq_entry {
1482 bna_cq_e_flag_t flags;
1483 u16 vlan_tag;
1484 u16 length;
1485 u32 rss_hash;
1486 u8 valid;
1487 u8 reserved1;
1488 u8 reserved2;
1489 u8 rxq_id;
1490 };
1491
1492 #endif /* __BNA_HW_H__ */