1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(C) 2019 Marvell International Ltd. 3 */ 4 5 #ifndef __OTX2_RVU_HW_H__ 6 #define __OTX2_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_MSIX_PBAX(a) (0xf0000ull | (uint64_t)(a) << 3) 103 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 #define RVU_BLOCK_TYPE_REE (0xeull) 134 135 #define RVU_BLOCK_ADDR_RVUM (0x0ull) 136 #define RVU_BLOCK_ADDR_LMT (0x1ull) 137 #define RVU_BLOCK_ADDR_NPA (0x3ull) 138 #define RVU_BLOCK_ADDR_NIX0 (0x4ull) 139 #define RVU_BLOCK_ADDR_NIX1 (0x5ull) 140 #define RVU_BLOCK_ADDR_NPC (0x6ull) 141 #define RVU_BLOCK_ADDR_SSO (0x7ull) 142 #define RVU_BLOCK_ADDR_SSOW (0x8ull) 143 #define RVU_BLOCK_ADDR_TIM (0x9ull) 144 #define RVU_BLOCK_ADDR_CPT0 (0xaull) 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 #define RVU_BLOCK_ADDR_REE0 (0x14ull) 151 #define RVU_BLOCK_ADDR_REE1 (0x15ull) 152 153 #define RVU_VF_INT_VEC_MBOX (0x0ull) 154 155 #define RVU_PF_INT_VEC_AFPF_MBOX (0x6ull) 156 #define RVU_PF_INT_VEC_VFFLR0 (0x0ull) 157 #define RVU_PF_INT_VEC_VFFLR1 (0x1ull) 158 #define RVU_PF_INT_VEC_VFME0 (0x2ull) 159 #define RVU_PF_INT_VEC_VFME1 (0x3ull) 160 #define RVU_PF_INT_VEC_VFPF_MBOX0 (0x4ull) 161 #define RVU_PF_INT_VEC_VFPF_MBOX1 (0x5ull) 162 163 164 #define AF_BAR2_ALIASX_SIZE (0x100000ull) 165 166 #define TIM_AF_BAR2_SEL (0x9000000ull) 167 #define SSO_AF_BAR2_SEL (0x9000000ull) 168 #define NIX_AF_BAR2_SEL (0x9000000ull) 169 #define SSOW_AF_BAR2_SEL (0x9000000ull) 170 #define NPA_AF_BAR2_SEL (0x9000000ull) 171 #define CPT_AF_BAR2_SEL (0x9000000ull) 172 #define RVU_AF_BAR2_SEL (0x9000000ull) 173 #define REE_AF_BAR2_SEL (0x9000000ull) 174 175 #define AF_BAR2_ALIASX(a, b) \ 176 (0x9100000ull | (uint64_t)(a) << 12 | (uint64_t)(b)) 177 #define TIM_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(a, b) 178 #define SSO_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(a, b) 179 #define NIX_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(0, b) 180 #define SSOW_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(a, b) 181 #define NPA_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(0, b) 182 #define CPT_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(a, b) 183 #define RVU_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(a, b) 184 #define REE_AF_BAR2_ALIASX(a, b) AF_BAR2_ALIASX(a, b) 185 186 /* Structures definitions */ 187 188 /* RVU admin function register address structure */ 189 struct rvu_af_addr_s { 190 uint64_t addr : 28; 191 uint64_t block : 5; 192 uint64_t rsvd_63_33 : 31; 193 }; 194 195 /* RVU function-unique address structure */ 196 struct rvu_func_addr_s { 197 uint32_t addr : 12; 198 uint32_t lf_slot : 8; 199 uint32_t block : 5; 200 uint32_t rsvd_31_25 : 7; 201 }; 202 203 /* RVU msi-x vector structure */ 204 struct rvu_msix_vec_s { 205 uint64_t addr : 64; /* W0 */ 206 uint64_t data : 32; 207 uint64_t mask : 1; 208 uint64_t pend : 1; 209 uint64_t rsvd_127_98 : 30; 210 }; 211 212 /* RVU pf function identification structure */ 213 struct rvu_pf_func_s { 214 uint16_t func : 10; 215 uint16_t pf : 6; 216 }; 217 218 #endif /* __OTX2_RVU_HW_H__ */ 219