| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* Marvell Octeon EP (EndPoint) Ethernet Driver |
| 3 |
* |
| 4 |
* Copyright (C) 2020 Marvell. |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <linux/bitfield.h> |
| 9 |
|
| 10 |
#ifndef _OCTEP_REGS_CN9K_PF_H_ |
| 11 |
#define _OCTEP_REGS_CN9K_PF_H_ |
| 12 |
|
| 13 |
/* ############################ RST ######################### */ |
| 14 |
#define CN93_RST_BOOT 0x000087E006001600ULL |
| 15 |
#define CN93_RST_CORE_DOMAIN_W1S 0x000087E006001820ULL |
| 16 |
#define CN93_RST_CORE_DOMAIN_W1C 0x000087E006001828ULL |
| 17 |
|
| 18 |
#define CN93_CONFIG_XPANSION_BAR 0x38 |
| 19 |
#define CN93_CONFIG_PCIE_CAP 0x70 |
| 20 |
#define CN93_CONFIG_PCIE_DEVCAP 0x74 |
| 21 |
#define CN93_CONFIG_PCIE_DEVCTL 0x78 |
| 22 |
#define CN93_CONFIG_PCIE_LINKCAP 0x7C |
| 23 |
#define CN93_CONFIG_PCIE_LINKCTL 0x80 |
| 24 |
#define CN93_CONFIG_PCIE_SLOTCAP 0x84 |
| 25 |
#define CN93_CONFIG_PCIE_SLOTCTL 0x88 |
| 26 |
|
| 27 |
#define CN93_PCIE_SRIOV_FDL 0x188 /* 0x98 */ |
| 28 |
#define CN93_PCIE_SRIOV_FDL_BIT_POS 0x10 |
| 29 |
#define CN93_PCIE_SRIOV_FDL_MASK 0xFF |
| 30 |
|
| 31 |
#define CN93_CONFIG_PCIE_FLTMSK 0x720 |
| 32 |
|
| 33 |
/* ################# Offsets of RING, EPF, MAC ######################### */ |
| 34 |
#define CN93_RING_OFFSET (0x1ULL << 17) |
| 35 |
#define CN93_EPF_OFFSET (0x1ULL << 25) |
| 36 |
#define CN93_MAC_OFFSET (0x1ULL << 4) |
| 37 |
#define CN93_BIT_ARRAY_OFFSET (0x1ULL << 4) |
| 38 |
#define CN93_EPVF_RING_OFFSET (0x1ULL << 4) |
| 39 |
|
| 40 |
/* ################# Scratch Registers ######################### */ |
| 41 |
#define CN93_SDP_EPF_SCRATCH 0x205E0 |
| 42 |
|
| 43 |
/* ################# Window Registers ######################### */ |
| 44 |
#define CN93_SDP_WIN_WR_ADDR64 0x20000 |
| 45 |
#define CN93_SDP_WIN_RD_ADDR64 0x20010 |
| 46 |
#define CN93_SDP_WIN_WR_DATA64 0x20020 |
| 47 |
#define CN93_SDP_WIN_WR_MASK_REG 0x20030 |
| 48 |
#define CN93_SDP_WIN_RD_DATA64 0x20040 |
| 49 |
|
| 50 |
#define CN93_SDP_MAC_NUMBER 0x2C100 |
| 51 |
|
| 52 |
/* ################# Global Previliged registers ######################### */ |
| 53 |
#define CN93_SDP_EPF_RINFO 0x205F0 |
| 54 |
|
| 55 |
#define CN93_SDP_EPF_RINFO_SRN(val) ((val) & 0xFF) |
| 56 |
#define CN93_SDP_EPF_RINFO_RPVF(val) (((val) >> 32) & 0xF) |
| 57 |
#define CN93_SDP_EPF_RINFO_NVFS(val) (((val) >> 48) & 0xFF) |
| 58 |
|
| 59 |
/* SDP Function select */ |
| 60 |
#define CN93_SDP_FUNC_SEL_EPF_BIT_POS 8 |
| 61 |
#define CN93_SDP_FUNC_SEL_FUNC_BIT_POS 0 |
| 62 |
|
| 63 |
/* ##### RING IN (Into device from PCI: Tx Ring) REGISTERS #### */ |
| 64 |
#define CN93_SDP_R_IN_CONTROL_START 0x10000 |
| 65 |
#define CN93_SDP_R_IN_ENABLE_START 0x10010 |
| 66 |
#define CN93_SDP_R_IN_INSTR_BADDR_START 0x10020 |
| 67 |
#define CN93_SDP_R_IN_INSTR_RSIZE_START 0x10030 |
| 68 |
#define CN93_SDP_R_IN_INSTR_DBELL_START 0x10040 |
| 69 |
#define CN93_SDP_R_IN_CNTS_START 0x10050 |
| 70 |
#define CN93_SDP_R_IN_INT_LEVELS_START 0x10060 |
| 71 |
#define CN93_SDP_R_IN_PKT_CNT_START 0x10080 |
| 72 |
#define CN93_SDP_R_IN_BYTE_CNT_START 0x10090 |
| 73 |
|
| 74 |
#define CN93_SDP_R_IN_CONTROL(ring) \ |
| 75 |
(CN93_SDP_R_IN_CONTROL_START + ((ring) * CN93_RING_OFFSET)) |
| 76 |
|
| 77 |
#define CN93_SDP_R_IN_ENABLE(ring) \ |
| 78 |
(CN93_SDP_R_IN_ENABLE_START + ((ring) * CN93_RING_OFFSET)) |
| 79 |
|
| 80 |
#define CN93_SDP_R_IN_INSTR_BADDR(ring) \ |
| 81 |
(CN93_SDP_R_IN_INSTR_BADDR_START + ((ring) * CN93_RING_OFFSET)) |
| 82 |
|
| 83 |
#define CN93_SDP_R_IN_INSTR_RSIZE(ring) \ |
| 84 |
(CN93_SDP_R_IN_INSTR_RSIZE_START + ((ring) * CN93_RING_OFFSET)) |
| 85 |
|
| 86 |
#define CN93_SDP_R_IN_INSTR_DBELL(ring) \ |
| 87 |
(CN93_SDP_R_IN_INSTR_DBELL_START + ((ring) * CN93_RING_OFFSET)) |
| 88 |
|
| 89 |
#define CN93_SDP_R_IN_CNTS(ring) \ |
| 90 |
(CN93_SDP_R_IN_CNTS_START + ((ring) * CN93_RING_OFFSET)) |
| 91 |
|
| 92 |
#define CN93_SDP_R_IN_INT_LEVELS(ring) \ |
| 93 |
(CN93_SDP_R_IN_INT_LEVELS_START + ((ring) * CN93_RING_OFFSET)) |
| 94 |
|
| 95 |
#define CN93_SDP_R_IN_PKT_CNT(ring) \ |
| 96 |
(CN93_SDP_R_IN_PKT_CNT_START + ((ring) * CN93_RING_OFFSET)) |
| 97 |
|
| 98 |
#define CN93_SDP_R_IN_BYTE_CNT(ring) \ |
| 99 |
(CN93_SDP_R_IN_BYTE_CNT_START + ((ring) * CN93_RING_OFFSET)) |
| 100 |
|
| 101 |
/* Rings per Virtual Function */ |
| 102 |
#define CN93_R_IN_CTL_RPVF_MASK (0xF) |
| 103 |
#define CN93_R_IN_CTL_RPVF_POS (48) |
| 104 |
|
| 105 |
/* Number of instructions to be read in one MAC read request. |
| 106 |
* setting to Max value(4) |
| 107 |
*/ |
| 108 |
#define CN93_R_IN_CTL_IDLE (0x1ULL << 28) |
| 109 |
#define CN93_R_IN_CTL_RDSIZE (0x3ULL << 25) |
| 110 |
#define CN93_R_IN_CTL_IS_64B (0x1ULL << 24) |
| 111 |
#define CN93_R_IN_CTL_D_NSR (0x1ULL << 8) |
| 112 |
#define CN93_R_IN_CTL_D_ESR (0x1ULL << 6) |
| 113 |
#define CN93_R_IN_CTL_D_ROR (0x1ULL << 5) |
| 114 |
#define CN93_R_IN_CTL_NSR (0x1ULL << 3) |
| 115 |
#define CN93_R_IN_CTL_ESR (0x1ULL << 1) |
| 116 |
#define CN93_R_IN_CTL_ROR (0x1ULL << 0) |
| 117 |
|
| 118 |
#define CN93_R_IN_CTL_MASK (CN93_R_IN_CTL_RDSIZE | CN93_R_IN_CTL_IS_64B) |
| 119 |
|
| 120 |
/* ##### RING OUT (out from device to PCI host: Rx Ring) REGISTERS #### */ |
| 121 |
#define CN93_SDP_R_OUT_CNTS_START 0x10100 |
| 122 |
#define CN93_SDP_R_OUT_INT_LEVELS_START 0x10110 |
| 123 |
#define CN93_SDP_R_OUT_SLIST_BADDR_START 0x10120 |
| 124 |
#define CN93_SDP_R_OUT_SLIST_RSIZE_START 0x10130 |
| 125 |
#define CN93_SDP_R_OUT_SLIST_DBELL_START 0x10140 |
| 126 |
#define CN93_SDP_R_OUT_CONTROL_START 0x10150 |
| 127 |
#define CN93_SDP_R_OUT_ENABLE_START 0x10160 |
| 128 |
#define CN93_SDP_R_OUT_PKT_CNT_START 0x10180 |
| 129 |
#define CN93_SDP_R_OUT_BYTE_CNT_START 0x10190 |
| 130 |
|
| 131 |
#define CN93_SDP_R_OUT_CONTROL(ring) \ |
| 132 |
(CN93_SDP_R_OUT_CONTROL_START + ((ring) * CN93_RING_OFFSET)) |
| 133 |
|
| 134 |
#define CN93_SDP_R_OUT_ENABLE(ring) \ |
| 135 |
(CN93_SDP_R_OUT_ENABLE_START + ((ring) * CN93_RING_OFFSET)) |
| 136 |
|
| 137 |
#define CN93_SDP_R_OUT_SLIST_BADDR(ring) \ |
| 138 |
(CN93_SDP_R_OUT_SLIST_BADDR_START + ((ring) * CN93_RING_OFFSET)) |
| 139 |
|
| 140 |
#define CN93_SDP_R_OUT_SLIST_RSIZE(ring) \ |
| 141 |
(CN93_SDP_R_OUT_SLIST_RSIZE_START + ((ring) * CN93_RING_OFFSET)) |
| 142 |
|
| 143 |
#define CN93_SDP_R_OUT_SLIST_DBELL(ring) \ |
| 144 |
(CN93_SDP_R_OUT_SLIST_DBELL_START + ((ring) * CN93_RING_OFFSET)) |
| 145 |
|
| 146 |
#define CN93_SDP_R_OUT_CNTS(ring) \ |
| 147 |
(CN93_SDP_R_OUT_CNTS_START + ((ring) * CN93_RING_OFFSET)) |
| 148 |
|
| 149 |
#define CN93_SDP_R_OUT_INT_LEVELS(ring) \ |
| 150 |
(CN93_SDP_R_OUT_INT_LEVELS_START + ((ring) * CN93_RING_OFFSET)) |
| 151 |
|
| 152 |
#define CN93_SDP_R_OUT_PKT_CNT(ring) \ |
| 153 |
(CN93_SDP_R_OUT_PKT_CNT_START + ((ring) * CN93_RING_OFFSET)) |
| 154 |
|
| 155 |
#define CN93_SDP_R_OUT_BYTE_CNT(ring) \ |
| 156 |
(CN93_SDP_R_OUT_BYTE_CNT_START + ((ring) * CN93_RING_OFFSET)) |
| 157 |
|
| 158 |
/*------------------ R_OUT Masks ----------------*/ |
| 159 |
#define CN93_R_OUT_INT_LEVELS_BMODE BIT_ULL(63) |
| 160 |
#define CN93_R_OUT_INT_LEVELS_TIMET (32) |
| 161 |
|
| 162 |
#define CN93_R_OUT_CTL_IDLE BIT_ULL(40) |
| 163 |
#define CN93_R_OUT_CTL_ES_I BIT_ULL(34) |
| 164 |
#define CN93_R_OUT_CTL_NSR_I BIT_ULL(33) |
| 165 |
#define CN93_R_OUT_CTL_ROR_I BIT_ULL(32) |
| 166 |
#define CN93_R_OUT_CTL_ES_D BIT_ULL(30) |
| 167 |
#define CN93_R_OUT_CTL_NSR_D BIT_ULL(29) |
| 168 |
#define CN93_R_OUT_CTL_ROR_D BIT_ULL(28) |
| 169 |
#define CN93_R_OUT_CTL_ES_P BIT_ULL(26) |
| 170 |
#define CN93_R_OUT_CTL_NSR_P BIT_ULL(25) |
| 171 |
#define CN93_R_OUT_CTL_ROR_P BIT_ULL(24) |
| 172 |
#define CN93_R_OUT_CTL_IMODE BIT_ULL(23) |
| 173 |
|
| 174 |
/* ############### Interrupt Moderation Registers ############### */ |
| 175 |
#define CN93_SDP_R_IN_INT_MDRT_CTL0_START 0x10280 |
| 176 |
#define CN93_SDP_R_IN_INT_MDRT_CTL1_START 0x102A0 |
| 177 |
#define CN93_SDP_R_IN_INT_MDRT_DBG_START 0x102C0 |
| 178 |
|
| 179 |
#define CN93_SDP_R_OUT_INT_MDRT_CTL0_START 0x10380 |
| 180 |
#define CN93_SDP_R_OUT_INT_MDRT_CTL1_START 0x103A0 |
| 181 |
#define CN93_SDP_R_OUT_INT_MDRT_DBG_START 0x103C0 |
| 182 |
|
| 183 |
#define CN93_SDP_R_IN_INT_MDRT_CTL0(ring) \ |
| 184 |
(CN93_SDP_R_IN_INT_MDRT_CTL0_START + ((ring) * CN93_RING_OFFSET)) |
| 185 |
|
| 186 |
#define CN93_SDP_R_IN_INT_MDRT_CTL1(ring) \ |
| 187 |
(CN93_SDP_R_IN_INT_MDRT_CTL1_START + ((ring) * CN93_RING_OFFSET)) |
| 188 |
|
| 189 |
#define CN93_SDP_R_IN_INT_MDRT_DBG(ring) \ |
| 190 |
(CN93_SDP_R_IN_INT_MDRT_DBG_START + ((ring) * CN93_RING_OFFSET)) |
| 191 |
|
| 192 |
#define CN93_SDP_R_OUT_INT_MDRT_CTL0(ring) \ |
| 193 |
(CN93_SDP_R_OUT_INT_MDRT_CTL0_START + ((ring) * CN93_RING_OFFSET)) |
| 194 |
|
| 195 |
#define CN93_SDP_R_OUT_INT_MDRT_CTL1(ring) \ |
| 196 |
(CN93_SDP_R_OUT_INT_MDRT_CTL1_START + ((ring) * CN93_RING_OFFSET)) |
| 197 |
|
| 198 |
#define CN93_SDP_R_OUT_INT_MDRT_DBG(ring) \ |
| 199 |
(CN93_SDP_R_OUT_INT_MDRT_DBG_START + ((ring) * CN93_RING_OFFSET)) |
| 200 |
|
| 201 |
/* ##################### Mail Box Registers ########################## */ |
| 202 |
/* INT register for VF. when a MBOX write from PF happed to a VF, |
| 203 |
* corresponding bit will be set in this register as well as in |
| 204 |
* PF_VF_INT register. |
| 205 |
* |
| 206 |
* This is a RO register, the int can be cleared by writing 1 to PF_VF_INT |
| 207 |
*/ |
| 208 |
/* Basically first 3 are from PF to VF. The last one is data from VF to PF */ |
| 209 |
#define CN93_SDP_R_MBOX_PF_VF_DATA_START 0x10210 |
| 210 |
#define CN93_SDP_R_MBOX_PF_VF_INT_START 0x10220 |
| 211 |
#define CN93_SDP_R_MBOX_VF_PF_DATA_START 0x10230 |
| 212 |
|
| 213 |
#define CN93_SDP_MBOX_VF_PF_DATA_START 0x24000 |
| 214 |
#define CN93_SDP_MBOX_PF_VF_DATA_START 0x22000 |
| 215 |
|
| 216 |
#define CN93_SDP_R_MBOX_PF_VF_DATA(ring) \ |
| 217 |
(CN93_SDP_R_MBOX_PF_VF_DATA_START + ((ring) * CN93_RING_OFFSET)) |
| 218 |
|
| 219 |
#define CN93_SDP_R_MBOX_PF_VF_INT(ring) \ |
| 220 |
(CN93_SDP_R_MBOX_PF_VF_INT_START + ((ring) * CN93_RING_OFFSET)) |
| 221 |
|
| 222 |
#define CN93_SDP_R_MBOX_VF_PF_DATA(ring) \ |
| 223 |
(CN93_SDP_R_MBOX_VF_PF_DATA_START + ((ring) * CN93_RING_OFFSET)) |
| 224 |
|
| 225 |
#define CN93_SDP_MBOX_VF_PF_DATA(ring) \ |
| 226 |
(CN93_SDP_MBOX_VF_PF_DATA_START + ((ring) * CN93_EPVF_RING_OFFSET)) |
| 227 |
|
| 228 |
#define CN93_SDP_MBOX_PF_VF_DATA(ring) \ |
| 229 |
(CN93_SDP_MBOX_PF_VF_DATA_START + ((ring) * CN93_EPVF_RING_OFFSET)) |
| 230 |
|
| 231 |
/* ##################### Interrupt Registers ########################## */ |
| 232 |
#define CN93_SDP_R_ERR_TYPE_START 0x10400 |
| 233 |
|
| 234 |
#define CN93_SDP_R_ERR_TYPE(ring) \ |
| 235 |
(CN93_SDP_R_ERR_TYPE_START + ((ring) * CN93_RING_OFFSET)) |
| 236 |
|
| 237 |
#define CN93_SDP_R_MBOX_ISM_START 0x10500 |
| 238 |
#define CN93_SDP_R_OUT_CNTS_ISM_START 0x10510 |
| 239 |
#define CN93_SDP_R_IN_CNTS_ISM_START 0x10520 |
| 240 |
|
| 241 |
#define CN93_SDP_R_MBOX_ISM(ring) \ |
| 242 |
(CN93_SDP_R_MBOX_ISM_START + ((ring) * CN93_RING_OFFSET)) |
| 243 |
|
| 244 |
#define CN93_SDP_R_OUT_CNTS_ISM(ring) \ |
| 245 |
(CN93_SDP_R_OUT_CNTS_ISM_START + ((ring) * CN93_RING_OFFSET)) |
| 246 |
|
| 247 |
#define CN93_SDP_R_IN_CNTS_ISM(ring) \ |
| 248 |
(CN93_SDP_R_IN_CNTS_ISM_START + ((ring) * CN93_RING_OFFSET)) |
| 249 |
|
| 250 |
#define CN93_SDP_EPF_MBOX_RINT_START 0x20100 |
| 251 |
#define CN93_SDP_EPF_MBOX_RINT_W1S_START 0x20120 |
| 252 |
#define CN93_SDP_EPF_MBOX_RINT_ENA_W1C_START 0x20140 |
| 253 |
#define CN93_SDP_EPF_MBOX_RINT_ENA_W1S_START 0x20160 |
| 254 |
|
| 255 |
#define CN93_SDP_EPF_VFIRE_RINT_START 0x20180 |
| 256 |
#define CN93_SDP_EPF_VFIRE_RINT_W1S_START 0x201A0 |
| 257 |
#define CN93_SDP_EPF_VFIRE_RINT_ENA_W1C_START 0x201C0 |
| 258 |
#define CN93_SDP_EPF_VFIRE_RINT_ENA_W1S_START 0x201E0 |
| 259 |
|
| 260 |
#define CN93_SDP_EPF_IRERR_RINT 0x20200 |
| 261 |
#define CN93_SDP_EPF_IRERR_RINT_W1S 0x20210 |
| 262 |
#define CN93_SDP_EPF_IRERR_RINT_ENA_W1C 0x20220 |
| 263 |
#define CN93_SDP_EPF_IRERR_RINT_ENA_W1S 0x20230 |
| 264 |
|
| 265 |
#define CN93_SDP_EPF_VFORE_RINT_START 0x20240 |
| 266 |
#define CN93_SDP_EPF_VFORE_RINT_W1S_START 0x20260 |
| 267 |
#define CN93_SDP_EPF_VFORE_RINT_ENA_W1C_START 0x20280 |
| 268 |
#define CN93_SDP_EPF_VFORE_RINT_ENA_W1S_START 0x202A0 |
| 269 |
|
| 270 |
#define CN93_SDP_EPF_ORERR_RINT 0x20320 |
| 271 |
#define CN93_SDP_EPF_ORERR_RINT_W1S 0x20330 |
| 272 |
#define CN93_SDP_EPF_ORERR_RINT_ENA_W1C 0x20340 |
| 273 |
#define CN93_SDP_EPF_ORERR_RINT_ENA_W1S 0x20350 |
| 274 |
|
| 275 |
#define CN93_SDP_EPF_OEI_RINT 0x20360 |
| 276 |
#define CN93_SDP_EPF_OEI_RINT_W1S 0x20370 |
| 277 |
#define CN93_SDP_EPF_OEI_RINT_ENA_W1C 0x20380 |
| 278 |
#define CN93_SDP_EPF_OEI_RINT_ENA_W1S 0x20390 |
| 279 |
|
| 280 |
#define CN93_SDP_EPF_DMA_RINT 0x20400 |
| 281 |
#define CN93_SDP_EPF_DMA_RINT_W1S 0x20410 |
| 282 |
#define CN93_SDP_EPF_DMA_RINT_ENA_W1C 0x20420 |
| 283 |
#define CN93_SDP_EPF_DMA_RINT_ENA_W1S 0x20430 |
| 284 |
|
| 285 |
#define CN93_SDP_EPF_DMA_INT_LEVEL_START 0x20440 |
| 286 |
#define CN93_SDP_EPF_DMA_CNT_START 0x20460 |
| 287 |
#define CN93_SDP_EPF_DMA_TIM_START 0x20480 |
| 288 |
|
| 289 |
#define CN93_SDP_EPF_MISC_RINT 0x204A0 |
| 290 |
#define CN93_SDP_EPF_MISC_RINT_W1S 0x204B0 |
| 291 |
#define CN93_SDP_EPF_MISC_RINT_ENA_W1C 0x204C0 |
| 292 |
#define CN93_SDP_EPF_MISC_RINT_ENA_W1S 0x204D0 |
| 293 |
|
| 294 |
#define CN93_SDP_EPF_DMA_VF_RINT_START 0x204E0 |
| 295 |
#define CN93_SDP_EPF_DMA_VF_RINT_W1S_START 0x20500 |
| 296 |
#define CN93_SDP_EPF_DMA_VF_RINT_ENA_W1C_START 0x20520 |
| 297 |
#define CN93_SDP_EPF_DMA_VF_RINT_ENA_W1S_START 0x20540 |
| 298 |
|
| 299 |
#define CN93_SDP_EPF_PP_VF_RINT_START 0x20560 |
| 300 |
#define CN93_SDP_EPF_PP_VF_RINT_W1S_START 0x20580 |
| 301 |
#define CN93_SDP_EPF_PP_VF_RINT_ENA_W1C_START 0x205A0 |
| 302 |
#define CN93_SDP_EPF_PP_VF_RINT_ENA_W1S_START 0x205C0 |
| 303 |
|
| 304 |
#define CN93_SDP_EPF_MBOX_RINT(index) \ |
| 305 |
(CN93_SDP_EPF_MBOX_RINT_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 306 |
#define CN93_SDP_EPF_MBOX_RINT_W1S(index) \ |
| 307 |
(CN93_SDP_EPF_MBOX_RINT_W1S_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 308 |
#define CN93_SDP_EPF_MBOX_RINT_ENA_W1C(index) \ |
| 309 |
(CN93_SDP_EPF_MBOX_RINT_ENA_W1C_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 310 |
#define CN93_SDP_EPF_MBOX_RINT_ENA_W1S(index) \ |
| 311 |
(CN93_SDP_EPF_MBOX_RINT_ENA_W1S_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 312 |
|
| 313 |
#define CN93_SDP_EPF_VFIRE_RINT(index) \ |
| 314 |
(CN93_SDP_EPF_VFIRE_RINT_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 315 |
#define CN93_SDP_EPF_VFIRE_RINT_W1S(index) \ |
| 316 |
(CN93_SDP_EPF_VFIRE_RINT_W1S_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 317 |
#define CN93_SDP_EPF_VFIRE_RINT_ENA_W1C(index) \ |
| 318 |
(CN93_SDP_EPF_VFIRE_RINT_ENA_W1C_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 319 |
#define CN93_SDP_EPF_VFIRE_RINT_ENA_W1S(index) \ |
| 320 |
(CN93_SDP_EPF_VFIRE_RINT_ENA_W1S_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 321 |
|
| 322 |
#define CN93_SDP_EPF_VFORE_RINT(index) \ |
| 323 |
(CN93_SDP_EPF_VFORE_RINT_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 324 |
#define CN93_SDP_EPF_VFORE_RINT_W1S(index) \ |
| 325 |
(CN93_SDP_EPF_VFORE_RINT_W1S_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 326 |
#define CN93_SDP_EPF_VFORE_RINT_ENA_W1C(index) \ |
| 327 |
(CN93_SDP_EPF_VFORE_RINT_ENA_W1C_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 328 |
#define CN93_SDP_EPF_VFORE_RINT_ENA_W1S(index) \ |
| 329 |
(CN93_SDP_EPF_VFORE_RINT_ENA_W1S_START + ((index) * CN93_BIT_ARRAY_OFFSET)) |
| 330 |
|
| 331 |
#define CN93_SDP_EPF_DMA_VF_RINT(index) \ |
| 332 |
(CN93_SDP_EPF_DMA_VF_RINT_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 333 |
#define CN93_SDP_EPF_DMA_VF_RINT_W1S(index) \ |
| 334 |
(CN93_SDP_EPF_DMA_VF_RINT_W1S_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 335 |
#define CN93_SDP_EPF_DMA_VF_RINT_ENA_W1C(index) \ |
| 336 |
(CN93_SDP_EPF_DMA_VF_RINT_ENA_W1C_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 337 |
#define CN93_SDP_EPF_DMA_VF_RINT_ENA_W1S(index) \ |
| 338 |
(CN93_SDP_EPF_DMA_VF_RINT_ENA_W1S_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 339 |
|
| 340 |
#define CN93_SDP_EPF_PP_VF_RINT(index) \ |
| 341 |
(CN93_SDP_EPF_PP_VF_RINT_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 342 |
#define CN93_SDP_EPF_PP_VF_RINT_W1S(index) \ |
| 343 |
(CN93_SDP_EPF_PP_VF_RINT_W1S_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 344 |
#define CN93_SDP_EPF_PP_VF_RINT_ENA_W1C(index) \ |
| 345 |
(CN93_SDP_EPF_PP_VF_RINT_ENA_W1C_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 346 |
#define CN93_SDP_EPF_PP_VF_RINT_ENA_W1S(index) \ |
| 347 |
(CN93_SDP_EPF_PP_VF_RINT_ENA_W1S_START + ((index) + CN93_BIT_ARRAY_OFFSET)) |
| 348 |
|
| 349 |
/*------------------ Interrupt Masks ----------------*/ |
| 350 |
#define CN93_INTR_R_SEND_ISM BIT_ULL(63) |
| 351 |
#define CN93_INTR_R_OUT_INT BIT_ULL(62) |
| 352 |
#define CN93_INTR_R_IN_INT BIT_ULL(61) |
| 353 |
#define CN93_INTR_R_MBOX_INT BIT_ULL(60) |
| 354 |
#define CN93_INTR_R_RESEND BIT_ULL(59) |
| 355 |
#define CN93_INTR_R_CLR_TIM BIT_ULL(58) |
| 356 |
|
| 357 |
/* ####################### Ring Mapping Registers ################################## */ |
| 358 |
#define CN93_SDP_EPVF_RING_START 0x26000 |
| 359 |
#define CN93_SDP_IN_RING_TB_MAP_START 0x28000 |
| 360 |
#define CN93_SDP_IN_RATE_LIMIT_START 0x2A000 |
| 361 |
#define CN93_SDP_MAC_PF_RING_CTL_START 0x2C000 |
| 362 |
|
| 363 |
#define CN93_SDP_EPVF_RING(ring) \ |
| 364 |
(CN93_SDP_EPVF_RING_START + ((ring) * CN93_EPVF_RING_OFFSET)) |
| 365 |
#define CN93_SDP_IN_RING_TB_MAP(ring) \ |
| 366 |
(CN93_SDP_N_RING_TB_MAP_START + ((ring) * CN93_EPVF_RING_OFFSET)) |
| 367 |
#define CN93_SDP_IN_RATE_LIMIT(ring) \ |
| 368 |
(CN93_SDP_IN_RATE_LIMIT_START + ((ring) * CN93_EPVF_RING_OFFSET)) |
| 369 |
#define CN93_SDP_MAC_PF_RING_CTL(mac) \ |
| 370 |
(CN93_SDP_MAC_PF_RING_CTL_START + ((mac) * CN93_MAC_OFFSET)) |
| 371 |
|
| 372 |
#define CN93_SDP_MAC_PF_RING_CTL_NPFS(val) ((val) & 0xF) |
| 373 |
#define CN93_SDP_MAC_PF_RING_CTL_SRN(val) (((val) >> 8) & 0xFF) |
| 374 |
#define CN93_SDP_MAC_PF_RING_CTL_RPPF(val) (((val) >> 16) & 0x3F) |
| 375 |
|
| 376 |
#define CN98_SDP_MAC_PF_RING_CTL_NPFS(val) (((val) >> 48) & 0xF) |
| 377 |
#define CN98_SDP_MAC_PF_RING_CTL_SRN(val) ((val) & 0xFF) |
| 378 |
#define CN98_SDP_MAC_PF_RING_CTL_RPPF(val) (((val) >> 32) & 0x3F) |
| 379 |
|
| 380 |
/* Number of non-queue interrupts in CN93xx */ |
| 381 |
#define CN93_NUM_NON_IOQ_INTR 16 |
| 382 |
|
| 383 |
/* bit 0 for control mbox interrupt */ |
| 384 |
#define CN93_SDP_EPF_OEI_RINT_DATA_BIT_MBOX BIT_ULL(0) |
| 385 |
/* bit 1 for firmware heartbeat interrupt */ |
| 386 |
#define CN93_SDP_EPF_OEI_RINT_DATA_BIT_HBEAT BIT_ULL(1) |
| 387 |
|
| 388 |
#define FW_STATUS_DOWNING 0ULL |
| 389 |
#define FW_STATUS_RUNNING 2ULL |
| 390 |
|
| 391 |
#define CN9K_PEM_GENMASK BIT_ULL(36) |
| 392 |
#define CN9K_PF_GENMASK GENMASK_ULL(21, 18) |
| 393 |
#define CN9K_PFX_CSX_PFCFGX_SHADOW_BIT BIT_ULL(16) |
| 394 |
#define CN9K_PFX_CSX_PFCFGX_BASE_ADDR (0x8e0000008000ULL) |
| 395 |
#define CN9K_4BYTE_ALIGNED_ADDRESS_OFFSET(offset) ((offset) & BIT_ULL(2)) |
| 396 |
#define CN9K_PEMX_PFX_CSX_PFCFGX cn9k_pemx_pfx_csx_pfcfgx |
| 397 |
|
| 398 |
static inline u64 cn9k_pemx_pfx_csx_pfcfgx(u64 pem, u32 pf, u32 offset) |
| 399 |
{ |
| 400 |
u32 shadow_addr_bit, pf_addr_bits, aligned_offset; |
| 401 |
u64 pem_addr_bits; |
| 402 |
|
| 403 |
pem_addr_bits = FIELD_PREP(CN9K_PEM_GENMASK, pem); |
| 404 |
pf_addr_bits = FIELD_PREP(CN9K_PF_GENMASK, pf); |
| 405 |
shadow_addr_bit = CN9K_PFX_CSX_PFCFGX_SHADOW_BIT & (offset); |
| 406 |
aligned_offset = rounddown((offset), 8); |
| 407 |
|
| 408 |
return (CN9K_PFX_CSX_PFCFGX_BASE_ADDR | pem_addr_bits |
| 409 |
| pf_addr_bits | shadow_addr_bit | aligned_offset) |
| 410 |
+ CN9K_4BYTE_ALIGNED_ADDRESS_OFFSET(offset); |
| 411 |
} |
| 412 |
|
| 413 |
/* Register defines for use with CN9K_PEMX_PFX_CSX_PFCFGX */ |
| 414 |
#define CN9K_PCIEEP_VSECST_CTL 0x4D0 |
| 415 |
|
| 416 |
#define CN93_PEM_BAR4_INDEX 7 |
| 417 |
#define CN93_PEM_BAR4_INDEX_SIZE 0x400000ULL |
| 418 |
#define CN93_PEM_BAR4_INDEX_OFFSET (CN93_PEM_BAR4_INDEX * CN93_PEM_BAR4_INDEX_SIZE) |
| 419 |
#define CN93_INT_ENA_BIT BIT_ULL(62) |
| 420 |
|
| 421 |
#endif /* _OCTEP_REGS_CN9K_PF_H_ */ |