1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2017-2021, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef MOD_CMN600_H 9 #define MOD_CMN600_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 GroupModuleCMN600 CMN600 24 * 25 * \brief Arm Coherent Mesh Network (CMN) 600 module 26 * 27 * \details This module adds support for the CMN600 interconnect 28 * \{ 29 */ 30 31 /*! 32 * \brief Max entries of the Memory Map table 33 * for the Home Agent. 34 */ 35 #define MAX_HA_MMAP_ENTRIES 4 36 37 /*! 38 * \brief Module API indices 39 */ 40 enum mod_cmn600_api_idx { 41 /*! Index of the PPU_V1 power state observer API */ 42 MOD_CMN600_API_IDX_PPU_OBSERVER, 43 44 /*! Index of the CCIX config setup API */ 45 MOD_CMN600_API_IDX_CCIX_CONFIG, 46 47 /*! Number of APIs */ 48 MOD_CMN600_API_COUNT 49 }; 50 51 /*! 52 * \brief Memory region configuration type 53 */ 54 enum mod_cmn600_memory_region_type { 55 /*! Input/Output region (serviced by dedicated HN-I and HN-D nodes) */ 56 MOD_CMN600_MEMORY_REGION_TYPE_IO, 57 58 /*! 59 * Region backed by the system cache (serviced by all HN-F nodes in the 60 * system) 61 */ 62 MOD_CMN600_MEMORY_REGION_TYPE_SYSCACHE, 63 64 /*! 65 * Sub region of the system cache for non-hashed access (serviced by 66 * HN-F nodes). 67 */ 68 MOD_CMN600_REGION_TYPE_SYSCACHE_SUB, 69 70 /*! 71 * Region used for CCIX access. 72 */ 73 MOD_CMN600_REGION_TYPE_CCIX, 74 75 /*! 76 * Non-hash regions in SYSCACHE group. 77 */ 78 MOD_CMN600_REGION_TYPE_SYSCACHE_NONHASH, 79 }; 80 81 /*! 82 * \brief Memory region map descriptor 83 */ 84 struct mod_cmn600_memory_region_map { 85 /*! Base address */ 86 uint64_t base; 87 88 /*! Region size in bytes */ 89 uint64_t size; 90 91 /*! Region configuration type */ 92 enum mod_cmn600_memory_region_type type; 93 94 /*! 95 * \brief Target node identifier 96 * 97 * \note Not used for ::MOD_CMN600_MEMORY_REGION_TYPE_SYSCACHE memory 98 * regions as it uses the pool of HN-F nodes available in the system. 99 */ 100 unsigned int node_id; 101 }; 102 103 /*! 104 * \brief CMN600 configuration data 105 */ 106 struct mod_cmn600_config { 107 /*! Peripheral base address. */ 108 uintptr_t base; 109 110 /*! Size along x-axis of the interconnect mesh */ 111 unsigned int mesh_size_x; 112 113 /*! Size along y-axis of the interconnect mesh */ 114 unsigned int mesh_size_y; 115 116 /*! Default HN-D node identifier containing the global configuration */ 117 unsigned int hnd_node_id; 118 119 /*! 120 * \brief Table of SN-Fs used as targets for the HN-F nodes 121 * 122 * \details Each entry of this table corresponds to a HN-F node in the 123 * system. The HN-F's logical identifiers are used as indices in this 124 * table 125 */ 126 const unsigned int *snf_table; 127 128 /*! Number of entries in the ::mod_cmn600_config::snf_table */ 129 size_t snf_count; 130 131 /*! Host SA count */ 132 unsigned int sa_count; 133 134 /*! Table of region memory map entries */ 135 const struct mod_cmn600_memory_region_map *mmap_table; 136 137 /*! Number of entries in the ::mod_cmn600_config::mmap_table */ 138 size_t mmap_count; 139 140 /*! Address space of the chip */ 141 uint64_t chip_addr_space; 142 143 /*! Identifier of the clock that this device depends on */ 144 fwk_id_t clock_id; 145 146 /*! 147 * \brief HN-F with CAL support flag 148 * \details When set to true, enables HN-F with CAL support. This flag will 149 * be used only if HN-F is found to be connected to CAL (When connected 150 * to a CAL port, node id of HN-F will be a odd number). 151 */ 152 bool hnf_cal_mode; 153 }; 154 155 /*! 156 * \brief CCIX HA memory table entry structure 157 */ 158 struct mod_cmn600_ccix_ha_mmap { 159 160 /*! HA node ID */ 161 uint8_t ha_id; 162 163 /*! Base address */ 164 uint64_t base; 165 166 /*! Region size in bytes */ 167 uint64_t size; 168 }; 169 170 171 /*! 172 * \brief CMN600 CCIX configuration data from remote node 173 */ 174 struct mod_cmn600_ccix_remote_node_config { 175 /*! 176 * Count of remote caching agent (RN-F) that can send request to local HNs 177 */ 178 uint8_t remote_rnf_count; 179 180 /*! Remote SA count */ 181 uint8_t remote_sa_count; 182 183 /*! Remote HA count */ 184 uint8_t remote_ha_count; 185 186 /*! PCIe traffic class used for CCIX Virtual Channel */ 187 uint8_t ccix_tc; 188 189 /*! CCIX message packing flag */ 190 bool ccix_msg_pack_enable; 191 192 /*! PCIe bus number on which CCIX link is enabled */ 193 uint8_t pcie_bus_num; 194 195 /*! CCIX link identifier */ 196 uint8_t ccix_link_id; 197 198 /*! optimised tlp mode */ 199 bool ccix_opt_tlp; 200 201 /*! Remote HA memory map table count */ 202 uint8_t remote_ha_mmap_count; 203 204 /*! SMP mode */ 205 bool smp_mode; 206 207 /*! Remote HA memory map table */ 208 struct mod_cmn600_ccix_ha_mmap remote_ha_mmap[MAX_HA_MMAP_ENTRIES]; 209 210 /*! Max Packet Size */ 211 uint8_t ccix_max_packet_size; 212 }; 213 214 /*! 215 * \brief CMN600 CCIX configuration data from host node 216 */ 217 struct mod_cmn600_ccix_host_node_config { 218 /*! Host RA count */ 219 uint8_t host_ra_count; 220 221 /*! Host SA count */ 222 uint8_t host_sa_count; 223 224 /*! Host HA count */ 225 uint8_t host_ha_count; 226 227 /*! CCIX HA memory map table count for endpoints */ 228 uint8_t ccix_host_mmap_count; 229 230 /*! CCIX HA memory map table for endpoints */ 231 struct mod_cmn600_ccix_ha_mmap ccix_host_mmap[MAX_HA_MMAP_ENTRIES]; 232 233 /*! CCIX Maximum Memory Request send credits from Host */ 234 uint16_t ccix_request_credits; 235 236 /*! CCIX Maximum Snoop send credits from Host */ 237 uint16_t ccix_snoop_credits; 238 239 /*! CCIX Maximum Data send credits from Host */ 240 uint16_t ccix_data_credits; 241 242 /*! Max Packet Size */ 243 uint8_t ccix_max_packet_size; 244 245 /*! CCIX optimised tlp mode capabiltiy of Host */ 246 bool ccix_opt_tlp; 247 248 /*! CCIX message packing flag capability of Host */ 249 bool ccix_msg_pack_enable; 250 }; 251 252 /*! 253 * \brief CMN600 CCIX configuration interface 254 */ 255 struct mod_cmn600_ccix_config_api { 256 /*! 257 * \brief Get the CCIX host configuration 258 * 259 * \param[out] config CCIX host configuration 260 * 261 * \retval ::FWK_SUCCESS if the operation succeed. 262 * \return one of the error code otherwise. 263 */ 264 int (*get_config)(struct mod_cmn600_ccix_host_node_config *config); 265 /*! 266 * \brief set the CCIX endpoint configuration 267 * 268 * \param[in] config CCIX endpoint configuration 269 * 270 * \retval ::FWK_SUCCESS if the operation succeed. 271 * \return one of the error code otherwise. 272 */ 273 int (*set_config)(struct mod_cmn600_ccix_remote_node_config *config); 274 /*! 275 * \brief Interface to trigger the protocol credit exchange 276 * 277 * \param link_id Link on which the protocol credit exchange 278 * would initiate. 279 * 280 * \retval ::FWK_SUCCESS if the operation succeed. 281 * \return one of the error code otherwise. 282 */ 283 int (*exchange_protocol_credit)(uint8_t link_id); 284 /*! 285 * \brief Interface to configure for system coherency 286 * 287 * \param link_id Link on which the coherency has to 288 * be enabled. 289 * 290 * \retval ::FWK_SUCCESS if the operation succeed. 291 * \return one of the error code otherwise. 292 */ 293 int (*enter_system_coherency)(uint8_t link_id); 294 /*! 295 * \brief Interface to enter DVM domain 296 * 297 * \param link_id Link on which DVM domain has to be enabled 298 * 299 * \retval ::FWK_SUCCESS if the operation succeed. 300 * \return one of the error code otherwise. 301 */ 302 int (*enter_dvm_domain)(uint8_t link_id); 303 }; 304 305 /*! 306 * \} 307 */ 308 309 /*! 310 * \} 311 */ 312 313 #endif /* MOD_CMN600_H */ 314