be2net: Move the Emulex driver
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / net / bna / bna_hw.h
blob16a5eed4a03bce5ca023aa34259c683ddb82c500
1 /*
2 * Linux network driver for Brocade Converged Network Adapter.
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
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.
14 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
15 * All rights reserved
16 * www.brocade.com
19 /**
20 * File for interrupt macros and functions
23 #ifndef __BNA_HW_H__
24 #define __BNA_HW_H__
26 #include "bfi_reg.h"
28 /**
30 * SW imposed limits
34 #ifndef BNA_BIOS_BUILD
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
48 /**
49 * There are 2 free IB index pools:
50 * pool1: 120 segments of 1 index each
51 * pool8: 1 segment of 8 indexes
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 } \
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
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 } \
88 #else /* BNA_BIOS_BUILD */
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] = \
110 { BFI_IBIDX_POOL1_SIZE, BFI_IBIDX_POOL1_ENTRY_SIZE } \
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] = \
120 { BFI_RIT_SEG_POOL1_SIZE, BFI_RIT_SEG_POOL1_ENTRY_SIZE } \
123 #endif /* BNA_BIOS_BUILD */
125 #define BFI_RSS_HASH_KEY_LEN 10
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 */
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
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
147 /* Small Q buffer size */
148 #define BFI_SMALL_RXBUF_SIZE 128
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 */
156 * HW register offsets, macros
160 /* DMA Block Register Host Window Start Address */
161 #define DMA_BLK_REG_ADDR 0x00013000
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)
170 /* APP Block Register Address Offset from BAR0 */
171 #define APP_BLK_REG_ADDR 0x00014000
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)
180 * Host Function PCIe Error Registers
181 * Duplicates "Correctable" & "Uncorrectable"
182 * registers in PCIe Config space.
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)
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)
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)
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)
211 /* PCIe Misc Register */
212 #define PCIE_MISC_REG (APP_BLK_REG_ADDR + 0x200)
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)
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)
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)
227 * FCoE/FIP Ethertype Register
228 * 31:16 -- Chip wide value for FIP type
229 * 15:0 -- Chip wide value for FCoE type
231 #define FCOE_FIP_ETH_TYPE (APP_BLK_REG_ADDR + 0x280)
234 * Reserved Ethertype Register
235 * 31:16 -- Reserved
236 * 15:0 -- Other ethertype
238 #define RESV_ETH_TYPE (APP_BLK_REG_ADDR + 0x284)
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 ?
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)
298 * LPU0 Block Register Address Offset from BAR0
299 * Range 0x18000 - 0x18033
301 #define LPU0_BLK_REG_ADDR 0x00018000
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
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)
321 * LPU1 Block Register Address Offset from BAR0
322 * Range 0x18400 - 0x18433
324 #define LPU1_BLK_REG_ADDR 0x00018400
327 * LPU1 Registers
328 * Same as LPU0 registers above
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)
340 * PSS Block Register Address Offset from BAR0
341 * Range 0x18800 - 0x188DB
343 #define PSS_BLK_REG_ADDR 0x00018800
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
351 #define ERR_STATUS_SET (PSS_BLK_REG_ADDR + 0x018)
352 #define PSS_RAM_ERR_STATUS_REG (PSS_BLK_REG_ADDR + 0x01C)
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
362 #define PSS_SEM_LOCK_REG(_num) \
363 (PSS_BLK_REG_ADDR + 0x020 + ((_num) << 2))
366 * PSS Semaphore Status Registers,
367 * corresponding to the lock registers above
369 #define PSS_SEM_STATUS_REG(_num) \
370 (PSS_BLK_REG_ADDR + 0x060 + ((_num) << 2))
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.
380 * Note : LPU0<->LPU1 mailboxes are not listed here
382 #define CPQ_BLK_REG_ADDR 0x00019000
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)
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)
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)
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)
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)
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)
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)
418 /* EMC FLI (Flash Controller) Block Register Address Offset from BAR0 */
419 #define FLI_BLK_REG_ADDR 0x0001D000
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)
431 * RO register
432 * 31:16 -- Vendor Id
433 * 15:0 -- Device Id
435 #define FLI_DEV_VENDOR_REG (FLI_BLK_REG_ADDR + 0x01C)
436 #define FLI_ERR_STATUS_REG (FLI_BLK_REG_ADDR + 0x020)
439 * RAD (RxAdm) Block Register Address Offset from BAR0
440 * RAD0 Range : 0x20000 - 0x203FF
441 * RAD1 Range : 0x20400 - 0x207FF
443 #define RAD0_BLK_REG_ADDR 0x00020000
444 #define RAD1_BLK_REG_ADDR 0x00020400
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)
451 /* Default function ID register */
452 #define RAD0_DEFAULT_REG (RAD0_BLK_REG_ADDR + 0x00C)
454 /* Default promiscuous ID register */
455 #define RAD0_PROMISC_REG (RAD0_BLK_REG_ADDR + 0x010)
457 #define RAD0_BCNQ_REG (RAD0_BLK_REG_ADDR + 0x014)
460 * This register selects 1 of 8 PM Q's using
461 * VLAN pri, for non-BCN packets without a VLAN tag
463 #define RAD0_DEFAULTQ_REG (RAD0_BLK_REG_ADDR + 0x018)
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)
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)
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)
498 #define RAD0_LAST4_IP (RAD0_BLK_REG_ADDR + 0x100)
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)
505 /* Default function ID register */
506 #define RAD1_DEFAULT_REG (RAD1_BLK_REG_ADDR + 0x00C)
508 /* Promiscuous function ID register */
509 #define RAD1_PROMISC_REG (RAD1_BLK_REG_ADDR + 0x010)
511 #define RAD1_BCNQ_REG (RAD1_BLK_REG_ADDR + 0x014)
514 * This register selects 1 of 8 PM Q's using
515 * VLAN pri, for non-BCN packets without a VLAN tag
517 #define RAD1_DEFAULTQ_REG (RAD1_BLK_REG_ADDR + 0x018)
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)
524 * TXA Block Register Address Offset from BAR0
525 * TXA0 Range : 0x21000 - 0x213FF
526 * TXA1 Range : 0x21400 - 0x217FF
528 #define TXA0_BLK_REG_ADDR 0x00021000
529 #define TXA1_BLK_REG_ADDR 0x00021400
531 /* TXA Registers */
532 #define TXA0_CTRL_REG (TXA0_BLK_REG_ADDR + 0x000)
533 #define TXA1_CTRL_REG (TXA1_BLK_REG_ADDR + 0x000)
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
541 #define TXA0_TSO_TCP_SEQ_REG(_num) \
542 (TXA0_BLK_REG_ADDR + 0x020 + ((_num) << 2))
544 #define TXA1_TSO_TCP_SEQ_REG(_num) \
545 (TXA1_BLK_REG_ADDR + 0x020 + ((_num) << 2))
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
553 #define TXA0_TSO_IP_INFO_REG(_num) \
554 (TXA0_BLK_REG_ADDR + 0x040 + ((_num) << 2))
556 #define TXA1_TSO_IP_INFO_REG(_num) \
557 (TXA1_BLK_REG_ADDR + 0x040 + ((_num) << 2))
560 * RXA Block Register Address Offset from BAR0
561 * RXA0 Range : 0x21800 - 0x21BFF
562 * RXA1 Range : 0x21C00 - 0x21FFF
564 #define RXA0_BLK_REG_ADDR 0x00021800
565 #define RXA1_BLK_REG_ADDR 0x00021C00
567 /* RXA Registers */
568 #define RXA0_CTL_REG (RXA0_BLK_REG_ADDR + 0x040)
569 #define RXA1_CTL_REG (RXA1_BLK_REG_ADDR + 0x040)
572 * PPLB Block Register Address Offset from BAR0
573 * PPLB0 Range : 0x22000 - 0x223FF
574 * PPLB1 Range : 0x22400 - 0x227FF
576 #define PLB0_BLK_REG_ADDR 0x00022000
577 #define PLB1_BLK_REG_ADDR 0x00022400
580 * PLB Registers
581 * Holds RL timer used time stamps in RLT tagged frames
583 #define PLB0_ECM_TIMER_REG (PLB0_BLK_REG_ADDR + 0x05C)
584 #define PLB1_ECM_TIMER_REG (PLB1_BLK_REG_ADDR + 0x05C)
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)
591 * Max byte register, total 8, 0-7
592 * see catapult_spec.pdf for details
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))
600 * RL Time Unit Register for priority 0-7
601 * 4 bits per priority
602 * (2^rl_unit)*1us is the actual time period
604 #define PLB0_RL_TU_PRIO (PLB0_BLK_REG_ADDR + 0x084)
605 #define PLB1_RL_TU_PRIO (PLB1_BLK_REG_ADDR + 0x084)
608 * RL byte count register,
609 * bytes transmitted in (rl_unit*1)us time period
610 * 1 per priority, 8 in all, 0-7.
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))
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
623 #define PLB0_RL_MIN_REG (PLB0_BLK_REG_ADDR + 0x0A8)
624 #define PLB1_RL_MIN_REG (PLB1_BLK_REG_ADDR + 0x0A8)
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
632 #define PLB0_RL_MAX_REG (PLB0_BLK_REG_ADDR + 0x0AC)
633 #define PLB1_RL_MAX_REG (PLB1_BLK_REG_ADDR + 0x0AC)
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)
639 /* LL EMS Registers */
640 #define LL_EMS0_BLK_REG_ADDR 0x00026800
641 #define LL_EMS1_BLK_REG_ADDR 0x00026C00
644 * BPC Block Register Address Offset from BAR0
645 * BPC0 Range : 0x23000 - 0x233FF
646 * BPC1 Range : 0x23400 - 0x237FF
648 #define BPC0_BLK_REG_ADDR 0x00023000
649 #define BPC1_BLK_REG_ADDR 0x00023400
652 * PMM Block Register Address Offset from BAR0
653 * PMM0 Range : 0x23800 - 0x23BFF
654 * PMM1 Range : 0x23C00 - 0x23FFF
656 #define PMM0_BLK_REG_ADDR 0x00023800
657 #define PMM1_BLK_REG_ADDR 0x00023C00
660 * HQM Block Register Address Offset from BAR0
661 * HQM0 Range : 0x24000 - 0x243FF
662 * HQM1 Range : 0x24400 - 0x247FF
664 #define HQM0_BLK_REG_ADDR 0x00024000
665 #define HQM1_BLK_REG_ADDR 0x00024400
668 * HQM Control Register
669 * Controls some aspects of IB
670 * See catapult_spec.pdf for details
672 #define HQM0_CTL_REG (HQM0_BLK_REG_ADDR + 0x000)
673 #define HQM1_CTL_REG (HQM1_BLK_REG_ADDR + 0x000)
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
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)
688 * LUT Block Register Address Offset from BAR0
689 * LUT0 Range : 0x25800 - 0x25BFF
690 * LUT1 Range : 0x25C00 - 0x25FFF
692 #define LUT0_BLK_REG_ADDR 0x00025800
693 #define LUT1_BLK_REG_ADDR 0x00025C00
696 * LUT Registers
697 * See catapult_spec.pdf for details
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)
705 * TRC (Debug/Trace) Register Offset from BAR0
706 * Range : 0x26000 -- 0x263FFF
708 #define TRC_BLK_REG_ADDR 0x00026000
711 * TRC Registers
712 * See catapult_spec.pdf for details of each
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)
723 * TRC Trigger match filters, total 10
724 * Determines the trigger condition
726 #define TRC_TRGM_REG(_num) \
727 (TRC_BLK_REG_ADDR + 0x040 + ((_num) << 2))
730 * TRC Next State filters, total 10
731 * Determines the next state conditions
733 #define TRC_NXTM_REG(_num) \
734 (TRC_BLK_REG_ADDR + 0x080 + ((_num) << 2))
737 * TRC Store Match filters, total 10
738 * Determines the store conditions
740 #define TRC_STRM_REG(_num) \
741 (TRC_BLK_REG_ADDR + 0x0C0 + ((_num) << 2))
743 /* DOORBELLS ACCESS */
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
757 #define HQM_DOORBELL_BLK_BASE_ADDR 0x00038000
758 #define HQM_DOORBELL_VM_BLK_BASE_ADDR 0x00100000
760 /* MEMORY ACCESS */
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
767 #define HW_BLK_HOST_MEM_ADDR 0x08000
770 * Catapult LUT Memory Access Page Numbers
771 * Range : LUT0 0xa0-0xa1
772 * LUT1 0xa2-0xa3
774 #define LUT0_MEM_BLK_BASE_PG_NUM 0x000000A0
775 #define LUT1_MEM_BLK_BASE_PG_NUM 0x000000A2
778 * Catapult RxFn Database Memory Block Base Offset
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)
787 #define RX_FNDB_RAM_BASE_OFFSET 0x0000B400
790 * Catapult TxFn Database Memory Block Base Offset Address
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)
799 #define TX_FNDB_RAM_BASE_OFFSET 0x0000B800
802 * Catapult Unicast CAM Base Offset Address
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].
811 #define UCAST_CAM_BASE_OFFSET 0x0000A800
814 * Catapult Unicast RAM Base Offset Address
816 * Exists in LUT memory space.
817 * Shared by both the LL & FCoE driver.
818 * Size is 256x9 bits.
820 #define UCAST_RAM_BASE_OFFSET 0x0000B000
823 * Catapult Mulicast CAM Base Offset Address
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].
832 #define MCAST_CAM_BASE_OFFSET 0x0000A000
835 * Catapult VLAN RAM Base Offset Address
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.
843 #define VLAN_RAM_BASE_OFFSET 0x00000000
846 * Catapult Tx Stats RAM Base Offset Address
848 * Exists in LUT memory space.
849 * Size is 1024x33 bits;
850 * Each Tx function has 64 bytes of space
852 #define TX_STATS_RAM_BASE_OFFSET 0x00009000
855 * Catapult Rx Stats RAM Base Offset Address
857 * Exists in LUT memory space.
858 * Size is 1024x33 bits;
859 * Each Rx function has 64 bytes of space
861 #define RX_STATS_RAM_BASE_OFFSET 0x00008000
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
868 * Catapult Multicast Vector Table Base Offset Address
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
880 #define MCAST_APPROX_MVT_BASE_OFFSET 0x00000000
881 #define MCAST_EXACT_MVT_BASE_OFFSET 0x00001000
884 * Catapult RxQ Translate Table (RIT) Base Offset Address
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
892 #define FUNCTION_TO_RXQ_TRANSLATE 0x00002000
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
899 * Catapult RSS Table Base Offset Address
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.
907 #define RSS_TABLE_BASE_OFFSET 0x00000800
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.
914 #define CPQ_BLK_PG_NUM 0x00000005
917 * Clarification :
918 * LL functions are 2 & 3; can HostFn0/HostFn1
919 * <-> LPU0/LPU1 memories be used ?
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
926 #define CPQ_BLK_REG_MBOX_ADDR (CPQ_BLK_REG_ADDR + 0x200)
928 #define HOSTFN_LPU_MBOX (CPQ_BLK_REG_MBOX_ADDR + 0x000)
930 /* Catapult LPU0/LPU1 to HostFn0/HostFn1 Mbox memory */
931 #define LPU_HOSTFN_MBOX (CPQ_BLK_REG_MBOX_ADDR + 0x080)
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
939 #define HQM0_BLK_PG_NUM 0x00000096
940 #define HQM1_BLK_PG_NUM 0x00000097
943 * Note that TxQ and RxQ entries are interlaced
944 * the HQM memory, i.e RXQ0, TXQ0, RXQ1, TXQ1.. etc.
947 #define HQM_RXTX_Q_RAM_BASE_OFFSET 0x00004000
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
956 #define HQM_CQ_RAM_BASE_OFFSET 0x00006000
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
965 #define HQM_IB_RAM_BASE_OFFSET 0x00001000
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
974 #define HQM_INDX_TBL_RAM_BASE_OFFSET 0x00002000
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
984 #define PSS_BLK_PG_NUM 0x00000180
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
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
1000 #define BNA_PCI_REG_CT_ADDRSZ (0x40000)
1002 #define BNA_GET_PAGE_NUM(_base_page, _offset) \
1003 ((_base_page) + ((_offset) >> 15))
1005 #define BNA_GET_PAGE_OFFSET(_offset) \
1006 ((_offset) & 0x7fff)
1008 #define BNA_GET_MEM_BASE_ADDR(_bar0, _base_offset) \
1009 ((_bar0) + HW_BLK_HOST_MEM_ADDR \
1010 + BNA_GET_PAGE_OFFSET((_base_offset)))
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))
1020 * Interrupt related bits, flags and macros
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
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
1034 #define __LPU2HOST_MBOX_MASK_BITS \
1035 (__LPU02HOST_MBOX0_MASK_BITS | __LPU02HOST_MBOX1_MASK_BITS | \
1036 __LPU12HOST_MBOX0_MASK_BITS | __LPU12HOST_MBOX1_MASK_BITS)
1038 #define __LPU2HOST_IB_STATUS_BITS 0x0000ffff
1040 #define BNA_IS_LPU0_MBOX_INTR(_intr_status) \
1041 ((_intr_status) & (__LPU02HOST_MBOX0_STATUS_BITS | \
1042 __LPU02HOST_MBOX1_STATUS_BITS))
1044 #define BNA_IS_LPU1_MBOX_INTR(_intr_status) \
1045 ((_intr_status) & (__LPU12HOST_MBOX0_STATUS_BITS | \
1046 __LPU12HOST_MBOX1_STATUS_BITS))
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))
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
1060 #define __HALT_STATUS_BITS 0x01000000
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
1067 #define __HALT_MASK_BITS 0x01000000
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)
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))
1082 #define BNA_IS_MBOX_ERR_INTR(_intr_status) \
1083 (BNA_IS_MBOX_INTR((_intr_status)) | \
1084 BNA_IS_ERR_INTR((_intr_status)))
1086 #define BNA_IS_INTX_DATA_INTR(_intr_status) \
1087 ((_intr_status) & __LPU2HOST_IB_STATUS_BITS)
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)
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)
1106 #define bna_intx_disable(_bna, _cur_mask) \
1108 (_cur_mask) = readl((_bna)->regs.fn_int_mask);\
1109 writel(0xffffffff, (_bna)->regs.fn_int_mask);\
1112 #define bna_intx_enable(bna, new_mask) \
1113 writel((new_mask), (bna)->regs.fn_int_mask)
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)
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)
1125 #define bna_intr_status_get(_bna, _status) \
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);\
1137 #define bna_intr_status_get_no_clr(_bna, _status) \
1138 (_status) = readl((_bna)->regs.fn_int_status)
1140 #define bna_intr_mask_get(bna, mask) \
1141 (*mask) = readl((bna)->regs.fn_int_mask)
1143 #define bna_intr_ack(bna, intr_bmap) \
1144 writel((intr_bmap), (bna)->regs.fn_int_status)
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)
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)
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)
1165 * TxQ, RxQ, CQ related bits, offsets, macros
1169 #define BNA_Q_IDLE_STATE 0x00008001
1171 #define BNA_GET_DOORBELL_BASE_ADDR(_bar0) \
1172 ((_bar0) + HQM_DOORBELL_BLK_BASE_ADDR)
1174 #define BNA_GET_DOORBELL_ENTRY_OFFSET(_entry) \
1175 ((HQM_DOORBELL_BLK_BASE_ADDR) \
1176 + (_entry << 7))
1178 #define BNA_DOORBELL_IB_INT_ACK(_timeout, _events) \
1179 (0x80000000 | ((_timeout) << 16) | (_events))
1181 #define BNA_DOORBELL_IB_INT_DISABLE (0x40000000)
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 */
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)
1197 #define BNA_TXQ_WI_L4_HDR_N_OFFSET(_hdr_size, _offset) \
1198 (((_hdr_size) << 10) | ((_offset) & 0x3FF))
1201 * Completion Q defines
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)
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)
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)
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)
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)
1229 #define BNA_CQ_EF_LOCAL (1 << 20)
1233 * Data structures
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
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)
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)
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),
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)
1281 struct bna_chip_regs_offset {
1282 u32 page_addr;
1283 u32 fn_int_status;
1284 u32 fn_int_mask;
1285 u32 msix_idx;
1288 struct bna_chip_regs {
1289 void __iomem *page_addr;
1290 void __iomem *fn_int_status;
1291 void __iomem *fn_int_mask;
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];
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];
1337 struct bna_rxtx_q_mem {
1338 struct bna_rxq_mem rxq;
1339 struct bna_txq_mem txq;
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;
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];
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;
1372 u32 reserved[3];
1375 struct bna_idx_tbl_mem {
1376 u32 idx; /* !< 31:16->res;15:0->idx; */
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];
1386 struct bna_rx_fndb_ram {
1387 u32 rss_prop;
1388 u32 size_routing_props;
1389 u32 rit_hds_mcastq;
1390 u32 control_flags;
1393 struct bna_tx_fndb_ram {
1394 u32 vlan_n_ctrl_flags;
1398 * @brief
1399 * Structure which maps to RxFn Indirection Table (RIT)
1400 * Size : 1 word
1401 * See catapult_spec.pdf, RxA for details
1403 struct bna_rit_mem {
1404 u32 rxq_ids; /* !< 31:12->res;11:0->two 6 bit RxQ Ids */
1408 * @brief
1409 * Structure which maps to RSS Table entry
1410 * Size : 16 words
1411 * See catapult_spec.pdf, RAD for details
1413 struct bna_rss_mem {
1415 * 31:12-> res
1416 * 11:8 -> protocol type
1417 * 7:0 -> hash index
1419 u32 type_n_hash;
1420 u32 hash_key[10]; /* !< 40 byte Toeplitz hash key */
1421 u32 reserved[5];
1424 /* TxQ Vector (a.k.a. Tx-Buffer Descriptor) */
1425 struct bna_dma_addr {
1426 u32 msb;
1427 u32 lsb;
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 */
1436 typedef u16 bna_txq_wi_opcode_t;
1438 typedef u16 bna_txq_wi_ctrl_flag_t;
1441 * TxQ Entry Structure
1443 * BEWARE: Load values into this structure with correct endianess.
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;
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];
1470 #define wi_hdr hdr.wi
1471 #define wi_ext_hdr hdr.wi_ext
1473 /* RxQ Entry Structure */
1474 struct bna_rxq_entry { /* Rx-Buffer */
1475 struct bna_dma_addr host_addr; /* Rx-Buffer DMA address */
1478 typedef u32 bna_cq_e_flag_t;
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;
1492 #endif /* __BNA_HW_H__ */