Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git] / arch / arm / include / asm / arch-octeontx2 / csrs / csrs-npc.h
1 /* SPDX-License-Identifier:    GPL-2.0
2  *
3  * Copyright (C) 2020 Marvell International Ltd.
4  *
5  * https://spdx.org/licenses
6  */
7 #ifndef __CSRS_NPC_H__
8 #define __CSRS_NPC_H__
9
10 /**
11  * @file
12  *
13  * Configuration and status register (CSR) address and type definitions for
14  * NPC.
15  *
16  * This file is auto generated.  Do not edit.
17  *
18  */
19
20 /**
21  * Enumeration npc_errlev_e
22  *
23  * NPC Error Level Enumeration Enumerates the lowest protocol layer
24  * containing an error.
25  */
26 #define NPC_ERRLEV_E_LA (1)
27 #define NPC_ERRLEV_E_LB (2)
28 #define NPC_ERRLEV_E_LC (3)
29 #define NPC_ERRLEV_E_LD (4)
30 #define NPC_ERRLEV_E_LE (5)
31 #define NPC_ERRLEV_E_LF (6)
32 #define NPC_ERRLEV_E_LG (7)
33 #define NPC_ERRLEV_E_LH (8)
34 #define NPC_ERRLEV_E_NIX (0xf)
35 #define NPC_ERRLEV_E_RX(a) (0 + (a))
36 #define NPC_ERRLEV_E_RE (0)
37
38 /**
39  * Enumeration npc_intf_e
40  *
41  * NPC Interface Enumeration Enumerates the NPC interfaces.
42  */
43 #define NPC_INTF_E_NIXX_RX(a) (0 + 2 * (a))
44 #define NPC_INTF_E_NIXX_TX(a) (1 + 2 * (a))
45
46 /**
47  * Enumeration npc_lid_e
48  *
49  * NPC Layer ID Enumeration Enumerates layers parsed by NPC.
50  */
51 #define NPC_LID_E_LA (0)
52 #define NPC_LID_E_LB (1)
53 #define NPC_LID_E_LC (2)
54 #define NPC_LID_E_LD (3)
55 #define NPC_LID_E_LE (4)
56 #define NPC_LID_E_LF (5)
57 #define NPC_LID_E_LG (6)
58 #define NPC_LID_E_LH (7)
59
60 /**
61  * Enumeration npc_lkupop_e
62  *
63  * NPC Lookup Operation Enumeration Enumerates the lookup operation for
64  * NPC_AF_LKUP_CTL[OP].
65  */
66 #define NPC_LKUPOP_E_KEY (1)
67 #define NPC_LKUPOP_E_PKT (0)
68
69 /**
70  * Enumeration npc_mcamkeyw_e
71  *
72  * NPC MCAM Search Key Width Enumeration
73  */
74 #define NPC_MCAMKEYW_E_X1 (0)
75 #define NPC_MCAMKEYW_E_X2 (1)
76 #define NPC_MCAMKEYW_E_X4 (2)
77
78 /**
79  * Structure npc_layer_info_s
80  *
81  * NPC Layer Parse Information Structure This structure specifies the
82  * format of NPC_RESULT_S[LA,LB,...,LH].
83  */
84 union npc_layer_info_s {
85         u32 u;
86         struct npc_layer_info_s_s {
87                 u32 lptr                             : 8;
88                 u32 flags                            : 8;
89                 u32 ltype                            : 4;
90                 u32 reserved_20_31                   : 12;
91         } s;
92         /* struct npc_layer_info_s_s cn; */
93 };
94
95 /**
96  * Structure npc_layer_kex_s
97  *
98  * NPC Layer MCAM Search Key Extract Structure This structure specifies
99  * the format of each of the NPC_PARSE_KEX_S[LA,LB,...,LH] fields. It
100  * contains the subset of NPC_LAYER_INFO_S fields that can be included in
101  * the MCAM search key. See NPC_PARSE_KEX_S and NPC_AF_INTF()_KEX_CFG.
102  */
103 union npc_layer_kex_s {
104         u32 u;
105         struct npc_layer_kex_s_s {
106                 u32 flags                            : 8;
107                 u32 ltype                            : 4;
108                 u32 reserved_12_31                   : 20;
109         } s;
110         /* struct npc_layer_kex_s_s cn; */
111 };
112
113 /**
114  * Structure npc_mcam_key_x1_s
115  *
116  * NPC MCAM Search Key X1 Structure This structure specifies the MCAM
117  * search key format used by an interface when
118  * NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X1.
119  */
120 union npc_mcam_key_x1_s {
121         u64 u[3];
122         struct npc_mcam_key_x1_s_s {
123                 u64 intf                             : 2;
124                 u64 reserved_2_63                    : 62;
125                 u64 kw0                              : 64;
126                 u64 kw1                              : 48;
127                 u64 reserved_176_191                 : 16;
128         } s;
129         /* struct npc_mcam_key_x1_s_s cn; */
130 };
131
132 /**
133  * Structure npc_mcam_key_x2_s
134  *
135  * NPC MCAM Search Key X2 Structure This structure specifies the MCAM
136  * search key format used by an interface when
137  * NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X2.
138  */
139 union npc_mcam_key_x2_s {
140         u64 u[5];
141         struct npc_mcam_key_x2_s_s {
142                 u64 intf                             : 2;
143                 u64 reserved_2_63                    : 62;
144                 u64 kw0                              : 64;
145                 u64 kw1                              : 64;
146                 u64 kw2                              : 64;
147                 u64 kw3                              : 32;
148                 u64 reserved_288_319                 : 32;
149         } s;
150         /* struct npc_mcam_key_x2_s_s cn; */
151 };
152
153 /**
154  * Structure npc_mcam_key_x4_s
155  *
156  * NPC MCAM Search Key X4 Structure This structure specifies the MCAM
157  * search key format used by an interface when
158  * NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X4.
159  */
160 union npc_mcam_key_x4_s {
161         u64 u[8];
162         struct npc_mcam_key_x4_s_s {
163                 u64 intf                             : 2;
164                 u64 reserved_2_63                    : 62;
165                 u64 kw0                              : 64;
166                 u64 kw1                              : 64;
167                 u64 kw2                              : 64;
168                 u64 kw3                              : 64;
169                 u64 kw4                              : 64;
170                 u64 kw5                              : 64;
171                 u64 kw6                              : 64;
172         } s;
173         /* struct npc_mcam_key_x4_s_s cn; */
174 };
175
176 /**
177  * Structure npc_parse_kex_s
178  *
179  * NPC Parse Key Extract Structure This structure contains the subset of
180  * NPC_RESULT_S fields that can be included in the MCAM search key. See
181  * NPC_AF_INTF()_KEX_CFG.
182  */
183 union npc_parse_kex_s {
184         u64 u[2];
185         struct npc_parse_kex_s_s {
186                 u64 chan                             : 12;
187                 u64 errlev                           : 4;
188                 u64 errcode                          : 8;
189                 u64 l2m                              : 1;
190                 u64 l2b                              : 1;
191                 u64 l3m                              : 1;
192                 u64 l3b                              : 1;
193                 u64 la                               : 12;
194                 u64 lb                               : 12;
195                 u64 lc                               : 12;
196                 u64 ld                               : 12;
197                 u64 le                               : 12;
198                 u64 lf                               : 12;
199                 u64 lg                               : 12;
200                 u64 lh                               : 12;
201                 u64 reserved_124_127                 : 4;
202         } s;
203         /* struct npc_parse_kex_s_s cn; */
204 };
205
206 /**
207  * Structure npc_result_s
208  *
209  * NPC Result Structure This structure contains a packet's parse and flow
210  * identification information.
211  */
212 union npc_result_s {
213         u64 u[6];
214         struct npc_result_s_s {
215                 u64 intf                             : 2;
216                 u64 pkind                            : 6;
217                 u64 chan                             : 12;
218                 u64 errlev                           : 4;
219                 u64 errcode                          : 8;
220                 u64 l2m                              : 1;
221                 u64 l2b                              : 1;
222                 u64 l3m                              : 1;
223                 u64 l3b                              : 1;
224                 u64 eoh_ptr                          : 8;
225                 u64 reserved_44_63                   : 20;
226                 u64 action                           : 64;
227                 u64 vtag_action                      : 64;
228                 u64 la                               : 20;
229                 u64 lb                               : 20;
230                 u64 lc                               : 20;
231                 u64 reserved_252_255                 : 4;
232                 u64 ld                               : 20;
233                 u64 le                               : 20;
234                 u64 lf                               : 20;
235                 u64 reserved_316_319                 : 4;
236                 u64 lg                               : 20;
237                 u64 lh                               : 20;
238                 u64 reserved_360_383                 : 24;
239         } s;
240         /* struct npc_result_s_s cn; */
241 };
242
243 /**
244  * Register (RVU_PF_BAR0) npc_af_active_pc
245  *
246  * NPC Interrupt-Timer Configuration Register
247  */
248 union npc_af_active_pc {
249         u64 u;
250         struct npc_af_active_pc_s {
251                 u64 active_pc                        : 64;
252         } s;
253         /* struct npc_af_active_pc_s cn; */
254 };
255
256 static inline u64 NPC_AF_ACTIVE_PC(void)
257         __attribute__ ((pure, always_inline));
258 static inline u64 NPC_AF_ACTIVE_PC(void)
259 {
260         return 0x10;
261 }
262
263 /**
264  * Register (RVU_PF_BAR0) npc_af_blk_rst
265  *
266  * NPC AF Block Reset Register
267  */
268 union npc_af_blk_rst {
269         u64 u;
270         struct npc_af_blk_rst_s {
271                 u64 rst                              : 1;
272                 u64 reserved_1_62                    : 62;
273                 u64 busy                             : 1;
274         } s;
275         /* struct npc_af_blk_rst_s cn; */
276 };
277
278 static inline u64 NPC_AF_BLK_RST(void)
279         __attribute__ ((pure, always_inline));
280 static inline u64 NPC_AF_BLK_RST(void)
281 {
282         return 0x40;
283 }
284
285 /**
286  * Register (RVU_PF_BAR0) npc_af_cfg
287  *
288  * NPC AF General Configuration Register
289  */
290 union npc_af_cfg {
291         u64 u;
292         struct npc_af_cfg_s {
293                 u64 reserved_0_1                     : 2;
294                 u64 cclk_force                       : 1;
295                 u64 force_intf_clk_en                : 1;
296                 u64 reserved_4_63                    : 60;
297         } s;
298         /* struct npc_af_cfg_s cn; */
299 };
300
301 static inline u64 NPC_AF_CFG(void)
302         __attribute__ ((pure, always_inline));
303 static inline u64 NPC_AF_CFG(void)
304 {
305         return 0;
306 }
307
308 /**
309  * Register (RVU_PF_BAR0) npc_af_const
310  *
311  * NPC AF Constants Register This register contains constants for
312  * software discovery.
313  */
314 union npc_af_const {
315         u64 u;
316         struct npc_af_const_s {
317                 u64 intfs                            : 4;
318                 u64 lids                             : 4;
319                 u64 kpus                             : 5;
320                 u64 reserved_13_15                   : 3;
321                 u64 mcam_bank_width                  : 10;
322                 u64 reserved_26_27                   : 2;
323                 u64 mcam_bank_depth                  : 16;
324                 u64 mcam_banks                       : 4;
325                 u64 match_stats                      : 16;
326         } s;
327         /* struct npc_af_const_s cn; */
328 };
329
330 static inline u64 NPC_AF_CONST(void)
331         __attribute__ ((pure, always_inline));
332 static inline u64 NPC_AF_CONST(void)
333 {
334         return 0x20;
335 }
336
337 /**
338  * Register (RVU_PF_BAR0) npc_af_const1
339  *
340  * NPC AF Constants 1 Register This register contains constants for
341  * software discovery.
342  */
343 union npc_af_const1 {
344         u64 u;
345         struct npc_af_const1_s {
346                 u64 kpu_entries                      : 12;
347                 u64 pkinds                           : 8;
348                 u64 cpi_size                         : 16;
349                 u64 reserved_36_63                   : 28;
350         } s;
351         /* struct npc_af_const1_s cn; */
352 };
353
354 static inline u64 NPC_AF_CONST1(void)
355         __attribute__ ((pure, always_inline));
356 static inline u64 NPC_AF_CONST1(void)
357 {
358         return 0x30;
359 }
360
361 /**
362  * Register (RVU_PF_BAR0) npc_af_cpi#_cfg
363  *
364  * NPC AF Channel Parse Index Table Registers
365  */
366 union npc_af_cpix_cfg {
367         u64 u;
368         struct npc_af_cpix_cfg_s {
369                 u64 padd                             : 4;
370                 u64 reserved_4_63                    : 60;
371         } s;
372         /* struct npc_af_cpix_cfg_s cn; */
373 };
374
375 static inline u64 NPC_AF_CPIX_CFG(u64 a)
376         __attribute__ ((pure, always_inline));
377 static inline u64 NPC_AF_CPIX_CFG(u64 a)
378 {
379         return 0x200000 + 8 * a;
380 }
381
382 /**
383  * Register (RVU_PF_BAR0) npc_af_dbg_ctl
384  *
385  * NPC AF Debug Control Register This register controls the capture of
386  * debug information in NPC_AF_KPU()_DBG, NPC_AF_MCAM_DBG,
387  * NPC_AF_DBG_DATA() and NPC_AF_DBG_RESULT().
388  */
389 union npc_af_dbg_ctl {
390         u64 u;
391         struct npc_af_dbg_ctl_s {
392                 u64 continuous                       : 1;
393                 u64 lkup_dbg                         : 1;
394                 u64 intf_dbg                         : 4;
395                 u64 reserved_6_63                    : 58;
396         } s;
397         /* struct npc_af_dbg_ctl_s cn; */
398 };
399
400 static inline u64 NPC_AF_DBG_CTL(void)
401         __attribute__ ((pure, always_inline));
402 static inline u64 NPC_AF_DBG_CTL(void)
403 {
404         return 0x3000000;
405 }
406
407 /**
408  * Register (RVU_PF_BAR0) npc_af_dbg_data#
409  *
410  * NPC AF Debug Data Registers These registers contain the packet header
411  * data of the last packet/lookup whose debug information is captured by
412  * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG].
413  */
414 union npc_af_dbg_datax {
415         u64 u;
416         struct npc_af_dbg_datax_s {
417                 u64 data                             : 64;
418         } s;
419         /* struct npc_af_dbg_datax_s cn; */
420 };
421
422 static inline u64 NPC_AF_DBG_DATAX(u64 a)
423         __attribute__ ((pure, always_inline));
424 static inline u64 NPC_AF_DBG_DATAX(u64 a)
425 {
426         return 0x3001400 + 0x10 * a;
427 }
428
429 /**
430  * Register (RVU_PF_BAR0) npc_af_dbg_result#
431  *
432  * NPC AF Debug Result Registers These registers contain the result data
433  * of the last packet/lookup whose debug information is captured by
434  * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG].  Internal: FIXME - add note about
435  * coherency of data in continuous packet capture mode.
436  */
437 union npc_af_dbg_resultx {
438         u64 u;
439         struct npc_af_dbg_resultx_s {
440                 u64 data                             : 64;
441         } s;
442         /* struct npc_af_dbg_resultx_s cn; */
443 };
444
445 static inline u64 NPC_AF_DBG_RESULTX(u64 a)
446         __attribute__ ((pure, always_inline));
447 static inline u64 NPC_AF_DBG_RESULTX(u64 a)
448 {
449         return 0x3001800 + 0x10 * a;
450 }
451
452 /**
453  * Register (RVU_PF_BAR0) npc_af_dbg_status
454  *
455  * NPC AF Debug Status Register
456  */
457 union npc_af_dbg_status {
458         u64 u;
459         struct npc_af_dbg_status_s {
460                 u64 done                             : 1;
461                 u64 reserved_1_63                    : 63;
462         } s;
463         /* struct npc_af_dbg_status_s cn; */
464 };
465
466 static inline u64 NPC_AF_DBG_STATUS(void)
467         __attribute__ ((pure, always_inline));
468 static inline u64 NPC_AF_DBG_STATUS(void)
469 {
470         return 0x3000010;
471 }
472
473 /**
474  * Register (RVU_PF_BAR0) npc_af_dv_fc_scratch
475  *
476  * INTERNAL: NPC AF Scratch Register  Internal: This register is for
477  * internal DV purpose.
478  */
479 union npc_af_dv_fc_scratch {
480         u64 u;
481         struct npc_af_dv_fc_scratch_s {
482                 u64 it                               : 64;
483         } s;
484         /* struct npc_af_dv_fc_scratch_s cn; */
485 };
486
487 static inline u64 NPC_AF_DV_FC_SCRATCH(void)
488         __attribute__ ((pure, always_inline));
489 static inline u64 NPC_AF_DV_FC_SCRATCH(void)
490 {
491         return 0x60;
492 }
493
494 /**
495  * Register (RVU_PF_BAR0) npc_af_eco0
496  *
497  * INTERNAL: ECO 0 Register
498  */
499 union npc_af_eco0 {
500         u64 u;
501         struct npc_af_eco0_s {
502                 u64 eco_rw                           : 32;
503                 u64 reserved_32_63                   : 32;
504         } s;
505         /* struct npc_af_eco0_s cn; */
506 };
507
508 static inline u64 NPC_AF_ECO0(void)
509         __attribute__ ((pure, always_inline));
510 static inline u64 NPC_AF_ECO0(void)
511 {
512         return 0x200;
513 }
514
515 /**
516  * Register (RVU_PF_BAR0) npc_af_ikpu_err_ctl
517  *
518  * NPC AF Initial KPU Error Control Registers Similar to
519  * NPC_AF_KPU()_ERR_CTL, but specifies values captured in
520  * NPC_RESULT_S[ERRLEV,ERRCODE] for errors detected by the PKIND-based
521  * initial actions from NPC_AF_PKIND()_ACTION0 and
522  * NPC_AF_PKIND()_ACTION1. [DP_OFFSET_ERRCODE] from this register is
523  * never used.
524  */
525 union npc_af_ikpu_err_ctl {
526         u64 u;
527         struct npc_af_ikpu_err_ctl_s {
528                 u64 errlev                           : 4;
529                 u64 dp_offset_errcode                : 8;
530                 u64 ptr_advance_errcode              : 8;
531                 u64 var_len_offset_errcode           : 8;
532                 u64 reserved_28_63                   : 36;
533         } s;
534         /* struct npc_af_ikpu_err_ctl_s cn; */
535 };
536
537 static inline u64 NPC_AF_IKPU_ERR_CTL(void)
538         __attribute__ ((pure, always_inline));
539 static inline u64 NPC_AF_IKPU_ERR_CTL(void)
540 {
541         return 0x3000080;
542 }
543
544 /**
545  * Register (RVU_PF_BAR0) npc_af_intf#_kex_cfg
546  *
547  * NPC AF Interface Key Extract Configuration Registers
548  */
549 union npc_af_intfx_kex_cfg {
550         u64 u;
551         struct npc_af_intfx_kex_cfg_s {
552                 u64 parse_nibble_ena                 : 31;
553                 u64 reserved_31                      : 1;
554                 u64 keyw                             : 3;
555                 u64 reserved_35_63                   : 29;
556         } s;
557         /* struct npc_af_intfx_kex_cfg_s cn; */
558 };
559
560 static inline u64 NPC_AF_INTFX_KEX_CFG(u64 a)
561         __attribute__ ((pure, always_inline));
562 static inline u64 NPC_AF_INTFX_KEX_CFG(u64 a)
563 {
564         return 0x1010 + 0x100 * a;
565 }
566
567 /**
568  * Register (RVU_PF_BAR0) npc_af_intf#_ldata#_flags#_cfg
569  *
570  * NPC AF Interface Layer Data Flags Configuration Registers These
571  * registers control the extraction of layer data (LDATA) into the MCAM
572  * search key for each interface based on the FLAGS\<3:0\> bits of two
573  * layers selected by NPC_AF_KEX_LDATA()_FLAGS_CFG.
574  */
575 union npc_af_intfx_ldatax_flagsx_cfg {
576         u64 u;
577         struct npc_af_intfx_ldatax_flagsx_cfg_s {
578                 u64 key_offset                       : 6;
579                 u64 reserved_6                       : 1;
580                 u64 ena                              : 1;
581                 u64 hdr_offset                       : 8;
582                 u64 bytesm1                          : 4;
583                 u64 reserved_20_63                   : 44;
584         } s;
585         /* struct npc_af_intfx_ldatax_flagsx_cfg_s cn; */
586 };
587
588 static inline u64 NPC_AF_INTFX_LDATAX_FLAGSX_CFG(u64 a, u64 b, u64 c)
589         __attribute__ ((pure, always_inline));
590 static inline u64 NPC_AF_INTFX_LDATAX_FLAGSX_CFG(u64 a, u64 b, u64 c)
591 {
592         return 0x980000 + 0x10000 * a + 0x1000 * b + 8 * c;
593 }
594
595 /**
596  * Register (RVU_PF_BAR0) npc_af_intf#_lid#_lt#_ld#_cfg
597  *
598  * NPC AF Interface Layer Data Extract Configuration Registers These
599  * registers control the extraction of layer data (LDATA) into the MCAM
600  * search key for each interface. Up to two LDATA fields can be extracted
601  * per layer (LID(0..7) indexed by NPC_LID_E), with up to 16 bytes per
602  * LDATA field. For each layer, the corresponding NPC_LAYER_INFO_S[LTYPE]
603  * value in NPC_RESULT_S is used as the LTYPE(0..15) index and select the
604  * associated LDATA(0..1) registers.  NPC_LAYER_INFO_S[LTYPE]=0x0 means
605  * the corresponding layer not parsed (invalid), so software should keep
606  * NPC_AF_INTF()_LID()_LT(0)_LD()_CFG[ENA] clear to disable extraction
607  * when LTYPE is zero.
608  */
609 union npc_af_intfx_lidx_ltx_ldx_cfg {
610         u64 u;
611         struct npc_af_intfx_lidx_ltx_ldx_cfg_s {
612                 u64 key_offset                       : 6;
613                 u64 flags_ena                        : 1;
614                 u64 ena                              : 1;
615                 u64 hdr_offset                       : 8;
616                 u64 bytesm1                          : 4;
617                 u64 reserved_20_63                   : 44;
618         } s;
619         /* struct npc_af_intfx_lidx_ltx_ldx_cfg_s cn; */
620 };
621
622 static inline u64 NPC_AF_INTFX_LIDX_LTX_LDX_CFG(u64 a, u64 b, u64 c, u64 d)
623         __attribute__ ((pure, always_inline));
624 static inline u64 NPC_AF_INTFX_LIDX_LTX_LDX_CFG(u64 a, u64 b, u64 c, u64 d)
625 {
626         return 0x900000 + 0x10000 * a + 0x1000 * b + 0x20 * c + 8 * d;
627 }
628
629 /**
630  * Register (RVU_PF_BAR0) npc_af_intf#_miss_act
631  *
632  * NPC AF Interface MCAM Miss Action Data Registers When a combination of
633  * NPC_AF_MCAME()_BANK()_CAM()_* and NPC_AF_MCAME()_BANK()_CFG[ENA]
634  * yields an MCAM miss for a packet, this register specifies the packet's
635  * match action captured in NPC_RESULT_S[ACTION].
636  */
637 union npc_af_intfx_miss_act {
638         u64 u;
639         struct npc_af_intfx_miss_act_s {
640                 u64 action                           : 64;
641         } s;
642         /* struct npc_af_intfx_miss_act_s cn; */
643 };
644
645 static inline u64 NPC_AF_INTFX_MISS_ACT(u64 a)
646         __attribute__ ((pure, always_inline));
647 static inline u64 NPC_AF_INTFX_MISS_ACT(u64 a)
648 {
649         return 0x1a00000 + 0x10 * a;
650 }
651
652 /**
653  * Register (RVU_PF_BAR0) npc_af_intf#_miss_stat_act
654  *
655  * NPC AF Interface MCAM Miss Stat Action Data Registers Used to
656  * optionally increment a NPC_AF_MATCH_STAT() counter when a packet
657  * misses an MCAM entry.
658  */
659 union npc_af_intfx_miss_stat_act {
660         u64 u;
661         struct npc_af_intfx_miss_stat_act_s {
662                 u64 stat_sel                         : 9;
663                 u64 ena                              : 1;
664                 u64 reserved_10_63                   : 54;
665         } s;
666         /* struct npc_af_intfx_miss_stat_act_s cn; */
667 };
668
669 static inline u64 NPC_AF_INTFX_MISS_STAT_ACT(u64 a)
670         __attribute__ ((pure, always_inline));
671 static inline u64 NPC_AF_INTFX_MISS_STAT_ACT(u64 a)
672 {
673         return 0x1880040 + 8 * a;
674 }
675
676 /**
677  * Register (RVU_PF_BAR0) npc_af_intf#_miss_tag_act
678  *
679  * NPC AF Interface MCAM Miss VTag Action Data Registers When a
680  * combination of NPC_AF_MCAME()_BANK()_CAM()_* and
681  * NPC_AF_MCAME()_BANK()_CFG[ENA] yields an MCAM miss for a packet, this
682  * register specifies the packet's match Vtag action captured in
683  * NPC_RESULT_S[VTAG_ACTION].
684  */
685 union npc_af_intfx_miss_tag_act {
686         u64 u;
687         struct npc_af_intfx_miss_tag_act_s {
688                 u64 vtag_action                      : 64;
689         } s;
690         /* struct npc_af_intfx_miss_tag_act_s cn; */
691 };
692
693 static inline u64 NPC_AF_INTFX_MISS_TAG_ACT(u64 a)
694         __attribute__ ((pure, always_inline));
695 static inline u64 NPC_AF_INTFX_MISS_TAG_ACT(u64 a)
696 {
697         return 0x1b00008 + 0x10 * a;
698 }
699
700 /**
701  * Register (RVU_PF_BAR0) npc_af_intf#_stat
702  *
703  * NPC AF Interface Statistics Registers Statistics per interface. Index
704  * enumerated by NPC_INTF_E.
705  */
706 union npc_af_intfx_stat {
707         u64 u;
708         struct npc_af_intfx_stat_s {
709                 u64 count                            : 48;
710                 u64 reserved_48_63                   : 16;
711         } s;
712         /* struct npc_af_intfx_stat_s cn; */
713 };
714
715 static inline u64 NPC_AF_INTFX_STAT(u64 a)
716         __attribute__ ((pure, always_inline));
717 static inline u64 NPC_AF_INTFX_STAT(u64 a)
718 {
719         return 0x2000800 + 0x10 * a;
720 }
721
722 /**
723  * Register (RVU_PF_BAR0) npc_af_kcam_scrub_ctl
724  *
725  * NPC AF KCAM Scrub Control Register
726  */
727 union npc_af_kcam_scrub_ctl {
728         u64 u;
729         struct npc_af_kcam_scrub_ctl_s {
730                 u64 ena                              : 1;
731                 u64 reserved_1_7                     : 7;
732                 u64 lp_dis                           : 1;
733                 u64 reserved_9_15                    : 7;
734                 u64 toth                             : 4;
735                 u64 reserved_20_63                   : 44;
736         } s;
737         /* struct npc_af_kcam_scrub_ctl_s cn; */
738 };
739
740 static inline u64 NPC_AF_KCAM_SCRUB_CTL(void)
741         __attribute__ ((pure, always_inline));
742 static inline u64 NPC_AF_KCAM_SCRUB_CTL(void)
743 {
744         return 0xb0;
745 }
746
747 /**
748  * Register (RVU_PF_BAR0) npc_af_kex_ldata#_flags_cfg
749  *
750  * NPC AF Key Extract Layer Data Flags Configuration Register
751  */
752 union npc_af_kex_ldatax_flags_cfg {
753         u64 u;
754         struct npc_af_kex_ldatax_flags_cfg_s {
755                 u64 lid                              : 3;
756                 u64 reserved_3_63                    : 61;
757         } s;
758         /* struct npc_af_kex_ldatax_flags_cfg_s cn; */
759 };
760
761 static inline u64 NPC_AF_KEX_LDATAX_FLAGS_CFG(u64 a)
762         __attribute__ ((pure, always_inline));
763 static inline u64 NPC_AF_KEX_LDATAX_FLAGS_CFG(u64 a)
764 {
765         return 0x800 + 8 * a;
766 }
767
768 /**
769  * Register (RVU_PF_BAR0) npc_af_kpu#_cfg
770  *
771  * NPC AF KPU Configuration Registers
772  */
773 union npc_af_kpux_cfg {
774         u64 u;
775         struct npc_af_kpux_cfg_s {
776                 u64 ena                              : 1;
777                 u64 reserved_1_63                    : 63;
778         } s;
779         /* struct npc_af_kpux_cfg_s cn; */
780 };
781
782 static inline u64 NPC_AF_KPUX_CFG(u64 a)
783         __attribute__ ((pure, always_inline));
784 static inline u64 NPC_AF_KPUX_CFG(u64 a)
785 {
786         return 0x500 + 8 * a;
787 }
788
789 /**
790  * Register (RVU_PF_BAR0) npc_af_kpu#_dbg
791  *
792  * NPC AF KPU Debug Registers This register contains information for the
793  * last packet/lookup for which debug is enabled by
794  * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG]. The register contents are undefined
795  * when debug information is captured for a software key lookup
796  * (NPC_AF_LKUP_CTL[OP] = NPC_LKUPOP_E::KEY).
797  */
798 union npc_af_kpux_dbg {
799         u64 u;
800         struct npc_af_kpux_dbg_s {
801                 u64 hit_entry                        : 8;
802                 u64 byp                              : 1;
803                 u64 reserved_9_63                    : 55;
804         } s;
805         /* struct npc_af_kpux_dbg_s cn; */
806 };
807
808 static inline u64 NPC_AF_KPUX_DBG(u64 a)
809         __attribute__ ((pure, always_inline));
810 static inline u64 NPC_AF_KPUX_DBG(u64 a)
811 {
812         return 0x3000020 + 0x100 * a;
813 }
814
815 /**
816  * Register (RVU_PF_BAR0) npc_af_kpu#_entry#_action0
817  *
818  * NPC AF KPU Entry Action Data 0 Registers When a KPU's search data
819  * matches a KPU CAM entry in NPC_AF_KPU()_ENTRY()_CAM(), the
820  * corresponding entry action in NPC_AF_KPU()_ENTRY()_ACTION0 and
821  * NPC_AF_KPU()_ENTRY()_ACTION1 specifies the next state and operations
822  * to perform before exiting the KPU.
823  */
824 union npc_af_kpux_entryx_action0 {
825         u64 u;
826         struct npc_af_kpux_entryx_action0_s {
827                 u64 var_len_shift                    : 3;
828                 u64 var_len_right                    : 1;
829                 u64 var_len_mask                     : 8;
830                 u64 var_len_offset                   : 8;
831                 u64 ptr_advance                      : 8;
832                 u64 capture_flags                    : 8;
833                 u64 capture_ltype                    : 4;
834                 u64 capture_lid                      : 3;
835                 u64 reserved_43                      : 1;
836                 u64 next_state                       : 8;
837                 u64 parse_done                       : 1;
838                 u64 capture_ena                      : 1;
839                 u64 byp_count                        : 3;
840                 u64 reserved_57_63                   : 7;
841         } s;
842         /* struct npc_af_kpux_entryx_action0_s cn; */
843 };
844
845 static inline u64 NPC_AF_KPUX_ENTRYX_ACTION0(u64 a, u64 b)
846         __attribute__ ((pure, always_inline));
847 static inline u64 NPC_AF_KPUX_ENTRYX_ACTION0(u64 a, u64 b)
848 {
849         return 0x100020 + 0x4000 * a + 0x40 * b;
850 }
851
852 /**
853  * Register (RVU_PF_BAR0) npc_af_kpu#_entry#_action1
854  *
855  * NPC AF KPU Entry Action Data 0 Registers See
856  * NPC_AF_KPU()_ENTRY()_ACTION0.
857  */
858 union npc_af_kpux_entryx_action1 {
859         u64 u;
860         struct npc_af_kpux_entryx_action1_s {
861                 u64 dp0_offset                       : 8;
862                 u64 dp1_offset                       : 8;
863                 u64 dp2_offset                       : 8;
864                 u64 errcode                          : 8;
865                 u64 errlev                           : 4;
866                 u64 reserved_36_63                   : 28;
867         } s;
868         /* struct npc_af_kpux_entryx_action1_s cn; */
869 };
870
871 static inline u64 NPC_AF_KPUX_ENTRYX_ACTION1(u64 a, u64 b)
872         __attribute__ ((pure, always_inline));
873 static inline u64 NPC_AF_KPUX_ENTRYX_ACTION1(u64 a, u64 b)
874 {
875         return 0x100028 + 0x4000 * a + 0x40 * b;
876 }
877
878 /**
879  * Register (RVU_PF_BAR0) npc_af_kpu#_entry#_cam#
880  *
881  * NPC AF KPU Entry CAM Registers KPU comparison ternary data. The field
882  * values in NPC_AF_KPU()_ENTRY()_CAM() are ternary, where  each data bit
883  * of the search key matches as follows: _ [CAM(1)]\<n\>=0,
884  * [CAM(0)]\<n\>=0: Always match; search key data\<n\> don't care. _
885  * [CAM(1)]\<n\>=0, [CAM(0)]\<n\>=1: Match when search key data\<n\> ==
886  * 0. _ [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=0: Match when search key data\<n\>
887  * == 1. _ [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=1: Reserved.  The reserved
888  * combination is not allowed. Hardware suppresses any write to CAM(0) or
889  * CAM(1) that would result in the reserved combination for any CAM bit.
890  * The reset value for all non-reserved fields is all zeros for CAM(1)
891  * and all ones for CAM(0), matching a search key of all zeros.  Software
892  * must program a default entry for each KPU, e.g. by programming each
893  * KPU's last entry {b} (NPC_AF_KPU()_ENTRY({b})_CAM()) to always match
894  * all bits.
895  */
896 union npc_af_kpux_entryx_camx {
897         u64 u;
898         struct npc_af_kpux_entryx_camx_s {
899                 u64 dp0_data                         : 16;
900                 u64 dp1_data                         : 16;
901                 u64 dp2_data                         : 16;
902                 u64 state                            : 8;
903                 u64 reserved_56_63                   : 8;
904         } s;
905         /* struct npc_af_kpux_entryx_camx_s cn; */
906 };
907
908 static inline u64 NPC_AF_KPUX_ENTRYX_CAMX(u64 a, u64 b, u64 c)
909         __attribute__ ((pure, always_inline));
910 static inline u64 NPC_AF_KPUX_ENTRYX_CAMX(u64 a, u64 b, u64 c)
911 {
912         return 0x100000 + 0x4000 * a + 0x40 * b + 8 * c;
913 }
914
915 /**
916  * Register (RVU_PF_BAR0) npc_af_kpu#_entry_dis#
917  *
918  * NPC AF KPU Entry Disable Registers See NPC_AF_KPU()_ENTRY()_ACTION0.
919  */
920 union npc_af_kpux_entry_disx {
921         u64 u;
922         struct npc_af_kpux_entry_disx_s {
923                 u64 dis                              : 64;
924         } s;
925         /* struct npc_af_kpux_entry_disx_s cn; */
926 };
927
928 static inline u64 NPC_AF_KPUX_ENTRY_DISX(u64 a, u64 b)
929         __attribute__ ((pure, always_inline));
930 static inline u64 NPC_AF_KPUX_ENTRY_DISX(u64 a, u64 b)
931 {
932         return 0x180000 + 0x40 * a + 8 * b;
933 }
934
935 /**
936  * Register (RVU_PF_BAR0) npc_af_kpu#_err_ctl
937  *
938  * NPC AF KPU Error Control Registers This register specifies values
939  * captured in NPC_RESULT_S[ERRLEV,ERRCODE] when errors are detected by a
940  * KPU.
941  */
942 union npc_af_kpux_err_ctl {
943         u64 u;
944         struct npc_af_kpux_err_ctl_s {
945                 u64 errlev                           : 4;
946                 u64 dp_offset_errcode                : 8;
947                 u64 ptr_advance_errcode              : 8;
948                 u64 var_len_offset_errcode           : 8;
949                 u64 reserved_28_63                   : 36;
950         } s;
951         /* struct npc_af_kpux_err_ctl_s cn; */
952 };
953
954 static inline u64 NPC_AF_KPUX_ERR_CTL(u64 a)
955         __attribute__ ((pure, always_inline));
956 static inline u64 NPC_AF_KPUX_ERR_CTL(u64 a)
957 {
958         return 0x30000a0 + 0x100 * a;
959 }
960
961 /**
962  * Register (RVU_PF_BAR0) npc_af_kpu_diag
963  *
964  * INTERNAL : NPC AF Debug Result Registers
965  */
966 union npc_af_kpu_diag {
967         u64 u;
968         struct npc_af_kpu_diag_s {
969                 u64 skip_dis                         : 1;
970                 u64 reserved_1_63                    : 63;
971         } s;
972         /* struct npc_af_kpu_diag_s cn; */
973 };
974
975 static inline u64 NPC_AF_KPU_DIAG(void)
976         __attribute__ ((pure, always_inline));
977 static inline u64 NPC_AF_KPU_DIAG(void)
978 {
979         return 0x3002000;
980 }
981
982 /**
983  * Register (RVU_PF_BAR0) npc_af_lkup_ctl
984  *
985  * NPC AF Software Lookup Control Registers
986  */
987 union npc_af_lkup_ctl {
988         u64 u;
989         struct npc_af_lkup_ctl_s {
990                 u64 intf                             : 2;
991                 u64 pkind                            : 6;
992                 u64 chan                             : 12;
993                 u64 hdr_sizem1                       : 8;
994                 u64 op                               : 3;
995                 u64 exec                             : 1;
996                 u64 reserved_32_63                   : 32;
997         } s;
998         /* struct npc_af_lkup_ctl_s cn; */
999 };
1000
1001 static inline u64 NPC_AF_LKUP_CTL(void)
1002         __attribute__ ((pure, always_inline));
1003 static inline u64 NPC_AF_LKUP_CTL(void)
1004 {
1005         return 0x2000000;
1006 }
1007
1008 /**
1009  * Register (RVU_PF_BAR0) npc_af_lkup_data#
1010  *
1011  * NPC AF Software Lookup Data Registers
1012  */
1013 union npc_af_lkup_datax {
1014         u64 u;
1015         struct npc_af_lkup_datax_s {
1016                 u64 data                             : 64;
1017         } s;
1018         /* struct npc_af_lkup_datax_s cn; */
1019 };
1020
1021 static inline u64 NPC_AF_LKUP_DATAX(u64 a)
1022         __attribute__ ((pure, always_inline));
1023 static inline u64 NPC_AF_LKUP_DATAX(u64 a)
1024 {
1025         return 0x2000200 + 0x10 * a;
1026 }
1027
1028 /**
1029  * Register (RVU_PF_BAR0) npc_af_lkup_result#
1030  *
1031  * NPC AF Software Lookup Result Registers
1032  */
1033 union npc_af_lkup_resultx {
1034         u64 u;
1035         struct npc_af_lkup_resultx_s {
1036                 u64 data                             : 64;
1037         } s;
1038         /* struct npc_af_lkup_resultx_s cn; */
1039 };
1040
1041 static inline u64 NPC_AF_LKUP_RESULTX(u64 a)
1042         __attribute__ ((pure, always_inline));
1043 static inline u64 NPC_AF_LKUP_RESULTX(u64 a)
1044 {
1045         return 0x2000400 + 0x10 * a;
1046 }
1047
1048 /**
1049  * Register (RVU_PF_BAR0) npc_af_match_stat#
1050  *
1051  * NPC AF Match Statistics Registers
1052  */
1053 union npc_af_match_statx {
1054         u64 u;
1055         struct npc_af_match_statx_s {
1056                 u64 count                            : 48;
1057                 u64 reserved_48_63                   : 16;
1058         } s;
1059         /* struct npc_af_match_statx_s cn; */
1060 };
1061
1062 static inline u64 NPC_AF_MATCH_STATX(u64 a)
1063         __attribute__ ((pure, always_inline));
1064 static inline u64 NPC_AF_MATCH_STATX(u64 a)
1065 {
1066         return 0x1880008 + 0x100 * a;
1067 }
1068
1069 /**
1070  * Register (RVU_PF_BAR0) npc_af_mcam_bank#_hit#
1071  *
1072  * NPC AF MCAM Bank Hit Registers
1073  */
1074 union npc_af_mcam_bankx_hitx {
1075         u64 u;
1076         struct npc_af_mcam_bankx_hitx_s {
1077                 u64 hit                              : 64;
1078         } s;
1079         /* struct npc_af_mcam_bankx_hitx_s cn; */
1080 };
1081
1082 static inline u64 NPC_AF_MCAM_BANKX_HITX(u64 a, u64 b)
1083         __attribute__ ((pure, always_inline));
1084 static inline u64 NPC_AF_MCAM_BANKX_HITX(u64 a, u64 b)
1085 {
1086         return 0x1c80000 + 0x100 * a + 0x10 * b;
1087 }
1088
1089 /**
1090  * Register (RVU_PF_BAR0) npc_af_mcam_dbg
1091  *
1092  * NPC AF MCAM Debug Register This register contains information for the
1093  * last packet/lookup for which debug is enabled by
1094  * NPC_AF_DBG_CTL[INTF_DBG,LKUP_DBG].
1095  */
1096 union npc_af_mcam_dbg {
1097         u64 u;
1098         struct npc_af_mcam_dbg_s {
1099                 u64 hit_entry                        : 10;
1100                 u64 reserved_10_11                   : 2;
1101                 u64 hit_bank                         : 2;
1102                 u64 reserved_14_15                   : 2;
1103                 u64 miss                             : 1;
1104                 u64 reserved_17_63                   : 47;
1105         } s;
1106         /* struct npc_af_mcam_dbg_s cn; */
1107 };
1108
1109 static inline u64 NPC_AF_MCAM_DBG(void)
1110         __attribute__ ((pure, always_inline));
1111 static inline u64 NPC_AF_MCAM_DBG(void)
1112 {
1113         return 0x3001000;
1114 }
1115
1116 /**
1117  * Register (RVU_PF_BAR0) npc_af_mcam_scrub_ctl
1118  *
1119  * NPC AF MCAM Scrub Control Register
1120  */
1121 union npc_af_mcam_scrub_ctl {
1122         u64 u;
1123         struct npc_af_mcam_scrub_ctl_s {
1124                 u64 ena                              : 1;
1125                 u64 reserved_1_7                     : 7;
1126                 u64 lp_dis                           : 1;
1127                 u64 reserved_9_15                    : 7;
1128                 u64 toth                             : 4;
1129                 u64 reserved_20_63                   : 44;
1130         } s;
1131         /* struct npc_af_mcam_scrub_ctl_s cn; */
1132 };
1133
1134 static inline u64 NPC_AF_MCAM_SCRUB_CTL(void)
1135         __attribute__ ((pure, always_inline));
1136 static inline u64 NPC_AF_MCAM_SCRUB_CTL(void)
1137 {
1138         return 0xa0;
1139 }
1140
1141 /**
1142  * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_action
1143  *
1144  * NPC AF MCAM Entry Bank Action Data Registers Specifies a packet's
1145  * match action captured in NPC_RESULT_S[ACTION].  When an interface is
1146  * configured to use the NPC_MCAM_KEY_X2_S search key format
1147  * (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X2), *
1148  * NPC_AF_MCAME()_BANK(0)_ACTION/_TAG_ACT/_STAT_ACT are used if the
1149  * search key matches NPC_AF_MCAME()_BANK(0..1)_CAM()_W*. *
1150  * NPC_AF_MCAME()_BANK(2)_ACTION/_TAG_ACT/_STAT_ACT are used if the
1151  * search key matches NPC_AF_MCAME()_BANK(2..3)_CAM()_W*. *
1152  * NPC_AF_MCAME()_BANK(1,3)_ACTION/_TAG_ACT/_STAT_ACT are not used.  When
1153  * an interface is configured to use the NPC_MCAM_KEY_X4_S search key
1154  * format (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X4): *
1155  * NPC_AF_MCAME()_BANK(0)_ACTION/_TAG_ACT/_STAT_ACT are used if the
1156  * search key matches NPC_AF_MCAME()_BANK(0..3)_CAM()_W*. *
1157  * NPC_AF_MCAME()_BANK(1..3)_ACTION/_TAG_ACT/_STAT_ACT are not used.
1158  */
1159 union npc_af_mcamex_bankx_action {
1160         u64 u;
1161         struct npc_af_mcamex_bankx_action_s {
1162                 u64 action                           : 64;
1163         } s;
1164         /* struct npc_af_mcamex_bankx_action_s cn; */
1165 };
1166
1167 static inline u64 NPC_AF_MCAMEX_BANKX_ACTION(u64 a, u64 b)
1168         __attribute__ ((pure, always_inline));
1169 static inline u64 NPC_AF_MCAMEX_BANKX_ACTION(u64 a, u64 b)
1170 {
1171         return 0x1900000 + 0x100 * a + 0x10 * b;
1172 }
1173
1174 /**
1175  * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cam#_intf
1176  *
1177  * NPC AF MCAM Entry Bank CAM Data Interface Registers MCAM comparison
1178  * ternary data interface word. The field values in
1179  * NPC_AF_MCAME()_BANK()_CAM()_INTF, NPC_AF_MCAME()_BANK()_CAM()_W0 and
1180  * NPC_AF_MCAME()_BANK()_CAM()_W1 are ternary, where  each data bit of
1181  * the search key matches as follows: _ [CAM(1)]\<n\>=0, [CAM(0)]\<n\>=0:
1182  * Always match; search key data\<n\> don't care. _ [CAM(1)]\<n\>=0,
1183  * [CAM(0)]\<n\>=1: Match when search key data\<n\> == 0. _
1184  * [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=0: Match when search key data\<n\> ==
1185  * 1. _ [CAM(1)]\<n\>=1, [CAM(0)]\<n\>=1: Reserved.  The reserved
1186  * combination is not allowed. Hardware suppresses any write to CAM(0) or
1187  * CAM(1) that would result in the reserved combination for any CAM bit.
1188  * The reset value for all non-reserved fields in
1189  * NPC_AF_MCAME()_BANK()_CAM()_INTF, NPC_AF_MCAME()_BANK()_CAM()_W0 and
1190  * NPC_AF_MCAME()_BANK()_CAM()_W1 is all zeros for CAM(1) and all ones
1191  * for CAM(0), matching a search key of all zeros.  When an interface is
1192  * configured to use the NPC_MCAM_KEY_X1_S search key format
1193  * (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X1), the four banks of
1194  * every MCAM entry are used as individual entries, each of which is
1195  * independently compared with the search key as follows: _
1196  * NPC_AF_MCAME()_BANK()_CAM()_INTF[INTF] corresponds to
1197  * NPC_MCAM_KEY_X1_S[INTF]. _ NPC_AF_MCAME()_BANK()_CAM()_W0[MD]
1198  * corresponds to NPC_MCAM_KEY_X1_S[KW0]. _
1199  * NPC_AF_MCAME()_BANK()_CAM()_W1[MD] corresponds to
1200  * NPC_MCAM_KEY_X1_S[KW1].  When an interface is configured to use the
1201  * NPC_MCAM_KEY_X2_S search key format (NPC_AF_INTF()_KEX_CFG[KEYW] =
1202  * NPC_MCAMKEYW_E::X2), banks 0-1 of every MCAM entry are used as one
1203  * double-wide entry, banks 2-3 as a second double-wide entry, and each
1204  * double-wide entry is independently compared with the search key as
1205  * follows: _ NPC_AF_MCAME()_BANK(0,2)_CAM()_INTF[INTF] corresponds to
1206  * NPC_MCAM_KEY_X2_S[INTF]. _ NPC_AF_MCAME()_BANK(0,2)_CAM()_W0[MD]
1207  * corresponds to NPC_MCAM_KEY_X2_S[KW0]. _
1208  * NPC_AF_MCAME()_BANK(0,2)_CAM()_W1[MD] corresponds to
1209  * NPC_MCAM_KEY_X2_S[KW1]\<47:0\>. _
1210  * NPC_AF_MCAME()_BANK(1,3)_CAM()_INTF[INTF] corresponds to
1211  * NPC_MCAM_KEY_X2_S[INTF]. _
1212  * NPC_AF_MCAME()_BANK(1,3)_CAM()_W0[MD]\<15:0\> corresponds to
1213  * NPC_MCAM_KEY_X2_S[KW1]\<63:48\>. _
1214  * NPC_AF_MCAME()_BANK(1,3)_CAM()_W0[MD]\<63:16\> corresponds to
1215  * NPC_MCAM_KEY_X2_S[KW2]\<47:0\>. _
1216  * NPC_AF_MCAME()_BANK(1,3)_CAM()_W1[MD]\<15:0\> corresponds to
1217  * NPC_MCAM_KEY_X2_S[KW2]\<63:48\>. _
1218  * NPC_AF_MCAME()_BANK(1,3)_CAM()_W1[MD]\<47:16\> corresponds to
1219  * NPC_MCAM_KEY_X2_S[KW3]\<31:0\>.  When an interface is configured to
1220  * use the NPC_MCAM_KEY_X4_S search key format
1221  * (NPC_AF_INTF()_KEX_CFG[KEYW] = NPC_MCAMKEYW_E::X4), the four banks of
1222  * every MCAM entry are used as a single quad-wide entry that is compared
1223  * with the search key as follows: _
1224  * NPC_AF_MCAME()_BANK(0)_CAM()_INTF[INTF] corresponds to
1225  * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(0)_CAM()_W0[MD]
1226  * corresponds to NPC_MCAM_KEY_X4_S[KW0]. _
1227  * NPC_AF_MCAME()_BANK(0)_CAM()_W1[MD] corresponds to
1228  * NPC_MCAM_KEY_X4_S[KW1]\<47:0\>. _
1229  * NPC_AF_MCAME()_BANK(1)_CAM()_INTF[INTF] corresponds to
1230  * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(1)_CAM()_W0[MD]\<15:0\>
1231  * corresponds to NPC_MCAM_KEY_X4_S[KW1]\<63:48\>. _
1232  * NPC_AF_MCAME()_BANK(1)_CAM()_W0[MD]\<63:16\> corresponds to
1233  * NPC_MCAM_KEY_X4_S[KW2]\<47:0\>. _
1234  * NPC_AF_MCAME()_BANK(1)_CAM()_W1[MD]\<15:0\> corresponds to
1235  * NPC_MCAM_KEY_X4_S[KW2]\<63:48\>. _
1236  * NPC_AF_MCAME()_BANK(1)_CAM()_W1[MD]\<47:16\> corresponds to
1237  * NPC_MCAM_KEY_X4_S[KW3]\<31:0\>. _
1238  * NPC_AF_MCAME()_BANK(2)_CAM()_INTF[INTF] corresponds to
1239  * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(2)_CAM()_W0[MD]\<31:0\>
1240  * corresponds to NPC_MCAM_KEY_X4_S[KW3]\<63:32\>. _
1241  * NPC_AF_MCAME()_BANK(2)_CAM()_W0[MD]\<63:32\> corresponds to
1242  * NPC_MCAM_KEY_X4_S[KW4]\<31:0\>. _
1243  * NPC_AF_MCAME()_BANK(2)_CAM()_W1[MD]\<31:0\> corresponds to
1244  * NPC_MCAM_KEY_X4_S[KW4]\<63:32\>. _
1245  * NPC_AF_MCAME()_BANK(2)_CAM()_W1[MD]\<47:32\> corresponds to
1246  * NPC_MCAM_KEY_X4_S[KW5]\<15:0\>. _
1247  * NPC_AF_MCAME()_BANK(3)_CAM()_INTF[INTF] corresponds to
1248  * NPC_MCAM_KEY_X4_S[INTF]. _ NPC_AF_MCAME()_BANK(3)_CAM()_W0[MD]\<47:0\>
1249  * corresponds to NPC_MCAM_KEY_X4_S[KW5]\<63:16\>. _
1250  * NPC_AF_MCAME()_BANK(3)_CAM()_W0[MD]\<63:48\> corresponds to
1251  * NPC_MCAM_KEY_X4_S[KW6]\<15:0\>. _ NPC_AF_MCAME()_BANK(3)_CAM()_W1[MD]
1252  * corresponds to NPC_MCAM_KEY_X4_S[KW6]\<63:16\>.  Note that for the X2
1253  * and X4 formats, a wide entry will not match unless the INTF fields
1254  * from the associated two or four banks match the INTF value from the
1255  * search key.  For the X1 and X2 formats, a match in a lower-numbered
1256  * bank takes priority over a match in any higher numbered banks. Within
1257  * each bank, the lowest numbered matching entry takes priority over any
1258  * higher numbered entry.
1259  */
1260 union npc_af_mcamex_bankx_camx_intf {
1261         u64 u;
1262         struct npc_af_mcamex_bankx_camx_intf_s {
1263                 u64 intf                             : 2;
1264                 u64 reserved_2_63                    : 62;
1265         } s;
1266         /* struct npc_af_mcamex_bankx_camx_intf_s cn; */
1267 };
1268
1269 static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_INTF(u64 a, u64 b, u64 c)
1270         __attribute__ ((pure, always_inline));
1271 static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_INTF(u64 a, u64 b, u64 c)
1272 {
1273         return 0x1000000 + 0x400 * a + 0x40 * b + 8 * c;
1274 }
1275
1276 /**
1277  * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cam#_w0
1278  *
1279  * NPC AF MCAM Entry Bank CAM Data Word 0 Registers MCAM comparison
1280  * ternary data word 0. See NPC_AF_MCAME()_BANK()_CAM()_INTF.
1281  */
1282 union npc_af_mcamex_bankx_camx_w0 {
1283         u64 u;
1284         struct npc_af_mcamex_bankx_camx_w0_s {
1285                 u64 md                               : 64;
1286         } s;
1287         /* struct npc_af_mcamex_bankx_camx_w0_s cn; */
1288 };
1289
1290 static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W0(u64 a, u64 b, u64 c)
1291         __attribute__ ((pure, always_inline));
1292 static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W0(u64 a, u64 b, u64 c)
1293 {
1294         return 0x1000010 + 0x400 * a + 0x40 * b + 8 * c;
1295 }
1296
1297 /**
1298  * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cam#_w1
1299  *
1300  * NPC AF MCAM Entry Bank Data Word 1 Registers MCAM comparison ternary
1301  * data word 1. See NPC_AF_MCAME()_BANK()_CAM()_INTF.
1302  */
1303 union npc_af_mcamex_bankx_camx_w1 {
1304         u64 u;
1305         struct npc_af_mcamex_bankx_camx_w1_s {
1306                 u64 md                               : 48;
1307                 u64 reserved_48_63                   : 16;
1308         } s;
1309         /* struct npc_af_mcamex_bankx_camx_w1_s cn; */
1310 };
1311
1312 static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W1(u64 a, u64 b, u64 c)
1313         __attribute__ ((pure, always_inline));
1314 static inline u64 NPC_AF_MCAMEX_BANKX_CAMX_W1(u64 a, u64 b, u64 c)
1315 {
1316         return 0x1000020 + 0x400 * a + 0x40 * b + 8 * c;
1317 }
1318
1319 /**
1320  * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_cfg
1321  *
1322  * NPC AF MCAM Entry Bank Configuration Registers
1323  */
1324 union npc_af_mcamex_bankx_cfg {
1325         u64 u;
1326         struct npc_af_mcamex_bankx_cfg_s {
1327                 u64 ena                              : 1;
1328                 u64 reserved_1_63                    : 63;
1329         } s;
1330         /* struct npc_af_mcamex_bankx_cfg_s cn; */
1331 };
1332
1333 static inline u64 NPC_AF_MCAMEX_BANKX_CFG(u64 a, u64 b)
1334         __attribute__ ((pure, always_inline));
1335 static inline u64 NPC_AF_MCAMEX_BANKX_CFG(u64 a, u64 b)
1336 {
1337         return 0x1800000 + 0x100 * a + 0x10 * b;
1338 }
1339
1340 /**
1341  * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_stat_act
1342  *
1343  * NPC AF MCAM Entry Bank Statistics Action Registers Used to optionally
1344  * increment a NPC_AF_MATCH_STAT() counter when a packet matches an MCAM
1345  * entry. See also NPC_AF_MCAME()_BANK()_ACTION.
1346  */
1347 union npc_af_mcamex_bankx_stat_act {
1348         u64 u;
1349         struct npc_af_mcamex_bankx_stat_act_s {
1350                 u64 stat_sel                         : 9;
1351                 u64 ena                              : 1;
1352                 u64 reserved_10_63                   : 54;
1353         } s;
1354         /* struct npc_af_mcamex_bankx_stat_act_s cn; */
1355 };
1356
1357 static inline u64 NPC_AF_MCAMEX_BANKX_STAT_ACT(u64 a, u64 b)
1358         __attribute__ ((pure, always_inline));
1359 static inline u64 NPC_AF_MCAMEX_BANKX_STAT_ACT(u64 a, u64 b)
1360 {
1361         return 0x1880000 + 0x100 * a + 0x10 * b;
1362 }
1363
1364 /**
1365  * Register (RVU_PF_BAR0) npc_af_mcame#_bank#_tag_act
1366  *
1367  * NPC AF MCAM Entry Bank VTag Action Data Registers Specifies a packet's
1368  * match Vtag action captured in NPC_RESULT_S[VTAG_ACTION]. See also
1369  * NPC_AF_MCAME()_BANK()_ACTION.
1370  */
1371 union npc_af_mcamex_bankx_tag_act {
1372         u64 u;
1373         struct npc_af_mcamex_bankx_tag_act_s {
1374                 u64 vtag_action                      : 64;
1375         } s;
1376         /* struct npc_af_mcamex_bankx_tag_act_s cn; */
1377 };
1378
1379 static inline u64 NPC_AF_MCAMEX_BANKX_TAG_ACT(u64 a, u64 b)
1380         __attribute__ ((pure, always_inline));
1381 static inline u64 NPC_AF_MCAMEX_BANKX_TAG_ACT(u64 a, u64 b)
1382 {
1383         return 0x1900008 + 0x100 * a + 0x10 * b;
1384 }
1385
1386 /**
1387  * Register (RVU_PF_BAR0) npc_af_pck_cfg
1388  *
1389  * NPC AF Protocol Check Configuration Register
1390  */
1391 union npc_af_pck_cfg {
1392         u64 u;
1393         struct npc_af_pck_cfg_s {
1394                 u64 reserved_0                       : 1;
1395                 u64 iip4_cksum                       : 1;
1396                 u64 oip4_cksum                       : 1;
1397                 u64 reserved_3                       : 1;
1398                 u64 l3b                              : 1;
1399                 u64 l3m                              : 1;
1400                 u64 l2b                              : 1;
1401                 u64 l2m                              : 1;
1402                 u64 reserved_8_23                    : 16;
1403                 u64 iip4_cksum_errcode               : 8;
1404                 u64 oip4_cksum_errcode               : 8;
1405                 u64 reserved_40_63                   : 24;
1406         } s;
1407         /* struct npc_af_pck_cfg_s cn; */
1408 };
1409
1410 static inline u64 NPC_AF_PCK_CFG(void)
1411         __attribute__ ((pure, always_inline));
1412 static inline u64 NPC_AF_PCK_CFG(void)
1413 {
1414         return 0x600;
1415 }
1416
1417 /**
1418  * Register (RVU_PF_BAR0) npc_af_pck_def_iip4
1419  *
1420  * NPC AF Protocol Check Inner IPv4 Definition Register Provides layer
1421  * information used by the protocol checker to identify an inner IPv4
1422  * header.
1423  */
1424 union npc_af_pck_def_iip4 {
1425         u64 u;
1426         struct npc_af_pck_def_iip4_s {
1427                 u64 ltype_mask                       : 4;
1428                 u64 ltype_match                      : 4;
1429                 u64 lid                              : 3;
1430                 u64 reserved_11_63                   : 53;
1431         } s;
1432         /* struct npc_af_pck_def_iip4_s cn; */
1433 };
1434
1435 static inline u64 NPC_AF_PCK_DEF_IIP4(void)
1436         __attribute__ ((pure, always_inline));
1437 static inline u64 NPC_AF_PCK_DEF_IIP4(void)
1438 {
1439         return 0x640;
1440 }
1441
1442 /**
1443  * Register (RVU_PF_BAR0) npc_af_pck_def_oip4
1444  *
1445  * NPC AF Protocol Check Outer IPv4 Definition Register Provides layer
1446  * information used by the protocol checker to identify an outer IPv4
1447  * header.
1448  */
1449 union npc_af_pck_def_oip4 {
1450         u64 u;
1451         struct npc_af_pck_def_oip4_s {
1452                 u64 ltype_mask                       : 4;
1453                 u64 ltype_match                      : 4;
1454                 u64 lid                              : 3;
1455                 u64 reserved_11_63                   : 53;
1456         } s;
1457         /* struct npc_af_pck_def_oip4_s cn; */
1458 };
1459
1460 static inline u64 NPC_AF_PCK_DEF_OIP4(void)
1461         __attribute__ ((pure, always_inline));
1462 static inline u64 NPC_AF_PCK_DEF_OIP4(void)
1463 {
1464         return 0x620;
1465 }
1466
1467 /**
1468  * Register (RVU_PF_BAR0) npc_af_pck_def_oip6
1469  *
1470  * NPC AF Protocol Check Outer IPv6 Definition Register Provides layer
1471  * information used by the protocol checker to identify an outer IPv6
1472  * header. [LID] must have the same value as NPC_AF_PCK_DEF_OIP4[LID].
1473  */
1474 union npc_af_pck_def_oip6 {
1475         u64 u;
1476         struct npc_af_pck_def_oip6_s {
1477                 u64 ltype_mask                       : 4;
1478                 u64 ltype_match                      : 4;
1479                 u64 lid                              : 3;
1480                 u64 reserved_11_63                   : 53;
1481         } s;
1482         /* struct npc_af_pck_def_oip6_s cn; */
1483 };
1484
1485 static inline u64 NPC_AF_PCK_DEF_OIP6(void)
1486         __attribute__ ((pure, always_inline));
1487 static inline u64 NPC_AF_PCK_DEF_OIP6(void)
1488 {
1489         return 0x630;
1490 }
1491
1492 /**
1493  * Register (RVU_PF_BAR0) npc_af_pck_def_ol2
1494  *
1495  * NPC AF Protocol Check Outer L2 Definition Register Provides layer
1496  * information used by the protocol checker to identify an outer L2
1497  * header.
1498  */
1499 union npc_af_pck_def_ol2 {
1500         u64 u;
1501         struct npc_af_pck_def_ol2_s {
1502                 u64 ltype_mask                       : 4;
1503                 u64 ltype_match                      : 4;
1504                 u64 lid                              : 3;
1505                 u64 reserved_11_63                   : 53;
1506         } s;
1507         /* struct npc_af_pck_def_ol2_s cn; */
1508 };
1509
1510 static inline u64 NPC_AF_PCK_DEF_OL2(void)
1511         __attribute__ ((pure, always_inline));
1512 static inline u64 NPC_AF_PCK_DEF_OL2(void)
1513 {
1514         return 0x610;
1515 }
1516
1517 /**
1518  * Register (RVU_PF_BAR0) npc_af_pkind#_action0
1519  *
1520  * NPC AF Port Kind Action Data 0 Registers NPC_AF_PKIND()_ACTION0 and
1521  * NPC_AF_PKIND()_ACTION1 specify the initial parse state and operations
1522  * to perform before entering KPU 0.
1523  */
1524 union npc_af_pkindx_action0 {
1525         u64 u;
1526         struct npc_af_pkindx_action0_s {
1527                 u64 var_len_shift                    : 3;
1528                 u64 var_len_right                    : 1;
1529                 u64 var_len_mask                     : 8;
1530                 u64 var_len_offset                   : 8;
1531                 u64 ptr_advance                      : 8;
1532                 u64 capture_flags                    : 8;
1533                 u64 capture_ltype                    : 4;
1534                 u64 capture_lid                      : 3;
1535                 u64 reserved_43                      : 1;
1536                 u64 next_state                       : 8;
1537                 u64 parse_done                       : 1;
1538                 u64 capture_ena                      : 1;
1539                 u64 byp_count                        : 3;
1540                 u64 reserved_57_63                   : 7;
1541         } s;
1542         /* struct npc_af_pkindx_action0_s cn; */
1543 };
1544
1545 static inline u64 NPC_AF_PKINDX_ACTION0(u64 a)
1546         __attribute__ ((pure, always_inline));
1547 static inline u64 NPC_AF_PKINDX_ACTION0(u64 a)
1548 {
1549         return 0x80000 + 0x40 * a;
1550 }
1551
1552 /**
1553  * Register (RVU_PF_BAR0) npc_af_pkind#_action1
1554  *
1555  * NPC AF Port Kind Action Data 1 Registers NPC_AF_PKIND()_ACTION0 and
1556  * NPC_AF_PKIND()_ACTION1 specify the initial parse state and operations
1557  * to perform before entering KPU 0.
1558  */
1559 union npc_af_pkindx_action1 {
1560         u64 u;
1561         struct npc_af_pkindx_action1_s {
1562                 u64 dp0_offset                       : 8;
1563                 u64 dp1_offset                       : 8;
1564                 u64 dp2_offset                       : 8;
1565                 u64 errcode                          : 8;
1566                 u64 errlev                           : 4;
1567                 u64 reserved_36_63                   : 28;
1568         } s;
1569         /* struct npc_af_pkindx_action1_s cn; */
1570 };
1571
1572 static inline u64 NPC_AF_PKINDX_ACTION1(u64 a)
1573         __attribute__ ((pure, always_inline));
1574 static inline u64 NPC_AF_PKINDX_ACTION1(u64 a)
1575 {
1576         return 0x80008 + 0x40 * a;
1577 }
1578
1579 /**
1580  * Register (RVU_PF_BAR0) npc_af_pkind#_cpi_def#
1581  *
1582  * NPC AF Port Kind Channel Parse Index Definition Registers These
1583  * registers specify the layer information and algorithm to compute a
1584  * packet's channel parse index (CPI), which provides a port to channel
1585  * adder for calculating NPC_RESULT_S[CHAN].  There are two CPI
1586  * definitions per port kind, allowing the CPI computation to use two
1587  * possible layer definitions in the parsed packet, e.g. DiffServ DSCP
1588  * from either IPv4 or IPv6 header.  CPI pseudocode: \<pre\> for (i = 0;
1589  * i \< 2; i++) {    cpi_def = NPC_AF_PKIND()_CPI_DEF(i);    LX = LA, LB,
1590  * ..., or LH as selected by cpi_def[LID];     if (cpi_def[ENA]        &&
1591  * ((cpi_def[LTYPE_MATCH] & cpi_def[LTYPE_MASK])             ==
1592  * (NPC_RESULT_S[LX[LTYPE]] & cpi_def[LTYPE_MASK]))        &&
1593  * ((cpi_def[FLAGS_MATCH] & cpi_def[FLAGS_MASK])             ==
1594  * (NPC_RESULT_S[LX[FLAGS]] & cpi_def[FLAGS_MASK])))    {       // Found
1595  * matching layer       nibble_offset = (2*NPC_RESULT_S[LX[LPTR]]) +
1596  * cpi_def[ADD_OFFSET];       add_byte = byte at nibble_offset from start
1597  * of packet;       cpi_add = (add_byte & cpi_def[ADD_MASK]) \>\>
1598  * cpi_def[ADD_SHIFT];       cpi = cpi_def[CPI_BASE] + cpi_add;
1599  * NPC_RESULT_S[CHAN] += NPC_AF_CPI(cpi)_CFG[PADD];       break;    } }
1600  * \</pre\>
1601  */
1602 union npc_af_pkindx_cpi_defx {
1603         u64 u;
1604         struct npc_af_pkindx_cpi_defx_s {
1605                 u64 cpi_base                         : 10;
1606                 u64 reserved_10_11                   : 2;
1607                 u64 add_shift                        : 3;
1608                 u64 reserved_15                      : 1;
1609                 u64 add_mask                         : 8;
1610                 u64 add_offset                       : 8;
1611                 u64 flags_mask                       : 8;
1612                 u64 flags_match                      : 8;
1613                 u64 ltype_mask                       : 4;
1614                 u64 ltype_match                      : 4;
1615                 u64 lid                              : 3;
1616                 u64 reserved_59_62                   : 4;
1617                 u64 ena                              : 1;
1618         } s;
1619         /* struct npc_af_pkindx_cpi_defx_s cn; */
1620 };
1621
1622 static inline u64 NPC_AF_PKINDX_CPI_DEFX(u64 a, u64 b)
1623         __attribute__ ((pure, always_inline));
1624 static inline u64 NPC_AF_PKINDX_CPI_DEFX(u64 a, u64 b)
1625 {
1626         return 0x80020 + 0x40 * a + 8 * b;
1627 }
1628
1629 #endif /* __CSRS_NPC_H__ */