18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * PCE microcode extracted from UGW 7.1.1 switch api 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (c) 2012, 2014, 2015 Lantiq Deutschland GmbH 68c2ecf20Sopenharmony_ci * Copyright (C) 2012 John Crispin <john@phrozen.org> 78c2ecf20Sopenharmony_ci * Copyright (C) 2017 - 2018 Hauke Mehrtens <hauke@hauke-m.de> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cienum { 118c2ecf20Sopenharmony_ci OUT_MAC0 = 0, 128c2ecf20Sopenharmony_ci OUT_MAC1, 138c2ecf20Sopenharmony_ci OUT_MAC2, 148c2ecf20Sopenharmony_ci OUT_MAC3, 158c2ecf20Sopenharmony_ci OUT_MAC4, 168c2ecf20Sopenharmony_ci OUT_MAC5, 178c2ecf20Sopenharmony_ci OUT_ETHTYP, 188c2ecf20Sopenharmony_ci OUT_VTAG0, 198c2ecf20Sopenharmony_ci OUT_VTAG1, 208c2ecf20Sopenharmony_ci OUT_ITAG0, 218c2ecf20Sopenharmony_ci OUT_ITAG1, /*10 */ 228c2ecf20Sopenharmony_ci OUT_ITAG2, 238c2ecf20Sopenharmony_ci OUT_ITAG3, 248c2ecf20Sopenharmony_ci OUT_IP0, 258c2ecf20Sopenharmony_ci OUT_IP1, 268c2ecf20Sopenharmony_ci OUT_IP2, 278c2ecf20Sopenharmony_ci OUT_IP3, 288c2ecf20Sopenharmony_ci OUT_SIP0, 298c2ecf20Sopenharmony_ci OUT_SIP1, 308c2ecf20Sopenharmony_ci OUT_SIP2, 318c2ecf20Sopenharmony_ci OUT_SIP3, /*20*/ 328c2ecf20Sopenharmony_ci OUT_SIP4, 338c2ecf20Sopenharmony_ci OUT_SIP5, 348c2ecf20Sopenharmony_ci OUT_SIP6, 358c2ecf20Sopenharmony_ci OUT_SIP7, 368c2ecf20Sopenharmony_ci OUT_DIP0, 378c2ecf20Sopenharmony_ci OUT_DIP1, 388c2ecf20Sopenharmony_ci OUT_DIP2, 398c2ecf20Sopenharmony_ci OUT_DIP3, 408c2ecf20Sopenharmony_ci OUT_DIP4, 418c2ecf20Sopenharmony_ci OUT_DIP5, /*30*/ 428c2ecf20Sopenharmony_ci OUT_DIP6, 438c2ecf20Sopenharmony_ci OUT_DIP7, 448c2ecf20Sopenharmony_ci OUT_SESID, 458c2ecf20Sopenharmony_ci OUT_PROT, 468c2ecf20Sopenharmony_ci OUT_APP0, 478c2ecf20Sopenharmony_ci OUT_APP1, 488c2ecf20Sopenharmony_ci OUT_IGMP0, 498c2ecf20Sopenharmony_ci OUT_IGMP1, 508c2ecf20Sopenharmony_ci OUT_IPOFF, /*39*/ 518c2ecf20Sopenharmony_ci OUT_NONE = 63, 528c2ecf20Sopenharmony_ci}; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/* parser's microcode length type */ 558c2ecf20Sopenharmony_ci#define INSTR 0 568c2ecf20Sopenharmony_ci#define IPV6 1 578c2ecf20Sopenharmony_ci#define LENACCU 2 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/* parser's microcode flag type */ 608c2ecf20Sopenharmony_cienum { 618c2ecf20Sopenharmony_ci FLAG_ITAG = 0, 628c2ecf20Sopenharmony_ci FLAG_VLAN, 638c2ecf20Sopenharmony_ci FLAG_SNAP, 648c2ecf20Sopenharmony_ci FLAG_PPPOE, 658c2ecf20Sopenharmony_ci FLAG_IPV6, 668c2ecf20Sopenharmony_ci FLAG_IPV6FL, 678c2ecf20Sopenharmony_ci FLAG_IPV4, 688c2ecf20Sopenharmony_ci FLAG_IGMP, 698c2ecf20Sopenharmony_ci FLAG_TU, 708c2ecf20Sopenharmony_ci FLAG_HOP, 718c2ecf20Sopenharmony_ci FLAG_NN1, /*10 */ 728c2ecf20Sopenharmony_ci FLAG_NN2, 738c2ecf20Sopenharmony_ci FLAG_END, 748c2ecf20Sopenharmony_ci FLAG_NO, /*13*/ 758c2ecf20Sopenharmony_ci}; 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_cistruct gswip_pce_microcode { 788c2ecf20Sopenharmony_ci u16 val_3; 798c2ecf20Sopenharmony_ci u16 val_2; 808c2ecf20Sopenharmony_ci u16 val_1; 818c2ecf20Sopenharmony_ci u16 val_0; 828c2ecf20Sopenharmony_ci}; 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_ci#define MC_ENTRY(val, msk, ns, out, len, type, flags, ipv4_len) \ 858c2ecf20Sopenharmony_ci { val, msk, ((ns) << 10 | (out) << 4 | (len) >> 1),\ 868c2ecf20Sopenharmony_ci ((len) & 1) << 15 | (type) << 13 | (flags) << 9 | (ipv4_len) << 8 } 878c2ecf20Sopenharmony_cistatic const struct gswip_pce_microcode gswip_pce_microcode[] = { 888c2ecf20Sopenharmony_ci /* value mask ns fields L type flags ipv4_len */ 898c2ecf20Sopenharmony_ci MC_ENTRY(0x88c3, 0xFFFF, 1, OUT_ITAG0, 4, INSTR, FLAG_ITAG, 0), 908c2ecf20Sopenharmony_ci MC_ENTRY(0x8100, 0xFFFF, 2, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), 918c2ecf20Sopenharmony_ci MC_ENTRY(0x88A8, 0xFFFF, 1, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), 928c2ecf20Sopenharmony_ci MC_ENTRY(0x8100, 0xFFFF, 1, OUT_VTAG0, 2, INSTR, FLAG_VLAN, 0), 938c2ecf20Sopenharmony_ci MC_ENTRY(0x8864, 0xFFFF, 17, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), 948c2ecf20Sopenharmony_ci MC_ENTRY(0x0800, 0xFFFF, 21, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), 958c2ecf20Sopenharmony_ci MC_ENTRY(0x86DD, 0xFFFF, 22, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), 968c2ecf20Sopenharmony_ci MC_ENTRY(0x8863, 0xFFFF, 16, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), 978c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0xF800, 10, OUT_NONE, 0, INSTR, FLAG_NO, 0), 988c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 40, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), 998c2ecf20Sopenharmony_ci MC_ENTRY(0x0600, 0x0600, 40, OUT_ETHTYP, 1, INSTR, FLAG_NO, 0), 1008c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 12, OUT_NONE, 1, INSTR, FLAG_NO, 0), 1018c2ecf20Sopenharmony_ci MC_ENTRY(0xAAAA, 0xFFFF, 14, OUT_NONE, 1, INSTR, FLAG_NO, 0), 1028c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_NO, 0), 1038c2ecf20Sopenharmony_ci MC_ENTRY(0x0300, 0xFF00, 41, OUT_NONE, 0, INSTR, FLAG_SNAP, 0), 1048c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_NO, 0), 1058c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_DIP7, 3, INSTR, FLAG_NO, 0), 1068c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 18, OUT_DIP7, 3, INSTR, FLAG_PPPOE, 0), 1078c2ecf20Sopenharmony_ci MC_ENTRY(0x0021, 0xFFFF, 21, OUT_NONE, 1, INSTR, FLAG_NO, 0), 1088c2ecf20Sopenharmony_ci MC_ENTRY(0x0057, 0xFFFF, 22, OUT_NONE, 1, INSTR, FLAG_NO, 0), 1098c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 40, OUT_NONE, 0, INSTR, FLAG_NO, 0), 1108c2ecf20Sopenharmony_ci MC_ENTRY(0x4000, 0xF000, 24, OUT_IP0, 4, INSTR, FLAG_IPV4, 1), 1118c2ecf20Sopenharmony_ci MC_ENTRY(0x6000, 0xF000, 27, OUT_IP0, 3, INSTR, FLAG_IPV6, 0), 1128c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_NO, 0), 1138c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 25, OUT_IP3, 2, INSTR, FLAG_NO, 0), 1148c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 26, OUT_SIP0, 4, INSTR, FLAG_NO, 0), 1158c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 40, OUT_NONE, 0, LENACCU, FLAG_NO, 0), 1168c2ecf20Sopenharmony_ci MC_ENTRY(0x1100, 0xFF00, 39, OUT_PROT, 1, INSTR, FLAG_NO, 0), 1178c2ecf20Sopenharmony_ci MC_ENTRY(0x0600, 0xFF00, 39, OUT_PROT, 1, INSTR, FLAG_NO, 0), 1188c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_HOP, 0), 1198c2ecf20Sopenharmony_ci MC_ENTRY(0x2B00, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_NN1, 0), 1208c2ecf20Sopenharmony_ci MC_ENTRY(0x3C00, 0xFF00, 33, OUT_IP3, 17, INSTR, FLAG_NN2, 0), 1218c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 39, OUT_PROT, 1, INSTR, FLAG_NO, 0), 1228c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x00E0, 35, OUT_NONE, 0, INSTR, FLAG_NO, 0), 1238c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 40, OUT_NONE, 0, INSTR, FLAG_NO, 0), 1248c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_HOP, 0), 1258c2ecf20Sopenharmony_ci MC_ENTRY(0x2B00, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_NN1, 0), 1268c2ecf20Sopenharmony_ci MC_ENTRY(0x3C00, 0xFF00, 33, OUT_NONE, 0, IPV6, FLAG_NN2, 0), 1278c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 40, OUT_PROT, 1, IPV6, FLAG_NO, 0), 1288c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 40, OUT_SIP0, 16, INSTR, FLAG_NO, 0), 1298c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_APP0, 4, INSTR, FLAG_IGMP, 0), 1308c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1318c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1328c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1338c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1348c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1358c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1368c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1378c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1388c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1398c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1408c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1418c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1428c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1438c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1448c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1458c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1468c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1478c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1488c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1498c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1508c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1518c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1528c2ecf20Sopenharmony_ci MC_ENTRY(0x0000, 0x0000, 41, OUT_NONE, 0, INSTR, FLAG_END, 0), 1538c2ecf20Sopenharmony_ci}; 154