1 /******************************************************************************* 2 * Copyright 2019-2021 Microchip FPGA Embedded Systems Solutions. 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 * MPFS HAL Embedded Software 7 * 8 */ 9 10 /*************************************************************************** 11 * @file mss_l2_cache.h 12 * @author Microchip-FPGA Embedded Systems Solutions 13 * @brief MACROs defines and prototypes associated with L2 Cache 14 * 15 */ 16 #ifndef MSS_L2_CACHE_H 17 #define MSS_L2_CACHE_H 18 19 #include <stdint.h> 20 #include "encoding.h" 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 /* 27 * The following defines will be present in configurator generated xml Q1 2021 28 * In the interim, you can manually edit if required. 29 */ 30 #if !defined (LIBERO_SETTING_WAY_ENABLE) 31 /*Way indexes less than or equal to this register value may be used by the 32 cache. E.g. set to 0x7, will allocate 8 cache ways, 0-7 to cache, and leave 33 8-15 as LIM. Note 1: Way 0 is always allocated as cache. Note 2: each way is 34 128KB. */ 35 #define LIBERO_SETTING_WAY_ENABLE 0x00000007UL 36 /* WAY_ENABLE [0:8] RW value= 0x7 */ 37 #endif 38 #if !defined (LIBERO_SETTING_WAY_MASK_DMA) 39 /*Way mask register master DMA. Set field to zero to disable way from this 40 master. The available cache ways are 0 to number set in WAY_ENABLE register. If 41 using scratch pad memory, the ways you want reserved for scrathpad are not 42 available for selection, you must set to 0. e.g. If three ways reserved for 43 scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for all 44 masters, so they can not evict the way. */ 45 #define LIBERO_SETTING_WAY_MASK_DMA 0x0000FFFFUL 46 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 47 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 48 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 49 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 50 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 51 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 52 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 53 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 54 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 55 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 56 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 57 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 58 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 59 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 60 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 61 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 62 #endif 63 #if !defined (LIBERO_SETTING_WAY_MASK_AXI4_PORT_0) 64 /*Way mask register master DMA. Set field to zero to disable way from this 65 master. The available cache ways are 0 to number set in WAY_ENABLE register. If 66 using scratch pad memory, the ways you want reserved for scrathpad are not 67 available for selection, you must set to 0. e.g. If three ways reserved for 68 scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for all 69 masters, so they can not evict the way. */ 70 #define LIBERO_SETTING_WAY_MASK_AXI4_PORT_0 0x0000FFFFUL 71 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 72 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 73 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 74 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 75 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 76 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 77 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 78 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 79 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 80 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 81 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 82 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 83 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 84 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 85 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 86 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 87 #endif 88 #if !defined (LIBERO_SETTING_WAY_MASK_AXI4_PORT_1) 89 /*Way mask register master DMA. Set field to zero to disable way from this 90 master. The available cache ways are 0 to number set in WAY_ENABLE register. If 91 using scratch pad memory, the ways you want reserved for scrathpad are not 92 available for selection, you must set to 0. e.g. If three ways reserved for 93 scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for all 94 masters, so they can not evict the way. */ 95 #define LIBERO_SETTING_WAY_MASK_AXI4_PORT_1 0x0000FFFFUL 96 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 97 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 98 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 99 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 100 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 101 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 102 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 103 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 104 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 105 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 106 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 107 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 108 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 109 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 110 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 111 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 112 #endif 113 #if !defined (LIBERO_SETTING_WAY_MASK_AXI4_PORT_2) 114 /*Way mask registerAXI slave port 2. Set field to zero to disable way from this 115 master. The available cache ways are 0 to number set in WAY_ENABLE register. If 116 using scratch pad memory, the ways you want reserved for scrathpad are not 117 available for selection, you must set to 0. e.g. If three ways reserved for 118 scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for all 119 masters, so they can not evict the way. */ 120 #define LIBERO_SETTING_WAY_MASK_AXI4_PORT_2 0x0000FFFFUL 121 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 122 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 123 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 124 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 125 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 126 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 127 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 128 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 129 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 130 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 131 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 132 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 133 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 134 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 135 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 136 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 137 #endif 138 #if !defined (LIBERO_SETTING_WAY_MASK_AXI4_PORT_3) 139 /*Way mask register AXI slave port 3. Set field to 1 to disable way from this 140 master. Set field to zero to disable way from this master. The available cache 141 ways are 0 to number set in WAY_ENABLE register. If using scratch pad memory, 142 the ways you want reserved for scrathpad are not available for selection, you 143 must set to 0. e.g. If three ways reserved for scratchpad, WAY_MASK_0, 144 WAY_MASK_1 and WAY_MASK_2 will be set to zero for all masters, so they can not 145 evict the way. */ 146 #define LIBERO_SETTING_WAY_MASK_AXI4_PORT_3 0x0000FFFFUL 147 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 148 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 149 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 150 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 151 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 152 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 153 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 154 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 155 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 156 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 157 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 158 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 159 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 160 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 161 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 162 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 163 #endif 164 #if !defined (LIBERO_SETTING_WAY_MASK_E51_DCACHE) 165 /*Way mask register E51 data cache (hart0). Set field to zero to disable way 166 from this master. The available cache ways are 0 to number set in WAY_ENABLE 167 register. If using scratch pad memory, the ways you want reserved for scrathpad 168 are not available for selection, you must set to 0. e.g. If three ways reserved 169 for scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for 170 all masters, so they can not evict the way. */ 171 #define LIBERO_SETTING_WAY_MASK_E51_DCACHE 0x0000FFFFUL 172 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 173 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 174 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 175 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 176 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 177 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 178 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 179 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 180 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 181 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 182 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 183 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 184 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 185 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 186 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 187 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 188 #endif 189 #if !defined (LIBERO_SETTING_WAY_MASK_E51_ICACHE) 190 /*Way mask registerE52 instruction cache (hart0). Set field to zero to disable 191 way from this master. The available cache ways are 0 to number set in 192 WAY_ENABLE register. If using scratch pad memory, the ways you want reserved 193 for scrathpad are not available for selection, you must set to 0. e.g. If three 194 ways reserved for scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set 195 to zero for all masters, so they can not evict the way. */ 196 #define LIBERO_SETTING_WAY_MASK_E51_ICACHE 0x0000FFFFUL 197 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 198 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 199 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 200 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 201 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 202 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 203 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 204 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 205 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 206 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 207 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 208 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 209 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 210 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 211 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 212 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 213 #endif 214 #if !defined (LIBERO_SETTING_WAY_MASK_U54_1_DCACHE) 215 /*Way mask register data cache (hart1). Set field to zero to disable way from 216 this master. The available cache ways are 0 to number set in WAY_ENABLE 217 register. If using scratch pad memory, the ways you want reserved for scrathpad 218 are not available for selection, you must set to 0. e.g. If three ways reserved 219 for scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for 220 all masters, so they can not evict the way. */ 221 #define LIBERO_SETTING_WAY_MASK_U54_1_DCACHE 0x0000FFFFUL 222 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 223 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 224 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 225 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 226 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 227 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 228 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 229 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 230 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 231 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 232 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 233 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 234 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 235 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 236 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 237 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 238 #endif 239 #if !defined (LIBERO_SETTING_WAY_MASK_U54_1_ICACHE) 240 /*Way mask register instruction cache (hart1). Set field to zero to disable way 241 from this master. The available cache ways are 0 to number set in WAY_ENABLE 242 register. If using scratch pad memory, the ways you want reserved for scrathpad 243 are not available for selection, you must set to 0. e.g. If three ways reserved 244 for scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for 245 all masters, so they can not evict the way. */ 246 #define LIBERO_SETTING_WAY_MASK_U54_1_ICACHE 0x0000FFFFUL 247 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 248 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 249 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 250 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 251 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 252 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 253 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 254 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 255 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 256 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 257 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 258 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 259 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 260 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 261 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 262 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 263 #endif 264 #if !defined (LIBERO_SETTING_WAY_MASK_U54_2_DCACHE) 265 /*Way mask register data cache (hart2). Set field to 1 to disable way from this 266 master. Set field to zero to disable way from this master. The available cache 267 ways are 0 to number set in WAY_ENABLE register. If using scratch pad memory, 268 the ways you want reserved for scrathpad are not available for selection, you 269 must set to 0. e.g. If three ways reserved for scratchpad, WAY_MASK_0, 270 WAY_MASK_1 and WAY_MASK_2 will be set to zero for all masters, so they can not 271 evict the way. */ 272 #define LIBERO_SETTING_WAY_MASK_U54_2_DCACHE 0x0000FFFFUL 273 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 274 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 275 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 276 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 277 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 278 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 279 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 280 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 281 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 282 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 283 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 284 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 285 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 286 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 287 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 288 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 289 #endif 290 #if !defined (LIBERO_SETTING_WAY_MASK_U54_2_ICACHE) 291 /*Way mask register instruction cache (hart2). Set field to zero to disable way 292 from this master. The available cache ways are 0 to number set in WAY_ENABLE 293 register. If using scratch pad memory, the ways you want reserved for scrathpad 294 are not available for selection, you must set to 0. e.g. If three ways reserved 295 for scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for 296 all masters, so they can not evict the way. */ 297 #define LIBERO_SETTING_WAY_MASK_U54_2_ICACHE 0x0000FFFFUL 298 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 299 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 300 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 301 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 302 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 303 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 304 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 305 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 306 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 307 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 308 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 309 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 310 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 311 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 312 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 313 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 314 #endif 315 #if !defined (LIBERO_SETTING_WAY_MASK_U54_3_DCACHE) 316 /*Way mask register data cache (hart3). Set field to 1 to disable way from this 317 master.Set field to zero to disable way from this master. The available cache 318 ways are 0 to number set in WAY_ENABLE register. If using scratch pad memory, 319 the ways you want reserved for scrathpad are not available for selection, you 320 must set to 0. e.g. If three ways reserved for scratchpad, WAY_MASK_0, 321 WAY_MASK_1 and WAY_MASK_2 will be set to zero for all masters, so they can not 322 evict the way. */ 323 #define LIBERO_SETTING_WAY_MASK_U54_3_DCACHE 0x0000FFFFUL 324 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 325 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 326 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 327 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 328 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 329 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 330 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 331 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 332 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 333 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 334 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 335 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 336 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 337 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 338 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 339 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 340 #endif 341 #if !defined (LIBERO_SETTING_WAY_MASK_U54_3_ICACHE) 342 /*Way mask register instruction cache(hart3). Set field to zero to disable way 343 from this master. The available cache ways are 0 to number set in WAY_ENABLE 344 register. If using scratch pad memory, the ways you want reserved for scrathpad 345 are not available for selection, you must set to 0. e.g. If three ways reserved 346 for scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for 347 all masters, so they can not evict the way. */ 348 #define LIBERO_SETTING_WAY_MASK_U54_3_ICACHE 0x0000FFFFUL 349 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 350 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 351 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 352 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 353 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 354 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 355 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 356 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 357 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 358 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 359 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 360 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 361 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 362 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 363 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 364 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 365 #endif 366 #if !defined (LIBERO_SETTING_WAY_MASK_U54_4_DCACHE) 367 /*Way mask register data cache (hart4). Set field to 1 to disable way from this 368 master. Set field to zero to disable way from this master. The available cache 369 ways are 0 to number set in WAY_ENABLE register. If using scratch pad memory, 370 the ways you want reserved for scrathpad are not available for selection, you 371 must set to 0. e.g. If three ways reserved for scratchpad, WAY_MASK_0, 372 WAY_MASK_1 and WAY_MASK_2 will be set to zero for all masters, so they can not 373 evict the way. */ 374 #define LIBERO_SETTING_WAY_MASK_U54_4_DCACHE 0x0000FFFFUL 375 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 376 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 377 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 378 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 379 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 380 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 381 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 382 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 383 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 384 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 385 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 386 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 387 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 388 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 389 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 390 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 391 #endif 392 #if !defined (LIBERO_SETTING_WAY_MASK_U54_4_ICACHE) 393 /*Way mask register instruction cache (hart4). Set field to zero to disable way 394 from this master. The available cache ways are 0 to number set in WAY_ENABLE 395 register. If using scratch pad memory, the ways you want reserved for scrathpad 396 are not available for selection, you must set to 0. e.g. If three ways reserved 397 for scratchpad, WAY_MASK_0, WAY_MASK_1 and WAY_MASK_2 will be set to zero for 398 all masters, so they can not evict the way. */ 399 #define LIBERO_SETTING_WAY_MASK_U54_4_ICACHE 0x0000FFFFUL 400 /* WAY_MASK_0 [0:1] RW value= 0x1 */ 401 /* WAY_MASK_1 [1:1] RW value= 0x1 */ 402 /* WAY_MASK_2 [2:1] RW value= 0x1 */ 403 /* WAY_MASK_3 [3:1] RW value= 0x1 */ 404 /* WAY_MASK_4 [4:1] RW value= 0x1 */ 405 /* WAY_MASK_5 [5:1] RW value= 0x1 */ 406 /* WAY_MASK_6 [6:1] RW value= 0x1 */ 407 /* WAY_MASK_7 [7:1] RW value= 0x1 */ 408 /* WAY_MASK_8 [8:1] RW value= 0x1 */ 409 /* WAY_MASK_9 [9:1] RW value= 0x1 */ 410 /* WAY_MASK_10 [10:1] RW value= 0x1 */ 411 /* WAY_MASK_11 [11:1] RW value= 0x1 */ 412 /* WAY_MASK_12 [12:1] RW value= 0x1 */ 413 /* WAY_MASK_13 [13:1] RW value= 0x1 */ 414 /* WAY_MASK_14 [14:1] RW value= 0x1 */ 415 /* WAY_MASK_15 [15:1] RW value= 0x1 */ 416 #endif 417 #if !defined (LIBERO_SETTING_NUM_SCRATCH_PAD_WAYS) 418 /*Number of ways reserved for scratchpad. Note 1: This is not a register Note 419 2: each way is 128KB. Note 3: Embedded software expects cache ways allocated 420 for scratchpad start at way 0, and work up. */ 421 #define LIBERO_SETTING_NUM_SCRATCH_PAD_WAYS 0x00000000UL 422 /* NUM_OF_WAYS [0:8] RW value= 0x0 */ 423 #endif 424 425 426 #if !defined (LIBERO_SETTING_L2_SHUTDOWN_CR) 427 /*Number of ways reserved for scratchpad. Note 1: This is not a register Note 428 2: each way is 128KB. Note 3: Embedded software expects cache ways allocated 429 for scratchpad start at way 0, and work up. */ 430 #define LIBERO_SETTING_L2_SHUTDOWN_CR 0x00000000UL 431 /* NUM_OF_WAYS [0:8] RW value= 0x0 */ 432 #endif 433 434 435 436 /*============================================================================== 437 * Define describing cache characteristics. 438 */ 439 #define MAX_WAY_ENABLE 15 440 #define NB_SETS 512 441 #define NB_BANKS 4 442 #define CACHE_BLOCK_BYTE_LENGTH 64 443 #define UINT64_BYTE_LENGTH 8 444 #define WAY_BYTE_LENGTH (CACHE_BLOCK_BYTE_LENGTH * NB_SETS * NB_BANKS) 445 446 #define ZERO_DEVICE_BOTTOM 0x0A000000ULL 447 #define ZERO_DEVICE_TOP 0x0C000000ULL 448 449 #define CACHE_CTRL_BASE 0x02010000ULL 450 451 #define INIT_MARKER 0xC0FFEEBEC0010000ULL 452 453 #define SHUTDOWN_CACHE_CC24_00_07_MASK 0x01 454 #define SHUTDOWN_CACHE_CC24_08_15_MASK 0x02 455 #define SHUTDOWN_CACHE_CC24_16_23_MASK 0x04 456 #define SHUTDOWN_CACHE_CC24_24_31_MASK 0x08 457 458 459 /*============================================================================== 460 * Cache controller registers definitions 461 */ 462 #define RO volatile const 463 #define RW volatile 464 #define WO volatile 465 466 typedef struct { 467 RO uint8_t BANKS; 468 RO uint8_t WAYS; 469 RO uint8_t SETS; 470 RO uint8_t BYTES; 471 } CACHE_CONFIG_typedef; 472 473 typedef struct { 474 CACHE_CONFIG_typedef CONFIG; 475 RO uint32_t RESERVED; 476 RW uint8_t WAY_ENABLE; 477 RO uint8_t RESERVED0[55]; 478 479 RW uint32_t ECC_INJECT_ERROR; 480 RO uint32_t RESERVED1[47]; 481 482 RO uint64_t ECC_DIR_FIX_ADDR; 483 RO uint32_t ECC_DIR_FIX_COUNT; 484 RO uint32_t RESERVED2[13]; 485 486 RO uint64_t ECC_DATA_FIX_ADDR; 487 RO uint32_t ECC_DATA_FIX_COUNT; 488 RO uint32_t RESERVED3[5]; 489 490 RO uint64_t ECC_DATA_FAIL_ADDR; 491 RO uint32_t ECC_DATA_FAIL_COUNT; 492 RO uint32_t RESERVED4[37]; 493 494 WO uint64_t FLUSH64; 495 RO uint64_t RESERVED5[7]; 496 497 WO uint32_t FLUSH32; 498 RO uint32_t RESERVED6[367]; 499 500 RW uint64_t WAY_MASK_DMA; 501 502 RW uint64_t WAY_MASK_AXI4_SLAVE_PORT_0; 503 RW uint64_t WAY_MASK_AXI4_SLAVE_PORT_1; 504 RW uint64_t WAY_MASK_AXI4_SLAVE_PORT_2; 505 RW uint64_t WAY_MASK_AXI4_SLAVE_PORT_3; 506 507 RW uint64_t WAY_MASK_E51_DCACHE; 508 RW uint64_t WAY_MASK_E51_ICACHE; 509 510 RW uint64_t WAY_MASK_U54_1_DCACHE; 511 RW uint64_t WAY_MASK_U54_1_ICACHE; 512 513 RW uint64_t WAY_MASK_U54_2_DCACHE; 514 RW uint64_t WAY_MASK_U54_2_ICACHE; 515 516 RW uint64_t WAY_MASK_U54_3_DCACHE; 517 RW uint64_t WAY_MASK_U54_3_ICACHE; 518 519 RW uint64_t WAY_MASK_U54_4_DCACHE; 520 RW uint64_t WAY_MASK_U54_4_ICACHE; 521 } CACHE_CTRL_typedef; 522 523 #define CACHE_CTRL ((volatile CACHE_CTRL_typedef *) CACHE_CTRL_BASE) 524 525 void config_l2_cache(void); 526 uint8_t check_num_scratch_ways(uint64_t *start, uint64_t *end); 527 528 #ifdef __cplusplus 529 } 530 #endif 531 532 #endif /* MSS_L2_CACHE_H */ 533