1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef MOD_CMN650_H 9 #define MOD_CMN650_H 10 11 #include <fwk_id.h> 12 13 #include <stdbool.h> 14 #include <stddef.h> 15 #include <stdint.h> 16 17 /*! 18 * \addtogroup GroupModules Modules 19 * \{ 20 */ 21 22 /*! 23 * \defgroup GroupModuleCMN650 CMN650 24 * 25 * \brief Arm Coherent Mesh Network (CMN) 650 module 26 * 27 * \details This module adds support for the CMN650 interconnect 28 * \{ 29 */ 30 31 /*! Maximum CCIX Protocol Links supported by CCIX Gateway (CXG) */ 32 #define CMN650_MAX_CCIX_PROTOCOL_LINKS 3 33 34 /*! Maximum RA SAM Address regions */ 35 #define CMN650_MAX_RA_SAM_ADDR_REGION 8 36 37 /*! 38 * \brief Module API indices 39 */ 40 enum mod_cmn650_api_idx { 41 /*! Index of the PPU_V1 power state observer API */ 42 MOD_CMN650_API_IDX_PPU_OBSERVER, 43 44 /*! Number of APIs */ 45 MOD_CMN650_API_COUNT 46 }; 47 48 /*! 49 * \brief Memory region configuration type 50 */ 51 enum mod_cmn650_mem_region_type { 52 /*! Input/Output region (serviced by dedicated HN-I and HN-D nodes) */ 53 MOD_CMN650_MEM_REGION_TYPE_IO, 54 55 /*! 56 * Region backed by the system cache (serviced by all HN-F nodes in the 57 * system) 58 */ 59 MOD_CMN650_MEM_REGION_TYPE_SYSCACHE, 60 61 /*! 62 * Sub region of the system cache for non-hashed access (serviced by 63 * dedicated SN-F nodes). 64 */ 65 MOD_CMN650_REGION_TYPE_SYSCACHE_SUB, 66 67 /*! 68 * Region used for CCIX access (serviced by the CXRA nodes). 69 */ 70 MOD_CMN650_REGION_TYPE_CCIX, 71 }; 72 73 /*! 74 * \brief Memory region map descriptor 75 */ 76 struct mod_cmn650_mem_region_map { 77 /*! Base address */ 78 uint64_t base; 79 80 /*! Region size in bytes */ 81 uint64_t size; 82 83 /*! Region configuration type */ 84 enum mod_cmn650_mem_region_type type; 85 86 /*! 87 * \brief Target node identifier 88 * 89 * \note Not used for ::MOD_CMN650_REGION_TYPE_SYSCACHE_SUB memory 90 * regions as it uses the pool of HN-F nodes available in the system. 91 */ 92 unsigned int node_id; 93 }; 94 95 /*! 96 * \brief Remote Agent to Link ID mapping 97 * 98 * \details Each CCIX Gateway block (CXG) can communicate up to three remote 99 * CCIX protocol links. Each remote agent, identified by their AgentID 100 * (RAID or HAID) will be behind one of these three links. This structure 101 * holds the start and end Agent IDs for each link. The remote AgentID to 102 * LinkID LUT registers (por_{cxg_ra,cxg_ha, 103 * cxla}_agentid_to_linkid_reg<X>) will be configured sequentially from 104 * ::mod_cmn650_agentid_to_linkid_map::remote_agentid_start and 105 * ::mod_cmn650_agentid_to_linkid_map::remote_agentid_end values. For 106 * all three links, corresponding to these remote Agent IDs, HN-F's 107 * RN_PHYS_ID registers will be programmed with the node id of the CXG 108 * Gateway block. 109 * 110 */ 111 struct mod_cmn650_agentid_to_linkid_map { 112 /*! Remote Agent ID start */ 113 unsigned int remote_agentid_start; 114 115 /*! Remote Agent ID end */ 116 unsigned int remote_agentid_end; 117 }; 118 119 /*! 120 * \brief Remote Memory region map descriptor which will be used by CXRA SAM 121 * programming 122 */ 123 struct mod_cmn650_ra_mem_region_map { 124 /*! Base address */ 125 uint64_t base; 126 127 /*! Region size in bytes */ 128 uint64_t size; 129 130 /*! Target HAID of remote CXG gateway for CXRA SAM Address region */ 131 unsigned int remote_haid; 132 }; 133 134 /*! 135 * \brief CCIX Gateway block descriptor 136 * 137 * \details Each CCIX Gateway block (CXG) can have up to eight remote memory map 138 * ::mod_cmn650_ra_mem_region_map descriptors and can have three links 139 * which can target range of remote agent ids. User is expected to assign 140 * an Home AgentID (HAID) ::mod_cmn650_ccix_config::haid for each 141 * logical ids of the CXG blocks. Overall structure of the descriptor is 142 * shown below: 143 * 144 * +----------------------------------------------------------+ 145 * | mod_cmn650_ccix_config<ldid> | 146 * | | 147 * | HAID = haid | 148 * +----------------------------------------------------------+ 149 * | ra_mmap_table0 | agentid_to_linkid_map0| 150 * | | remote_agent_id_start| 151 * | base..base+size --> remote_haid | . | 152 * | | . | 153 * +----------------------------------+ . | 154 * | ra_mmap_table1 | . | 155 * | | remote_agent_id_end | 156 * | base..base+size --> remote_haid | | 157 * | +-----------------------+ 158 * +----------------------------------+ agentid_to_linkid_map1| 159 * | . | remote_agent_id_start| 160 * | . | . | 161 * | . | . | 162 * | . | . | 163 * | . | . | 164 * | . | remote_agent_id_end | 165 * +----------------------------------+ | 166 * | ra_mmap_table6 +-----------------------+ 167 * | | agentid_to_linkid_map2| 168 * | base..base+size --> remote_haid | remote_agent_id_start| 169 * | | . | 170 * +----------------------------------+ . | 171 * | ra_mmap_table7 | . | 172 * | | . | 173 * | base..base+size --> remote_haid | remote_agent_id_end | 174 * | | | 175 * +----------------------------------+-----------------------+ 176 */ 177 struct mod_cmn650_ccix_config { 178 /*! Logical ID of the CXG block to which this configuration applies */ 179 unsigned int ldid; 180 181 /*! Unique HAID in a multi-chip system. This has to be assigned manually */ 182 unsigned int haid; 183 184 /*! Number of remote RN Caching agents. */ 185 unsigned int remote_rnf_count; 186 187 /*! Table of region memory map entries */ 188 const struct mod_cmn650_mem_region_map remote_mmap_table; 189 190 /*! Table of remote region memory map entries */ 191 const struct mod_cmn650_ra_mem_region_map 192 ra_mmap_table[CMN650_MAX_RA_SAM_ADDR_REGION]; 193 194 /*! Number of entries in the ::mod_cmn650_ccix_config::ra_mmap_table */ 195 size_t ra_mmap_count; 196 197 /*! Table of remote agent ids start and end backed by the links */ 198 struct mod_cmn650_agentid_to_linkid_map 199 remote_agentid_to_linkid_map[CMN650_MAX_CCIX_PROTOCOL_LINKS]; 200 201 /*! SMP Mode */ 202 bool smp_mode; 203 204 /*! Port Aggregation Mode */ 205 bool port_aggregate; 206 207 /*! 208 * \brief Logical ID (LDID) of the CCIX Gateway to which port aggregation 209 * pair to be created 210 */ 211 unsigned int port_aggregate_ldid; 212 213 /*! HAID of the CCIX Gateway to which port aggregation pair to be created */ 214 unsigned int port_aggregate_haid; 215 216 /*! 217 * \brief Target HAID of remote CXG gateway for CXRA SAM Address region for 218 * the port aggregated CXG block 219 */ 220 unsigned int port_aggregate_remote_haid[CMN650_MAX_RA_SAM_ADDR_REGION]; 221 }; 222 223 /*! 224 * \brief CMN650 configuration data 225 */ 226 struct mod_cmn650_config { 227 /*! Peripheral base address. */ 228 uintptr_t base; 229 230 /*! Size along x-axis of the interconnect mesh */ 231 unsigned int mesh_size_x; 232 233 /*! Size along y-axis of the interconnect mesh */ 234 unsigned int mesh_size_y; 235 236 /*! Default HN-D node identifier containing the global configuration */ 237 unsigned int hnd_node_id; 238 239 /*! 240 * \brief Table of SN-Fs used as targets for the HN-F nodes 241 * 242 * \details Each entry of this table corresponds to a HN-F node in the 243 * system. The HN-F's logical identifiers are used as indices in this 244 * table 245 */ 246 const unsigned int *snf_table; 247 248 /*! Number of entries in the ::mod_cmn650_config::snf_table */ 249 size_t snf_count; 250 251 /*! Table of region memory map entries */ 252 const struct mod_cmn650_mem_region_map *mmap_table; 253 254 /*! Number of entries in the ::mod_cmn650_config::mmap_table */ 255 size_t mmap_count; 256 257 /*! Table of CCIX configuration */ 258 const struct mod_cmn650_ccix_config *ccix_config_table; 259 260 /*! 261 * \brief Number of entries in the 262 * ::mod_cmn650_config::ccix_config_table table. 263 */ 264 const size_t ccix_table_count; 265 266 /*! Address space size of the chip */ 267 uint64_t chip_addr_space; 268 269 /*! Identifier of the clock that this device depends on */ 270 fwk_id_t clock_id; 271 272 /*! 273 * \brief HN-F with CAL support flag 274 * \details When set to true, enables HN-F with CAL support. This flag will 275 * be used only if HN-F is found to be connected to CAL (When connected 276 * to a CAL port, node id of HN-F will be a odd number). 277 */ 278 bool hnf_cal_mode; 279 }; 280 281 /*! 282 * \} 283 */ 284 285 /*! 286 * \} 287 */ 288 289 #endif /* MOD_CMN650_H */ 290