|
9 | 9 | #define CSR_BIT(nr) (1u << (nr))
|
10 | 10 | #define CSR_GENMASK(h, l) GENMASK(h, l)
|
11 | 11 |
|
| 12 | +#define DESC_BIT(nr) BIT_ULL(nr) |
| 13 | +#define DESC_GENMASK(h, l) GENMASK_ULL(h, l) |
| 14 | + |
12 | 15 | #define PCI_DEVICE_ID_META_FBNIC_ASIC 0x0013
|
13 | 16 |
|
14 | 17 | #define FBNIC_CLOCK_FREQ (600 * (1000 * 1000))
|
15 | 18 |
|
| 19 | +/* Register Definitions |
| 20 | + * |
| 21 | + * The registers are laid as indexes into an le32 array. As such the actual |
| 22 | + * address is 4 times the index value. Below each register is defined as 3 |
| 23 | + * fields, name, index, and Address. |
| 24 | + * |
| 25 | + * Name Index Address |
| 26 | + *************************************************************************/ |
| 27 | +/* Interrupt Registers */ |
| 28 | +#define FBNIC_CSR_START_INTR 0x00000 /* CSR section delimiter */ |
| 29 | +#define FBNIC_INTR_STATUS(n) (0x00000 + (n)) /* 0x00000 + 4*n */ |
| 30 | +#define FBNIC_INTR_STATUS_CNT 8 |
| 31 | +#define FBNIC_INTR_MASK(n) (0x00008 + (n)) /* 0x00020 + 4*n */ |
| 32 | +#define FBNIC_INTR_MASK_CNT 8 |
| 33 | +#define FBNIC_INTR_SET(n) (0x00010 + (n)) /* 0x00040 + 4*n */ |
| 34 | +#define FBNIC_INTR_SET_CNT 8 |
| 35 | +#define FBNIC_INTR_CLEAR(n) (0x00018 + (n)) /* 0x00060 + 4*n */ |
| 36 | +#define FBNIC_INTR_CLEAR_CNT 8 |
| 37 | +#define FBNIC_INTR_SW_STATUS(n) (0x00020 + (n)) /* 0x00080 + 4*n */ |
| 38 | +#define FBNIC_INTR_SW_STATUS_CNT 8 |
| 39 | +#define FBNIC_INTR_SW_AC_MODE(n) (0x00028 + (n)) /* 0x000a0 + 4*n */ |
| 40 | +#define FBNIC_INTR_SW_AC_MODE_CNT 8 |
| 41 | +#define FBNIC_INTR_MASK_SET(n) (0x00030 + (n)) /* 0x000c0 + 4*n */ |
| 42 | +#define FBNIC_INTR_MASK_SET_CNT 8 |
| 43 | +#define FBNIC_INTR_MASK_CLEAR(n) (0x00038 + (n)) /* 0x000e0 + 4*n */ |
| 44 | +#define FBNIC_INTR_MASK_CLEAR_CNT 8 |
| 45 | +#define FBNIC_MAX_MSIX_VECS 256U |
| 46 | +#define FBNIC_INTR_MSIX_CTRL(n) (0x00040 + (n)) /* 0x00100 + 4*n */ |
| 47 | +#define FBNIC_INTR_MSIX_CTRL_VECTOR_MASK CSR_GENMASK(7, 0) |
| 48 | +#define FBNIC_INTR_MSIX_CTRL_ENABLE CSR_BIT(31) |
| 49 | + |
| 50 | +#define FBNIC_CSR_END_INTR 0x0005f /* CSR section delimiter */ |
| 51 | + |
| 52 | +/* Interrupt MSIX Registers */ |
| 53 | +#define FBNIC_CSR_START_INTR_CQ 0x00400 /* CSR section delimiter */ |
| 54 | +#define FBNIC_INTR_CQ_REARM(n) \ |
| 55 | + (0x00400 + 4 * (n)) /* 0x01000 + 16*n */ |
| 56 | +#define FBNIC_INTR_CQ_REARM_CNT 256 |
| 57 | +#define FBNIC_INTR_CQ_REARM_RCQ_TIMEOUT CSR_GENMASK(13, 0) |
| 58 | +#define FBNIC_INTR_CQ_REARM_RCQ_TIMEOUT_UPD_EN CSR_BIT(14) |
| 59 | +#define FBNIC_INTR_CQ_REARM_TCQ_TIMEOUT CSR_GENMASK(28, 15) |
| 60 | +#define FBNIC_INTR_CQ_REARM_TCQ_TIMEOUT_UPD_EN CSR_BIT(29) |
| 61 | +#define FBNIC_INTR_CQ_REARM_INTR_RELOAD CSR_BIT(30) |
| 62 | +#define FBNIC_INTR_CQ_REARM_INTR_UNMASK CSR_BIT(31) |
| 63 | + |
| 64 | +#define FBNIC_CSR_END_INTR_CQ 0x007fe /* CSR section delimiter */ |
| 65 | + |
16 | 66 | /* Global QM Tx registers */
|
17 | 67 | #define FBNIC_CSR_START_QM_TX 0x00800 /* CSR section delimiter */
|
18 | 68 | #define FBNIC_QM_TWQ_DEFAULT_META_L 0x00818 /* 0x02060 */
|
@@ -318,4 +368,33 @@ enum {
|
318 | 368 |
|
319 | 369 | #define FBNIC_MAX_QUEUES 128
|
320 | 370 |
|
| 371 | +/* BAR 4 CSRs */ |
| 372 | + |
| 373 | +/* The IPC mailbox consists of 32 mailboxes, with each mailbox consisting |
| 374 | + * of 32 4 byte registers. We will use 2 registers per descriptor so the |
| 375 | + * length of the mailbox is reduced to 16. |
| 376 | + * |
| 377 | + * Currently we use an offset of 0x6000 on BAR4 for the mailbox so we just |
| 378 | + * have to do the math and determine the offset based on the mailbox |
| 379 | + * direction and index inside that mailbox. |
| 380 | + */ |
| 381 | +#define FBNIC_IPC_MBX_DESC_LEN 16 |
| 382 | +#define FBNIC_IPC_MBX(mbx_idx, desc_idx) \ |
| 383 | + ((((mbx_idx) * FBNIC_IPC_MBX_DESC_LEN + (desc_idx)) * 2) + 0x6000) |
| 384 | + |
| 385 | +/* Use first register in mailbox to flush writes */ |
| 386 | +#define FBNIC_FW_ZERO_REG FBNIC_IPC_MBX(0, 0) |
| 387 | + |
| 388 | +enum { |
| 389 | + FBNIC_IPC_MBX_RX_IDX, |
| 390 | + FBNIC_IPC_MBX_TX_IDX, |
| 391 | + FBNIC_IPC_MBX_INDICES, |
| 392 | +}; |
| 393 | + |
| 394 | +#define FBNIC_IPC_MBX_DESC_LEN_MASK DESC_GENMASK(63, 48) |
| 395 | +#define FBNIC_IPC_MBX_DESC_EOM DESC_BIT(46) |
| 396 | +#define FBNIC_IPC_MBX_DESC_ADDR_MASK DESC_GENMASK(45, 3) |
| 397 | +#define FBNIC_IPC_MBX_DESC_FW_CMPL DESC_BIT(1) |
| 398 | +#define FBNIC_IPC_MBX_DESC_HOST_CMPL DESC_BIT(0) |
| 399 | + |
321 | 400 | #endif /* _FBNIC_CSR_H_ */
|
0 commit comments