common/cnxk: support flow entry dump
[dpdk.git] / drivers / common / cnxk / hw / rvu.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(C) 2021 Marvell.
3  */
4
5 #ifndef __RVU_HW_H__
6 #define __RVU_HW_H__
7
8 /* Register offsets */
9
10 #define RVU_AF_MSIXTR_BASE     (0x10ull)
11 #define RVU_AF_BLK_RST         (0x30ull)
12 #define RVU_AF_PF_BAR4_ADDR    (0x40ull)
13 #define RVU_AF_RAS             (0x100ull)
14 #define RVU_AF_RAS_W1S         (0x108ull)
15 #define RVU_AF_RAS_ENA_W1S     (0x110ull)
16 #define RVU_AF_RAS_ENA_W1C     (0x118ull)
17 #define RVU_AF_GEN_INT         (0x120ull)
18 #define RVU_AF_GEN_INT_W1S     (0x128ull)
19 #define RVU_AF_GEN_INT_ENA_W1S (0x130ull)
20 #define RVU_AF_GEN_INT_ENA_W1C (0x138ull)
21 #define RVU_AF_AFPFX_MBOXX(a, b)                                               \
22         (0x2000ull | (uint64_t)(a) << 4 | (uint64_t)(b) << 3)
23 #define RVU_AF_PFME_STATUS           (0x2800ull)
24 #define RVU_AF_PFTRPEND              (0x2810ull)
25 #define RVU_AF_PFTRPEND_W1S          (0x2820ull)
26 #define RVU_AF_PF_RST                (0x2840ull)
27 #define RVU_AF_HWVF_RST              (0x2850ull)
28 #define RVU_AF_PFAF_MBOX_INT         (0x2880ull)
29 #define RVU_AF_PFAF_MBOX_INT_W1S     (0x2888ull)
30 #define RVU_AF_PFAF_MBOX_INT_ENA_W1S (0x2890ull)
31 #define RVU_AF_PFAF_MBOX_INT_ENA_W1C (0x2898ull)
32 #define RVU_AF_PFFLR_INT             (0x28a0ull)
33 #define RVU_AF_PFFLR_INT_W1S         (0x28a8ull)
34 #define RVU_AF_PFFLR_INT_ENA_W1S     (0x28b0ull)
35 #define RVU_AF_PFFLR_INT_ENA_W1C     (0x28b8ull)
36 #define RVU_AF_PFME_INT              (0x28c0ull)
37 #define RVU_AF_PFME_INT_W1S          (0x28c8ull)
38 #define RVU_AF_PFME_INT_ENA_W1S      (0x28d0ull)
39 #define RVU_AF_PFME_INT_ENA_W1C      (0x28d8ull)
40 #define RVU_PRIV_CONST               (0x8000000ull)
41 #define RVU_PRIV_GEN_CFG             (0x8000010ull)
42 #define RVU_PRIV_CLK_CFG             (0x8000020ull)
43 #define RVU_PRIV_ACTIVE_PC           (0x8000030ull)
44 #define RVU_PRIV_PFX_CFG(a)          (0x8000100ull | (uint64_t)(a) << 16)
45 #define RVU_PRIV_PFX_MSIX_CFG(a)     (0x8000110ull | (uint64_t)(a) << 16)
46 #define RVU_PRIV_PFX_ID_CFG(a)       (0x8000120ull | (uint64_t)(a) << 16)
47 #define RVU_PRIV_PFX_INT_CFG(a)      (0x8000200ull | (uint64_t)(a) << 16)
48 #define RVU_PRIV_PFX_NIXX_CFG(a, b)                                            \
49         (0x8000300ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3)
50 #define RVU_PRIV_PFX_NPA_CFG(a)  (0x8000310ull | (uint64_t)(a) << 16)
51 #define RVU_PRIV_PFX_SSO_CFG(a)  (0x8000320ull | (uint64_t)(a) << 16)
52 #define RVU_PRIV_PFX_SSOW_CFG(a) (0x8000330ull | (uint64_t)(a) << 16)
53 #define RVU_PRIV_PFX_TIM_CFG(a)  (0x8000340ull | (uint64_t)(a) << 16)
54 #define RVU_PRIV_PFX_CPTX_CFG(a, b)                                            \
55         (0x8000350ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3)
56 #define RVU_PRIV_BLOCK_TYPEX_REV(a) (0x8000400ull | (uint64_t)(a) << 3)
57 #define RVU_PRIV_HWVFX_INT_CFG(a)   (0x8001280ull | (uint64_t)(a) << 16)
58 #define RVU_PRIV_HWVFX_NIXX_CFG(a, b)                                          \
59         (0x8001300ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3)
60 #define RVU_PRIV_HWVFX_NPA_CFG(a)  (0x8001310ull | (uint64_t)(a) << 16)
61 #define RVU_PRIV_HWVFX_SSO_CFG(a)  (0x8001320ull | (uint64_t)(a) << 16)
62 #define RVU_PRIV_HWVFX_SSOW_CFG(a) (0x8001330ull | (uint64_t)(a) << 16)
63 #define RVU_PRIV_HWVFX_TIM_CFG(a)  (0x8001340ull | (uint64_t)(a) << 16)
64 #define RVU_PRIV_HWVFX_CPTX_CFG(a, b)                                          \
65         (0x8001350ull | (uint64_t)(a) << 16 | (uint64_t)(b) << 3)
66
67 #define RVU_PF_VFX_PFVF_MBOXX(a, b)                                            \
68         (0x0ull | (uint64_t)(a) << 12 | (uint64_t)(b) << 3)
69 #define RVU_PF_VF_BAR4_ADDR              (0x10ull)
70 #define RVU_PF_BLOCK_ADDRX_DISC(a)       (0x200ull | (uint64_t)(a) << 3)
71 #define RVU_PF_VFME_STATUSX(a)           (0x800ull | (uint64_t)(a) << 3)
72 #define RVU_PF_VFTRPENDX(a)              (0x820ull | (uint64_t)(a) << 3)
73 #define RVU_PF_VFTRPEND_W1SX(a)          (0x840ull | (uint64_t)(a) << 3)
74 #define RVU_PF_VFPF_MBOX_INTX(a)         (0x880ull | (uint64_t)(a) << 3)
75 #define RVU_PF_VFPF_MBOX_INT_W1SX(a)     (0x8a0ull | (uint64_t)(a) << 3)
76 #define RVU_PF_VFPF_MBOX_INT_ENA_W1SX(a) (0x8c0ull | (uint64_t)(a) << 3)
77 #define RVU_PF_VFPF_MBOX_INT_ENA_W1CX(a) (0x8e0ull | (uint64_t)(a) << 3)
78 #define RVU_PF_VFFLR_INTX(a)             (0x900ull | (uint64_t)(a) << 3)
79 #define RVU_PF_VFFLR_INT_W1SX(a)         (0x920ull | (uint64_t)(a) << 3)
80 #define RVU_PF_VFFLR_INT_ENA_W1SX(a)     (0x940ull | (uint64_t)(a) << 3)
81 #define RVU_PF_VFFLR_INT_ENA_W1CX(a)     (0x960ull | (uint64_t)(a) << 3)
82 #define RVU_PF_VFME_INTX(a)              (0x980ull | (uint64_t)(a) << 3)
83 #define RVU_PF_VFME_INT_W1SX(a)          (0x9a0ull | (uint64_t)(a) << 3)
84 #define RVU_PF_VFME_INT_ENA_W1SX(a)      (0x9c0ull | (uint64_t)(a) << 3)
85 #define RVU_PF_VFME_INT_ENA_W1CX(a)      (0x9e0ull | (uint64_t)(a) << 3)
86 #define RVU_PF_PFAF_MBOXX(a)             (0xc00ull | (uint64_t)(a) << 3)
87 #define RVU_PF_INT                       (0xc20ull)
88 #define RVU_PF_INT_W1S                   (0xc28ull)
89 #define RVU_PF_INT_ENA_W1S               (0xc30ull)
90 #define RVU_PF_INT_ENA_W1C               (0xc38ull)
91 #define RVU_PF_MSIX_VECX_ADDR(a)         (0x80000ull | (uint64_t)(a) << 4)
92 #define RVU_PF_MSIX_VECX_CTL(a)          (0x80008ull | (uint64_t)(a) << 4)
93 #define RVU_PF_MSIX_PBAX(a)              (0xf0000ull | (uint64_t)(a) << 3)
94 #define RVU_VF_VFPF_MBOXX(a)             (0x0ull | (uint64_t)(a) << 3)
95 #define RVU_VF_INT                       (0x20ull)
96 #define RVU_VF_INT_W1S                   (0x28ull)
97 #define RVU_VF_INT_ENA_W1S               (0x30ull)
98 #define RVU_VF_INT_ENA_W1C               (0x38ull)
99 #define RVU_VF_BLOCK_ADDRX_DISC(a)       (0x200ull | (uint64_t)(a) << 3)
100 #define RVU_VF_MSIX_VECX_ADDR(a)         (0x80000ull | (uint64_t)(a) << 4)
101 #define RVU_VF_MSIX_VECX_CTL(a)          (0x80008ull | (uint64_t)(a) << 4)
102 #define RVU_VF_MBOX_REGION               (0xc0000ull) /* [CN10K, .) */
103 #define RVU_VF_MSIX_PBAX(a)              (0xf0000ull | (uint64_t)(a) << 3)
104
105 /* Enum offsets */
106
107 #define RVU_BAR_RVU_PF_END_BAR0   (0x84f000000000ull)
108 #define RVU_BAR_RVU_PF_START_BAR0 (0x840000000000ull)
109 #define RVU_BAR_RVU_PFX_FUNCX_BAR2(a, b)                                       \
110         (0x840200000000ull | ((uint64_t)(a) << 36) | ((uint64_t)(b) << 25))
111
112 #define RVU_AF_INT_VEC_POISON (0x0ull)
113 #define RVU_AF_INT_VEC_PFFLR  (0x1ull)
114 #define RVU_AF_INT_VEC_PFME   (0x2ull)
115 #define RVU_AF_INT_VEC_GEN    (0x3ull)
116 #define RVU_AF_INT_VEC_MBOX   (0x4ull)
117
118 #define RVU_BLOCK_TYPE_RVUM (0x0ull)
119 #define RVU_BLOCK_TYPE_LMT  (0x2ull)
120 #define RVU_BLOCK_TYPE_NIX  (0x3ull)
121 #define RVU_BLOCK_TYPE_NPA  (0x4ull)
122 #define RVU_BLOCK_TYPE_NPC  (0x5ull)
123 #define RVU_BLOCK_TYPE_SSO  (0x6ull)
124 #define RVU_BLOCK_TYPE_SSOW (0x7ull)
125 #define RVU_BLOCK_TYPE_TIM  (0x8ull)
126 #define RVU_BLOCK_TYPE_CPT  (0x9ull)
127 #define RVU_BLOCK_TYPE_NDC  (0xaull)
128 #define RVU_BLOCK_TYPE_DDF  (0xbull)
129 #define RVU_BLOCK_TYPE_ZIP  (0xcull)
130 #define RVU_BLOCK_TYPE_RAD  (0xdull)
131 #define RVU_BLOCK_TYPE_DFA  (0xeull)
132 #define RVU_BLOCK_TYPE_HNA  (0xfull)
133
134 #define RVU_BLOCK_ADDR_RVUM    (0x0ull)
135 #define RVU_BLOCK_ADDR_LMT     (0x1ull)
136 #define RVU_BLOCK_ADDR_NPA     (0x3ull)
137 #define RVU_BLOCK_ADDR_NIX0    (0x4ull)
138 #define RVU_BLOCK_ADDR_NIX1    (0x5ull)
139 #define RVU_BLOCK_ADDR_NPC     (0x6ull)
140 #define RVU_BLOCK_ADDR_SSO     (0x7ull)
141 #define RVU_BLOCK_ADDR_SSOW    (0x8ull)
142 #define RVU_BLOCK_ADDR_TIM     (0x9ull)
143 #define RVU_BLOCK_ADDR_CPT0    (0xaull)
144 #define RVU_BLOCK_ADDR_CPT1    (0xbull)
145 #define RVU_BLOCK_ADDR_NDC0    (0xcull)
146 #define RVU_BLOCK_ADDR_NDC1    (0xdull)
147 #define RVU_BLOCK_ADDR_NDC2    (0xeull)
148 #define RVU_BLOCK_ADDR_R_END   (0x1full)
149 #define RVU_BLOCK_ADDR_R_START (0x14ull)
150
151 #define RVU_VF_INT_VEC_MBOX (0x0ull)
152
153 #define RVU_PF_INT_VEC_AFPF_MBOX  (0x6ull)
154 #define RVU_PF_INT_VEC_VFFLR0     (0x0ull)
155 #define RVU_PF_INT_VEC_VFFLR1     (0x1ull)
156 #define RVU_PF_INT_VEC_VFME0      (0x2ull)
157 #define RVU_PF_INT_VEC_VFME1      (0x3ull)
158 #define RVU_PF_INT_VEC_VFPF_MBOX0 (0x4ull)
159 #define RVU_PF_INT_VEC_VFPF_MBOX1 (0x5ull)
160
161 #define AF_BAR2_ALIASX_SIZE (0x100000ull)
162
163 #define TIM_AF_BAR2_SEL  (0x9000000ull)
164 #define SSO_AF_BAR2_SEL  (0x9000000ull)
165 #define NIX_AF_BAR2_SEL  (0x9000000ull)
166 #define SSOW_AF_BAR2_SEL (0x9000000ull)
167 #define NPA_AF_BAR2_SEL  (0x9000000ull)
168 #define CPT_AF_BAR2_SEL  (0x9000000ull)
169 #define RVU_AF_BAR2_SEL  (0x9000000ull)
170
171 #define AF_BAR2_ALIASX(a, b)                                                   \
172         (0x9100000ull | (uint64_t)(a) << 12 | (uint64_t)(b))
173 #define TIM_AF_BAR2_ALIASX(a, b)  AF_BAR2_ALIASX(a, b)
174 #define SSO_AF_BAR2_ALIASX(a, b)  AF_BAR2_ALIASX(a, b)
175 #define NIX_AF_BAR2_ALIASX(a, b)  AF_BAR2_ALIASX(0, b)
176 #define SSOW_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(a, b)
177 #define NPA_AF_BAR2_ALIASX(a, b)  AF_BAR2_ALIASX(0, b)
178 #define CPT_AF_BAR2_ALIASX(a, b)  AF_BAR2_ALIASX(a, b)
179 #define RVU_AF_BAR2_ALIASX(a, b)  AF_BAR2_ALIASX(a, b)
180
181 /* Structures definitions */
182
183 /* RVU admin function register address structure */
184 struct rvu_af_addr_s {
185         uint64_t addr : 28;
186         uint64_t block : 5;
187         uint64_t rsvd_63_33 : 31;
188 };
189
190 /* RVU function-unique address structure */
191 struct rvu_func_addr_s {
192         uint32_t addr : 12;
193         uint32_t lf_slot : 8;
194         uint32_t block : 5;
195         uint32_t rsvd_31_25 : 7;
196 };
197
198 /* RVU msi-x vector structure */
199 struct rvu_msix_vec_s {
200         uint64_t addr : 64; /* W0 */
201         uint64_t data : 32;
202         uint64_t mask : 1;
203         uint64_t pend : 1;
204         uint64_t rsvd_127_98 : 30;
205 };
206
207 /* RVU pf function identification structure */
208 struct rvu_pf_func_s {
209         uint16_t func : 10;
210         uint16_t pf : 6;
211 };
212
213 #define RVU_CN9K_LMT_SLOT_MAX  256ULL
214 #define RVU_CN9K_LMT_SLOT_MASK (RVU_CN9K_LMT_SLOT_MAX - 1)
215
216 #define RVU_LMT_SZ 128ULL
217
218 /* 2048 LMT lines in BAR4 [CN10k, .) */
219 #define RVU_LMT_LINE_MAX       2048
220 #define RVU_LMT_LINE_BURST_MAX (uint16_t)32 /* [CN10K, .) */
221
222 #endif /* __RVU_HW_H__ */