From 0f6c734bbd893fc3b3a9ee38ae373557a20a1056 Mon Sep 17 00:00:00 2001 From: Vijayenthiran Subramaniam Date: Mon, 7 Dec 2020 14:23:16 +0530 Subject: [PATCH] module: rename cmn_rhodes to cmn650 The CMN-650 is the product name given to CMN-Rhodes interconnect. So rename the module and corresponding product usage to reflect the same. Signed-off-by: Vijayenthiran Subramaniam Change-Id: I3e930c61577a6c668274f8ec391b2cdd76c3e4ca --- .../include/internal/cmn650_ctx.h} | 20 +- .../include/mod_cmn650.h} | 80 ++-- module/{cmn_rhodes => cmn650}/src/Makefile | 6 +- .../src/cmn_rhodes.c => cmn650/src/cmn650.c} | 85 ++-- .../src/cmn_rhodes.h => cmn650/src/cmn650.h} | 170 ++++---- .../src/cmn650_ccix.c} | 404 +++++++++--------- module/cmn650/src/cmn650_ccix.h | 96 +++++ .../src/mod_cmn650.c} | 384 +++++++++-------- module/cmn_rhodes/src/cmn_rhodes_ccix.h | 90 ---- product/rdv1/include/scp_css_mmap.h | 2 +- .../{config_cmn_rhodes.c => config_cmn650.c} | 34 +- product/rdv1/scp_ramfw/firmware.mk | 4 +- product/rdv1mc/include/scp_css_mmap.h | 2 +- .../{config_cmn_rhodes.c => config_cmn650.c} | 84 ++-- product/rdv1mc/scp_ramfw/firmware.mk | 4 +- 15 files changed, 743 insertions(+), 722 deletions(-) rename module/{cmn_rhodes/include/internal/cmn_rhodes_ctx.h => cmn650/include/internal/cmn650_ctx.h} (83%) rename module/{cmn_rhodes/include/mod_cmn_rhodes.h => cmn650/include/mod_cmn650.h} (76%) rename module/{cmn_rhodes => cmn650}/src/Makefile (61%) rename module/{cmn_rhodes/src/cmn_rhodes.c => cmn650/src/cmn650.c} (64%) rename module/{cmn_rhodes/src/cmn_rhodes.h => cmn650/src/cmn650.h} (75%) rename module/{cmn_rhodes/src/cmn_rhodes_ccix.c => cmn650/src/cmn650_ccix.c} (60%) create mode 100644 module/cmn650/src/cmn650_ccix.h rename module/{cmn_rhodes/src/mod_cmn_rhodes.c => cmn650/src/mod_cmn650.c} (67%) delete mode 100644 module/cmn_rhodes/src/cmn_rhodes_ccix.h rename product/rdv1/scp_ramfw/{config_cmn_rhodes.c => config_cmn650.c} (79%) rename product/rdv1mc/scp_ramfw/{config_cmn_rhodes.c => config_cmn650.c} (88%) diff --git a/module/cmn_rhodes/include/internal/cmn_rhodes_ctx.h b/module/cmn650/include/internal/cmn650_ctx.h similarity index 83% rename from module/cmn_rhodes/include/internal/cmn_rhodes_ctx.h rename to module/cmn650/include/internal/cmn650_ctx.h index 343a5dd74..9f9fb6d4e 100644 --- a/module/cmn_rhodes/include/internal/cmn_rhodes_ctx.h +++ b/module/cmn650/include/internal/cmn650_ctx.h @@ -5,23 +5,23 @@ * SPDX-License-Identifier: BSD-3-Clause * * Description: - * CMN_RHODES Context structure Interface + * CMN650 Context structure Interface */ -#ifndef INTERNAL_CMN_RHODES_CTX_H -#define INTERNAL_CMN_RHODES_CTX_H +#ifndef INTERNAL_CMN650_CTX_H +#define INTERNAL_CMN650_CTX_H -#include +#include -#include +#include #include #include -struct cmn_rhodes_device_ctx { - const struct mod_cmn_rhodes_config *config; +struct cmn650_device_ctx { + const struct mod_cmn650_config *config; - struct cmn_rhodes_cfgm_reg *root; + struct cmn650_cfgm_reg *root; /* Number of HN-F (system cache) nodes in the system */ unsigned int hnf_count; @@ -45,7 +45,7 @@ struct cmn_rhodes_device_ctx { * parameters are known */ unsigned int internal_rnsam_count; - struct cmn_rhodes_rnsam_reg **internal_rnsam_table; + struct cmn650_rnsam_reg **internal_rnsam_table; /* Count of RN Nodes for the use in CCIX programming */ unsigned int rnd_count; @@ -81,4 +81,4 @@ struct cmn_rhodes_device_ctx { bool initialized; }; -#endif /* INTERNAL_CMN_RHODES_CTX_H */ +#endif /* INTERNAL_CMN650_CTX_H */ diff --git a/module/cmn_rhodes/include/mod_cmn_rhodes.h b/module/cmn650/include/mod_cmn650.h similarity index 76% rename from module/cmn_rhodes/include/mod_cmn_rhodes.h rename to module/cmn650/include/mod_cmn650.h index 4ec33592a..504b799f8 100644 --- a/module/cmn_rhodes/include/mod_cmn_rhodes.h +++ b/module/cmn650/include/mod_cmn650.h @@ -5,8 +5,8 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#ifndef MOD_CMN_RHODES_H -#define MOD_CMN_RHODES_H +#ifndef MOD_CMN650_H +#define MOD_CMN650_H #include @@ -20,60 +20,60 @@ */ /*! - * \defgroup GroupModuleCMN_RHODES CMN_RHODES + * \defgroup GroupModuleCMN650 CMN650 * - * \brief Arm Coherent Mesh Network (CMN) RHODES module + * \brief Arm Coherent Mesh Network (CMN) 650 module * - * \details This module adds support for the CMN_RHODES interconnect + * \details This module adds support for the CMN650 interconnect * \{ */ /*! Maximum CCIX Protocol Links supported by CCIX Gateway (CXG) */ -#define CMN_RHODES_MAX_CCIX_PROTOCOL_LINKS 3 +#define CMN650_MAX_CCIX_PROTOCOL_LINKS 3 /*! Maximum RA SAM Address regions */ -#define CMN_RHODES_MAX_RA_SAM_ADDR_REGION 8 +#define CMN650_MAX_RA_SAM_ADDR_REGION 8 /*! * \brief Module API indices */ -enum mod_cmn_rhodes_api_idx { +enum mod_cmn650_api_idx { /*! Index of the PPU_V1 power state observer API */ - MOD_CMN_RHODES_API_IDX_PPU_OBSERVER, + MOD_CMN650_API_IDX_PPU_OBSERVER, /*! Number of APIs */ - MOD_CMN_RHODES_API_COUNT + MOD_CMN650_API_COUNT }; /*! * \brief Memory region configuration type */ -enum mod_cmn_rhodes_mem_region_type { +enum mod_cmn650_mem_region_type { /*! Input/Output region (serviced by dedicated HN-I and HN-D nodes) */ - MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + MOD_CMN650_MEM_REGION_TYPE_IO, /*! * Region backed by the system cache (serviced by all HN-F nodes in the * system) */ - MOD_CMN_RHODES_MEM_REGION_TYPE_SYSCACHE, + MOD_CMN650_MEM_REGION_TYPE_SYSCACHE, /*! * Sub region of the system cache for non-hashed access (serviced by * dedicated SN-F nodes). */ - MOD_CMN_RHODES_REGION_TYPE_SYSCACHE_SUB, + MOD_CMN650_REGION_TYPE_SYSCACHE_SUB, /*! * Region used for CCIX access (serviced by the CXRA nodes). */ - MOD_CMN_RHODES_REGION_TYPE_CCIX, + MOD_CMN650_REGION_TYPE_CCIX, }; /*! * \brief Memory region map descriptor */ -struct mod_cmn_rhodes_mem_region_map { +struct mod_cmn650_mem_region_map { /*! Base address */ uint64_t base; @@ -81,12 +81,12 @@ struct mod_cmn_rhodes_mem_region_map { uint64_t size; /*! Region configuration type */ - enum mod_cmn_rhodes_mem_region_type type; + enum mod_cmn650_mem_region_type type; /*! * \brief Target node identifier * - * \note Not used for ::MOD_CMN_RHODES_REGION_TYPE_SYSCACHE_SUB memory + * \note Not used for ::MOD_CMN650_REGION_TYPE_SYSCACHE_SUB memory * regions as it uses the pool of HN-F nodes available in the system. */ unsigned int node_id; @@ -101,14 +101,14 @@ struct mod_cmn_rhodes_mem_region_map { * holds the start and end Agent IDs for each link. The remote AgentID to * LinkID LUT registers (por_{cxg_ra,cxg_ha, * cxla}_agentid_to_linkid_reg) will be configured sequentially from - * ::mod_cmn_rhodes_agentid_to_linkid_map::remote_agentid_start and - * ::mod_cmn_rhodes_agentid_to_linkid_map::remote_agentid_end values. For + * ::mod_cmn650_agentid_to_linkid_map::remote_agentid_start and + * ::mod_cmn650_agentid_to_linkid_map::remote_agentid_end values. For * all three links, corresponding to these remote Agent IDs, HN-F's * RN_PHYS_ID registers will be programmed with the node id of the CXG * Gateway block. * */ -struct mod_cmn_rhodes_agentid_to_linkid_map { +struct mod_cmn650_agentid_to_linkid_map { /*! Remote Agent ID start */ unsigned int remote_agentid_start; @@ -120,7 +120,7 @@ struct mod_cmn_rhodes_agentid_to_linkid_map { * \brief Remote Memory region map descriptor which will be used by CXRA SAM * programming */ -struct mod_cmn_rhodes_ra_mem_region_map { +struct mod_cmn650_ra_mem_region_map { /*! Base address */ uint64_t base; @@ -135,14 +135,14 @@ struct mod_cmn_rhodes_ra_mem_region_map { * \brief CCIX Gateway block descriptor * * \details Each CCIX Gateway block (CXG) can have up to eight remote memory map - * ::mod_cmn_rhodes_ra_mem_region_map descriptors and can have three links + * ::mod_cmn650_ra_mem_region_map descriptors and can have three links * which can target range of remote agent ids. User is expected to assign - * an Home AgentID (HAID) ::mod_cmn_rhodes_ccix_config::haid for each + * an Home AgentID (HAID) ::mod_cmn650_ccix_config::haid for each * logical ids of the CXG blocks. Overall structure of the descriptor is * shown below: * * +----------------------------------------------------------+ - * | mod_cmn_rhodes_ccix_config | + * | mod_cmn650_ccix_config | * | | * | HAID = haid | * +----------------------------------------------------------+ @@ -174,7 +174,7 @@ struct mod_cmn_rhodes_ra_mem_region_map { * | | | * +----------------------------------+-----------------------+ */ -struct mod_cmn_rhodes_ccix_config { +struct mod_cmn650_ccix_config { /*! Logical ID of the CXG block to which this configuration applies */ unsigned int ldid; @@ -185,27 +185,27 @@ struct mod_cmn_rhodes_ccix_config { unsigned int remote_rnf_count; /*! Table of region memory map entries */ - const struct mod_cmn_rhodes_mem_region_map remote_mmap_table; + const struct mod_cmn650_mem_region_map remote_mmap_table; /*! Table of remote region memory map entries */ - const struct mod_cmn_rhodes_ra_mem_region_map - ra_mmap_table[CMN_RHODES_MAX_RA_SAM_ADDR_REGION]; + const struct mod_cmn650_ra_mem_region_map + ra_mmap_table[CMN650_MAX_RA_SAM_ADDR_REGION]; - /*! Number of entries in the ::mod_cmn_rhodes_ccix_config::ra_mmap_table */ + /*! Number of entries in the ::mod_cmn650_ccix_config::ra_mmap_table */ size_t ra_mmap_count; /*! Table of remote agent ids start and end backed by the links */ - struct mod_cmn_rhodes_agentid_to_linkid_map - remote_agentid_to_linkid_map[CMN_RHODES_MAX_CCIX_PROTOCOL_LINKS]; + struct mod_cmn650_agentid_to_linkid_map + remote_agentid_to_linkid_map[CMN650_MAX_CCIX_PROTOCOL_LINKS]; /*! SMP Mode */ bool smp_mode; }; /*! - * \brief CMN_RHODES configuration data + * \brief CMN650 configuration data */ -struct mod_cmn_rhodes_config { +struct mod_cmn650_config { /*! Peripheral base address. */ uintptr_t base; @@ -227,21 +227,21 @@ struct mod_cmn_rhodes_config { */ const unsigned int *snf_table; - /*! Number of entries in the ::mod_cmn_rhodes_config::snf_table */ + /*! Number of entries in the ::mod_cmn650_config::snf_table */ size_t snf_count; /*! Table of region memory map entries */ - const struct mod_cmn_rhodes_mem_region_map *mmap_table; + const struct mod_cmn650_mem_region_map *mmap_table; - /*! Number of entries in the ::mod_cmn_rhodes_config::mmap_table */ + /*! Number of entries in the ::mod_cmn650_config::mmap_table */ size_t mmap_count; /*! Table of CCIX configuration */ - const struct mod_cmn_rhodes_ccix_config *ccix_config_table; + const struct mod_cmn650_ccix_config *ccix_config_table; /*! * \brief Number of entries in the - * ::mod_cmn_rhodes_config::ccix_config_table table. + * ::mod_cmn650_config::ccix_config_table table. */ const size_t ccix_table_count; @@ -268,4 +268,4 @@ struct mod_cmn_rhodes_config { * \} */ -#endif /* MOD_CMN_RHODES_H */ +#endif /* MOD_CMN650_H */ diff --git a/module/cmn_rhodes/src/Makefile b/module/cmn650/src/Makefile similarity index 61% rename from module/cmn_rhodes/src/Makefile rename to module/cmn650/src/Makefile index e1be1a7ad..efa5dfbf5 100644 --- a/module/cmn_rhodes/src/Makefile +++ b/module/cmn650/src/Makefile @@ -5,9 +5,9 @@ # SPDX-License-Identifier: BSD-3-Clause # -BS_LIB_NAME := CMN_RHODES +BS_LIB_NAME := CMN650 -BS_LIB_SOURCES = mod_cmn_rhodes.c -BS_LIB_SOURCES += cmn_rhodes.c cmn_rhodes_ccix.c +BS_LIB_SOURCES = mod_cmn650.c +BS_LIB_SOURCES += cmn650.c cmn650_ccix.c include $(BS_DIR)/lib.mk diff --git a/module/cmn_rhodes/src/cmn_rhodes.c b/module/cmn650/src/cmn650.c similarity index 64% rename from module/cmn_rhodes/src/cmn_rhodes.c rename to module/cmn650/src/cmn650.c index 9ad76b2b5..b2639c0b0 100644 --- a/module/cmn_rhodes/src/cmn_rhodes.c +++ b/module/cmn650/src/cmn650.c @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include +#include #include #include @@ -21,27 +21,26 @@ static unsigned int mask_bits; unsigned int get_node_child_count(void *node_base) { struct node_header *node = node_base; - return node->CHILD_INFO & CMN_RHODES_CHILD_INFO_COUNT; + return node->CHILD_INFO & CMN650_CHILD_INFO_COUNT; } enum node_type get_node_type(void *node_base) { struct node_header *node = node_base; - return (enum node_type)(node->NODE_INFO & CMN_RHODES_NODE_INFO_TYPE); + return (enum node_type)(node->NODE_INFO & CMN650_NODE_INFO_TYPE); } unsigned int get_node_id(void *node_base) { struct node_header *node = node_base; - return (node->NODE_INFO & CMN_RHODES_NODE_INFO_ID) >> - CMN_RHODES_NODE_INFO_ID_POS; + return (node->NODE_INFO & CMN650_NODE_INFO_ID) >> CMN650_NODE_INFO_ID_POS; } unsigned int get_node_logical_id(void *node_base) { struct node_header *node = node_base; - return (node->NODE_INFO & CMN_RHODES_NODE_INFO_LOGICAL_ID) >> - CMN_RHODES_NODE_INFO_LOGICAL_ID_POS; + return (node->NODE_INFO & CMN650_NODE_INFO_LOGICAL_ID) >> + CMN650_NODE_INFO_LOGICAL_ID_POS; } void *get_child_node(uintptr_t base, void *node_base, unsigned int child_index) @@ -52,22 +51,21 @@ void *get_child_node(uintptr_t base, void *node_base, unsigned int child_index) void *child_node; child_pointer = node->CHILD_POINTER[child_index]; - offset = child_pointer & CMN_RHODES_CHILD_POINTER_OFFSET; + offset = child_pointer & CMN650_CHILD_POINTER_OFFSET; child_node = (void *)(base + offset); return child_node; } -unsigned int get_child_node_id(void *node_base, - unsigned int child_index) +unsigned int get_child_node_id(void *node_base, unsigned int child_index) { struct node_header *node = node_base; uint32_t node_pointer; unsigned int node_id; node_pointer = (node->CHILD_POINTER[child_index] & - CMN_RHODES_CHILD_POINTER_EXT_NODE_POINTER) >> - CMN_RHODES_CHILD_POINTER_EXT_NODE_POINTER_POS; + CMN650_CHILD_POINTER_EXT_NODE_POINTER) >> + CMN650_CHILD_POINTER_EXT_NODE_POINTER_POS; /* * For mesh widths using 2 bits each for X,Y encoding: @@ -83,8 +81,7 @@ unsigned int get_child_node_id(void *node_base, * NodeID[8:6] = NODE POINTER[11:9] */ node_id = (((node_pointer >> 6) & 0xff) << 3) | - ((node_pointer & 0x1) << 2) | - ((node_pointer >> 2) & 0x3); + ((node_pointer & 0x1) << 2) | ((node_pointer >> 2) & 0x3); return node_id; } @@ -97,15 +94,15 @@ bool is_child_external(void *node_base, unsigned int child_index) bool get_port_number(unsigned int child_node_id) { - return (child_node_id >> CMN_RHODES_NODE_ID_PORT_POS) & - CMN_RHODES_NODE_ID_PORT_MASK; + return (child_node_id >> CMN650_NODE_ID_PORT_POS) & + CMN650_NODE_ID_PORT_MASK; } unsigned int get_device_type(void *mxp_base, bool port) { - struct cmn_rhodes_mxp_reg *mxp = mxp_base; + struct cmn650_mxp_reg *mxp = mxp_base; return mxp->PORT_CONNECT_INFO[port] & - CMN_RHODES_MXP_PORT_CONNECT_INFO_DEVICE_TYPE_MASK; + CMN650_MXP_PORT_CONNECT_INFO_DEVICE_TYPE_MASK; } uint64_t sam_encode_region_size(uint64_t size) @@ -125,7 +122,10 @@ uint64_t sam_encode_region_size(uint64_t size) return result; } -void configure_region(volatile uint64_t *reg, uint64_t base, uint64_t size, +void configure_region( + volatile uint64_t *reg, + uint64_t base, + uint64_t size, enum sam_node_type node_type) { uint64_t value; @@ -133,11 +133,10 @@ void configure_region(volatile uint64_t *reg, uint64_t base, uint64_t size, fwk_assert(reg); fwk_assert((base % size) == 0); - value = CMN_RHODES_RNSAM_REGION_ENTRY_VALID; - value |= node_type << CMN_RHODES_RNSAM_REGION_ENTRY_TYPE_POS; - value |= sam_encode_region_size(size) << - CMN_RHODES_RNSAM_REGION_ENTRY_SIZE_POS; - value |= (base / SAM_GRANULARITY) << CMN_RHODES_RNSAM_REGION_ENTRY_BASE_POS; + value = CMN650_RNSAM_REGION_ENTRY_VALID; + value |= node_type << CMN650_RNSAM_REGION_ENTRY_TYPE_POS; + value |= sam_encode_region_size(size) << CMN650_RNSAM_REGION_ENTRY_SIZE_POS; + value |= (base / SAM_GRANULARITY) << CMN650_RNSAM_REGION_ENTRY_BASE_POS; *reg = value; } @@ -158,7 +157,7 @@ static const char * const type_to_name[] = { [NODE_TYPE_RN_SAM] = "RN-SAM", }; -static const char * const type_to_name_cml[] = { +static const char *const type_to_name_cml[] = { [NODE_TYPE_CXRA - NODE_TYPE_CML_BASE] = "CXRA", [NODE_TYPE_CXHA - NODE_TYPE_CML_BASE] = "CXHA", [NODE_TYPE_CXLA - NODE_TYPE_CML_BASE] = "CXLA", @@ -172,8 +171,7 @@ const char *get_node_type_name(enum node_type node_type) return type_to_name[node_type]; /* CML node IDs */ - if ((node_type >= NODE_TYPE_CML_BASE) && - (node_type <= NODE_TYPE_CXLA)) + if ((node_type >= NODE_TYPE_CML_BASE) && (node_type <= NODE_TYPE_CXLA)) return type_to_name_cml[node_type - NODE_TYPE_CML_BASE]; /* Invalid node IDs */ @@ -183,18 +181,20 @@ const char *get_node_type_name(enum node_type node_type) unsigned int get_node_pos_x(void *node_base) { struct node_header *node = node_base; - return (get_node_id(node) >> (CMN_RHODES_NODE_ID_Y_POS + encoding_bits)) & - mask_bits; + return (get_node_id(node) >> (CMN650_NODE_ID_Y_POS + encoding_bits)) & + mask_bits; } unsigned int get_node_pos_y(void *node_base) { struct node_header *node = node_base; - return (get_node_id(node) >> CMN_RHODES_NODE_ID_Y_POS) & mask_bits; + return (get_node_id(node) >> CMN650_NODE_ID_Y_POS) & mask_bits; } -struct cmn_rhodes_cfgm_reg *get_root_node(uintptr_t base, - unsigned int hnd_node_id, unsigned int mesh_size_x, +struct cmn650_cfgm_reg *get_root_node( + uintptr_t base, + unsigned int hnd_node_id, + unsigned int mesh_size_x, unsigned int mesh_size_y) { unsigned int node_pos_x; @@ -204,23 +204,22 @@ struct cmn_rhodes_cfgm_reg *get_root_node(uintptr_t base, /* * Determine the number of bits used to represent each node coordinate based - * on the mesh size as per CMN_RHODES specification. + * on the mesh size as per CMN650 specification. */ encoding_bits = ((mesh_size_x > 4) || (mesh_size_y > 4)) ? 3 : 2; /* Extract node coordinates from the node identifier */ mask_bits = (1 << encoding_bits) - 1; - node_pos_y = (hnd_node_id >> CMN_RHODES_NODE_ID_Y_POS) & mask_bits; - node_pos_x = (hnd_node_id >> (CMN_RHODES_NODE_ID_Y_POS + encoding_bits)) & - mask_bits; - node_port = (hnd_node_id >> CMN_RHODES_NODE_ID_PORT_POS) & - CMN_RHODES_NODE_ID_PORT_MASK; + node_pos_y = (hnd_node_id >> CMN650_NODE_ID_Y_POS) & mask_bits; + node_pos_x = + (hnd_node_id >> (CMN650_NODE_ID_Y_POS + encoding_bits)) & mask_bits; + node_port = + (hnd_node_id >> CMN650_NODE_ID_PORT_POS) & CMN650_NODE_ID_PORT_MASK; /* Calculate node address offset */ - offset = (node_pos_y << CMN_RHODES_ROOT_NODE_OFFSET_Y_POS) | - (node_pos_x << (CMN_RHODES_ROOT_NODE_OFFSET_Y_POS + - encoding_bits)) | - (node_port << CMN_RHODES_ROOT_NODE_OFFSET_PORT_POS); + offset = (node_pos_y << CMN650_ROOT_NODE_OFFSET_Y_POS) | + (node_pos_x << (CMN650_ROOT_NODE_OFFSET_Y_POS + encoding_bits)) | + (node_port << CMN650_ROOT_NODE_OFFSET_PORT_POS); - return (struct cmn_rhodes_cfgm_reg *)(base + offset); + return (struct cmn650_cfgm_reg *)(base + offset); } diff --git a/module/cmn_rhodes/src/cmn_rhodes.h b/module/cmn650/src/cmn650.h similarity index 75% rename from module/cmn_rhodes/src/cmn_rhodes.h rename to module/cmn650/src/cmn650.h index f56134970..5c640a98f 100644 --- a/module/cmn_rhodes/src/cmn_rhodes.h +++ b/module/cmn650/src/cmn650.h @@ -5,11 +5,11 @@ * SPDX-License-Identifier: BSD-3-Clause * * Description: - * Definitions and utility functions for the CMN RHODES module. + * Definitions and utility functions for the CMN 650 module. */ -#ifndef CMN_RHODES_H -#define CMN_RHODES_H +#ifndef CMN650_H +#define CMN650_H #include @@ -22,38 +22,38 @@ #define MAX_RNI_COUNT 32 #define MAX_RNF_COUNT 64 -/* Maximum System Cache Group regions supported by CMN-Rhodes */ +/* Maximum System Cache Group regions supported by CMN-650 */ #define MAX_SCG_COUNT 4 /* SAM Granularity of RN-SAM and HN-F SAM */ -#define SAM_GRANULARITY (64 * FWK_MIB) +#define SAM_GRANULARITY (64 * FWK_MIB) /* Macros to split 64 bit value two 32 bit values */ -#define HIGH_WORD(x) ((unsigned int)((((x) & 0xFFFFFFFF00000000ULL) >> 32))) -#define LOW_WORD(x) ((unsigned int)((x) & 0xFFFFFFFF)) +#define HIGH_WORD(x) ((unsigned int)((((x)&0xFFFFFFFF00000000ULL) >> 32))) +#define LOW_WORD(x) ((unsigned int)((x)&0xFFFFFFFF)) /* External nodes that require RN-SAM mapping during run-time */ struct external_rnsam_tuple { unsigned int node_id; - struct cmn_rhodes_rnsam_reg *node; + struct cmn650_rnsam_reg *node; }; /* Pair of CCIX Request Agent (CXG_RA) register and its node-id */ struct cxg_ra_reg_tuple { unsigned int node_id; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; }; /* Pair of CCIX Request Agent (CXG_HA) register and its node-id */ struct cxg_ha_reg_tuple { unsigned int node_id; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; }; /* Pair of CCIX Link Agent (CXLA) register and its node-id */ struct cxla_reg_tuple { unsigned int node_id; - struct cmn_rhodes_cxla_reg *cxla_reg; + struct cmn650_cxla_reg *cxla_reg; }; enum node_type { @@ -78,9 +78,9 @@ enum node_type { }; enum device_type { - DEVICE_TYPE_CXHA = 0x11, // 0b10001 - DEVICE_TYPE_CXRA = 0x12, // 0b10010 - DEVICE_TYPE_CXRH = 0x13, // 0b10011 + DEVICE_TYPE_CXHA = 0x11, // 0b10001 + DEVICE_TYPE_CXRA = 0x12, // 0b10010 + DEVICE_TYPE_CXRH = 0x13, // 0b10011 }; /* Common node header */ @@ -102,7 +102,7 @@ enum sam_node_type { /* * Request Node System Address Map (RN-SAM) registers */ -struct cmn_rhodes_rnsam_reg { +struct cmn650_rnsam_reg { FWK_R uint64_t NODE_INFO; uint8_t RESERVED0[0x80 - 0x8]; FWK_R uint64_t CHILD_INFO; @@ -130,7 +130,7 @@ struct cmn_rhodes_rnsam_reg { /* * Fully Coherent Home Node (HN-F) registers */ -struct cmn_rhodes_hnf_reg { +struct cmn650_hnf_reg { FWK_R uint64_t NODE_INFO; uint8_t RESERVED0[0x80 - 0x8]; FWK_R uint64_t CHILD_INFO; @@ -156,7 +156,7 @@ struct cxg_link_regs { /* * CCIX Gateway (CXG) Requesting Agent (RA) registers */ -struct cmn_rhodes_cxg_ra_reg { +struct cmn650_cxg_ra_reg { FWK_R uint64_t CXG_RA_NODE_INFO; uint8_t RESERVED0[0x80-0x8]; FWK_R uint64_t CXG_RA_CHILD_INFO; @@ -189,7 +189,7 @@ struct cmn_rhodes_cxg_ra_reg { /* * CCIX Gateway (CXG) Home Agent (HA) registers */ -struct cmn_rhodes_cxg_ha_reg { +struct cmn650_cxg_ha_reg { FWK_R uint64_t CXG_HA_NODE_INFO; FWK_RW uint64_t CXG_HA_ID; uint8_t RESERVED0[0x80-0x10]; @@ -215,7 +215,7 @@ struct cmn_rhodes_cxg_ha_reg { /* * CCIX Gateway (CXG) Link Agent (LA) registers */ -struct cmn_rhodes_cxla_reg { +struct cmn650_cxla_reg { FWK_R uint64_t CXLA_NODE_INFO; uint8_t RESERVED0[0x80-0x8]; FWK_R uint64_t CXLA_CHILD_INFO; @@ -237,11 +237,10 @@ struct cmn_rhodes_cxla_reg { FWK_RW uint64_t CXLA_PCIE_HDR_FIELDS; }; - /* * Configuration slave registers */ -struct cmn_rhodes_cfgm_reg { +struct cmn650_cfgm_reg { FWK_R uint64_t NODE_INFO; FWK_RW uint64_t PERIPH_ID[4]; FWK_RW uint64_t COMPONENT_ID[2]; @@ -252,7 +251,7 @@ struct cmn_rhodes_cfgm_reg { /* * Crosspoint (XP) registers */ -struct cmn_rhodes_mxp_reg { +struct cmn650_mxp_reg { FWK_R uint64_t NODE_INFO; FWK_R uint64_t PORT_CONNECT_INFO[2]; uint8_t RESERVED0[0x80 - 0x18]; @@ -261,70 +260,70 @@ struct cmn_rhodes_mxp_reg { FWK_R uint64_t CHILD_POINTER[16]; }; -#define CMN_RHODES_NODE_INFO_TYPE UINT64_C(0x000000000000FFFF) -#define CMN_RHODES_NODE_INFO_ID UINT64_C(0x00000000FFFF0000) -#define CMN_RHODES_NODE_INFO_ID_POS 16 -#define CMN_RHODES_NODE_INFO_LOGICAL_ID UINT64_C(0x0000FFFF00000000) -#define CMN_RHODES_NODE_INFO_LOGICAL_ID_POS 32 +#define CMN650_NODE_INFO_TYPE UINT64_C(0x000000000000FFFF) +#define CMN650_NODE_INFO_ID UINT64_C(0x00000000FFFF0000) +#define CMN650_NODE_INFO_ID_POS 16 +#define CMN650_NODE_INFO_LOGICAL_ID UINT64_C(0x0000FFFF00000000) +#define CMN650_NODE_INFO_LOGICAL_ID_POS 32 -#define CMN_RHODES_CHILD_INFO_COUNT UINT64_C(0x000000000000FFFF) +#define CMN650_CHILD_INFO_COUNT UINT64_C(0x000000000000FFFF) -#define CMN_RHODES_CHILD_POINTER_OFFSET UINT64_C(0x000000000FFFFFFF) -#define CMN_RHODES_CHILD_POINTER_EXT UINT64_C(0x0000000080000000) +#define CMN650_CHILD_POINTER_OFFSET UINT64_C(0x000000000FFFFFFF) +#define CMN650_CHILD_POINTER_EXT UINT64_C(0x0000000080000000) /* External child node */ -#define CMN_RHODES_CHILD_POINTER_EXT_REGISTER_OFFSET UINT64_C(0x00003FFF) -#define CMN_RHODES_CHILD_POINTER_EXT_NODE_POINTER UINT64_C(0x3FFF0000) -#define CMN_RHODES_CHILD_POINTER_EXT_NODE_POINTER_POS 16 +#define CMN650_CHILD_POINTER_EXT_REGISTER_OFFSET UINT64_C(0x00003FFF) +#define CMN650_CHILD_POINTER_EXT_NODE_POINTER UINT64_C(0x3FFF0000) +#define CMN650_CHILD_POINTER_EXT_NODE_POINTER_POS 16 /* Used by NON_HASH_MEM_REGIONx and SYS_CACHE_GRP_REGIONx group registers */ -#define CMN_RHODES_RNSAM_REGION_ENTRY_TYPE_POS 2 -#define CMN_RHODES_RNSAM_REGION_ENTRY_SIZE_POS 56 -#define CMN_RHODES_RNSAM_REGION_ENTRY_BASE_POS 26 -#define CMN_RHODES_RNSAM_REGION_ENTRY_BITS_WIDTH 64 -#define CMN_RHODES_RNSAM_REGION_ENTRY_VALID UINT64_C(0x0000000000000001) -#define CMN_RHODES_RNSAM_REGION_ENTRIES_PER_GROUP 1 -#define CMN_RHODES_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP 4 -#define CMN_RHODES_RNSAM_SCG_HNF_CAL_MODE_EN UINT64_C(0x01) -#define CMN_RHODES_RNSAM_SCG_HNF_CAL_MODE_SHIFT 16 - -#define CMN_RHODES_RNSAM_STATUS_UNSTALL UINT64_C(0x0000000000000002) -#define CMN_RHODES_RNSAM_STATUS_DEFAULT_NODEID_POS 48 - -#define CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_BITS_WIDTH 12 -#define CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK UINT64_C(0xFFF) -#define CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP 4 - -#define CMN_RHODES_HNF_SAM_MEMREGION_SIZE_POS 12 -#define CMN_RHODES_HNF_SAM_MEMREGION_BASE_POS 26 -#define CMN_RHODES_HNF_SAM_MEMREGION_VALID UINT64_C(0x8000000000000000) - -#define CMN_RHODES_HNF_CACHE_GROUP_ENTRIES_MAX 64 -#define CMN_RHODES_HNF_CACHE_GROUP_ENTRIES_PER_GROUP 4 -#define CMN_RHODES_HNF_CACHE_GROUP_ENTRY_BITS_WIDTH 12 - -#define CMN_RHODES_PPU_PWPR_POLICY_OFF UINT64_C(0x0000000000000000) -#define CMN_RHODES_PPU_PWPR_POLICY_MEM_RET UINT64_C(0x0000000000000002) -#define CMN_RHODES_PPU_PWPR_POLICY_FUNC_RET UINT64_C(0x000000000000007) -#define CMN_RHODES_PPU_PWPR_POLICY_ON UINT64_C(0x0000000000000008) -#define CMN_RHODES_PPU_PWPR_OPMODE_NOSFSLC UINT64_C(0x0000000000000000) -#define CMN_RHODES_PPU_PWPR_OPMODE_SFONLY UINT64_C(0x0000000000000010) -#define CMN_RHODES_PPU_PWPR_OPMODE_HAM UINT64_C(0x0000000000000020) -#define CMN_RHODES_PPU_PWPR_OPMODE_FAM UINT64_C(0x0000000000000030) -#define CMN_RHODES_PPU_PWPR_DYN_EN UINT64_C(0x0000000000000100) +#define CMN650_RNSAM_REGION_ENTRY_TYPE_POS 2 +#define CMN650_RNSAM_REGION_ENTRY_SIZE_POS 56 +#define CMN650_RNSAM_REGION_ENTRY_BASE_POS 26 +#define CMN650_RNSAM_REGION_ENTRY_BITS_WIDTH 64 +#define CMN650_RNSAM_REGION_ENTRY_VALID UINT64_C(0x0000000000000001) +#define CMN650_RNSAM_REGION_ENTRIES_PER_GROUP 1 +#define CMN650_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP 4 +#define CMN650_RNSAM_SCG_HNF_CAL_MODE_EN UINT64_C(0x01) +#define CMN650_RNSAM_SCG_HNF_CAL_MODE_SHIFT 16 + +#define CMN650_RNSAM_STATUS_UNSTALL UINT64_C(0x0000000000000002) +#define CMN650_RNSAM_STATUS_DEFAULT_NODEID_POS 48 + +#define CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_BITS_WIDTH 12 +#define CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK UINT64_C(0xFFF) +#define CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP 4 + +#define CMN650_HNF_SAM_MEMREGION_SIZE_POS 12 +#define CMN650_HNF_SAM_MEMREGION_BASE_POS 26 +#define CMN650_HNF_SAM_MEMREGION_VALID UINT64_C(0x8000000000000000) + +#define CMN650_HNF_CACHE_GROUP_ENTRIES_MAX 64 +#define CMN650_HNF_CACHE_GROUP_ENTRIES_PER_GROUP 4 +#define CMN650_HNF_CACHE_GROUP_ENTRY_BITS_WIDTH 12 + +#define CMN650_PPU_PWPR_POLICY_OFF UINT64_C(0x0000000000000000) +#define CMN650_PPU_PWPR_POLICY_MEM_RET UINT64_C(0x0000000000000002) +#define CMN650_PPU_PWPR_POLICY_FUNC_RET UINT64_C(0x000000000000007) +#define CMN650_PPU_PWPR_POLICY_ON UINT64_C(0x0000000000000008) +#define CMN650_PPU_PWPR_OPMODE_NOSFSLC UINT64_C(0x0000000000000000) +#define CMN650_PPU_PWPR_OPMODE_SFONLY UINT64_C(0x0000000000000010) +#define CMN650_PPU_PWPR_OPMODE_HAM UINT64_C(0x0000000000000020) +#define CMN650_PPU_PWPR_OPMODE_FAM UINT64_C(0x0000000000000030) +#define CMN650_PPU_PWPR_DYN_EN UINT64_C(0x0000000000000100) /* Mesh and Node ID mapping */ -#define CMN_RHODES_MESH_X_MAX 8 -#define CMN_RHODES_MESH_Y_MAX 8 +#define CMN650_MESH_X_MAX 8 +#define CMN650_MESH_Y_MAX 8 -#define CMN_RHODES_NODE_ID_PORT_POS 2 -#define CMN_RHODES_NODE_ID_PORT_MASK 0x1 -#define CMN_RHODES_NODE_ID_Y_POS 3 +#define CMN650_NODE_ID_PORT_POS 2 +#define CMN650_NODE_ID_PORT_MASK 0x1 +#define CMN650_NODE_ID_Y_POS 3 -#define CMN_RHODES_MXP_PORT_CONNECT_INFO_DEVICE_TYPE_MASK UINT64_C(0x1F) +#define CMN650_MXP_PORT_CONNECT_INFO_DEVICE_TYPE_MASK UINT64_C(0x1F) -#define CMN_RHODES_ROOT_NODE_OFFSET_PORT_POS 16 -#define CMN_RHODES_ROOT_NODE_OFFSET_Y_POS 22 +#define CMN650_ROOT_NODE_OFFSET_PORT_POS 16 +#define CMN650_ROOT_NODE_OFFSET_Y_POS 22 /* * Retrieve the number of child nodes of a given node @@ -403,7 +402,7 @@ unsigned int get_child_node_id(void *node_base, unsigned int child_index); /* * Verify if a child node (given a parent node base and child index) is an - * external node from the CMN RHODES instance point of view. + * external node from the CMN 650 instance point of view. * * \param node_base Pointer to the parent node descriptor * \pre The node pointer must be valid @@ -437,9 +436,9 @@ bool get_port_number(unsigned int child_node_id); unsigned int get_device_type(void *mxp_base, bool port); /* - * Convert a memory region size into a size format used by the CMN RHODES + * Convert a memory region size into a size format used by the CMN 650 * registers. The format is the binary logarithm of the memory region size - * represented as blocks multiple of the CMN RHODES's granularity: + * represented as blocks multiple of the CMN 650's granularity: * n = log2(size / SAM_GRANULARITY) * * \param size Memory region size to be converted @@ -461,7 +460,10 @@ uint64_t sam_encode_region_size(uint64_t size); * * \return None */ -void configure_region(volatile uint64_t *reg, uint64_t base, uint64_t size, +void configure_region( + volatile uint64_t *reg, + uint64_t base, + uint64_t size, enum sam_node_type node_type); /* @@ -495,15 +497,17 @@ unsigned int get_node_pos_y(void *node_base); * Get the root node descriptor based on the peripheral base, HN-D node * identifier and mesh size. * - * \param base CMN RHODES peripheral base address + * \param base CMN 650 peripheral base address * \param hnd_node_id HN-D node identifier containing the global configuration * \param mesh_size_x Size of the mesh along the x-axis * \param mesh_size_y Size of the mesh along the x-axis * * \return Pointer to the root node descriptor */ -struct cmn_rhodes_cfgm_reg *get_root_node(uintptr_t base, - unsigned int hnd_node_id, unsigned int mesh_size_x, +struct cmn650_cfgm_reg *get_root_node( + uintptr_t base, + unsigned int hnd_node_id, + unsigned int mesh_size_x, unsigned int mesh_size_y); -#endif /* CMN_RHODES_H */ +#endif /* CMN650_H */ diff --git a/module/cmn_rhodes/src/cmn_rhodes_ccix.c b/module/cmn650/src/cmn650_ccix.c similarity index 60% rename from module/cmn_rhodes/src/cmn_rhodes_ccix.c rename to module/cmn650/src/cmn650_ccix.c index 898511f74..7cd59a863 100644 --- a/module/cmn_rhodes/src/cmn_rhodes_ccix.c +++ b/module/cmn650/src/cmn650_ccix.c @@ -5,38 +5,38 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include +#include +#include -#include +#include #include #include -#include #include +#include -#define MOD_NAME "[CMN_RHODES_CCIX] " +#define MOD_NAME "[CMN650_CCIX] " /* RAID value common to all function */ static uint8_t raid_value; /* Pointer to the current CCIX configuration data */ -static const struct mod_cmn_rhodes_ccix_config *config; +static const struct mod_cmn650_ccix_config *config; static bool cxg_link_wait_condition(void *data) { uint64_t val1; uint64_t val2; uint8_t linkid; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; fwk_assert(data != NULL); struct cxg_wait_condition_data *wait_data = (struct cxg_wait_condition_data *)data; - struct cmn_rhodes_device_ctx *ctx = wait_data->ctx; + struct cmn650_device_ctx *ctx = wait_data->ctx; linkid = wait_data->linkid; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; @@ -46,38 +46,44 @@ static bool cxg_link_wait_condition(void *data) case CXG_LINK_CTRL_EN_BIT_SET: val1 = cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL; val2 = cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL; - return (((val1 & CXG_LINK_CTRL_EN_MASK) && - (val2 & CXG_LINK_CTRL_EN_MASK)) != 0); + return ( + ((val1 & CXG_LINK_CTRL_EN_MASK) && + (val2 & CXG_LINK_CTRL_EN_MASK)) != 0); case CXG_LINK_CTRL_UP_BIT_CLR: val1 = cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL; val2 = cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL; - return ((((val1 & CXG_LINK_CTRL_UP_MASK) == 0) && - ((val2 & CXG_LINK_CTRL_UP_MASK) == 0)) != 0); + return ( + (((val1 & CXG_LINK_CTRL_UP_MASK) == 0) && + ((val2 & CXG_LINK_CTRL_UP_MASK) == 0)) != 0); case CXG_LINK_STATUS_DWN_BIT_SET: val1 = cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; val2 = cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; - return (((val1 & CXG_LINK_STATUS_DOWN_MASK) && - (val2 & CXG_LINK_STATUS_DOWN_MASK)) != 0); + return ( + ((val1 & CXG_LINK_STATUS_DOWN_MASK) && + (val2 & CXG_LINK_STATUS_DOWN_MASK)) != 0); case CXG_LINK_STATUS_DWN_BIT_CLR: val1 = cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; val2 = cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; - return ((((val1 & CXG_LINK_STATUS_DOWN_MASK) == 0) && - ((val2 & CXG_LINK_STATUS_DOWN_MASK) == 0)) != 0); + return ( + (((val1 & CXG_LINK_STATUS_DOWN_MASK) == 0) && + ((val2 & CXG_LINK_STATUS_DOWN_MASK) == 0)) != 0); case CXG_LINK_STATUS_ACK_BIT_SET: val1 = cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; val2 = cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; - return (((val1 & CXG_LINK_STATUS_ACK_MASK) && - (val2 & CXG_LINK_STATUS_ACK_MASK)) != 0); + return ( + ((val1 & CXG_LINK_STATUS_ACK_MASK) && + (val2 & CXG_LINK_STATUS_ACK_MASK)) != 0); case CXG_LINK_STATUS_ACK_BIT_CLR: val1 = cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; val2 = cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; - return ((((val1 & CXG_LINK_STATUS_ACK_MASK) == 0) && - ((val2 & CXG_LINK_STATUS_ACK_MASK) == 0)) != 0); + return ( + (((val1 & CXG_LINK_STATUS_ACK_MASK) == 0) && + ((val2 & CXG_LINK_STATUS_ACK_MASK) == 0)) != 0); case CXG_LINK_STATUS_HA_DVMDOMAIN_ACK_BIT_SET: val1 = cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_STATUS; @@ -94,11 +100,13 @@ static bool cxg_link_wait_condition(void *data) } static void program_cxg_ra_rnf_ldid_to_raid_reg( - struct cmn_rhodes_device_ctx *ctx, uint8_t ldid_value, uint8_t raid) + struct cmn650_device_ctx *ctx, + uint8_t ldid_value, + uint8_t raid) { uint32_t reg_offset = 0; uint32_t ldid_value_offset = 0; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; @@ -118,11 +126,13 @@ static void program_cxg_ra_rnf_ldid_to_raid_reg( } static void program_cxg_ra_rni_ldid_to_raid_reg( - struct cmn_rhodes_device_ctx * ctx, uint8_t ldid_value, uint8_t raid) + struct cmn650_device_ctx *ctx, + uint8_t ldid_value, + uint8_t raid) { uint32_t reg_offset = 0; uint32_t ldid_value_offset = 0; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; @@ -132,8 +142,7 @@ static void program_cxg_ra_rni_ldid_to_raid_reg( /* Adding raid_value into LDID-to-RAID register */ cxg_ra_reg->CXG_RA_RNI_LDID_TO_RAID_REG[reg_offset] |= - ((uint64_t)raid << - (ldid_value_offset * NUM_BITS_RESERVED_FOR_RAID)); + ((uint64_t)raid << (ldid_value_offset * NUM_BITS_RESERVED_FOR_RAID)); /* Set corresponding valid bit */ cxg_ra_reg->CXG_RA_RNI_LDID_TO_RAID_VAL |= ((uint64_t)0x1 << ldid_value); @@ -143,11 +152,13 @@ static void program_cxg_ra_rni_ldid_to_raid_reg( } static void program_cxg_ra_rnd_ldid_to_raid_reg( - struct cmn_rhodes_device_ctx *ctx, uint8_t ldid_value, uint8_t raid) + struct cmn650_device_ctx *ctx, + uint8_t ldid_value, + uint8_t raid) { uint32_t reg_offset = 0; uint32_t ldid_value_offset = 0; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; @@ -157,8 +168,7 @@ static void program_cxg_ra_rnd_ldid_to_raid_reg( /* Adding raid_value into LDID-to-RAID register */ cxg_ra_reg->CXG_RA_RND_LDID_TO_RAID_REG[reg_offset] |= - ((uint64_t)raid << - (ldid_value_offset * NUM_BITS_RESERVED_FOR_RAID)); + ((uint64_t)raid << (ldid_value_offset * NUM_BITS_RESERVED_FOR_RAID)); /* Set corresponding valid bit */ cxg_ra_reg->CXG_RA_RND_LDID_TO_RAID_VAL |= ((uint64_t)0x1 << ldid_value); @@ -168,16 +178,16 @@ static void program_cxg_ra_rnd_ldid_to_raid_reg( } static void program_agentid_to_linkid_reg( - struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *config) + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *config) { uint32_t agentid; uint32_t reg_index = 0; uint8_t linkid = 0; uint32_t agentid_bit_offset = 0; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; - struct cmn_rhodes_cxla_reg *cxla_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxla_reg *cxla_reg; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; cxg_ha_reg = ctx->cxg_ha_reg_table[config->ldid].cxg_ha_reg; cxla_reg = ctx->cxla_reg_table[config->ldid].cxla_reg; @@ -185,7 +195,7 @@ static void program_agentid_to_linkid_reg( unsigned int remote_agentid_start; unsigned int remote_agentid_end; - for (linkid = 0; linkid < CMN_RHODES_MAX_CCIX_PROTOCOL_LINKS; linkid++) { + for (linkid = 0; linkid < CMN650_MAX_CCIX_PROTOCOL_LINKS; linkid++) { remote_agentid_start = config->remote_agentid_to_linkid_map[linkid].remote_agentid_start; remote_agentid_end = @@ -199,29 +209,29 @@ static void program_agentid_to_linkid_reg( continue; FWK_LOG_INFO( - MOD_NAME " Remote [AgentID %d - AgentID %d] Link %d", - remote_agentid_start, - remote_agentid_end, - linkid); + MOD_NAME " Remote [AgentID %d - AgentID %d] Link %d", + remote_agentid_start, + remote_agentid_end, + linkid); for (agentid = remote_agentid_start; agentid <= remote_agentid_end; - agentid++) { + agentid++) { /* Each register is 64 bits and holds 8 AgentID/LinkID mappings */ reg_index = agentid / 8; agentid_bit_offset = agentid % 8; /* Writing AgentID-to-LinkID mappings */ cxg_ra_reg->CXG_RA_AGENTID_TO_LINKID_REG[reg_index] |= - ((uint64_t)linkid << - (agentid_bit_offset * NUM_BITS_RESERVED_FOR_LINKID)); + ((uint64_t)linkid + << (agentid_bit_offset * NUM_BITS_RESERVED_FOR_LINKID)); cxg_ha_reg->CXG_HA_AGENTID_TO_LINKID_REG[reg_index] |= - ((uint64_t)linkid << - (agentid_bit_offset * NUM_BITS_RESERVED_FOR_LINKID)); + ((uint64_t)linkid + << (agentid_bit_offset * NUM_BITS_RESERVED_FOR_LINKID)); cxla_reg->CXLA_AGENTID_TO_LINKID_REG[reg_index] |= - ((uint64_t)linkid << - (agentid_bit_offset * NUM_BITS_RESERVED_FOR_LINKID)); + ((uint64_t)linkid + << (agentid_bit_offset * NUM_BITS_RESERVED_FOR_LINKID)); /* Setting corresponding valid bits */ cxg_ra_reg->CXG_RA_AGENTID_TO_LINKID_VAL |= @@ -233,27 +243,29 @@ static void program_agentid_to_linkid_reg( } } -static void program_cxg_ha_id(struct cmn_rhodes_device_ctx *ctx, uint8_t haid) +static void program_cxg_ha_id(struct cmn650_device_ctx *ctx, uint8_t haid) { - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; cxg_ha_reg = ctx->cxg_ha_reg_table[config->ldid].cxg_ha_reg; FWK_LOG_INFO( - MOD_NAME "HAID for CCIX %d with nodeid %d: HAID %d", - config->ldid, - get_node_id(cxg_ha_reg), - haid); + MOD_NAME "HAID for CCIX %d with nodeid %d: HAID %d", + config->ldid, + get_node_id(cxg_ha_reg), + haid); cxg_ha_reg->CXG_HA_ID = haid; } -static void program_cxg_ha_raid_to_ldid_lut(struct cmn_rhodes_device_ctx *ctx, - uint8_t raid_id, uint8_t ldid_value) +static void program_cxg_ha_raid_to_ldid_lut( + struct cmn650_device_ctx *ctx, + uint8_t raid_id, + uint8_t ldid_value) { uint32_t reg_index = 0; uint32_t raid_bit_offset = 0; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; cxg_ha_reg = ctx->cxg_ha_reg_table[config->ldid].cxg_ha_reg; @@ -263,22 +275,22 @@ static void program_cxg_ha_raid_to_ldid_lut(struct cmn_rhodes_device_ctx *ctx, /* Write RAID-to-LDID mapping (with RNF bit set) */ cxg_ha_reg->CXG_HA_RNF_RAID_TO_LDID_REG[reg_index] |= - ((uint64_t)(ldid_value | CXG_HA_RAID_TO_LDID_RNF_MASK) << - (raid_bit_offset * NUM_BITS_RESERVED_FOR_LDID)); + ((uint64_t)(ldid_value | CXG_HA_RAID_TO_LDID_RNF_MASK) + << (raid_bit_offset * NUM_BITS_RESERVED_FOR_LDID)); /* Set corresponding valid bit */ cxg_ha_reg->CXG_HA_RNF_RAID_TO_LDID_VAL |= ((uint64_t)0x1 << raid_id); } static void program_hnf_ldid_to_chi_node_id_reg( - struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *config) + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *config) { uint32_t agentid; uint32_t reg_index = 0; uint32_t reg_bit_offset = 0; uint32_t i = 0; - struct cmn_rhodes_hnf_reg *hnf_reg = NULL; + struct cmn650_hnf_reg *hnf_reg = NULL; uint32_t nodeid_ra; uint8_t linkid = 0; @@ -288,7 +300,7 @@ static void program_hnf_ldid_to_chi_node_id_reg( /* Assign the NodeID of CXHA as the RA's NodeID */ nodeid_ra = ctx->cxg_ha_reg_table[config->ldid].node_id; - for (linkid = 0; linkid < CMN_RHODES_MAX_CCIX_PROTOCOL_LINKS; linkid++) { + for (linkid = 0; linkid < CMN650_MAX_CCIX_PROTOCOL_LINKS; linkid++) { remote_agentid_start = config->remote_agentid_to_linkid_map[linkid].remote_agentid_start; remote_agentid_end = @@ -302,38 +314,39 @@ static void program_hnf_ldid_to_chi_node_id_reg( continue; FWK_LOG_INFO( - MOD_NAME " Remote [AgentID %d - AgentID %d] Link %d", - remote_agentid_start, - remote_agentid_end, - linkid); + MOD_NAME " Remote [AgentID %d - AgentID %d] Link %d", + remote_agentid_start, + remote_agentid_end, + linkid); for (agentid = remote_agentid_start; agentid <= remote_agentid_end; - agentid++) { + agentid++) { /* Each 64-bit register holds 2 sets of config data, 32 bits each */ reg_index = agentid / 2; reg_bit_offset = agentid % 2; for (i = 0; i < ctx->hnf_count; i++) { - hnf_reg = (struct cmn_rhodes_hnf_reg *)ctx->hnf_node[i]; + hnf_reg = (struct cmn650_hnf_reg *)ctx->hnf_node[i]; /* Write CXHA NodeID, local/remote and valid bit */ hnf_reg->RN_PHYS_ID[reg_index] |= - ((uint64_t)(nodeid_ra | - (REMOTE_CCIX_NODE << - HNF_RN_PHYS_RN_LOCAL_REMOTE_SHIFT_VAL) | - (UINT64_C(0x1) << - HNF_RN_PHYS_RN_ID_VALID_SHIFT_VAL)) << - (reg_bit_offset * NUM_BITS_RESERVED_FOR_PHYS_ID)); + ((uint64_t)( + nodeid_ra | + (REMOTE_CCIX_NODE + << HNF_RN_PHYS_RN_LOCAL_REMOTE_SHIFT_VAL) | + (UINT64_C(0x1) << HNF_RN_PHYS_RN_ID_VALID_SHIFT_VAL)) + << (reg_bit_offset * NUM_BITS_RESERVED_FOR_PHYS_ID)); } } } } -static int enable_smp_mode(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *config) +static int enable_smp_mode( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *config) { - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; - struct cmn_rhodes_cxla_reg *cxla_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxla_reg *cxla_reg; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; cxg_ha_reg = ctx->cxg_ha_reg_table[config->ldid].cxg_ha_reg; @@ -348,21 +361,22 @@ static int enable_smp_mode(struct cmn_rhodes_device_ctx *ctx, return FWK_SUCCESS; } -static void program_cxg_ra_sam_addr_region(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *config) +static void program_cxg_ra_sam_addr_region( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *config) { unsigned int i; uint64_t blocks; uint64_t size; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; FWK_LOG_INFO( - MOD_NAME "Configuring RA SAM for CXRA NodeID %d", - get_node_id(cxg_ra_reg)); + MOD_NAME "Configuring RA SAM for CXRA NodeID %d", + get_node_id(cxg_ra_reg)); - for (i = 0; i < CMN_RHODES_MAX_RA_SAM_ADDR_REGION; i++) { + for (i = 0; i < CMN650_MAX_RA_SAM_ADDR_REGION; i++) { /* If the size is zero, skip that entry */ if (config->ra_mmap_table[i].size == 0) continue; @@ -371,27 +385,27 @@ static void program_cxg_ra_sam_addr_region(struct cmn_rhodes_device_ctx *ctx, fwk_assert((config->ra_mmap_table[i].size % (64 * FWK_KIB)) == 0); /* Size also must be a power of two */ - fwk_assert((config->ra_mmap_table[i].size & - (config->ra_mmap_table[i].size - 1)) == 0); + fwk_assert( + (config->ra_mmap_table[i].size & + (config->ra_mmap_table[i].size - 1)) == 0); /* Region base should be naturally aligned to the region size */ - fwk_assert(config->ra_mmap_table[i].base % - config->ra_mmap_table[i].size == 0); + fwk_assert( + config->ra_mmap_table[i].base % config->ra_mmap_table[i].size == 0); FWK_LOG_INFO( - MOD_NAME " [0x%llx - 0x%llx] HAID %d", - config->ra_mmap_table[i].base, - config->ra_mmap_table[i].base + - config->ra_mmap_table[i].size - 1, - config->ra_mmap_table[i].remote_haid); + MOD_NAME " [0x%llx - 0x%llx] HAID %d", + config->ra_mmap_table[i].base, + config->ra_mmap_table[i].base + config->ra_mmap_table[i].size - 1, + config->ra_mmap_table[i].remote_haid); blocks = config->ra_mmap_table[i].size / (64 * FWK_KIB); size = fwk_math_log2(blocks); - cxg_ra_reg->CXG_RA_SAM_ADDR_REGION_REG[i] = - size | (config->ra_mmap_table[i].base) | - ((uint64_t)config->ra_mmap_table[i].remote_haid << - SAM_ADDR_TARGET_HAID_SHIFT) | + cxg_ra_reg->CXG_RA_SAM_ADDR_REGION_REG[i] = size | + (config->ra_mmap_table[i].base) | + ((uint64_t)config->ra_mmap_table[i].remote_haid + << SAM_ADDR_TARGET_HAID_SHIFT) | (SAM_ADDR_REG_VALID_MASK); i++; @@ -399,12 +413,13 @@ static void program_cxg_ra_sam_addr_region(struct cmn_rhodes_device_ctx *ctx, } static int enable_and_start_ccix_link_up_sequence( - struct cmn_rhodes_device_ctx *ctx, uint8_t linkid) + struct cmn650_device_ctx *ctx, + uint8_t linkid) { int status; struct cxg_wait_condition_data wait_data; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; cxg_ha_reg = ctx->cxg_ha_reg_table[config->ldid].cxg_ha_reg; @@ -415,81 +430,74 @@ static int enable_and_start_ccix_link_up_sequence( wait_data.ctx = ctx; wait_data.linkid = linkid; - FWK_LOG_INFO( - MOD_NAME "Enabling CCIX link %d...", linkid); + FWK_LOG_INFO(MOD_NAME "Enabling CCIX link %d...", linkid); /* Set link enable bit to enable the CCIX link */ - cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL = - CXG_LINK_CTRL_EN_MASK; - cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL = - CXG_LINK_CTRL_EN_MASK; + cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL = CXG_LINK_CTRL_EN_MASK; + cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL = CXG_LINK_CTRL_EN_MASK; /* Wait until link enable bits are set */ wait_data.cond = CXG_LINK_CTRL_EN_BIT_SET; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_CTRL_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_CTRL_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { - FWK_LOG_INFO( - MOD_NAME "Enabling CCIX link %d... Failed", linkid); + FWK_LOG_INFO(MOD_NAME "Enabling CCIX link %d... Failed", linkid); return status; } - FWK_LOG_INFO( - MOD_NAME "Enabling CCIX link %d... Done", linkid); + FWK_LOG_INFO(MOD_NAME "Enabling CCIX link %d... Done", linkid); - FWK_LOG_INFO( - MOD_NAME "Verifying link down status..."); + FWK_LOG_INFO(MOD_NAME "Verifying link down status..."); /* Wait till link up bits are cleared in control register */ wait_data.cond = CXG_LINK_CTRL_UP_BIT_CLR; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_CTRL_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_CTRL_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { - FWK_LOG_INFO( - MOD_NAME "Verifying link down status... Failed"); + FWK_LOG_INFO(MOD_NAME "Verifying link down status... Failed"); return status; } /* Wait till link down bits are set in status register */ wait_data.cond = CXG_LINK_STATUS_DWN_BIT_SET; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_CTRL_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_CTRL_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { - FWK_LOG_INFO( - MOD_NAME "Verifying link down status... Failed"); + FWK_LOG_INFO(MOD_NAME "Verifying link down status... Failed"); return status; } /* Wait till link ACK bits are cleared in status register */ wait_data.cond = CXG_LINK_STATUS_ACK_BIT_CLR; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_CTRL_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_CTRL_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { - FWK_LOG_INFO( - MOD_NAME "Verifying link down status... Failed"); + FWK_LOG_INFO(MOD_NAME "Verifying link down status... Failed"); return status; } - FWK_LOG_INFO( - MOD_NAME "Verifying link down status... Done"); + FWK_LOG_INFO(MOD_NAME "Verifying link down status... Done"); FWK_LOG_INFO(MOD_NAME "Bringing up link..."); /* Bring up link using link request bit */ - cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= - CXG_LINK_CTRL_REQ_MASK; - cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= - CXG_LINK_CTRL_REQ_MASK; + cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= CXG_LINK_CTRL_REQ_MASK; + cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= CXG_LINK_CTRL_REQ_MASK; /* Wait till link ACK bits are set in status register */ wait_data.cond = CXG_LINK_STATUS_ACK_BIT_SET; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_CTRL_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_CTRL_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { FWK_LOG_INFO(MOD_NAME "Bringing up link... Failed"); return status; @@ -497,10 +505,11 @@ static int enable_and_start_ccix_link_up_sequence( /* Wait till link down bits are cleared in status register */ wait_data.cond = CXG_LINK_STATUS_DWN_BIT_CLR; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_CTRL_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_CTRL_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { FWK_LOG_INFO(MOD_NAME "Bringing up link... Failed"); return status; @@ -510,8 +519,10 @@ static int enable_and_start_ccix_link_up_sequence( return FWK_SUCCESS; } -int ccix_setup(const unsigned int chip_id, struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config) +int ccix_setup( + const unsigned int chip_id, + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config) { unsigned int i; unsigned int unique_remote_rnf_ldid_value; @@ -524,8 +535,7 @@ int ccix_setup(const unsigned int chip_id, struct cmn_rhodes_device_ctx *ctx, uint8_t local_ra_cnt; int status; - FWK_LOG_INFO( - MOD_NAME "Programming CCIX gateway..."); + FWK_LOG_INFO(MOD_NAME "Programming CCIX gateway..."); /* Assign the max count among the RNs as local_ra_cnt */ if ((ctx->rnf_count > ctx->rnd_count) && (ctx->rnf_count > ctx->rni_count)) @@ -541,7 +551,6 @@ int ccix_setup(const unsigned int chip_id, struct cmn_rhodes_device_ctx *ctx, return status; } - /* Set the global config data */ config = ccix_config; @@ -572,21 +581,21 @@ int ccix_setup(const unsigned int chip_id, struct cmn_rhodes_device_ctx *ctx, unique_remote_rnf_ldid_value = ctx->rnf_count; for (i = 0; i < ccix_config->remote_rnf_count; i++) { - /* - * The remote_agentid should not include the current chip's AgentIDs. - * If `block` is less than the current chip_id, then include the - * AgentIDs starting from chip 0 till (not including) current chip. If - * the `block` is equal or greater than the current chip, then include - * the AgentIDs from next chip till the max chip. - */ - if ((i / ctx->rnf_count) < chip_id) - remote_agentid = i; - else - remote_agentid = i + ctx->rnf_count; + /* + * The remote_agentid should not include the current chip's AgentIDs. + * If `block` is less than the current chip_id, then include the + * AgentIDs starting from chip 0 till (not including) current chip. If + * the `block` is equal or greater than the current chip, then include + * the AgentIDs from next chip till the max chip. + */ + if ((i / ctx->rnf_count) < chip_id) + remote_agentid = i; + else + remote_agentid = i + ctx->rnf_count; /* Program the CXHA raid to ldid LUT */ - program_cxg_ha_raid_to_ldid_lut(ctx, remote_agentid, - unique_remote_rnf_ldid_value); + program_cxg_ha_raid_to_ldid_lut( + ctx, remote_agentid, unique_remote_rnf_ldid_value); unique_remote_rnf_ldid_value++; } @@ -628,12 +637,13 @@ int ccix_setup(const unsigned int chip_id, struct cmn_rhodes_device_ctx *ctx, return status; } -int ccix_exchange_protocol_credit(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config) +int ccix_exchange_protocol_credit( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config) { int linkid; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; config = ccix_config; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; @@ -642,26 +652,24 @@ int ccix_exchange_protocol_credit(struct cmn_rhodes_device_ctx *ctx, /* TODO Add support to enable multiple links */ linkid = 0; - FWK_LOG_INFO( - MOD_NAME "Exchanging protocol credits for link %d...", linkid); + FWK_LOG_INFO(MOD_NAME "Exchanging protocol credits for link %d...", linkid); /* Exchange protocol credits using link up bit */ - cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= - CXG_LINK_CTRL_UP_MASK; - cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= - CXG_LINK_CTRL_UP_MASK; + cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= CXG_LINK_CTRL_UP_MASK; + cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= CXG_LINK_CTRL_UP_MASK; FWK_LOG_INFO( MOD_NAME "Exchanging protocol credits for link %d... Done", linkid); return FWK_SUCCESS; } -int ccix_enter_system_coherency(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config) +int ccix_enter_system_coherency( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config) { struct cxg_wait_condition_data wait_data; int status; int linkid; - struct cmn_rhodes_cxg_ha_reg *cxg_ha_reg; + struct cmn650_cxg_ha_reg *cxg_ha_reg; config = ccix_config; cxg_ha_reg = ctx->cxg_ha_reg_table[config->ldid].cxg_ha_reg; @@ -672,18 +680,18 @@ int ccix_enter_system_coherency(struct cmn_rhodes_device_ctx *ctx, wait_data.ctx = ctx; wait_data.linkid = linkid; - FWK_LOG_INFO( - MOD_NAME "Entering system coherency for link %d...", linkid); + FWK_LOG_INFO(MOD_NAME "Entering system coherency for link %d...", linkid); /* Enter system coherency by setting DVMDOMAIN request bit */ cxg_ha_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= CXG_LINK_CTRL_DVMDOMAIN_REQ_MASK; /* Wait till DVMDOMAIN ACK bit is set in status register */ wait_data.cond = CXG_LINK_STATUS_HA_DVMDOMAIN_ACK_BIT_SET; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_DVMDOMAIN_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_DVMDOMAIN_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { FWK_LOG_INFO( MOD_NAME "Entering system coherency for link %d... Failed", linkid); @@ -695,13 +703,14 @@ int ccix_enter_system_coherency(struct cmn_rhodes_device_ctx *ctx, return FWK_SUCCESS; } -int ccix_enter_dvm_domain(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config) +int ccix_enter_dvm_domain( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config) { struct cxg_wait_condition_data wait_data; int status; int linkid; - struct cmn_rhodes_cxg_ra_reg *cxg_ra_reg; + struct cmn650_cxg_ra_reg *cxg_ra_reg; config = ccix_config; cxg_ra_reg = ctx->cxg_ra_reg_table[config->ldid].cxg_ra_reg; @@ -712,25 +721,24 @@ int ccix_enter_dvm_domain(struct cmn_rhodes_device_ctx *ctx, wait_data.ctx = ctx; wait_data.linkid = linkid; - FWK_LOG_INFO( - MOD_NAME "Entering DVM domain for link %d...", linkid); + FWK_LOG_INFO(MOD_NAME "Entering DVM domain for link %d...", linkid); /* Enter system coherency by setting DVMDOMAIN request bit */ cxg_ra_reg->LINK_REGS[linkid].CXG_PRTCL_LINK_CTRL |= CXG_LINK_CTRL_DVMDOMAIN_REQ_MASK; /* Wait till DVMDOMAIN ACK bit is set in status register */ wait_data.cond = CXG_LINK_STATUS_RA_DVMDOMAIN_ACK_BIT_SET; - status = ctx->timer_api->wait(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - CXG_PRTCL_LINK_DVMDOMAIN_TIMEOUT, - cxg_link_wait_condition, - &wait_data); + status = ctx->timer_api->wait( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + CXG_PRTCL_LINK_DVMDOMAIN_TIMEOUT, + cxg_link_wait_condition, + &wait_data); if (status != FWK_SUCCESS) { FWK_LOG_INFO( MOD_NAME "Entering DVM domain for link %d... Failed", linkid); return status; } - FWK_LOG_INFO( - MOD_NAME "Entering DVM domain for link %d... Done", linkid); + FWK_LOG_INFO(MOD_NAME "Entering DVM domain for link %d... Done", linkid); return FWK_SUCCESS; } diff --git a/module/cmn650/src/cmn650_ccix.h b/module/cmn650/src/cmn650_ccix.h new file mode 100644 index 000000000..014ae3d94 --- /dev/null +++ b/module/cmn650/src/cmn650_ccix.h @@ -0,0 +1,96 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * CMN-650 CCIX Configuration Interface + */ + +#ifndef CMN650_CCIX_H +#define CMN650_CCIX_H + +#include + +#include + +int ccix_setup( + const unsigned int chip_id, + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config); + +int ccix_exchange_protocol_credit( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config); + +int ccix_enter_system_coherency( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config); + +int ccix_enter_dvm_domain( + struct cmn650_device_ctx *ctx, + const struct mod_cmn650_ccix_config *ccix_config); + +/* + * CCIX Link UP stages + */ +enum cxg_link_up_wait_cond { + CXG_LINK_CTRL_EN_BIT_SET, + CXG_LINK_CTRL_UP_BIT_CLR, + CXG_LINK_STATUS_DWN_BIT_SET, + CXG_LINK_STATUS_DWN_BIT_CLR, + CXG_LINK_STATUS_ACK_BIT_SET, + CXG_LINK_STATUS_ACK_BIT_CLR, + CXG_LINK_STATUS_HA_DVMDOMAIN_ACK_BIT_SET, + CXG_LINK_STATUS_RA_DVMDOMAIN_ACK_BIT_SET, + CXG_LINK_UP_SEQ_COUNT, +}; + +/* + * Structure defining data to be passed to timer API + */ +struct cxg_wait_condition_data { + struct cmn650_device_ctx *ctx; + uint8_t linkid; + enum cxg_link_up_wait_cond cond; +}; + +/* CCIX Gateway (CXG) Home Agent (HA) defines */ +#define CXG_HA_RAID_TO_LDID_RNF_MASK (0x80) + +#define CXLA_CCIX_PROP_MAX_PACK_SIZE_MASK UINT64_C(0x0000000000000380) +#define CXLA_CCIX_PROP_MAX_PACK_SIZE_SHIFT_VAL 7 +#define CXLA_CCIX_PROP_MAX_PACK_SIZE_128 0 +#define CXLA_CCIX_PROP_MAX_PACK_SIZE_256 1 +#define CXLA_CCIX_PROP_MAX_PACK_SIZE_512 2 + +/* CCIX Gateway (CXG) link control & status defines */ + +#define CXG_LINK_CTRL_EN_MASK UINT64_C(0x0000000000000001) +#define CXG_LINK_CTRL_REQ_MASK UINT64_C(0x0000000000000002) +#define CXG_LINK_CTRL_UP_MASK UINT64_C(0x0000000000000004) +#define CXG_LINK_CTRL_DVMDOMAIN_REQ_MASK UINT64_C(0x0000000000000008) +#define CXG_LINK_STATUS_ACK_MASK UINT64_C(0x0000000000000001) +#define CXG_LINK_STATUS_DOWN_MASK UINT64_C(0x0000000000000002) +#define CXG_LINK_STATUS_DVMDOMAIN_ACK_MASK UINT64_C(0x0000000000000004) +#define CXG_PRTCL_LINK_CTRL_TIMEOUT UINT32_C(100) +#define CXG_PRTCL_LINK_DVMDOMAIN_TIMEOUT UINT32_C(100) + +/* SMP Mode related defines */ +#define CXG_RA_AUX_CTRL_SMP_MODE_EN_SHIFT_VAL 16 +#define CXG_HA_AUX_CTRL_SMP_MODE_EN_SHIFT_VAL 16 +#define CXLA_AUX_CTRL_SMP_MODE_EN_SHIFT_VAL 47 + +#define HNF_RN_PHYS_RN_ID_VALID_SHIFT_VAL 31 +#define HNF_RN_PHYS_RN_LOCAL_REMOTE_SHIFT_VAL 16 +#define NUM_BITS_RESERVED_FOR_RAID 8 +#define NUM_BITS_RESERVED_FOR_LINKID 8 +#define NUM_BITS_RESERVED_FOR_LDID 8 +#define NUM_BITS_RESERVED_FOR_PHYS_ID 32 +#define LOCAL_CCIX_NODE 0 +#define REMOTE_CCIX_NODE 1 +#define SAM_ADDR_TARGET_HAID_SHIFT (52) +#define SAM_ADDR_REG_VALID_MASK UINT64_C(0x8000000000000000) + +#endif /* CMN650_CCIX_H */ diff --git a/module/cmn_rhodes/src/mod_cmn_rhodes.c b/module/cmn650/src/mod_cmn650.c similarity index 67% rename from module/cmn_rhodes/src/mod_cmn_rhodes.c rename to module/cmn650/src/mod_cmn650.c index c036db2a7..20f79c13a 100644 --- a/module/cmn_rhodes/src/mod_cmn_rhodes.c +++ b/module/cmn650/src/mod_cmn650.c @@ -5,13 +5,13 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include -#include +#include +#include -#include +#include #include -#include +#include #include #include #include @@ -28,9 +28,9 @@ #include -#define MOD_NAME "[CMN_RHODES] " +#define MOD_NAME "[CMN650] " -static struct cmn_rhodes_device_ctx *ctx; +static struct cmn650_device_ctx *ctx; /* Chip Information */ static struct mod_system_info_get_info_api *system_info_api; @@ -40,7 +40,7 @@ static const struct mod_system_info *system_info; static unsigned int chip_id; static bool multi_chip_mode; -static void process_node_hnf(struct cmn_rhodes_hnf_reg *hnf) +static void process_node_hnf(struct cmn650_hnf_reg *hnf) { unsigned int bit_pos; unsigned int group; @@ -50,8 +50,8 @@ static void process_node_hnf(struct cmn_rhodes_hnf_reg *hnf) unsigned int region_sub_count = 0; static unsigned int cal_mode_factor = 1; uint64_t base; - const struct mod_cmn_rhodes_mem_region_map *region; - const struct mod_cmn_rhodes_config *config = ctx->config; + const struct mod_cmn650_mem_region_map *region; + const struct mod_cmn650_config *config = ctx->config; logical_id = get_node_logical_id(hnf); node_id = get_node_id(hnf); @@ -68,11 +68,10 @@ static void process_node_hnf(struct cmn_rhodes_hnf_reg *hnf) fwk_assert(logical_id < config->snf_count); group = logical_id / - (CMN_RHODES_HNF_CACHE_GROUP_ENTRIES_PER_GROUP * cal_mode_factor); - bit_pos = (CMN_RHODES_HNF_CACHE_GROUP_ENTRY_BITS_WIDTH / cal_mode_factor) * - ((logical_id % - (CMN_RHODES_HNF_CACHE_GROUP_ENTRIES_PER_GROUP * - cal_mode_factor))); + (CMN650_HNF_CACHE_GROUP_ENTRIES_PER_GROUP * cal_mode_factor); + bit_pos = (CMN650_HNF_CACHE_GROUP_ENTRY_BITS_WIDTH / cal_mode_factor) * + ((logical_id % + (CMN650_HNF_CACHE_GROUP_ENTRIES_PER_GROUP * cal_mode_factor))); /* * If CAL mode is set, add only even numbered hnd node to @@ -80,15 +79,15 @@ static void process_node_hnf(struct cmn_rhodes_hnf_reg *hnf) */ if (config->hnf_cal_mode == true) { if (node_id % 2 == 0) { - ctx->hnf_cache_group[group] += ((uint64_t)get_node_id(hnf)) << - bit_pos; + ctx->hnf_cache_group[group] += ((uint64_t)get_node_id(hnf)) + << bit_pos; ctx->sn_nodeid_group[group] += ((uint64_t)config->snf_table[logical_id]) << bit_pos; } } else { ctx->hnf_cache_group[group] += ((uint64_t)get_node_id(hnf)) << bit_pos; - ctx->sn_nodeid_group[group] += - ((uint64_t)config->snf_table[logical_id]) << bit_pos; + ctx->sn_nodeid_group[group] += ((uint64_t)config->snf_table[logical_id]) + << bit_pos; } /* Set target node */ @@ -101,28 +100,26 @@ static void process_node_hnf(struct cmn_rhodes_hnf_reg *hnf) region = &config->mmap_table[region_idx]; /* Skip non sub-regions */ - if (region->type != MOD_CMN_RHODES_REGION_TYPE_SYSCACHE_SUB) + if (region->type != MOD_CMN650_REGION_TYPE_SYSCACHE_SUB) continue; /* Offset the base with chip address space base on chip-id */ - base = ((uint64_t) (ctx->config->chip_addr_space * chip_id)) + - region->base; + base = + ((uint64_t)(ctx->config->chip_addr_space * chip_id)) + region->base; /* Configure sub-region entry */ hnf->SAM_MEMREGION[region_sub_count] = region->node_id | - (sam_encode_region_size(region->size) << - CMN_RHODES_HNF_SAM_MEMREGION_SIZE_POS) | - ((base / SAM_GRANULARITY) << - CMN_RHODES_HNF_SAM_MEMREGION_BASE_POS) | - CMN_RHODES_HNF_SAM_MEMREGION_VALID; + (sam_encode_region_size(region->size) + << CMN650_HNF_SAM_MEMREGION_SIZE_POS) | + ((base / SAM_GRANULARITY) << CMN650_HNF_SAM_MEMREGION_BASE_POS) | + CMN650_HNF_SAM_MEMREGION_VALID; region_sub_count++; } /* Configure the system cache RAM PPU */ - hnf->PPU_PWPR = CMN_RHODES_PPU_PWPR_POLICY_ON | - CMN_RHODES_PPU_PWPR_OPMODE_FAM | - CMN_RHODES_PPU_PWPR_DYN_EN; + hnf->PPU_PWPR = CMN650_PPU_PWPR_POLICY_ON | CMN650_PPU_PWPR_OPMODE_FAM | + CMN650_PPU_PWPR_DYN_EN; } /* @@ -131,7 +128,7 @@ static void process_node_hnf(struct cmn_rhodes_hnf_reg *hnf) * - Internal RN-SAM nodes * - HN-F nodes (cache) */ -static int cmn_rhodes_discovery(void) +static int cmn650_discovery(void) { unsigned int xp_count; unsigned int xp_idx; @@ -141,9 +138,9 @@ static int cmn_rhodes_discovery(void) unsigned int cxg_ha_reg_count; unsigned int cxla_reg_count; bool xp_port; - struct cmn_rhodes_mxp_reg *xp; + struct cmn650_mxp_reg *xp; struct node_header *node; - const struct mod_cmn_rhodes_config *config = ctx->config; + const struct mod_cmn650_config *config = ctx->config; cxg_ra_reg_count = 0; cxg_ha_reg_count = 0; @@ -241,8 +238,8 @@ static int cmn_rhodes_discovery(void) /* CXLA should not be an internal node */ case NODE_TYPE_CXLA: FWK_LOG_ERR(MOD_NAME - "CXLA node should not be internal node, " - "discovery failed"); + "CXLA node should not be internal node, " + "discovery failed"); return FWK_E_DEVICE; break; @@ -271,7 +268,8 @@ static int cmn_rhodes_discovery(void) /* Total number of CXG_RA, CXG_HA and CXLA nodes should be equal */ if ((cxg_ra_reg_count != cxg_ha_reg_count) || (cxg_ha_reg_count != cxla_reg_count)) { - FWK_LOG_ERR(MOD_NAME + FWK_LOG_ERR( + MOD_NAME "Inconsistent count of CXG components detected, discovery failed.\n" " CXG_RA count: %d\n" " CXG_HA count: %d\n" @@ -291,7 +289,7 @@ static int cmn_rhodes_discovery(void) * RN-SAM count minus the total RN-D, RN-I and CXHA count combined. */ ctx->rnf_count = ctx->internal_rnsam_count + ctx->external_rnsam_count - - (ctx->rnd_count + ctx->rni_count + cxg_ha_reg_count); + (ctx->rnd_count + ctx->rni_count + cxg_ha_reg_count); if (ctx->rnf_count > MAX_RNF_COUNT) { FWK_LOG_ERR( @@ -301,29 +299,23 @@ static int cmn_rhodes_discovery(void) return FWK_E_RANGE; } - FWK_LOG_INFO(MOD_NAME - "Total internal RN-SAM nodes: %d", ctx->internal_rnsam_count); - FWK_LOG_INFO(MOD_NAME - "Total external RN-SAM nodes: %d", ctx->external_rnsam_count); - FWK_LOG_INFO(MOD_NAME - "Total HN-F nodes: %d", ctx->hnf_count); - FWK_LOG_INFO(MOD_NAME - "Total RN-D nodes: %d\n", ctx->rnd_count); - FWK_LOG_INFO(MOD_NAME - "Total RN-F nodes: %d\n", ctx->rnf_count); - FWK_LOG_INFO(MOD_NAME - "Total RN-I nodes: %d\n", ctx->rni_count); - FWK_LOG_INFO(MOD_NAME - "Total CCIX Request Agent nodes: %d", cxg_ra_reg_count); - FWK_LOG_INFO(MOD_NAME - "Total CCIX Home Agent nodes: %d", cxg_ha_reg_count); - FWK_LOG_INFO(MOD_NAME - "Total CCIX Link Agent nodes: %d", cxla_reg_count); + FWK_LOG_INFO( + MOD_NAME "Total internal RN-SAM nodes: %d", ctx->internal_rnsam_count); + FWK_LOG_INFO( + MOD_NAME "Total external RN-SAM nodes: %d", ctx->external_rnsam_count); + FWK_LOG_INFO(MOD_NAME "Total HN-F nodes: %d", ctx->hnf_count); + FWK_LOG_INFO(MOD_NAME "Total RN-D nodes: %d\n", ctx->rnd_count); + FWK_LOG_INFO(MOD_NAME "Total RN-F nodes: %d\n", ctx->rnf_count); + FWK_LOG_INFO(MOD_NAME "Total RN-I nodes: %d\n", ctx->rni_count); + FWK_LOG_INFO( + MOD_NAME "Total CCIX Request Agent nodes: %d", cxg_ra_reg_count); + FWK_LOG_INFO(MOD_NAME "Total CCIX Home Agent nodes: %d", cxg_ha_reg_count); + FWK_LOG_INFO(MOD_NAME "Total CCIX Link Agent nodes: %d", cxla_reg_count); return FWK_SUCCESS; } -static void cmn_rhodes_configure(void) +static void cmn650_configure(void) { unsigned int node_count; unsigned int node_idx; @@ -336,8 +328,8 @@ static void cmn_rhodes_configure(void) unsigned int node_id; bool xp_port; void *node; - struct cmn_rhodes_mxp_reg *xp; - const struct mod_cmn_rhodes_config *config = ctx->config; + struct cmn650_mxp_reg *xp; + const struct mod_cmn650_config *config = ctx->config; fwk_assert(get_node_type(ctx->root) == NODE_TYPE_CFG); @@ -365,10 +357,9 @@ static void cmn_rhodes_configure(void) ldid = get_node_logical_id(node); fwk_assert(ldid < ctx->ccix_node_count); - ctx->cxla_reg_table[ldid].node_id = - node_id; + ctx->cxla_reg_table[ldid].node_id = node_id; ctx->cxla_reg_table[ldid].cxla_reg = - (struct cmn_rhodes_cxla_reg *)node; + (struct cmn650_cxla_reg *)node; } else { fwk_assert(xrnsam_entry < ctx->external_rnsam_count); @@ -394,7 +385,7 @@ static void cmn_rhodes_configure(void) /* Use ldid as index of the cxg_ra table */ ctx->cxg_ra_reg_table[ldid].node_id = node_id; ctx->cxg_ra_reg_table[ldid].cxg_ra_reg = - (struct cmn_rhodes_cxg_ra_reg *)node; + (struct cmn650_cxg_ra_reg *)node; } else if (node_type == NODE_TYPE_CXHA) { ldid = get_node_logical_id(node); fwk_assert(ldid < ctx->ccix_node_count); @@ -402,7 +393,7 @@ static void cmn_rhodes_configure(void) /* Use ldid as index of the cxg_ra table */ ctx->cxg_ha_reg_table[ldid].node_id = node_id; ctx->cxg_ha_reg_table[ldid].cxg_ha_reg = - (struct cmn_rhodes_cxg_ha_reg *)node; + (struct cmn650_cxg_ha_reg *)node; } else if (node_type == NODE_TYPE_HN_F) { fwk_assert(hnf_entry < ctx->hnf_count); ctx->hnf_node[hnf_entry++] = (uintptr_t)(void *)node; @@ -414,14 +405,14 @@ static void cmn_rhodes_configure(void) } } -static const char * const mmap_type_name[] = { - [MOD_CMN_RHODES_MEM_REGION_TYPE_IO] = "I/O", - [MOD_CMN_RHODES_MEM_REGION_TYPE_SYSCACHE] = "System Cache", - [MOD_CMN_RHODES_REGION_TYPE_SYSCACHE_SUB] = "Sub-System Cache", - [MOD_CMN_RHODES_REGION_TYPE_CCIX] = "CCIX", +static const char *const mmap_type_name[] = { + [MOD_CMN650_MEM_REGION_TYPE_IO] = "I/O", + [MOD_CMN650_MEM_REGION_TYPE_SYSCACHE] = "System Cache", + [MOD_CMN650_REGION_TYPE_SYSCACHE_SUB] = "Sub-System Cache", + [MOD_CMN650_REGION_TYPE_CCIX] = "CCIX", }; -static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) +static int cmn650_setup_sam(struct cmn650_rnsam_reg *rnsam) { unsigned int bit_pos; unsigned int group; @@ -433,10 +424,10 @@ static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) unsigned int region_sys_count = 0; unsigned int cxra_ldid; unsigned int cxra_node_id; - unsigned int scg_regions_enabled[MAX_SCG_COUNT] = {0, 0, 0, 0}; + unsigned int scg_regions_enabled[MAX_SCG_COUNT] = { 0, 0, 0, 0 }; uint64_t base; - const struct mod_cmn_rhodes_mem_region_map *region; - const struct mod_cmn_rhodes_config *config = ctx->config; + const struct mod_cmn650_mem_region_map *region; + const struct mod_cmn650_config *config = ctx->config; FWK_LOG_INFO(MOD_NAME "Configuring SAM for node %d", get_node_id(rnsam)); @@ -444,59 +435,63 @@ static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) region = &config->mmap_table[region_idx]; /* Offset the base with chip address space base on chip-id */ - base = ((uint64_t)(ctx->config->chip_addr_space * chip_id) + - region->base); + base = + ((uint64_t)(ctx->config->chip_addr_space * chip_id) + region->base); switch (region->type) { - case MOD_CMN_RHODES_MEM_REGION_TYPE_IO: + case MOD_CMN650_MEM_REGION_TYPE_IO: /* * Configure memory region */ FWK_LOG_INFO( MOD_NAME " [0x%x%x - 0x%x%x] %s", - HIGH_WORD(base), LOW_WORD(base), + HIGH_WORD(base), + LOW_WORD(base), HIGH_WORD(base + region->size - 1), LOW_WORD(base + region->size - 1), mmap_type_name[region->type]); - configure_region(&rnsam->NON_HASH_MEM_REGION[region_io_count], - base, - region->size, - SAM_NODE_TYPE_HN_I); + configure_region( + &rnsam->NON_HASH_MEM_REGION[region_io_count], + base, + region->size, + SAM_NODE_TYPE_HN_I); /* * Configure target node */ group = region_io_count / - CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP; - bit_pos = CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_BITS_WIDTH * - (region_io_count % - CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP); + CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP; + bit_pos = CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_BITS_WIDTH * + (region_io_count % + CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP); rnsam->NON_HASH_TGT_NODEID[group] &= - ~(CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK << bit_pos); + ~(CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK << bit_pos); rnsam->NON_HASH_TGT_NODEID[group] |= - (region->node_id & - CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK) << bit_pos; + (region->node_id & CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK) + << bit_pos; region_io_count++; break; - case MOD_CMN_RHODES_MEM_REGION_TYPE_SYSCACHE: + case MOD_CMN650_MEM_REGION_TYPE_SYSCACHE: /* * Configure memory region */ FWK_LOG_INFO( MOD_NAME " [0x%x%x - 0x%x%x] %s", - HIGH_WORD(region->base), LOW_WORD(region->base), + HIGH_WORD(region->base), + LOW_WORD(region->base), HIGH_WORD(region->base + region->size - 1), LOW_WORD(region->base + region->size - 1), mmap_type_name[region->type]); - configure_region(&rnsam->SYS_CACHE_GRP_REGION[region_sys_count], - region->base, - region->size, - SAM_NODE_TYPE_HN_F); + configure_region( + &rnsam->SYS_CACHE_GRP_REGION[region_sys_count], + region->base, + region->size, + SAM_NODE_TYPE_HN_F); /* Mark corresponding region as enabled */ fwk_assert(region_sys_count < MAX_SCG_COUNT); @@ -505,10 +500,11 @@ static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) region_sys_count++; break; - case MOD_CMN_RHODES_REGION_TYPE_SYSCACHE_SUB: + case MOD_CMN650_REGION_TYPE_SYSCACHE_SUB: FWK_LOG_INFO( MOD_NAME " [0x%x%x - 0x%x%x] %s", - HIGH_WORD(region->base), LOW_WORD(region->base), + HIGH_WORD(region->base), + LOW_WORD(region->base), HIGH_WORD(region->base + region->size - 1), LOW_WORD(region->base + region->size - 1), mmap_type_name[region->type]); @@ -528,20 +524,22 @@ static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) FWK_LOG_INFO( MOD_NAME " [0x%x%x - 0x%x%x] %s", - HIGH_WORD(region->base), LOW_WORD(region->base), + HIGH_WORD(region->base), + LOW_WORD(region->base), HIGH_WORD(region->base + region->size - 1), LOW_WORD(region->base + region->size - 1), mmap_type_name[region->type]); switch (region->type) { - case MOD_CMN_RHODES_REGION_TYPE_CCIX: + case MOD_CMN650_REGION_TYPE_CCIX: /* * Configure memory region */ - configure_region(&rnsam->NON_HASH_MEM_REGION[region_io_count], - region->base, - region->size, - SAM_NODE_TYPE_CXRA); + configure_region( + &rnsam->NON_HASH_MEM_REGION[region_io_count], + region->base, + region->size, + SAM_NODE_TYPE_CXRA); /* * Configure target node @@ -549,16 +547,16 @@ static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) cxra_ldid = config->ccix_config_table[idx].ldid; cxra_node_id = ctx->cxg_ra_reg_table[cxra_ldid].node_id; group = region_io_count / - CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP; - bit_pos = CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_BITS_WIDTH * - (region_io_count % - CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP); + CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP; + bit_pos = CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_BITS_WIDTH * + (region_io_count % + CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRIES_PER_GROUP); rnsam->NON_HASH_TGT_NODEID[group] &= - ~(CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK << bit_pos); + ~(CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK << bit_pos); rnsam->NON_HASH_TGT_NODEID[group] |= - (cxra_node_id & - CMN_RHODES_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK) << bit_pos; + (cxra_node_id & CMN650_RNSAM_NON_HASH_TGT_NODEID_ENTRY_MASK) + << bit_pos; region_io_count++; break; @@ -575,11 +573,11 @@ static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) * half if CAL mode is enabled. */ if (config->hnf_cal_mode) - hnf_count = ctx->hnf_count/2; + hnf_count = ctx->hnf_count / 2; else hnf_count = ctx->hnf_count; - group_count = hnf_count / CMN_RHODES_HNF_CACHE_GROUP_ENTRIES_PER_GROUP; + group_count = hnf_count / CMN650_HNF_CACHE_GROUP_ENTRIES_PER_GROUP; for (group = 0; group < group_count; group++) rnsam->SYS_CACHE_GRP_HN_NODEID[group] = ctx->hnf_cache_group[group]; @@ -593,36 +591,36 @@ static int cmn_rhodes_setup_sam(struct cmn_rhodes_rnsam_reg *rnsam) if (config->hnf_cal_mode) for (region_idx = 0; region_idx < MAX_SCG_COUNT; region_idx++) rnsam->SYS_CACHE_GRP_CAL_MODE |= scg_regions_enabled[region_idx] * - (CMN_RHODES_RNSAM_SCG_HNF_CAL_MODE_EN << - (region_idx * CMN_RHODES_RNSAM_SCG_HNF_CAL_MODE_SHIFT)); + (CMN650_RNSAM_SCG_HNF_CAL_MODE_EN + << (region_idx * CMN650_RNSAM_SCG_HNF_CAL_MODE_SHIFT)); /* Program the SYS_CACHE_GRP_SN_NODEID register for PrefetchTgt */ - if (config->hnf_cal_mode) - group_count = config->snf_count/ - (CMN_RHODES_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP * 2); - else - group_count = config->snf_count/ - CMN_RHODES_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP; + if (config->hnf_cal_mode) + group_count = config->snf_count / + (CMN650_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP * 2); + else + group_count = config->snf_count / + CMN650_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP; - for (group = 0; group < group_count; group++) - rnsam->SYS_CACHE_GRP_SN_NODEID[group] = ctx->sn_nodeid_group[group]; + for (group = 0; group < group_count; group++) + rnsam->SYS_CACHE_GRP_SN_NODEID[group] = ctx->sn_nodeid_group[group]; /* Enable RNSAM */ - rnsam->STATUS = ((uint64_t)config->hnd_node_id << - CMN_RHODES_RNSAM_STATUS_DEFAULT_NODEID_POS) | - CMN_RHODES_RNSAM_STATUS_UNSTALL; + rnsam->STATUS = ((uint64_t)config->hnd_node_id + << CMN650_RNSAM_STATUS_DEFAULT_NODEID_POS) | + CMN650_RNSAM_STATUS_UNSTALL; __sync_synchronize(); return FWK_SUCCESS; } -static int cmn_rhodes_setup(void) +static int cmn650_setup(void) { unsigned int rnsam_idx; int status = FWK_SUCCESS; if (!ctx->initialized) { - status = cmn_rhodes_discovery(); + status = cmn650_discovery(); if (status != FWK_SUCCESS) return FWK_SUCCESS; @@ -648,43 +646,43 @@ static int cmn_rhodes_setup(void) * Allocate enough group descriptors to accommodate all expected * HN-F nodes in the system. */ - ctx->hnf_node = fwk_mm_calloc(ctx->hnf_count, - sizeof(*ctx->hnf_node)); + ctx->hnf_node = + fwk_mm_calloc(ctx->hnf_count, sizeof(*ctx->hnf_node)); if (ctx->hnf_node == NULL) return FWK_E_NOMEM; ctx->hnf_cache_group = fwk_mm_calloc( - ctx->hnf_count / CMN_RHODES_HNF_CACHE_GROUP_ENTRIES_PER_GROUP, + ctx->hnf_count / CMN650_HNF_CACHE_GROUP_ENTRIES_PER_GROUP, sizeof(*ctx->hnf_cache_group)); ctx->sn_nodeid_group = fwk_mm_calloc( ctx->hnf_count / - CMN_RHODES_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP, + CMN650_RNSAM_SYS_CACHE_GRP_SN_NODEID_ENTRIES_PER_GROUP, sizeof(*ctx->sn_nodeid_group)); } /* Allocate resource for the CCIX Gateway nodes */ if (ctx->ccix_node_count != 0) { - ctx->cxg_ra_reg_table = fwk_mm_calloc(ctx->ccix_node_count, - sizeof(*ctx->cxg_ra_reg_table)); + ctx->cxg_ra_reg_table = fwk_mm_calloc( + ctx->ccix_node_count, sizeof(*ctx->cxg_ra_reg_table)); if (ctx->cxg_ra_reg_table == NULL) return FWK_E_NOMEM; - ctx->cxg_ha_reg_table = fwk_mm_calloc(ctx->ccix_node_count, - sizeof(*ctx->cxg_ha_reg_table)); + ctx->cxg_ha_reg_table = fwk_mm_calloc( + ctx->ccix_node_count, sizeof(*ctx->cxg_ha_reg_table)); if (ctx->cxg_ha_reg_table == NULL) return FWK_E_NOMEM; - ctx->cxla_reg_table = fwk_mm_calloc(ctx->ccix_node_count, - sizeof(*ctx->cxla_reg_table)); + ctx->cxla_reg_table = fwk_mm_calloc( + ctx->ccix_node_count, sizeof(*ctx->cxla_reg_table)); if (ctx->cxla_reg_table == NULL) return FWK_E_NOMEM; } } - cmn_rhodes_configure(); + cmn650_configure(); /* Setup internal RN-SAM nodes */ for (rnsam_idx = 0; rnsam_idx < ctx->internal_rnsam_count; rnsam_idx++) - cmn_rhodes_setup_sam(ctx->internal_rnsam_table[rnsam_idx]); + cmn650_setup_sam(ctx->internal_rnsam_table[rnsam_idx]); FWK_LOG_INFO(MOD_NAME "Done"); @@ -693,10 +691,10 @@ static int cmn_rhodes_setup(void) return FWK_SUCCESS; } -static int cmn_rhodes_ccix_setup(void) +static int cmn650_ccix_setup(void) { unsigned int idx; - const struct mod_cmn_rhodes_config *config = ctx->config; + const struct mod_cmn650_config *config = ctx->config; /* Do configuration for CCIX Gateway Nodes and enable the links */ for (idx = 0; idx < config->ccix_table_count; idx++) @@ -714,13 +712,13 @@ static int cmn_rhodes_ccix_setup(void) return FWK_SUCCESS; } -static int cmn_rhodes_setup_rnsam(unsigned int node_id) +static int cmn650_setup_rnsam(unsigned int node_id) { unsigned int node_idx; for (node_idx = 0; node_idx < ctx->external_rnsam_count; node_idx++) { if (ctx->external_rnsam_table[node_idx].node_id == node_id) { - cmn_rhodes_setup_sam(ctx->external_rnsam_table[node_idx].node); + cmn650_setup_sam(ctx->external_rnsam_table[node_idx].node); return FWK_SUCCESS; } } @@ -735,11 +733,10 @@ static int cmn_rhodes_setup_rnsam(unsigned int node_id) static void post_ppu_on(void *data) { fwk_assert(data != NULL); - cmn_rhodes_setup_rnsam(*(unsigned int *)data); + cmn650_setup_rnsam(*(unsigned int *)data); } -static const struct mod_ppu_v1_power_state_observer_api -cmn_rhodes_observer_api = { +static const struct mod_ppu_v1_power_state_observer_api cmn650_observer_api = { .post_ppu_on = post_ppu_on, }; @@ -747,7 +744,9 @@ cmn_rhodes_observer_api = { * Framework handlers */ -static int cmn_rhodes_init(fwk_id_t module_id, unsigned int device_count, +static int cmn650_init( + fwk_id_t module_id, + unsigned int device_count, const void *data) { /* Atleast one device should be passed as element */ @@ -755,16 +754,17 @@ static int cmn_rhodes_init(fwk_id_t module_id, unsigned int device_count, return FWK_E_DATA; /* Allocate space for the device context table */ - ctx = fwk_mm_calloc(device_count, sizeof(struct cmn_rhodes_device_ctx)); + ctx = fwk_mm_calloc(device_count, sizeof(struct cmn650_device_ctx)); return FWK_SUCCESS; } -static int cmn_rhodes_device_init(fwk_id_t element_id, - unsigned int element_count, - const void *data) +static int cmn650_device_init( + fwk_id_t element_id, + unsigned int element_count, + const void *data) { - struct cmn_rhodes_device_ctx *device_ctx; + struct cmn650_device_ctx *device_ctx; fwk_assert(data != NULL); @@ -775,35 +775,36 @@ static int cmn_rhodes_device_init(fwk_id_t element_id, return FWK_E_DATA; if ((device_ctx->config->mesh_size_x == 0) || - (device_ctx->config->mesh_size_x > CMN_RHODES_MESH_X_MAX)) + (device_ctx->config->mesh_size_x > CMN650_MESH_X_MAX)) return FWK_E_DATA; if ((device_ctx->config->mesh_size_y == 0) || - (device_ctx->config->mesh_size_y > CMN_RHODES_MESH_Y_MAX)) + (device_ctx->config->mesh_size_y > CMN650_MESH_Y_MAX)) return FWK_E_DATA; - if (device_ctx->config->snf_count > CMN_RHODES_HNF_CACHE_GROUP_ENTRIES_MAX) + if (device_ctx->config->snf_count > CMN650_HNF_CACHE_GROUP_ENTRIES_MAX) return FWK_E_DATA; - device_ctx->root = get_root_node(device_ctx->config->base, - device_ctx->config->hnd_node_id, - device_ctx->config->mesh_size_x, - device_ctx->config->mesh_size_y); + device_ctx->root = get_root_node( + device_ctx->config->base, + device_ctx->config->hnd_node_id, + device_ctx->config->mesh_size_x, + device_ctx->config->mesh_size_y); return FWK_SUCCESS; } -static int cmn_rhodes_bind(fwk_id_t id, unsigned int round) +static int cmn650_bind(fwk_id_t id, unsigned int round) { int status; - struct cmn_rhodes_device_ctx *device_ctx; + struct cmn650_device_ctx *device_ctx; if (fwk_id_is_type(id, FWK_ID_TYPE_MODULE)) { /* Bind to system info module to obtain multi-chip info */ - status = fwk_module_bind(FWK_ID_MODULE(FWK_MODULE_IDX_SYSTEM_INFO), - FWK_ID_API(FWK_MODULE_IDX_SYSTEM_INFO, - MOD_SYSTEM_INFO_GET_API_IDX), - &system_info_api); + status = fwk_module_bind( + FWK_ID_MODULE(FWK_MODULE_IDX_SYSTEM_INFO), + FWK_ID_API(FWK_MODULE_IDX_SYSTEM_INFO, MOD_SYSTEM_INFO_GET_API_IDX), + &system_info_api); return status; } @@ -812,10 +813,10 @@ static int cmn_rhodes_bind(fwk_id_t id, unsigned int round) device_ctx = ctx + fwk_id_get_element_idx(id); /* Bind to the timer component */ - status = fwk_module_bind(FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), - FWK_ID_API(FWK_MODULE_IDX_TIMER, - MOD_TIMER_API_IDX_TIMER), - &device_ctx->timer_api); + status = fwk_module_bind( + FWK_ID_ELEMENT(FWK_MODULE_IDX_TIMER, 0), + FWK_ID_API(FWK_MODULE_IDX_TIMER, MOD_TIMER_API_IDX_TIMER), + &device_ctx->timer_api); if (status != FWK_SUCCESS) return FWK_E_PANIC; } @@ -823,14 +824,17 @@ static int cmn_rhodes_bind(fwk_id_t id, unsigned int round) return FWK_SUCCESS; } -static int cmn_rhodes_process_bind_request(fwk_id_t requester_id, - fwk_id_t target_id, fwk_id_t api_id, const void **api) +static int cmn650_process_bind_request( + fwk_id_t requester_id, + fwk_id_t target_id, + fwk_id_t api_id, + const void **api) { - *api = &cmn_rhodes_observer_api; + *api = &cmn650_observer_api; return FWK_SUCCESS; } -int cmn_rhodes_start(fwk_id_t id) +int cmn650_start(fwk_id_t id) { int status; @@ -851,47 +855,47 @@ int cmn_rhodes_start(fwk_id_t id) /* Pickup the context based on the chip_id */ ctx = ctx + fwk_id_get_element_idx(id); - FWK_LOG_INFO(MOD_NAME "Multichip mode: %d Chip ID: %d\n", - multi_chip_mode, chip_id); + FWK_LOG_INFO( + MOD_NAME "Multichip mode: %d Chip ID: %d\n", multi_chip_mode, chip_id); if (fwk_id_is_equal(ctx->config->clock_id, FWK_ID_NONE)) { - cmn_rhodes_setup(); - cmn_rhodes_ccix_setup(); + cmn650_setup(); + cmn650_ccix_setup(); return FWK_SUCCESS; } /* Register the module for clock state notifications */ - return fwk_notification_subscribe(mod_clock_notification_id_state_changed, - ctx->config->clock_id, id); + return fwk_notification_subscribe( + mod_clock_notification_id_state_changed, ctx->config->clock_id, id); } -static int cmn_rhodes_process_notification( +static int cmn650_process_notification( const struct fwk_event *event, struct fwk_event *resp_event) { struct clock_notification_params *params; - fwk_assert(fwk_id_is_equal(event->id, - mod_clock_notification_id_state_changed)); + fwk_assert( + fwk_id_is_equal(event->id, mod_clock_notification_id_state_changed)); fwk_assert(fwk_id_is_type(event->target_id, FWK_ID_TYPE_ELEMENT)); params = (struct clock_notification_params *)event->params; if (params->new_state == MOD_CLOCK_STATE_RUNNING) { - cmn_rhodes_setup(); - cmn_rhodes_ccix_setup(); + cmn650_setup(); + cmn650_ccix_setup(); } return FWK_SUCCESS; } -const struct fwk_module module_cmn_rhodes = { - .name = "CMN_RHODES", +const struct fwk_module module_cmn650 = { + .name = "CMN650", .type = FWK_MODULE_TYPE_DRIVER, - .api_count = MOD_CMN_RHODES_API_COUNT, - .init = cmn_rhodes_init, - .element_init = cmn_rhodes_device_init, - .bind = cmn_rhodes_bind, - .start = cmn_rhodes_start, - .process_bind_request = cmn_rhodes_process_bind_request, - .process_notification = cmn_rhodes_process_notification, + .api_count = MOD_CMN650_API_COUNT, + .init = cmn650_init, + .element_init = cmn650_device_init, + .bind = cmn650_bind, + .start = cmn650_start, + .process_bind_request = cmn650_process_bind_request, + .process_notification = cmn650_process_notification, }; diff --git a/module/cmn_rhodes/src/cmn_rhodes_ccix.h b/module/cmn_rhodes/src/cmn_rhodes_ccix.h deleted file mode 100644 index 623d27995..000000000 --- a/module/cmn_rhodes/src/cmn_rhodes_ccix.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Arm SCP/MCP Software - * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - * Description: - * CMN-Rhodes CCIX Configuration Interface - */ - -#ifndef CMN_RHODES_CCIX_H -#define CMN_RHODES_CCIX_H - -#include -#include - -int ccix_setup(const unsigned int chip_id, struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config); - -int ccix_exchange_protocol_credit(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config); - -int ccix_enter_system_coherency(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config); - -int ccix_enter_dvm_domain(struct cmn_rhodes_device_ctx *ctx, - const struct mod_cmn_rhodes_ccix_config *ccix_config); - -/* - * CCIX Link UP stages - */ -enum cxg_link_up_wait_cond { - CXG_LINK_CTRL_EN_BIT_SET, - CXG_LINK_CTRL_UP_BIT_CLR, - CXG_LINK_STATUS_DWN_BIT_SET, - CXG_LINK_STATUS_DWN_BIT_CLR, - CXG_LINK_STATUS_ACK_BIT_SET, - CXG_LINK_STATUS_ACK_BIT_CLR, - CXG_LINK_STATUS_HA_DVMDOMAIN_ACK_BIT_SET, - CXG_LINK_STATUS_RA_DVMDOMAIN_ACK_BIT_SET, - CXG_LINK_UP_SEQ_COUNT, -}; - -/* - * Structure defining data to be passed to timer API - */ -struct cxg_wait_condition_data { - struct cmn_rhodes_device_ctx *ctx; - uint8_t linkid; - enum cxg_link_up_wait_cond cond; -}; - -/* CCIX Gateway (CXG) Home Agent (HA) defines */ -#define CXG_HA_RAID_TO_LDID_RNF_MASK (0x80) - -#define CXLA_CCIX_PROP_MAX_PACK_SIZE_MASK UINT64_C(0x0000000000000380) -#define CXLA_CCIX_PROP_MAX_PACK_SIZE_SHIFT_VAL 7 -#define CXLA_CCIX_PROP_MAX_PACK_SIZE_128 0 -#define CXLA_CCIX_PROP_MAX_PACK_SIZE_256 1 -#define CXLA_CCIX_PROP_MAX_PACK_SIZE_512 2 - -/* CCIX Gateway (CXG) link control & status defines */ - -#define CXG_LINK_CTRL_EN_MASK UINT64_C(0x0000000000000001) -#define CXG_LINK_CTRL_REQ_MASK UINT64_C(0x0000000000000002) -#define CXG_LINK_CTRL_UP_MASK UINT64_C(0x0000000000000004) -#define CXG_LINK_CTRL_DVMDOMAIN_REQ_MASK UINT64_C(0x0000000000000008) -#define CXG_LINK_STATUS_ACK_MASK UINT64_C(0x0000000000000001) -#define CXG_LINK_STATUS_DOWN_MASK UINT64_C(0x0000000000000002) -#define CXG_LINK_STATUS_DVMDOMAIN_ACK_MASK UINT64_C(0x0000000000000004) -#define CXG_PRTCL_LINK_CTRL_TIMEOUT UINT32_C(100) -#define CXG_PRTCL_LINK_DVMDOMAIN_TIMEOUT UINT32_C(100) - -/* SMP Mode related defines */ -#define CXG_RA_AUX_CTRL_SMP_MODE_EN_SHIFT_VAL 16 -#define CXG_HA_AUX_CTRL_SMP_MODE_EN_SHIFT_VAL 16 -#define CXLA_AUX_CTRL_SMP_MODE_EN_SHIFT_VAL 47 - -#define HNF_RN_PHYS_RN_ID_VALID_SHIFT_VAL 31 -#define HNF_RN_PHYS_RN_LOCAL_REMOTE_SHIFT_VAL 16 -#define NUM_BITS_RESERVED_FOR_RAID 8 -#define NUM_BITS_RESERVED_FOR_LINKID 8 -#define NUM_BITS_RESERVED_FOR_LDID 8 -#define NUM_BITS_RESERVED_FOR_PHYS_ID 32 -#define LOCAL_CCIX_NODE 0 -#define REMOTE_CCIX_NODE 1 -#define SAM_ADDR_TARGET_HAID_SHIFT (52) -#define SAM_ADDR_REG_VALID_MASK UINT64_C(0x8000000000000000) - -#endif /* CMN_RHODES_CCIX_H */ diff --git a/product/rdv1/include/scp_css_mmap.h b/product/rdv1/include/scp_css_mmap.h index 4ee285bf9..a2cc5644d 100644 --- a/product/rdv1/include/scp_css_mmap.h +++ b/product/rdv1/include/scp_css_mmap.h @@ -10,7 +10,7 @@ #include "scp_mmap.h" -#define SCP_CMN_RHODES_BASE (SCP_SYSTEM_ACCESS_PORT0_BASE + 0x10000000) +#define SCP_CMN650_BASE (SCP_SYSTEM_ACCESS_PORT0_BASE + 0x10000000) #define SCP_REFCLK_CNTCONTROL_BASE (SCP_SYSTEM_ACCESS_PORT1_BASE + 0x2A430000) #define SCP_SID_BASE (SCP_SYSTEM_ACCESS_PORT1_BASE + 0x2A4A0000) diff --git a/product/rdv1/scp_ramfw/config_cmn_rhodes.c b/product/rdv1/scp_ramfw/config_cmn650.c similarity index 79% rename from product/rdv1/scp_ramfw/config_cmn_rhodes.c rename to product/rdv1/scp_ramfw/config_cmn650.c index e3fb3493a..71785e07f 100644 --- a/product/rdv1/scp_ramfw/config_cmn_rhodes.c +++ b/product/rdv1/scp_ramfw/config_cmn650.c @@ -8,7 +8,7 @@ #include "clock_soc.h" #include "scp_css_mmap.h" -#include +#include #include #include @@ -20,7 +20,7 @@ #include /* - * CMN_RHODES nodes + * CMN650 nodes */ #define MEM_CNTRL0_ID 12 #define MEM_CNTRL1_ID 136 @@ -48,7 +48,7 @@ static const unsigned int snf_table[] = { MEM_CNTRL3_ID, /* Maps to HN-F logical node 15 */ }; -static const struct mod_cmn_rhodes_mem_region_map mmap[] = { +static const struct mod_cmn650_mem_region_map mmap[] = { { /* * System cache backed region @@ -56,7 +56,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x000000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_SYSCACHE, + .type = MOD_CMN650_MEM_REGION_TYPE_SYSCACHE, }, { /* @@ -65,7 +65,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x000000000000), .size = UINT64_C(128) * FWK_MIB, - .type = MOD_CMN_RHODES_REGION_TYPE_SYSCACHE_SUB, + .type = MOD_CMN650_REGION_TYPE_SYSCACHE_SUB, .node_id = NODE_ID_SBSX, }, { @@ -75,7 +75,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0008000000), .size = UINT64_C(128) * FWK_MIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, { @@ -85,7 +85,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0010000000), .size = UINT64_C(256) * FWK_MIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, { @@ -95,7 +95,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0020000000), .size = UINT64_C(512) * FWK_MIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, { @@ -105,16 +105,16 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0040000000), .size = UINT64_C(1) * FWK_GIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, }; -static const struct fwk_element cmn_rhodes_device_table[] = { +static const struct fwk_element cmn650_device_table[] = { [0] = { - .name = "Chip-0 CMN-Rhodes Mesh Config", - .data = &((struct mod_cmn_rhodes_config){ - .base = SCP_CMN_RHODES_BASE, + .name = "Chip-0 CMN-650 Mesh Config", + .data = &((struct mod_cmn650_config){ + .base = SCP_CMN650_BASE, .mesh_size_x = 3, .mesh_size_y = 5, .hnd_node_id = NODE_ID_HND, @@ -131,11 +131,11 @@ static const struct fwk_element cmn_rhodes_device_table[] = { [1] = { 0 } }; -static const struct fwk_element *cmn_rhodes_get_device_table(fwk_id_t module_id) +static const struct fwk_element *cmn650_get_device_table(fwk_id_t module_id) { - return cmn_rhodes_device_table; + return cmn650_device_table; } -const struct fwk_module_config config_cmn_rhodes = { - .elements = FWK_MODULE_DYNAMIC_ELEMENTS(cmn_rhodes_get_device_table), +const struct fwk_module_config config_cmn650 = { + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(cmn650_get_device_table), }; diff --git a/product/rdv1/scp_ramfw/firmware.mk b/product/rdv1/scp_ramfw/firmware.mk index 2024e2e6a..62d60856a 100644 --- a/product/rdv1/scp_ramfw/firmware.mk +++ b/product/rdv1/scp_ramfw/firmware.mk @@ -21,7 +21,7 @@ BS_FIRMWARE_MODULES := \ clock \ gtimer \ timer \ - cmn_rhodes \ + cmn650 \ apcontext \ ppu_v1 \ system_power \ @@ -50,7 +50,7 @@ BS_FIRMWARE_SOURCES := \ config_sds.c \ config_timer.c \ config_gtimer.c \ - config_cmn_rhodes.c \ + config_cmn650.c \ config_scmi_system_power.c \ config_system_pll.c \ config_pik_clock.c \ diff --git a/product/rdv1mc/include/scp_css_mmap.h b/product/rdv1mc/include/scp_css_mmap.h index 4ee285bf9..a2cc5644d 100644 --- a/product/rdv1mc/include/scp_css_mmap.h +++ b/product/rdv1mc/include/scp_css_mmap.h @@ -10,7 +10,7 @@ #include "scp_mmap.h" -#define SCP_CMN_RHODES_BASE (SCP_SYSTEM_ACCESS_PORT0_BASE + 0x10000000) +#define SCP_CMN650_BASE (SCP_SYSTEM_ACCESS_PORT0_BASE + 0x10000000) #define SCP_REFCLK_CNTCONTROL_BASE (SCP_SYSTEM_ACCESS_PORT1_BASE + 0x2A430000) #define SCP_SID_BASE (SCP_SYSTEM_ACCESS_PORT1_BASE + 0x2A4A0000) diff --git a/product/rdv1mc/scp_ramfw/config_cmn_rhodes.c b/product/rdv1mc/scp_ramfw/config_cmn650.c similarity index 88% rename from product/rdv1mc/scp_ramfw/config_cmn_rhodes.c rename to product/rdv1mc/scp_ramfw/config_cmn650.c index 245b29c6b..38343369c 100644 --- a/product/rdv1mc/scp_ramfw/config_cmn_rhodes.c +++ b/product/rdv1mc/scp_ramfw/config_cmn650.c @@ -8,14 +8,14 @@ #include "clock_soc.h" #include "scp_css_mmap.h" -#include +#include #include #include #include /* - * CMN_RHODES nodes + * CMN650 nodes */ #define MEM_CNTRL0_ID 332 #define MEM_CNTRL1_ID 333 @@ -115,7 +115,7 @@ static const unsigned int snf_table_1_3[] = { MEM_CNTRL7_ID, /* Maps to HN-F logical node 31 */ }; -static const struct mod_cmn_rhodes_mem_region_map mmap[] = { +static const struct mod_cmn650_mem_region_map mmap[] = { { /* * System cache backed region @@ -123,7 +123,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x000000000000), .size = UINT64_C(16) * FWK_TIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_SYSCACHE, + .type = MOD_CMN650_MEM_REGION_TYPE_SYSCACHE, }, { /* @@ -132,7 +132,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x000000000000), .size = UINT64_C(128) * FWK_MIB, - .type = MOD_CMN_RHODES_REGION_TYPE_SYSCACHE_SUB, + .type = MOD_CMN650_REGION_TYPE_SYSCACHE_SUB, .node_id = NODE_ID_SBSX, }, { @@ -142,7 +142,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0008000000), .size = UINT64_C(128) * FWK_MIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, { @@ -152,7 +152,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0010000000), .size = UINT64_C(256) * FWK_MIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, { @@ -162,7 +162,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0020000000), .size = UINT64_C(512) * FWK_MIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, { @@ -172,7 +172,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { */ .base = UINT64_C(0x0040000000), .size = UINT64_C(1) * FWK_GIB, - .type = MOD_CMN_RHODES_MEM_REGION_TYPE_IO, + .type = MOD_CMN650_MEM_REGION_TYPE_IO, .node_id = NODE_ID_HND, }, }; @@ -180,7 +180,7 @@ static const struct mod_cmn_rhodes_mem_region_map mmap[] = { /* CCIX Related configuration data */ /* Chip-0 Config data */ -static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_0[] = { +static const struct mod_cmn650_ccix_config ccix_config_table_chip_0[] = { { .ldid = CCIX_PORT_0, .haid = (RNF_PER_CHIP * CHIP_0) + CCIX_PORT_0, @@ -188,7 +188,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_0[] = { .remote_mmap_table = { .base = UINT64_C(0x40000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -213,7 +213,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_0[] = { .remote_mmap_table = { .base = UINT64_C(0x80000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -238,7 +238,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_0[] = { .remote_mmap_table = { .base = UINT64_C(0xC0000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -259,7 +259,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_0[] = { }; /* Chip-1 Config data */ -static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_1[] = { +static const struct mod_cmn650_ccix_config ccix_config_table_chip_1[] = { { .ldid = CCIX_PORT_0, .haid = (RNF_PER_CHIP * CHIP_1) + CCIX_PORT_0, @@ -267,7 +267,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_1[] = { .remote_mmap_table = { .base = UINT64_C(0x000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -292,7 +292,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_1[] = { .remote_mmap_table = { .base = UINT64_C(0x80000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -317,7 +317,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_1[] = { .remote_mmap_table = { .base = UINT64_C(0xC0000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -338,7 +338,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_1[] = { }; /* Chip-2 Config data */ -static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_2[] = { +static const struct mod_cmn650_ccix_config ccix_config_table_chip_2[] = { { .ldid = CCIX_PORT_0, .haid = (RNF_PER_CHIP * CHIP_2) + CCIX_PORT_0, @@ -346,7 +346,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_2[] = { .remote_mmap_table = { .base = UINT64_C(0x000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -371,7 +371,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_2[] = { .remote_mmap_table = { .base = UINT64_C(0x40000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -396,7 +396,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_2[] = { .remote_mmap_table = { .base = UINT64_C(0xC0000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -417,7 +417,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_2[] = { }; /* Chip-3 Config data */ -static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_3[] = { +static const struct mod_cmn650_ccix_config ccix_config_table_chip_3[] = { { .ldid = CCIX_PORT_0, .haid = (RNF_PER_CHIP * CHIP_3) + CCIX_PORT_0, @@ -425,7 +425,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_3[] = { .remote_mmap_table = { .base = UINT64_C(0x000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -450,7 +450,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_3[] = { .remote_mmap_table = { .base = UINT64_C(0x40000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -475,7 +475,7 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_3[] = { .remote_mmap_table = { .base = UINT64_C(0x80000000000), .size = UINT64_C(4) * FWK_TIB, - .type = MOD_CMN_RHODES_REGION_TYPE_CCIX, + .type = MOD_CMN650_REGION_TYPE_CCIX, }, .ra_mmap_table = { { @@ -495,11 +495,11 @@ static const struct mod_cmn_rhodes_ccix_config ccix_config_table_chip_3[] = { }, }; -static const struct fwk_element cmn_rhodes_device_table[] = { +static const struct fwk_element cmn650_device_table[] = { [0] = { - .name = "Chip-0 CMN-Rhodes Mesh Config", - .data = &((struct mod_cmn_rhodes_config){ - .base = SCP_CMN_RHODES_BASE, + .name = "Chip-0 CMN-650 Mesh Config", + .data = &((struct mod_cmn650_config){ + .base = SCP_CMN650_BASE, .mesh_size_x = 6, .mesh_size_y = 6, .hnd_node_id = NODE_ID_HND, @@ -516,9 +516,9 @@ static const struct fwk_element cmn_rhodes_device_table[] = { }), }, [1] = { - .name = "Chip-1 CMN-Rhodes Mesh Config", - .data = &((struct mod_cmn_rhodes_config){ - .base = SCP_CMN_RHODES_BASE, + .name = "Chip-1 CMN-650 Mesh Config", + .data = &((struct mod_cmn650_config){ + .base = SCP_CMN650_BASE, .mesh_size_x = 6, .mesh_size_y = 6, .hnd_node_id = NODE_ID_HND, @@ -535,9 +535,9 @@ static const struct fwk_element cmn_rhodes_device_table[] = { }), }, [2] = { - .name = "Chip-2 CMN-Rhodes Mesh Config", - .data = &((struct mod_cmn_rhodes_config){ - .base = SCP_CMN_RHODES_BASE, + .name = "Chip-2 CMN-650 Mesh Config", + .data = &((struct mod_cmn650_config){ + .base = SCP_CMN650_BASE, .mesh_size_x = 6, .mesh_size_y = 6, .hnd_node_id = NODE_ID_HND, @@ -554,9 +554,9 @@ static const struct fwk_element cmn_rhodes_device_table[] = { }), }, [3] = { - .name = "Chip-3 CMN-Rhodes Mesh Config", - .data = &((struct mod_cmn_rhodes_config){ - .base = SCP_CMN_RHODES_BASE, + .name = "Chip-3 CMN-650 Mesh Config", + .data = &((struct mod_cmn650_config){ + .base = SCP_CMN650_BASE, .mesh_size_x = 6, .mesh_size_y = 6, .hnd_node_id = NODE_ID_HND, @@ -575,11 +575,11 @@ static const struct fwk_element cmn_rhodes_device_table[] = { [4] = { 0 } }; -static const struct fwk_element *cmn_rhodes_get_device_table(fwk_id_t module_id) +static const struct fwk_element *cmn650_get_device_table(fwk_id_t module_id) { - return cmn_rhodes_device_table; + return cmn650_device_table; } -const struct fwk_module_config config_cmn_rhodes = { - .elements = FWK_MODULE_DYNAMIC_ELEMENTS(cmn_rhodes_get_device_table), +const struct fwk_module_config config_cmn650 = { + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(cmn650_get_device_table), }; diff --git a/product/rdv1mc/scp_ramfw/firmware.mk b/product/rdv1mc/scp_ramfw/firmware.mk index e01b8acfa..068409071 100644 --- a/product/rdv1mc/scp_ramfw/firmware.mk +++ b/product/rdv1mc/scp_ramfw/firmware.mk @@ -21,7 +21,7 @@ BS_FIRMWARE_MODULES := \ clock \ gtimer \ timer \ - cmn_rhodes \ + cmn650 \ ppu_v1 \ system_power \ mhu2 \ @@ -50,7 +50,7 @@ BS_FIRMWARE_SOURCES := \ config_sds.c \ config_timer.c \ config_gtimer.c \ - config_cmn_rhodes.c \ + config_cmn650.c \ config_scmi_system_power.c \ config_scmi_power_domain.c \ config_system_pll.c \ -- GitLab