diff --git a/module/scmi/src/mod_scmi.c b/module/scmi/src/mod_scmi.c index dfaf441fbae50a606ec83709e213ee93caed1085..1786accb8fbb43791f120b7b6d23639dce121c7a 100644 --- a/module/scmi/src/mod_scmi.c +++ b/module/scmi/src/mod_scmi.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -956,6 +956,11 @@ static int scmi_bind(fwk_id_t id, unsigned int round) scmi_ctx.scmi_protocol_id_to_idx[scmi_protocol_id] = (uint8_t)(protocol_idx + PROTOCOL_TABLE_RESERVED_ENTRIES_COUNT); protocol->message_handler = protocol_api->message_handler; +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + if (protocol_api->notification_handler != NULL) { + protocol->notification_handler = protocol_api->notification_handler; + } +#endif } for (protocol_idx = 0; protocol_idx < scmi_ctx.protocol_requester_count; diff --git a/product/neoverse-rd/common/include/nrd_scmi.h b/product/neoverse-rd/common/include/nrd_scmi.h new file mode 100644 index 0000000000000000000000000000000000000000..b9b48cf4b5aefeb0a6864cb8b48a30ee1b519860 --- /dev/null +++ b/product/neoverse-rd/common/include/nrd_scmi.h @@ -0,0 +1,50 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * SCMI payload configuration data for Neoverse RD platform. + */ + +#ifndef NRD_SCMI_H +#define NRD_SCMI_H + +#include + +// clang-format off + +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +/* + * System power states for Neoverse RD platform + */ +enum nrd_scmi_system_state { + NRD_SCMI_SYSTEM_STATE_SHUTDOWN, + NRD_SCMI_SYSTEM_STATE_COLD_RESET, + NRD_SCMI_SYSTEM_STATE_WARM_RESET, + NRD_SCMI_SYSTEM_STATE_COUNT, +}; + +/* + * SCMI payload for scmi sytem power protocol, message id + * SYSTEM_POWER_STATE_SET + * This will be removed once SCMI support is enabled at RSE + */ +struct scp_cfgd_scmi_sys_power_state_set_payload { + uint32_t flags; + uint32_t system_state; +}; + +/* + * SCMI payload for scmi sytem power protocol, message id + * SYSTEM_POWER_STATE_NOTIFY + */ +struct mcp_cfgd_scmi_sys_power_state_notify_payload { + uint32_t flags; +}; +#endif + +// clang-format on + +#endif /* NRD_SCMI_H */ diff --git a/product/neoverse-rd/module/scmi_sys_power/CMakeLists.txt b/product/neoverse-rd/module/scmi_sys_power/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..f834c8118994df9962a7ce5bf6290d776c516a49 --- /dev/null +++ b/product/neoverse-rd/module/scmi_sys_power/CMakeLists.txt @@ -0,0 +1,17 @@ +# +# Arm SCP/MCP Software +# Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +add_library(${SCP_MODULE_TARGET} SCP_MODULE) + +target_include_directories(${SCP_MODULE_TARGET} + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") + +target_sources( + ${SCP_MODULE_TARGET} + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_scmi_sys_power.c") + +target_link_libraries(${SCP_MODULE_TARGET} PRIVATE module-scmi) diff --git a/product/neoverse-rd/module/scmi_sys_power/Module.cmake b/product/neoverse-rd/module/scmi_sys_power/Module.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b3f3a6a95b62315372a789980602be809add9d76 --- /dev/null +++ b/product/neoverse-rd/module/scmi_sys_power/Module.cmake @@ -0,0 +1,9 @@ +# +# Arm SCP/MCP Software +# Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +set(SCP_MODULE "scmi-sys-power") +set(SCP_MODULE_TARGET "module-scmi-sys-power") diff --git a/product/neoverse-rd/module/scmi_sys_power/include/internal/scmi_sys_power.h b/product/neoverse-rd/module/scmi_sys_power/include/internal/scmi_sys_power.h new file mode 100644 index 0000000000000000000000000000000000000000..7b4fa3cc9e2248635b399de2539d54731d177417 --- /dev/null +++ b/product/neoverse-rd/module/scmi_sys_power/include/internal/scmi_sys_power.h @@ -0,0 +1,45 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef SCMI_SYSPWR_H +#define SCMI_SYSPWR_H + +#include + +#define SCMI_PROTOCOL_VERSION_SYS_POWER UINT32_C(0x10000) + +/* Notifications supported by SCMI system power protocol as per SCMI 3.2 spec */ +enum scmi_sys_power_notification_id { + SCMI_SYS_POWER_STATE_SET_NOTIFY = 0x000, + SCMI_SYS_POWER_NOTIFICATION_COUNT, +}; + +/* + * SYSTEM_POWER_STATE_NOTIFY + */ + +#define STATE_NOTIFY_FLAGS_MASK 0x1U + +struct scmi_sys_power_state_notify_a2p { + uint32_t flags; +}; + +struct scmi_sys_power_state_notify_p2a { + int32_t status; +}; + +/* + * SYSTEM_POWER_STATE_NOTIFIER + */ + +struct scmi_sys_power_state_notifier { + uint32_t agent_id; + uint32_t flags; + uint32_t system_state; +}; + +#endif /* SCMI_SYSPWR_H */ diff --git a/product/neoverse-rd/module/scmi_sys_power/include/mod_scmi_sys_power.h b/product/neoverse-rd/module/scmi_sys_power/include/mod_scmi_sys_power.h new file mode 100644 index 0000000000000000000000000000000000000000..3acd474876883556c20af0304fc58dfde4669511 --- /dev/null +++ b/product/neoverse-rd/module/scmi_sys_power/include/mod_scmi_sys_power.h @@ -0,0 +1,37 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef MOD_SCMI_SYS_POWER_H +#define MOD_SCMI_SYS_POWER_H + +#include +#include + +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +# ifdef BUILD_HAS_NOTIFICATION +/*! + * \brief Indices of the notification sent by the module. + */ +enum mod_scmi_sys_power_notification_idx { + /*! Power state transition */ + MOD_SCMI_SYSTEM_POWER_NOTIFICATION_IDX_SYSTEM_POWER_DOWN, + + /*! Number of notifications defined */ + MOD_SCMI_SYSTEM_POWER_NOTIFICATION_COUNT +}; +# endif +#else +/*! + * \brief Indices of the notification sent by the module. + */ +enum mod_scmi_sys_power_notification_idx { + /*! Number of notifications defined */ + MOD_SCMI_SYSTEM_POWER_NOTIFICATION_COUNT = 0, +}; +#endif + +#endif /* MOD_SCMI_SYS_POWER_H */ diff --git a/product/neoverse-rd/module/scmi_sys_power/src/mod_scmi_sys_power.c b/product/neoverse-rd/module/scmi_sys_power/src/mod_scmi_sys_power.c new file mode 100644 index 0000000000000000000000000000000000000000..0ca014be0ce05d2e08cd892aed27bd47de6f69a3 --- /dev/null +++ b/product/neoverse-rd/module/scmi_sys_power/src/mod_scmi_sys_power.c @@ -0,0 +1,359 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define INVALID_AGENT_ID UINT32_MAX + +struct mod_scmi_sys_power_ctx { + const struct mod_scmi_from_protocol_api *scmi_api; +}; + +static int scmi_sys_power_version_handler( + fwk_id_t service_id, + const uint32_t *payload); + +static int scmi_sys_power_attributes_handler( + fwk_id_t service_id, + const uint32_t *payload); + +static int scmi_sys_power_msg_attributes_handler( + fwk_id_t service_id, + const uint32_t *payload); + +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +static int scmi_sys_power_state_notifier_handler( + fwk_id_t service_id, + const uint32_t *payload); + +/* Notification for system power down */ +static const fwk_id_t mod_scmi_sys_power_notification_system_power_down = + FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_SCMI_SYS_POWER, + MOD_SCMI_SYSTEM_POWER_NOTIFICATION_IDX_SYSTEM_POWER_DOWN); +#endif + +/* + * Internal variables + */ +static struct mod_scmi_sys_power_ctx scmi_sys_power_ctx; + +/* + * Add support for the three basic SCMI message: + * 1. protocol version + * 2. protocol attribute + * 3. protocol message attributes + * These three messages are common for all SCMI protocols. + */ +static int (*const message_handler_table[MOD_SCMI_SYS_POWER_COMMAND_COUNT])( + fwk_id_t, + const uint32_t *) = { + [MOD_SCMI_PROTOCOL_VERSION] = scmi_sys_power_version_handler, + [MOD_SCMI_PROTOCOL_ATTRIBUTES] = scmi_sys_power_attributes_handler, + [MOD_SCMI_PROTOCOL_MESSAGE_ATTRIBUTES] = + scmi_sys_power_msg_attributes_handler, +}; + +/* + * Input payload size of the basic SCMI messages as specified in SCMI v3.2 + */ +static const unsigned int + payload_size_table[MOD_SCMI_SYS_POWER_COMMAND_COUNT] = { + /* No input payload */ + [MOD_SCMI_PROTOCOL_VERSION] = 0, + /* No input payload */ + [MOD_SCMI_PROTOCOL_ATTRIBUTES] = 0, + /* payload specified in struct scmi_protocol_message_attributes_a2p */ + [MOD_SCMI_PROTOCOL_MESSAGE_ATTRIBUTES] = + (unsigned int)sizeof(struct scmi_protocol_message_attributes_a2p), + }; + +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +/* + * Support for SCMI system power protocol notification + */ +static int ( + *const notification_handler_table[SCMI_SYS_POWER_NOTIFICATION_COUNT])( + fwk_id_t, + const uint32_t *) = { + [SCMI_SYS_POWER_STATE_SET_NOTIFY] = scmi_sys_power_state_notifier_handler, +}; + +static const unsigned int + payload_size_table_notification[SCMI_SYS_POWER_NOTIFICATION_COUNT] = { + [SCMI_SYS_POWER_STATE_SET_NOTIFY] = + sizeof(struct scmi_sys_power_state_notifier), + }; +#endif + +/* + * PROTOCOL_VERSION + */ +static int scmi_sys_power_version_handler( + fwk_id_t service_id, + const uint32_t *payload) +{ + struct scmi_protocol_version_p2a return_values = { + .status = (int32_t)SCMI_SUCCESS, + .version = SCMI_PROTOCOL_VERSION_SYS_POWER, + }; + + return scmi_sys_power_ctx.scmi_api->respond( + service_id, &return_values, sizeof(return_values)); +} + +/* + * PROTOCOL_ATTRIBUTES + */ +static int scmi_sys_power_attributes_handler( + fwk_id_t service_id, + const uint32_t *payload) +{ + struct scmi_protocol_attributes_p2a return_values = { + .status = (int32_t)SCMI_SUCCESS, + .attributes = 0, + }; + + return scmi_sys_power_ctx.scmi_api->respond( + service_id, &return_values, sizeof(return_values)); +} + +/* + * PROTOCOL_MESSAGE_ATTRIBUTES + */ +static int scmi_sys_power_msg_attributes_handler( + fwk_id_t service_id, + const uint32_t *payload) +{ + struct scmi_protocol_message_attributes_p2a return_values; + + /* + * The module currently support only SCMI notification, not SCMI message, + * hence return SCMI_NOT_SUPPORTED for all message attribute query. + */ + return_values.status = (int32_t)SCMI_NOT_SUPPORTED; + + return scmi_sys_power_ctx.scmi_api->respond( + service_id, &return_values, sizeof(return_values.status)); +} + +/* + * SCMI module -> SCMI system power module interface + */ +static int scmi_sys_power_get_scmi_protocol_id( + fwk_id_t protocol_id, + uint8_t *scmi_protocol_id) +{ + *scmi_protocol_id = (uint8_t)MOD_SCMI_PROTOCOL_ID_SYS_POWER; + + return FWK_SUCCESS; +} + +/* + * Message handler for generic SCMI messages + */ +static int scmi_sys_power_message_handler( + fwk_id_t protocol_id, + fwk_id_t service_id, + const uint32_t *payload, + size_t payload_size, + unsigned int message_id) +{ + int32_t return_value; + + static_assert( + FWK_ARRAY_SIZE(message_handler_table) == + FWK_ARRAY_SIZE(payload_size_table), + "[SCMI] System power protocol table sizes not consistent"); + + fwk_assert(payload != NULL); + + if (message_id >= FWK_ARRAY_SIZE(message_handler_table)) { + return_value = (int32_t)SCMI_NOT_FOUND; + goto error; + } + + if (payload_size != payload_size_table[message_id]) { + /* Incorrect payload size or message is not supported */ + return_value = (int32_t)SCMI_PROTOCOL_ERROR; + goto error; + } + + return message_handler_table[message_id](service_id, payload); + +error: + return scmi_sys_power_ctx.scmi_api->respond( + service_id, &return_value, sizeof(return_value)); +} + +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +/* + * SYSTEM_POWER_STATE_NOTIFIER + */ +static int scmi_sys_power_state_notifier_handler( + fwk_id_t service_id, + const uint32_t *payload) +{ + int status = FWK_SUCCESS; + int32_t return_value; + const struct scmi_sys_power_state_notifier *parameters; +# ifdef BUILD_HAS_NOTIFICATION + unsigned int count; + struct fwk_event notification_event = { + .id = mod_scmi_sys_power_notification_system_power_down, + .response_requested = false, + .source_id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_SCMI_SYS_POWER), + }; +# endif + + parameters = (const struct scmi_sys_power_state_notifier *)payload; + + if (parameters->flags & (uint32_t)(~STATE_NOTIFY_FLAGS_MASK)) { + return_value = (int32_t)SCMI_INVALID_PARAMETERS; + goto exit; + } + +# ifdef BUILD_HAS_NOTIFICATION + fwk_str_memcpy( + notification_event.params, + ¶meters->system_state, + sizeof(parameters->system_state)); + status = fwk_notification_notify(¬ification_event, &count); + if (status != FWK_SUCCESS) { + FWK_LOG_ERR( + "[SCMI_SYSTEM_POWER] failed to notify power state transition: %s", + fwk_status_str(status)); + return SCMI_DENIED; + } +# endif + +exit: + status = scmi_sys_power_ctx.scmi_api->respond( + service_id, &return_value, sizeof(return_value)); + + return status; +} + +/* + * Handler for SCMI system power notifications + */ +static int scmi_sys_power_notification_handler( + fwk_id_t protocol_id, + fwk_id_t service_id, + const uint32_t *payload, + size_t payload_size, + unsigned int notification_id) +{ + int32_t return_value; + + static_assert( + FWK_ARRAY_SIZE(notification_handler_table) == + FWK_ARRAY_SIZE(payload_size_table_notification), + "[SCMI] System power protocol notification table sizes not consistent"); + + fwk_assert(payload != NULL); + + if (notification_id >= FWK_ARRAY_SIZE(notification_handler_table)) { + return_value = (int32_t)SCMI_NOT_FOUND; + goto error; + } + + if (payload_size != payload_size_table_notification[notification_id]) { + /* Incorrect payload size or message is not supported */ + return_value = (int32_t)SCMI_PROTOCOL_ERROR; + goto error; + } + + return notification_handler_table[notification_id](service_id, payload); + +error: + return scmi_sys_power_ctx.scmi_api->respond( + service_id, &return_value, sizeof(return_value)); +} +#endif + +static struct mod_scmi_to_protocol_api scmi_sys_power_mod_scmi_to_protocol = { + .get_scmi_protocol_id = scmi_sys_power_get_scmi_protocol_id, + .message_handler = scmi_sys_power_message_handler, +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + .notification_handler = scmi_sys_power_notification_handler, +#endif +}; + +/* + * Framework handlers + */ +static int scmi_sys_power_init( + fwk_id_t module_id, + unsigned int element_count, + const void *data) +{ + return FWK_SUCCESS; +} + +static int scmi_sys_power_bind(fwk_id_t id, unsigned int round) +{ + int status; + + if (round != 0) { + return FWK_SUCCESS; + } + + /* Bind to SCMI module */ + status = fwk_module_bind( + FWK_ID_MODULE(FWK_MODULE_IDX_SCMI), + FWK_ID_API(FWK_MODULE_IDX_SCMI, MOD_SCMI_API_IDX_PROTOCOL), + &scmi_sys_power_ctx.scmi_api); + if (status != FWK_SUCCESS) { + return status; + } + + return FWK_SUCCESS; +} + +static int scmi_sys_power_process_bind_request( + fwk_id_t source_id, + fwk_id_t _target_id, + fwk_id_t api_id, + const void **api) +{ + if (!fwk_id_is_equal(source_id, FWK_ID_MODULE(FWK_MODULE_IDX_SCMI))) { + return FWK_E_ACCESS; + } + + *api = &scmi_sys_power_mod_scmi_to_protocol; + + return FWK_SUCCESS; +} + +const struct fwk_module module_scmi_sys_power = { + .api_count = 1, + .notification_count = MOD_SCMI_SYSTEM_POWER_NOTIFICATION_COUNT, + .type = FWK_MODULE_TYPE_PROTOCOL, + .init = scmi_sys_power_init, + .bind = scmi_sys_power_bind, + .process_bind_request = scmi_sys_power_process_bind_request, +}; + +const struct fwk_module_config config_scmi_sys_power = { 0 }; diff --git a/product/neoverse-rd/rdv3/include/css_common.h b/product/neoverse-rd/rdv3/include/css_common.h index 7cb0394dace9f8c3b0ef4a323aae75434fb3063a..7553a980b352a9389fa65fad30e82182f4029426 100644 --- a/product/neoverse-rd/rdv3/include/css_common.h +++ b/product/neoverse-rd/rdv3/include/css_common.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -22,4 +22,8 @@ */ #define SYSCNT_INCR 8 +/* RSM SRAM physical address and size at the AP memory map */ +#define RSM_SHARED_SRAM_BASE UINT32_C(0x2F000000) +#define RSM_SHARED_SRAM_SIZE (4 * FWK_MIB) + #endif /* CSS_COMMON_H */ diff --git a/product/neoverse-rd/rdv3/include/platform_variant.h b/product/neoverse-rd/rdv3/include/platform_variant.h new file mode 100644 index 0000000000000000000000000000000000000000..58200552468d12c09083097b5747b703eafc8870 --- /dev/null +++ b/product/neoverse-rd/rdv3/include/platform_variant.h @@ -0,0 +1,18 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * RD-V3 platform variants. + */ + +#ifndef PLATFORM_VARIANT_H +#define PLATFORM_VARIANT_H + +#define RD_V3 0 +#define RD_V3_CFG1 1 +#define RD_V3_CFG2 2 + +#endif diff --git a/product/neoverse-rd/rdv3/include/rsm_fw_mmap.h b/product/neoverse-rd/rdv3/include/rsm_fw_mmap.h new file mode 100644 index 0000000000000000000000000000000000000000..3093d3c566b9d41a856527aac9c62839aa79a893 --- /dev/null +++ b/product/neoverse-rd/rdv3/include/rsm_fw_mmap.h @@ -0,0 +1,47 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Common RSM SRAM memory region mapping, shared across SCP, MCP and RSE. + */ + +#ifndef RSM_FW_MMAP_H +#define RSM_FW_MMAP_H + +#include + +// clang-format off + +/* + * [SCP_ATW0_SHARED_SRAM_RSM_BASE] + * +---------------------------------------+ SCP_MCP_SCMI_MSG_PAYLOAD_BASE + * | | + * | SCP-MCP SCMI payload | + * | (SCP_MCP_SCMI_MSG_PAYLOAD_SIZE bytes) | + * +---------------------------------------+ [SCP_RSE_SCMI_MSG_PAYLOAD_BASE] + * | | + * | SCP-RSE SCMI payload | + * | (SCP_RSE_SCMI_MSG_PAYLOAD_SIZE bytes) | + * +---------------------------------------+ + * | | + * | | + * | Unused | + * | | + * | | + * +---------------------------------------+ [SCP_ATW0_SHARED_SRAM_RSM_BASE + + * RSM_SHARED_SRAM_SIZE] + */ + +#define SCP_MCP_SCMI_MSG_PAYLOAD_OFFSET UINT32_C(0x0) +#define SCP_MCP_SCMI_MSG_PAYLOAD_SIZE (128) + +#define SCP_RSE_SCMI_MSG_PAYLOAD_OFFSET \ + (SCP_MCP_SCMI_MSG_PAYLOAD_OFFSET + SCP_MCP_SCMI_MSG_PAYLOAD_SIZE) +#define SCP_RSE_SCMI_MSG_PAYLOAD_SIZE (128) + +// clang-format on + +#endif /* RSM_FW_MMAP_H */ diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/CMakeLists.txt b/product/neoverse-rd/rdv3/mcp_ramfw/CMakeLists.txt index 181d7a4bca55bea294ab660e24e494b5c7682c38..d85b792ab49c561c13a2d5ea168da2f035ba59ed 100644 --- a/product/neoverse-rd/rdv3/mcp_ramfw/CMakeLists.txt +++ b/product/neoverse-rd/rdv3/mcp_ramfw/CMakeLists.txt @@ -33,6 +33,8 @@ else() "'2' for RD-V3-Cfg2\n") endif() +target_compile_definitions(rdv3-mcp-bl2 PRIVATE BUILD_HAS_ATU_MANAGE) + target_include_directories( rdv3-mcp-bl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" @@ -42,10 +44,14 @@ target_include_directories( target_sources( rdv3-mcp-bl2 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/config_armv7m_mpu.c" + "${CMAKE_CURRENT_SOURCE_DIR}/config_atu.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_clock.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_pl011.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_timer.c" - "${CMAKE_CURRENT_SOURCE_DIR}/config_gtimer.c") + "${CMAKE_CURRENT_SOURCE_DIR}/config_gtimer.c" + "${CMAKE_CURRENT_SOURCE_DIR}/config_mhu3.c" + "${CMAKE_CURRENT_SOURCE_DIR}/config_transport.c" + "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi") # # Some of our firmware includes require CMSIS. diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/Firmware.cmake b/product/neoverse-rd/rdv3/mcp_ramfw/Firmware.cmake index 8dcdedc4de512947823d2fbac979580194e20e17..97f9691babe42759c332fff47b839181fc768212 100644 --- a/product/neoverse-rd/rdv3/mcp_ramfw/Firmware.cmake +++ b/product/neoverse-rd/rdv3/mcp_ramfw/Firmware.cmake @@ -1,6 +1,6 @@ # # Arm SCP/MCP Software -# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -26,7 +26,15 @@ set(SCP_ENABLE_IPO_INIT FALSE) set(SCP_ARCHITECTURE "arm-m") +set(SCP_ENABLE_OUTBAND_MSG_SUPPORT TRUE) + +set(SCP_ENABLE_ATU_DELEGATE FALSE) +set(SCP_ENABLE_ATU_MANAGE TRUE) + +set(SCP_ENABLE_SCMI_NOTIFICATIONS TRUE) + list(PREPEND SCP_MODULE_PATHS + "${CMAKE_SOURCE_DIR}/product/neoverse-rd/module/scmi_sys_power" "${CMAKE_CURRENT_LIST_DIR}/../module/mcp_platform") # The order of the modules in the following list is the order in which the @@ -35,7 +43,12 @@ list(PREPEND SCP_MODULE_PATHS list(APPEND SCP_MODULES "armv7m-mpu") list(APPEND SCP_MODULES "pl011") +list(APPEND SCP_MODULES "atu") list(APPEND SCP_MODULES "clock") list(APPEND SCP_MODULES "timer") list(APPEND SCP_MODULES "gtimer") +list(APPEND SCP_MODULES "mhu3") +list(APPEND SCP_MODULES "transport") +list(APPEND SCP_MODULES "scmi") +list(APPEND SCP_MODULES "scmi-sys-power") list(APPEND SCP_MODULES "mcp-platform") diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/config_atu.c b/product/neoverse-rd/rdv3/mcp_ramfw/config_atu.c new file mode 100644 index 0000000000000000000000000000000000000000..fb712a02ca718bcae3dde2e1c604bbc2c9fd7e5c --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/config_atu.c @@ -0,0 +1,68 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Configuration data for module 'atu'. + */ + +#include "css_common.h" +#include "mcp_css_mmap.h" + +#include + +#include +#include +#include +#include +#include + +/* Indices for ATU module elements */ +enum cfgd_mod_atu_element_idx { + CFGD_MOD_ATU_EIDX_ATU0, + CFGD_MOD_ATU_EIDX_COUNT +}; + +#define MOD_MCP_ATU_ELEMENT_COUNT (CFGD_MOD_ATU_EIDX_COUNT + 1) + +/* Indices for translation regions to be configured in the ATU */ +enum atu_regions_idx { + /* ATU region to access shared RSM SRAM */ + ATU_REGION_IDX_SHARED_SRAM_RSM, + /* ATU region count */ + ATU_REGION_IDX_COUNT, +}; + +static struct atu_region_map atu_regions[ATU_REGION_IDX_COUNT] = { + [ATU_REGION_IDX_SHARED_SRAM_RSM] = { + .region_owner_id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_MCP_PLATFORM), + .log_addr_base = MCP_SHARED_SRAM_RSM_BASE, + .phy_addr_base = RSM_SHARED_SRAM_BASE, + .region_size = RSM_SHARED_SRAM_SIZE, + .attributes = ATU_ENCODE_ATTRIBUTES_SECURE_PAS, + }, +}; + +static const struct fwk_element element_table[MOD_MCP_ATU_ELEMENT_COUNT] = { + [CFGD_MOD_ATU_EIDX_ATU0] = { + .name = "MCP_ATU", + .data = &(struct mod_atu_device_config) { + .is_atu_delegated = false, + .atu_base = MCP_ATU_BASE, + .atu_region_config_table = atu_regions, + .atu_region_count = FWK_ARRAY_SIZE(atu_regions), + }, + }, + [CFGD_MOD_ATU_EIDX_COUNT] = { 0 }, +}; + +static const struct fwk_element *get_element_table(fwk_id_t module_id) +{ + return element_table; +} + +struct fwk_module_config config_atu = { + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_element_table), +}; diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/config_mhu3.c b/product/neoverse-rd/rdv3/mcp_ramfw/config_mhu3.c new file mode 100644 index 0000000000000000000000000000000000000000..d180d72bb2fb39f4f446266828bae0dbb8bdc07b --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/config_mhu3.c @@ -0,0 +1,50 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Configuration data for module 'mhu3'. + */ + +#include "mcp_cfgd_mhu3.h" +#include "mcp_css_mmap.h" + +#include + +#include +#include +#include + +#include + +/* MCP<-->SCP Secure MHUv3 doorbell channel configuration */ +static struct mod_mhu3_channel_config mcp2scp_s_dbch_config[] = { + /* PBX CH 0, FLAG 0, MBX CH 0, FLAG 0 */ + MOD_MHU3_INIT_DBCH(0, 0, 0, 0), +}; + +/* Module element table */ +static const struct fwk_element element_table[] = { + [MCP_CFGD_MOD_MHU3_EIDX_MCP_SCP_S] = { + .name = "MCP2SCP_S_MHU_DBCH", + .sub_element_count = 1, + .data = &(struct mod_mhu3_device_config) { + .irq = (unsigned int) MHU3_SCP2MCP_IRQ_S, + .in = MCP_SCP2MCP_MHUV3_RCV_S_BASE, + .out = MCP_MCP2SCP_MHUV3_SEND_S_BASE, + .channels = &mcp2scp_s_dbch_config[0], + }, + }, + [MCP_CFGD_MOD_MHU3_EIDX_COUNT] = { 0 }, +}; + +static const struct fwk_element *get_element_table(fwk_id_t module_id) +{ + return element_table; +} + +struct fwk_module_config config_mhu3 = { + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_element_table), +}; diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/config_scmi.c b/product/neoverse-rd/rdv3/mcp_ramfw/config_scmi.c new file mode 100644 index 0000000000000000000000000000000000000000..8640f18a6506daceb3aad5e62742e54cb8555f79 --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/config_scmi.c @@ -0,0 +1,104 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Configuration data for module 'scmi'. + */ + +#include "mcp_cfgd_scmi.h" +#include "mcp_cfgd_transport.h" + +#include +#include + +#include +#include +#include +#include +#include + +/* Module 'scmi' element count */ +#define MOD_SCMI_ELEMENT_COUNT (MCP_CFGD_MOD_SCMI_EIDX_COUNT + 1) + +static const struct fwk_element service_table[MOD_SCMI_ELEMENT_COUNT] = { +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + [MCP_CFGD_MOD_SCMI_EIDX_SCP_SCMI_SEND] = { + .name = "MCP_SCP_SCMI_SEND", + .data = &((struct mod_scmi_service_config) { + .transport_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_TRANSPORT, + MCP_CFGD_MOD_TRANSPORT_EIDX_SCP_SCMI_MSG_SEND_CH), + .transport_api_id = FWK_ID_API_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT), + .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED), + .scmi_agent_id = MCP_SCMI_AGENT_IDX_SCP, + .scmi_p2a_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_SCMI, + MCP_CFGD_MOD_SCMI_EIDX_SCP_SCMI_RECV), + }), + }, +#endif + [MCP_CFGD_MOD_SCMI_EIDX_SCP_SCMI_RECV] = { + .name = "MCP_SCP_SCMI_RECV", + .data = &((struct mod_scmi_service_config) { + .transport_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_TRANSPORT, + MCP_CFGD_MOD_TRANSPORT_EIDX_SCP_SCMI_MSG_RECV_CH), + .transport_api_id = FWK_ID_API_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT), + .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED), + .scmi_agent_id = MCP_SCMI_AGENT_IDX_SCP, +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + .scmi_p2a_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_SCMI, + MCP_CFGD_MOD_SCMI_EIDX_SCP_SCMI_SEND), +#else + .scmi_p2a_id = FWK_ID_NONE_INIT, +#endif + }), + }, + [MCP_CFGD_MOD_SCMI_EIDX_COUNT] = { 0 } +}; + +static const struct fwk_element *get_service_table(fwk_id_t module_id) +{ + return service_table; +} + +/* SCMI agent descriptor */ +static struct mod_scmi_agent agent_table[MCP_SCMI_AGENT_IDX_COUNT] = { + [MCP_SCMI_AGENT_IDX_SCP] = { + .type = SCMI_AGENT_TYPE_MANAGEMENT, + .name = "SCP", + }, +}; + +/* SCMI protocols used by MCP platform */ +enum mcp_scmi_protocol_count { MCP_SCMI_SYS_POWER_PROT, MCP_SCMI_PROT_CNT }; + +/* SCMI protocols requesters in MCP platform */ +enum mcp_scmi_protocol_req_count { MCP_PLATFORM_SYSTEM, MCP_SCMI_PROT_REQ_CNT }; + +/* SCMI module configuration */ +const struct fwk_module_config config_scmi = { + .data = + &(struct mod_scmi_config){ + .protocol_count_max = MCP_SCMI_PROT_CNT, + .protocol_requester_count_max = MCP_SCMI_PROT_REQ_CNT, + .agent_count = FWK_ARRAY_SIZE(agent_table) - 1, + .agent_table = agent_table, + .vendor_identifier = "arm", + .sub_vendor_identifier = "arm", + }, + + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(get_service_table), +}; diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/config_transport.c b/product/neoverse-rd/rdv3/mcp_ramfw/config_transport.c new file mode 100644 index 0000000000000000000000000000000000000000..cb253b029cfedeb148671d5e3cd0efecddc3ae0e --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/config_transport.c @@ -0,0 +1,96 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Configuration data for module 'transport'. + */ + +#include "mcp_cfgd_mhu3.h" +#include "mcp_cfgd_transport.h" +#include "mcp_fw_mmap.h" +#include "platform_variant.h" + +#include +#include +#include + +#include +#include +#include +#include + +#include + +static const struct fwk_element transport_element_table[] = { + [MCP_CFGD_MOD_TRANSPORT_EIDX_SCP_SCMI_MSG_SEND_CH] = { + .name = "MCP_SCP_SCMI_MSG_SEND_CH", + .data = &(( + struct mod_transport_channel_config) { + .transport_type = MOD_TRANSPORT_CHANNEL_TRANSPORT_TYPE_OUT_BAND, +#if (PLATFORM_VARIANT == RD_V3_CFG2) + /* TODO: Enable shutdown/reboot support for multichip platform + * as well, once chip to chip SCP communicaiton is enabled */ + .policies = MOD_TRANSPORT_POLICY_NONE, +#else + .policies = MOD_TRANSPORT_POLICY_INIT_MAILBOX | + MOD_TRANSPORT_POLICY_SECURE, +#endif + .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_REQUESTER, + .out_band_mailbox_address = + (uintptr_t) MCP_SCP_SCMI_MSG_PAYLOAD_BASE, + .out_band_mailbox_size = SCP_MCP_SCMI_MSG_PAYLOAD_SIZE, + .signal_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_SCMI, + MOD_SCMI_API_IDX_TRANSPORT), + .driver_id = + FWK_ID_SUB_ELEMENT_INIT( + FWK_MODULE_IDX_MHU3, + MCP_CFGD_MOD_MHU3_EIDX_MCP_SCP_S, + 0), + .driver_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_MHU3, + MOD_MHU3_API_IDX_TRANSPORT_DRIVER), + }), + }, + [MCP_CFGD_MOD_TRANSPORT_EIDX_SCP_SCMI_MSG_RECV_CH] = { + .name = "MCP_SCP_SCMI_MSG_RECV_CH", + .data = &(( + struct mod_transport_channel_config) { + .transport_type = MOD_TRANSPORT_CHANNEL_TRANSPORT_TYPE_OUT_BAND, +#if (PLATFORM_VARIANT == RD_V3_CFG2) + .policies = MOD_TRANSPORT_POLICY_NONE, +#else + .policies = MOD_TRANSPORT_POLICY_INIT_MAILBOX | + MOD_TRANSPORT_POLICY_SECURE, +#endif + .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_COMPLETER, + .out_band_mailbox_address = + (uintptr_t) MCP_SCP_SCMI_MSG_PAYLOAD_BASE, + .out_band_mailbox_size = SCP_MCP_SCMI_MSG_PAYLOAD_SIZE, + .driver_id = + FWK_ID_SUB_ELEMENT_INIT( + FWK_MODULE_IDX_MHU3, + MCP_CFGD_MOD_MHU3_EIDX_MCP_SCP_S, + 0), + .driver_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_MHU3, + MOD_MHU3_API_IDX_TRANSPORT_DRIVER), + }), + }, + [MCP_CFGD_MOD_TRANSPORT_EIDX_COUNT] = { 0 }, +}; + +static const struct fwk_element *transport_get_element_table(fwk_id_t module_id) +{ + return transport_element_table; +} + +const struct fwk_module_config config_transport = { + .elements = FWK_MODULE_DYNAMIC_ELEMENTS(transport_get_element_table), +}; diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/include/fmw_cmsis.h b/product/neoverse-rd/rdv3/mcp_ramfw/include/fmw_cmsis.h index fa34d14d22fd243f1445ccec9492c34f4b66e127..27c2036aa3df63fa351dd6f28a748c6398a3b1d2 100644 --- a/product/neoverse-rd/rdv3/mcp_ramfw/include/fmw_cmsis.h +++ b/product/neoverse-rd/rdv3/mcp_ramfw/include/fmw_cmsis.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -35,7 +35,8 @@ typedef enum IRQn { PendSV_IRQn = -2, SysTick_IRQn = -1, - REFCLK_GTIMER_IRQ = 31, /* MCP REFCLK Physical Timer interrupt */ + REFCLK_GTIMER_IRQ = 34, /* MCP REFCLK Physical Timer interrupt */ + MHU3_SCP2MCP_IRQ_S = 84, /* SCP to MCP Secure MHUv3 IRQ */ IRQn_MAX = INT16_MAX, } IRQn_Type; diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_mhu3.h b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_mhu3.h new file mode 100644 index 0000000000000000000000000000000000000000..8f4d369be913bf251a08f36c6ce8eb58717df3d5 --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_mhu3.h @@ -0,0 +1,19 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Definitions for MHUv3 module configuration data in MCP firmware. + */ + +#ifndef MCP_CFGD_MHU3_H +#define MCP_CFGD_MHU3_H + +enum mcp_cfgd_mod_mhu3_device_idx { + MCP_CFGD_MOD_MHU3_EIDX_MCP_SCP_S, + MCP_CFGD_MOD_MHU3_EIDX_COUNT +}; + +#endif /* MCP_CFGD_MHU3_H */ diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_scmi.h b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_scmi.h new file mode 100644 index 0000000000000000000000000000000000000000..aa7c8666fdf377c8238ce8b49c0b81e8cbc4cb58 --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_scmi.h @@ -0,0 +1,30 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Definitions for SCMI module configuration data in MCP firmware. + */ + +#ifndef MCP_CFGD_SCMI_H +#define MCP_CFGD_SCMI_H + +/* SCMI agent identifier indexes in the SCMI agent table */ +enum mcp_scmi_agent_idx { + /* 0 is reserved for the platform */ + MCP_SCMI_AGENT_IDX_SCP = 1, + MCP_SCMI_AGENT_IDX_COUNT, +}; + +/* Module 'scmi' element indexes (SCMI services supported) */ +enum mcp_cfgd_mod_scmi_element_idx { +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + MCP_CFGD_MOD_SCMI_EIDX_SCP_SCMI_SEND, +#endif + MCP_CFGD_MOD_SCMI_EIDX_SCP_SCMI_RECV, + MCP_CFGD_MOD_SCMI_EIDX_COUNT, +}; + +#endif /* MCP_CFGD_SCMI_H */ diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_transport.h b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_transport.h new file mode 100644 index 0000000000000000000000000000000000000000..4fe68f0c035174fbfe71ab57cd1cb30ea7bf2d43 --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_cfgd_transport.h @@ -0,0 +1,22 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Definitions for transport module configuration data in MCP + * firmware. + */ + +#ifndef MCP_CFGD_TRANSPORT_H +#define MCP_CFGD_TRANSPORT_H + +/* Module 'transport' element indexes */ +enum mcp_cfgd_mod_transport_element_idx { + MCP_CFGD_MOD_TRANSPORT_EIDX_SCP_SCMI_MSG_SEND_CH, + MCP_CFGD_MOD_TRANSPORT_EIDX_SCP_SCMI_MSG_RECV_CH, + MCP_CFGD_MOD_TRANSPORT_EIDX_COUNT, +}; + +#endif /* MCP_CFGD_TRANSPORT_H */ diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_css_mmap.h b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_css_mmap.h index a85dda00fedf726c033d02e17c2673fb3a457723..89293aabe4aa92ac181b84c2ae4f3e67cd835da5 100644 --- a/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_css_mmap.h +++ b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_css_mmap.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -21,11 +21,15 @@ #define MCP_DTC_RAM_SIZE (256 * 1024) /* SCP sub-system peripherals */ -#define MCP_REFCLK_CNTCTL_BASE (0x4C000000) -#define MCP_REFCLK_CNTBASE0_BASE (0x4C001000) -#define MCP_UART_BASE (0x4C002000) +#define MCP_MCP2SCP_MHUV3_SEND_S_BASE UINT32_C(0x45600000) +#define MCP_SCP2MCP_MHUV3_RCV_S_BASE UINT32_C(0x45610000) +#define MCP_REFCLK_CNTCTL_BASE (0x4C000000) +#define MCP_REFCLK_CNTBASE0_BASE (0x4C001000) +#define MCP_UART_BASE (0x4C002000) +#define MCP_ATU_BASE UINT32_C(0x50010000) /* MCP addresses translation window base addresses */ +#define MCP_ADDRESS_TRANSLATION_WINDOW0_BASE (0x60000000) #define MCP_ADDRESS_TRANSLATION_WINDOW1_BASE (0xA0000000) /* Offsets within MCP's Address Translation Window0 */ @@ -35,4 +39,10 @@ #define MCP_REFCLK_CNTCONTROL_BASE \ (MCP_ADDRESS_TRANSLATION_WINDOW1_BASE + MCP_ATW1_REFCLK_CNTCONTROL_OFFSET) +/* + * RSM memory region (shared between RSS, MCP, SCP) is mapped by ATU in + * the MCP address translation window 0. + */ +#define MCP_SHARED_SRAM_RSM_BASE (MCP_ADDRESS_TRANSLATION_WINDOW0_BASE) + #endif /* MCP_CSS_MMAP_H */ diff --git a/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_fw_mmap.h b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_fw_mmap.h new file mode 100644 index 0000000000000000000000000000000000000000..a2945c25941639c5f7b4bcc1adbc963c8a203af4 --- /dev/null +++ b/product/neoverse-rd/rdv3/mcp_ramfw/include/mcp_fw_mmap.h @@ -0,0 +1,28 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * Base address and size definitions for the various MCP's firmware defined + * memory carveouts. + */ + +#ifndef MCP_FW_MMAP_H +#define MCP_FW_MMAP_H + +#include "mcp_css_mmap.h" +#include "rsm_fw_mmap.h" + +/* + * RSM SRAM in the AP memory map with base address of 0x2F000000 is mapped in + * the MCP's address translation window 0 (0x60000000 - 0x9FFFFFFF) at the + * offset 'MCP_SHARED_SRAM_RSM_BASE' via ATU configuration. + */ + +/* MCP-SCP SCMI message payload base address (in RSM SRAM) */ +#define MCP_SCP_SCMI_MSG_PAYLOAD_BASE \ + (MCP_SHARED_SRAM_RSM_BASE + SCP_MCP_SCMI_MSG_PAYLOAD_OFFSET) + +#endif /* MCP_FW_MMAP_H */ diff --git a/product/neoverse-rd/rdv3/module/mcp_platform/CMakeLists.txt b/product/neoverse-rd/rdv3/module/mcp_platform/CMakeLists.txt index 3f1530c2dfb36b05ee4e0f1721f7ef1a87340e34..96160f46dbccd7c9eb2bed9c18f8b166bc3f8ffc 100644 --- a/product/neoverse-rd/rdv3/module/mcp_platform/CMakeLists.txt +++ b/product/neoverse-rd/rdv3/module/mcp_platform/CMakeLists.txt @@ -27,5 +27,11 @@ else() "'2' for RD-V3-Cfg2\n") endif() +target_include_directories(${SCP_MODULE_TARGET} + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") + target_sources(${SCP_MODULE_TARGET} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src/mod_mcp_platform.c") + +target_link_libraries(${SCP_MODULE_TARGET} + PRIVATE module-scmi module-scmi-sys-power) diff --git a/product/neoverse-rd/rdv3/module/mcp_platform/include/mod_mcp_platform.h b/product/neoverse-rd/rdv3/module/mcp_platform/include/mod_mcp_platform.h new file mode 100644 index 0000000000000000000000000000000000000000..3e39a3d83cdd6fc8205a47028f1607f1b2eb7c48 --- /dev/null +++ b/product/neoverse-rd/rdv3/module/mcp_platform/include/mod_mcp_platform.h @@ -0,0 +1,41 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * Description: + * MCP Platform Support + */ + +#ifndef MOD_MCP_PLATFORM_H +#define MOD_MCP_PLATFORM_H + +/*! + * \addtogroup GroupPLATFORMModule PLATFORM Product Modules + * @{ + */ + +/*! + * \defgroup GroupMCPPlatform MCP Platform Support + * @{ + */ + +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +/*! + * \brief Indices of the interfaces exposed by the module. + */ +enum mod_mcp_platform_api_idx { + /*! API index for the powerdown interface of SCMI module */ + MOD_MCP_PLATFORM_API_IDX_SCMI_POWER_DOWN, + + /*! Number of exposed interfaces */ + MOD_MCP_PLATFORM_API_COUNT +}; +#endif + +/*! + * @} + */ + +#endif /* MOD_MCP_PLATFORM_H */ diff --git a/product/neoverse-rd/rdv3/module/mcp_platform/src/mod_mcp_platform.c b/product/neoverse-rd/rdv3/module/mcp_platform/src/mod_mcp_platform.c index ff784db20dea090c4171d91ebc88c5834db2245f..5376ea5692327b93547b181eb6b8a7d284c32521 100644 --- a/product/neoverse-rd/rdv3/module/mcp_platform/src/mod_mcp_platform.c +++ b/product/neoverse-rd/rdv3/module/mcp_platform/src/mod_mcp_platform.c @@ -1,17 +1,44 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ +#include "mcp_cfgd_scmi.h" +#include "mod_mcp_platform.h" +#include "nrd_scmi.h" + +#include +#include + #include #include #include +#include #include +#include + #define MOD_NAME "[MCP_PLATFORM] " +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +/* Module context */ +struct mcp_platform_ctx { + /*! SCMI protocol API */ + const struct mod_scmi_from_protocol_req_api *scmi_protocol_req_api; +}; + +/* Module context data */ +struct mcp_platform_ctx mcp_platform_ctx; + +/* Notification for system power down */ +static const fwk_id_t mod_scmi_sys_power_notification_system_power_down = + FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_SCMI_SYS_POWER, + MOD_SCMI_SYSTEM_POWER_NOTIFICATION_IDX_SYSTEM_POWER_DOWN); +#endif + /* * Framework handlers. */ @@ -23,16 +50,176 @@ static int mod_mcp_platform_init( return FWK_SUCCESS; } +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS +static int mod_mcp_platform_bind(fwk_id_t id, unsigned int round) +{ + int status = FWK_SUCCESS; + + if (round == 0) { + /* Bind to SCMI module for SCP communication */ + status = fwk_module_bind( + FWK_ID_MODULE(FWK_MODULE_IDX_SCMI), + FWK_ID_API(FWK_MODULE_IDX_SCMI, MOD_SCMI_API_IDX_PROTOCOL_REQ), + &mcp_platform_ctx.scmi_protocol_req_api); + if (status != FWK_SUCCESS) { + return status; + } + } + + return status; +} + +/* + * SCMI module -> MCP platform module interface + */ +static int platform_system_get_scmi_protocol_id( + fwk_id_t protocol_id, + uint8_t *scmi_protocol_id) +{ + *scmi_protocol_id = (uint8_t)MOD_SCMI_PROTOCOL_ID_SYS_POWER; + + return FWK_SUCCESS; +} + +/* + * Upon binding the mcp_platform module to the SCMI module, the SCMI module + * will also bind back to the mcp_platform module, anticipating the presence of + * .get_scmi_protocol_id() and .message_handler() APIs. + * + * In the current implementation of mcp_platform module, only sending SCMI + * message is implemented, and the mcp_platform module is not intended to + * receive any SCMI messages. Therefore, it is necessary to include a minimal + * .message_handler() API to ensure the successful binding of the SCMI module. + */ +static int platform_system_scmi_message_handler( + fwk_id_t protocol_id, + fwk_id_t service_id, + const uint32_t *payload, + size_t payload_size, + unsigned int message_id) +{ + return FWK_SUCCESS; +} + +/* SCMI driver interface */ +const struct mod_scmi_to_protocol_api platform_system_scmi_api = { + .get_scmi_protocol_id = platform_system_get_scmi_protocol_id, + .message_handler = platform_system_scmi_message_handler, +}; + +static int mod_mcp_platform_process_bind( + fwk_id_t requester_id, + fwk_id_t target_id, + fwk_id_t api_id, + const void **api) +{ + int status; + enum mod_mcp_platform_api_idx api_id_type; + + api_id_type = (enum mod_mcp_platform_api_idx)fwk_id_get_api_idx(api_id); + + switch (api_id_type) { + case MOD_MCP_PLATFORM_API_IDX_SCMI_POWER_DOWN: + *api = &platform_system_scmi_api; + status = FWK_SUCCESS; + break; + + default: + status = FWK_E_PARAM; + } + + return status; +} +#endif + static int mod_mcp_platform_start(fwk_id_t id) { +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + /* + * TODO: Need to sent the SCMI message only after SCP has completed the SCMI + * initialization. + */ + int status; + + fwk_id_t mcp_scmi_prot_id = FWK_ID_ELEMENT( + FWK_MODULE_IDX_SCMI, MCP_CFGD_MOD_SCMI_EIDX_SCP_SCMI_SEND); + struct mcp_cfgd_scmi_sys_power_state_notify_payload mcp_scmi_payload; + + mcp_scmi_payload.flags = 1; + + status = mcp_platform_ctx.scmi_protocol_req_api->scmi_send_message( + MOD_SCMI_SYS_POWER_STATE_NOTIFY, + MOD_SCMI_PROTOCOL_ID_SYS_POWER, + 0, + mcp_scmi_prot_id, + (void *)&mcp_scmi_payload, + sizeof(mcp_scmi_payload), + false); + + if (status != FWK_SUCCESS) { + FWK_LOG_ERR(MOD_NAME + "Failed to subscribe SCMI power state change notofication"); + return status; + } + +# ifdef BUILD_HAS_NOTIFICATION + status = fwk_notification_subscribe( + mod_scmi_sys_power_notification_system_power_down, + FWK_ID_MODULE(FWK_MODULE_IDX_SCMI_SYS_POWER), + id); + if (status != FWK_SUCCESS) { + FWK_LOG_ERR(MOD_NAME "Failed to subscribe to power down notification"); + return status; + } +# endif +#endif + FWK_LOG_INFO(MOD_NAME "MCP RAM firmware initialized"); return FWK_SUCCESS; } +#ifdef BUILD_HAS_NOTIFICATION +static int mcp_platform_process_notification( + const struct fwk_event *event, + struct fwk_event *resp_event) +{ +# ifdef BUILD_HAS_SCMI_NOTIFICATIONS + unsigned int *power_down; + + /* Notification handler for system wide power down. */ + if (fwk_id_is_equal( + event->id, mod_scmi_sys_power_notification_system_power_down)) { + power_down = (unsigned int *)event->params; + + if (*power_down == NRD_SCMI_SYSTEM_STATE_SHUTDOWN) { + FWK_LOG_INFO(MOD_NAME "System shutting down!"); + } else if (*power_down == NRD_SCMI_SYSTEM_STATE_COLD_RESET) { + FWK_LOG_INFO(MOD_NAME "System rebooting!"); + } else { + FWK_LOG_ERR(MOD_NAME "Invalid power mode"); + } + + __WFI(); + } else { + return FWK_E_PARAM; + } +# endif + + return FWK_SUCCESS; +} +#endif + const struct fwk_module module_mcp_platform = { .type = FWK_MODULE_TYPE_SERVICE, .init = mod_mcp_platform_init, +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + .bind = mod_mcp_platform_bind, + .process_bind_request = mod_mcp_platform_process_bind, +#endif .start = mod_mcp_platform_start, +#ifdef BUILD_HAS_NOTIFICATION + .process_notification = mcp_platform_process_notification, +#endif }; const struct fwk_module_config config_mcp_platform = { 0 }; diff --git a/product/neoverse-rd/rdv3/module/scp_platform/CMakeLists.txt b/product/neoverse-rd/rdv3/module/scp_platform/CMakeLists.txt index dd9fd41d0a38ecf0fb33d05d8b584a0ab3820a08..3de394575177d44fea3db3a29a4389f173eaedeb 100644 --- a/product/neoverse-rd/rdv3/module/scp_platform/CMakeLists.txt +++ b/product/neoverse-rd/rdv3/module/scp_platform/CMakeLists.txt @@ -39,5 +39,5 @@ target_sources( target_link_libraries( ${SCP_MODULE_TARGET} - PRIVATE module-power-domain module-system-power + PRIVATE module-power-domain module-system-power module-scmi module-system-info module-transport module-timer) diff --git a/product/neoverse-rd/rdv3/module/scp_platform/include/internal/scp_platform.h b/product/neoverse-rd/rdv3/module/scp_platform/include/internal/scp_platform.h index f2074218c7449a984fa736198af280991cce9bcf..2568f4174d782c51d6c5726590db5696d2ce3c85 100644 --- a/product/neoverse-rd/rdv3/module/scp_platform/include/internal/scp_platform.h +++ b/product/neoverse-rd/rdv3/module/scp_platform/include/internal/scp_platform.h @@ -92,6 +92,19 @@ int platform_setup_lcp(void); */ const void *get_platform_system_power_driver_api(void); +/* + * SCMI interface helper functions. + */ + +/*! + * \brief Helper function to return platform system SCMI API. + * + * \param None. + * + * \return Pointer to the SCP platform system SCMI API. + */ +const void *get_platform_scmi_power_down_api(void); + /*! * \brief Helper function to bind to power domain restricted API. * diff --git a/product/neoverse-rd/rdv3/module/scp_platform/include/mod_scp_platform.h b/product/neoverse-rd/rdv3/module/scp_platform/include/mod_scp_platform.h index 0743b3dfd08b9576646a522f3d9a0b06f59f63cb..17d62ce26105e7d172225ca725252d7b466ec5fa 100644 --- a/product/neoverse-rd/rdv3/module/scp_platform/include/mod_scp_platform.h +++ b/product/neoverse-rd/rdv3/module/scp_platform/include/mod_scp_platform.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -31,6 +31,9 @@ * \brief Indices of the interfaces exposed by the module. */ enum mod_scp_platform_api_idx { + /*! API index for the powerdown interface of SCMI module */ + MOD_SCP_PLATFORM_API_IDX_SCMI_POWER_DOWN, + /*! API index for the driver interface of the SYSTEM POWER module */ MOD_SCP_PLATFORM_API_IDX_SYSTEM_POWER_DRIVER, diff --git a/product/neoverse-rd/rdv3/module/scp_platform/src/mod_scp_platform.c b/product/neoverse-rd/rdv3/module/scp_platform/src/mod_scp_platform.c index 56cdcad6acadca2a17580005f3aee96db867ee7b..74a4d8baeab0da314847544ac9928df8d3648442 100644 --- a/product/neoverse-rd/rdv3/module/scp_platform/src/mod_scp_platform.c +++ b/product/neoverse-rd/rdv3/module/scp_platform/src/mod_scp_platform.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2025, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -110,6 +110,11 @@ static int scp_platform_process_bind_request( api_id_type = (enum mod_scp_platform_api_idx)fwk_id_get_api_idx(api_id); switch (api_id_type) { + case MOD_SCP_PLATFORM_API_IDX_SCMI_POWER_DOWN: + *api = get_platform_scmi_power_down_api(); + status = FWK_SUCCESS; + break; + case MOD_SCP_PLATFORM_API_IDX_SYSTEM_POWER_DRIVER: *api = get_platform_system_power_driver_api(); status = FWK_SUCCESS; diff --git a/product/neoverse-rd/rdv3/module/scp_platform/src/platform_power_mgmt.c b/product/neoverse-rd/rdv3/module/scp_platform/src/platform_power_mgmt.c index b0053388dc03e96d58ad5e2d0644c9de0d909860..a238bd70315a681a06fe67f09fab1841a5000d68 100644 --- a/product/neoverse-rd/rdv3/module/scp_platform/src/platform_power_mgmt.c +++ b/product/neoverse-rd/rdv3/module/scp_platform/src/platform_power_mgmt.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,22 +8,62 @@ * SCP Platform Support - Power Management */ +#include "nrd_scmi.h" +#include "scp_cfgd_scmi.h" + #include #include +#include +#include #include +#include #include #include #include +/*! SCMI protocol API */ +static const struct mod_scmi_from_protocol_req_api *scmi_protocol_req_api; + /* Module 'power_domain' restricted API pointer */ static struct mod_pd_restricted_api *pd_restricted_api; /* System shutdown function */ static int platform_shutdown(enum mod_pd_system_shutdown system_shutdown) { + int status; + fwk_id_t rse_scmi_prot_id = FWK_ID_ELEMENT( + FWK_MODULE_IDX_SCMI, SCP_CFGD_MOD_SCMI_EIDX_RSE_SCMI_SEND); + struct scp_cfgd_scmi_sys_power_state_set_payload scp_scmi_payload; + + scp_scmi_payload.flags = 0; + scp_scmi_payload.system_state = (uint32_t)system_shutdown; + + /* + * The current RSE firmware lacks SCMI support, preventing the RSE platform + * firmware from sending SCMI power state notify messages to the SCP or + * subscribing to SCMI notifications. To address this limitation, notify + * the RSE about system power down using the SCMI system power state set + * message. As this message can be decoded in the RSE firmware with minimal + * SCMI message parsing logic. + */ + status = scmi_protocol_req_api->scmi_send_message( + MOD_SCMI_SYS_POWER_STATE_SET, + MOD_SCMI_PROTOCOL_ID_SYS_POWER, + 0, + rse_scmi_prot_id, + (void *)&scp_scmi_payload, + sizeof(scp_scmi_payload), + false); + + if (status != FWK_SUCCESS) { + FWK_LOG_ERR( + "[SCP_PLATFORM] ERROR! Unable to send shutdown request to RSE"); + return status; + } + while (1) { __WFI(); } @@ -41,8 +81,62 @@ const void *get_platform_system_power_driver_api(void) return &platform_system_pwr_drv_api; } +/* + * SCMI module -> SCP platform module interface + */ +static int platform_system_get_scmi_protocol_id( + fwk_id_t protocol_id, + uint8_t *scmi_protocol_id) +{ + *scmi_protocol_id = (uint8_t)MOD_SCMI_PROTOCOL_ID_SYS_POWER; + + return FWK_SUCCESS; +} + +/* + * Upon binding the scp_platform module to the SCMI module, the SCMI module + * will also bind back to the scp_platform module, anticipating the presence of + * .get_scmi_protocol_id() and .message_handler() APIs. + * + * In the current implementation of scp_platform module, only sending SCMI + * message is implemented, and the scp_platform module is not intended to + * receive any SCMI messages. Therefore, it is necessary to include a minimal + * .message_handler() API to ensure the successful binding of the SCMI module. + */ +static int platform_system_scmi_message_handler( + fwk_id_t protocol_id, + fwk_id_t service_id, + const uint32_t *payload, + size_t payload_size, + unsigned int message_id) +{ + return FWK_SUCCESS; +} + +/* SCMI driver interface */ +static const struct mod_scmi_to_protocol_api platform_system_scmi_api = { + .get_scmi_protocol_id = platform_system_get_scmi_protocol_id, + .message_handler = platform_system_scmi_message_handler, +}; + +const void *get_platform_scmi_power_down_api(void) +{ + return &platform_system_scmi_api; +} + int platform_power_mgmt_bind(void) { + int status; + + /* Bind to SCMI module for RSE communication */ + status = fwk_module_bind( + FWK_ID_MODULE(FWK_MODULE_IDX_SCMI), + FWK_ID_API(FWK_MODULE_IDX_SCMI, MOD_SCMI_API_IDX_PROTOCOL_REQ), + &scmi_protocol_req_api); + if (status != FWK_SUCCESS) { + return status; + } + return fwk_module_bind( fwk_module_id_power_domain, mod_pd_api_id_restricted, diff --git a/product/neoverse-rd/rdv3/scp_ramfw/Firmware.cmake b/product/neoverse-rd/rdv3/scp_ramfw/Firmware.cmake index 18e3bf38bbb0307eccfbeacb118500f795cfd16e..13ebf6f0dc94652e11bc1c06f3f404274fd0445f 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/Firmware.cmake +++ b/product/neoverse-rd/rdv3/scp_ramfw/Firmware.cmake @@ -1,6 +1,6 @@ # # Arm SCP/MCP Software -# Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -30,6 +30,8 @@ set(SCP_ENABLE_OUTBAND_MSG_SUPPORT TRUE) set(SCP_ENABLE_ATU_MANAGE TRUE) +set(SCP_ENABLE_SCMI_NOTIFICATIONS TRUE) + list(PREPEND SCP_MODULE_PATHS "${CMAKE_CURRENT_LIST_DIR}/../module/scp_platform") diff --git a/product/neoverse-rd/rdv3/scp_ramfw/config_atu.c b/product/neoverse-rd/rdv3/scp_ramfw/config_atu.c index 4be17088dfa38217291733fbbe8816c9af60e6ed..00cfd45b969dde005d31cf36058ba1d86ca00755 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/config_atu.c +++ b/product/neoverse-rd/rdv3/scp_ramfw/config_atu.c @@ -74,9 +74,9 @@ static struct atu_region_map atu_regions[ATU_REGION_IDX_COUNT] = { }, [ATU_REGION_IDX_RSM_SRAM] = { .region_owner_id = FWK_ID_MODULE_INIT(FWK_MODULE_IDX_SCP_PLATFORM), - .log_addr_base = SCP_ATW0_SYSTEM_CONTROL_SRAM_BASE, - .phy_addr_base = 0x2F000000, - .region_size = SCP_ATW0_SYSTEM_CONTROL_SRAM_SIZE, + .log_addr_base = SCP_ATW0_SHARED_SRAM_RSM_BASE, + .phy_addr_base = RSM_SHARED_SRAM_BASE, + .region_size = RSM_SHARED_SRAM_SIZE, .attributes = ATU_ENCODE_ATTRIBUTES_SECURE_PAS, }, }; diff --git a/product/neoverse-rd/rdv3/scp_ramfw/config_mhu3.c b/product/neoverse-rd/rdv3/scp_ramfw/config_mhu3.c index f6eebdc7aa5fe5d5804f1a5c8588d2cbe83ab506..51587f4a59021c631977c74e5427c9a764d700a6 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/config_mhu3.c +++ b/product/neoverse-rd/rdv3/scp_ramfw/config_mhu3.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -26,7 +26,10 @@ #define SCP2AP_S_DBCH_COUNT 1 /* SCP<-->RSS Secure MHUv3 Doorbell channel count */ -#define SCP2RSS_S_DBCH_COUNT 2 +#define SCP2RSS_S_DBCH_COUNT 3 + +/* SCP<-->MCP Secure MHUv3 Doorbell channel count */ +#define SCP2MCP_S_DBCH_COUNT 1 /* AP<-->SCP Secure MHUv3 doorbell channel configuration */ struct mod_mhu3_channel_config scp2ap_s_dbch_config[SCP2AP_S_DBCH_COUNT] = { @@ -40,8 +43,17 @@ struct mod_mhu3_channel_config scp2rss_s_dbch_config[SCP2RSS_S_DBCH_COUNT] = { MOD_MHU3_INIT_DBCH(0, 0, 0, 0), /* PBX CH 1, FLAG 0, MBX CH 1, FLAG 0 */ MOD_MHU3_INIT_DBCH(1, 0, 1, 0), + /* PBX CH 2, FLAG 0, MBX CH 2, FLAG 0, used by scp platform for shutdown */ + MOD_MHU3_INIT_DBCH(2, 0, 2, 0), }; +/* MCP<-->SCP Secure MHUv3 doorbell channel configuration */ +static struct mod_mhu3_channel_config + scp2mcp_s_dbch_config[SCP2MCP_S_DBCH_COUNT] = { + /* PBX CH 0, FLAG 0, MBX CH 0, FLAG 0 */ + MOD_MHU3_INIT_DBCH(0, 0, 0, 0), + }; + /* Module element table */ static const struct fwk_element mhu_element_table[MOD_MHU3_ELEMENT_COUNT] = { [SCP_CFGD_MOD_MHU3_EIDX_SCP_AP_S_CLUS0] = { @@ -56,7 +68,7 @@ static const struct fwk_element mhu_element_table[MOD_MHU3_ELEMENT_COUNT] = { }, [SCP_CFGD_MOD_MHU3_EIDX_SCP_RSS_S] = { .name = "SCP2RSS_S_MHU_DBCH", - .sub_element_count = 2, + .sub_element_count = SCP2RSS_S_DBCH_COUNT, .data = &(struct mod_mhu3_device_config) { .irq = (unsigned int) MHU3_RSS2SCP_IRQ_S, .in = SCP_RSS2SCP_MHUV3_RCV_S_BASE, @@ -64,6 +76,16 @@ static const struct fwk_element mhu_element_table[MOD_MHU3_ELEMENT_COUNT] = { .channels = &scp2rss_s_dbch_config[0], }, }, + [SCP_CFGD_MOD_MHU3_EIDX_SCP_MCP_S] = { + .name = "SCP2MCP_S_MHU_DBCH", + .sub_element_count = 1, + .data = &(struct mod_mhu3_device_config) { + .irq = (unsigned int) MHU3_MCP2SCP_IRQ_S, + .in = SCP_MCP2SCP_MHUV3_RCV_S_BASE, + .out = SCP_SCP2MCP_MHUV3_SEND_S_BASE, + .channels = &scp2mcp_s_dbch_config[0], + }, + }, [SCP_CFGD_MOD_MHU3_EIDX_COUNT] = { 0 }, }; diff --git a/product/neoverse-rd/rdv3/scp_ramfw/config_scmi.c b/product/neoverse-rd/rdv3/scp_ramfw/config_scmi.c index d9084e9a77d9d9aca7e64c2b50ec19e1450f7451..5ba386354bf9204b43080db0aa3fcaaa64ff8375 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/config_scmi.c +++ b/product/neoverse-rd/rdv3/scp_ramfw/config_scmi.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -40,6 +40,76 @@ static const struct fwk_element service_table[MOD_SCMI_ELEMENT_COUNT] = { .scmi_p2a_id = FWK_ID_NONE_INIT, }), }, + [SCP_CFGD_MOD_SCMI_EIDX_RSE_SCMI_SEND] = { + .name = "SCP_RSE_SCMI_SEND", + .data = &((struct mod_scmi_service_config) { + .transport_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_TRANSPORT, + SCP_CFGD_MOD_TRANSPORT_EIDX_RSE_SCMI_MSG_SEND_CH), + .transport_api_id = FWK_ID_API_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT), + .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED), + .scmi_agent_id = SCP_SCMI_AGENT_IDX_RSE, + .scmi_p2a_id = FWK_ID_NONE_INIT, + }), + }, + [SCP_CFGD_MOD_SCMI_EIDX_MCP_SCMI_SEND] = { + .name = "SCP_MCP_SCMI_SEND", + .data = &((struct mod_scmi_service_config) { + .transport_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_TRANSPORT, + SCP_CFGD_MOD_TRANSPORT_EIDX_MCP_SCMI_MSG_SEND_CH), + .transport_api_id = FWK_ID_API_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT), + .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED), + .scmi_agent_id = SCP_SCMI_AGENT_IDX_MCP, + .scmi_p2a_id = FWK_ID_NONE_INIT, + }), + }, +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + [SCP_CFGD_MOD_SCMI_EIDX_RSE_SCMI_RECV] = { + .name = "SCP_RSE_SCMI_RECV", + .data = &((struct mod_scmi_service_config) { + .transport_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_TRANSPORT, + SCP_CFGD_MOD_TRANSPORT_EIDX_RSE_SCMI_MSG_RECV_CH), + .transport_api_id = FWK_ID_API_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT), + .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED), + .scmi_agent_id = SCP_SCMI_AGENT_IDX_RSE, + .scmi_p2a_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_SCMI, + SCP_CFGD_MOD_SCMI_EIDX_RSE_SCMI_SEND), + }), + }, + [SCP_CFGD_MOD_SCMI_EIDX_MCP_SCMI_RECV] = { + .name = "SCP_MCP_SCMI_RECV", + .data = &((struct mod_scmi_service_config) { + .transport_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_TRANSPORT, + SCP_CFGD_MOD_TRANSPORT_EIDX_MCP_SCMI_MSG_RECV_CH), + .transport_api_id = FWK_ID_API_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_API_IDX_SCMI_TO_TRANSPORT), + .transport_notification_init_id = FWK_ID_NOTIFICATION_INIT( + FWK_MODULE_IDX_TRANSPORT, + MOD_TRANSPORT_NOTIFICATION_IDX_INITIALIZED), + .scmi_agent_id = SCP_SCMI_AGENT_IDX_MCP, + .scmi_p2a_id = FWK_ID_ELEMENT_INIT( + FWK_MODULE_IDX_SCMI, + SCP_CFGD_MOD_SCMI_EIDX_MCP_SCMI_SEND), + }), + }, +#endif [SCP_CFGD_MOD_SCMI_EIDX_COUNT] = { 0 } }; @@ -53,12 +123,21 @@ static struct mod_scmi_agent agent_table[SCP_SCMI_AGENT_IDX_COUNT] = { .type = SCMI_AGENT_TYPE_PSCI, .name = "PSCI", }, + [SCP_SCMI_AGENT_IDX_RSE] = { + .type = SCMI_AGENT_TYPE_MANAGEMENT, + .name = "RSE", + }, + [SCP_SCMI_AGENT_IDX_MCP] = { + .type = SCMI_AGENT_TYPE_MANAGEMENT, + .name = "MCP", + }, }; const struct fwk_module_config config_scmi = { .data = &(struct mod_scmi_config){ .protocol_count_max = 4, + .protocol_requester_count_max = SCMI_PROTOCOL_REQUESTER_COUNT, .agent_count = FWK_ARRAY_SIZE(agent_table) - 1, .agent_table = agent_table, .vendor_identifier = "arm", diff --git a/product/neoverse-rd/rdv3/scp_ramfw/config_scmi_system_power.c b/product/neoverse-rd/rdv3/scp_ramfw/config_scmi_system_power.c index 3abc63db96135a3370e75c86b56acec777a0e405..b95446540ff8e810be4b5e456997b743a07d7ba1 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/config_scmi_system_power.c +++ b/product/neoverse-rd/rdv3/scp_ramfw/config_scmi_system_power.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -8,6 +8,8 @@ * Configuration data for module 'scmi_system_power'. */ +#include "scp_cfgd_timer.h" + #include #include @@ -17,5 +19,12 @@ const struct fwk_module_config config_scmi_system_power = { .data = &((struct mod_scmi_system_power_config){ .system_view = MOD_SCMI_SYSTEM_VIEW_FULL, .system_suspend_state = MOD_SYSTEM_POWER_POWER_STATE_SLEEP0, +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + .alarm_id = FWK_ID_SUB_ELEMENT_INIT( + FWK_MODULE_IDX_TIMER, + SCP_TIMER_ALARM_EIDX, + SCP_CFGD_SCMI_SYSPWR_MGMT_NOTIFY_ALARM_IDX), + .graceful_timeout = 1000, /* ms */ +#endif }), }; diff --git a/product/neoverse-rd/rdv3/scp_ramfw/config_timer.c b/product/neoverse-rd/rdv3/scp_ramfw/config_timer.c index 13231e6152a07655a7fcd8ee49ea029e55b8dab6..1b296b21695b7a5202caa4e5065aebd5504cb72a 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/config_timer.c +++ b/product/neoverse-rd/rdv3/scp_ramfw/config_timer.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -20,20 +20,21 @@ #include /* Module 'timer' element count */ -#define MOD_TIMER_ELEMENT_COUNT 2 +#define MOD_TIMER_ELEMENT_COUNT (SCP_TIMER_ELEMENT_COUNT + 1) /* Timer HAL config */ static const struct fwk_element timer_dev_table[MOD_TIMER_ELEMENT_COUNT] = { - [0] = { + [SCP_TIMER_ALARM_EIDX] = { .name = "REFCLK", .data = &((struct mod_timer_dev_config) { - .id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_GTIMER, 0), + .id = FWK_ID_ELEMENT_INIT(FWK_MODULE_IDX_GTIMER, + SCP_TIMER_ALARM_EIDX), .timer_irq = REFCLK_GTIMER_IRQ, }), .sub_element_count = SCP_CFGD_MOD_TIMER_ALARM_IDX_COUNT, /* Number of alarms */ }, - [1] = { 0 }, + [SCP_TIMER_ELEMENT_COUNT] = { 0 }, }; static const struct fwk_element *timer_get_dev_table(fwk_id_t module_id) diff --git a/product/neoverse-rd/rdv3/scp_ramfw/config_transport.c b/product/neoverse-rd/rdv3/scp_ramfw/config_transport.c index 9e436996ed400fecb9bda37a83193c8b55933f62..5e1b11f9aad98f92537897c5e9d3be22216c95cb 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/config_transport.c +++ b/product/neoverse-rd/rdv3/scp_ramfw/config_transport.c @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -89,6 +90,102 @@ static const struct fwk_element element_table[MOD_TRANSPORT_ELEMENT_COUNT] = { MOD_MHU3_API_IDX_TRANSPORT_DRIVER), }), }, + [SCP_CFGD_MOD_TRANSPORT_EIDX_RSE_SCMI_MSG_SEND_CH] = { + .name = "SCP_RSE_SCMI_MSG_SEND_CH", + .data = &(( + struct mod_transport_channel_config) { + .transport_type = MOD_TRANSPORT_CHANNEL_TRANSPORT_TYPE_OUT_BAND, + .policies = MOD_TRANSPORT_POLICY_INIT_MAILBOX | + MOD_TRANSPORT_POLICY_SECURE, + .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_REQUESTER, + .out_band_mailbox_address = + (uintptr_t) SCP_RSE_SCMI_MSG_PAYLOAD_BASE, + .out_band_mailbox_size = SCP_RSE_SCMI_MSG_PAYLOAD_SIZE, + .signal_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_SCMI, + MOD_SCMI_API_IDX_TRANSPORT), + .driver_id = + FWK_ID_SUB_ELEMENT_INIT( + FWK_MODULE_IDX_MHU3, + SCP_CFGD_MOD_MHU3_EIDX_SCP_RSS_S, + 2), + .driver_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_MHU3, + MOD_MHU3_API_IDX_TRANSPORT_DRIVER), + }), + }, + [SCP_CFGD_MOD_TRANSPORT_EIDX_RSE_SCMI_MSG_RECV_CH] = { + .name = "SCP_RSE_SCMI_MSG_RECV_CH", + .data = &(( + struct mod_transport_channel_config) { + .transport_type = MOD_TRANSPORT_CHANNEL_TRANSPORT_TYPE_OUT_BAND, + .policies = MOD_TRANSPORT_POLICY_INIT_MAILBOX | + MOD_TRANSPORT_POLICY_SECURE, + .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_COMPLETER, + .out_band_mailbox_address = + (uintptr_t) SCP_RSE_SCMI_MSG_PAYLOAD_BASE, + .out_band_mailbox_size = SCP_RSE_SCMI_MSG_PAYLOAD_SIZE, + .driver_id = + FWK_ID_SUB_ELEMENT_INIT( + FWK_MODULE_IDX_MHU3, + SCP_CFGD_MOD_MHU3_EIDX_SCP_RSS_S, + 2), + .driver_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_MHU3, + MOD_MHU3_API_IDX_TRANSPORT_DRIVER), + }), + }, + [SCP_CFGD_MOD_TRANSPORT_EIDX_MCP_SCMI_MSG_SEND_CH] = { + .name = "SCP_MCP_SCMI_MSG_SEND_CH", + .data = &(( + struct mod_transport_channel_config) { + .transport_type = MOD_TRANSPORT_CHANNEL_TRANSPORT_TYPE_OUT_BAND, + .policies = MOD_TRANSPORT_POLICY_INIT_MAILBOX | + MOD_TRANSPORT_POLICY_SECURE, + .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_REQUESTER, + .out_band_mailbox_address = + (uintptr_t) SCP_MCP_SCMI_MSG_PAYLOAD_BASE, + .out_band_mailbox_size = SCP_MCP_SCMI_MSG_PAYLOAD_SIZE, + .signal_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_SCMI, + MOD_SCMI_API_IDX_TRANSPORT), + .driver_id = + FWK_ID_SUB_ELEMENT_INIT( + FWK_MODULE_IDX_MHU3, + SCP_CFGD_MOD_MHU3_EIDX_SCP_MCP_S, + 0), + .driver_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_MHU3, + MOD_MHU3_API_IDX_TRANSPORT_DRIVER), + }), + }, + [SCP_CFGD_MOD_TRANSPORT_EIDX_MCP_SCMI_MSG_RECV_CH] = { + .name = "SCP_MCP_SCMI_MSG_RECV_CH", + .data = &(( + struct mod_transport_channel_config) { + .transport_type = MOD_TRANSPORT_CHANNEL_TRANSPORT_TYPE_OUT_BAND, + .policies = MOD_TRANSPORT_POLICY_INIT_MAILBOX | + MOD_TRANSPORT_POLICY_SECURE, + .channel_type = MOD_TRANSPORT_CHANNEL_TYPE_COMPLETER, + .out_band_mailbox_address = + (uintptr_t) SCP_MCP_SCMI_MSG_PAYLOAD_BASE, + .out_band_mailbox_size = SCP_MCP_SCMI_MSG_PAYLOAD_SIZE, + .driver_id = + FWK_ID_SUB_ELEMENT_INIT( + FWK_MODULE_IDX_MHU3, + SCP_CFGD_MOD_MHU3_EIDX_SCP_MCP_S, + 0), + .driver_api_id = + FWK_ID_API_INIT( + FWK_MODULE_IDX_MHU3, + MOD_MHU3_API_IDX_TRANSPORT_DRIVER), + }), + }, [SCP_CFGD_MOD_TRANSPORT_EIDX_COUNT] = { 0 }, }; diff --git a/product/neoverse-rd/rdv3/scp_ramfw/include/fmw_cmsis.h b/product/neoverse-rd/rdv3/scp_ramfw/include/fmw_cmsis.h index c0d8c703223f43b9524d2586e98811caf649dcd7..09499e1de5e4e3f7ca1c83163e61eac9f6f9d861 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/include/fmw_cmsis.h +++ b/product/neoverse-rd/rdv3/scp_ramfw/include/fmw_cmsis.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ @@ -56,6 +56,8 @@ typedef enum IRQn { PPU_CLUSTERS3_IRQ = 62, /* MHUv3 secure IRQ between SCP and AP */ MHU3_AP2SCP_IRQ_S = 83, + /* MHUv3 secure IRQ between SCP and MCP */ + MHU3_MCP2SCP_IRQ_S = 85, /* MHUv3 secure IRQ between SCP and RSS */ MHU3_RSS2SCP_IRQ_S = 86, diff --git a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_mhu3.h b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_mhu3.h index b27b57587a56b150b5f7a38e467830a3f1cfd21d..75222842db2abd615e5f2cca2a36869a32ab2ca2 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_mhu3.h +++ b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_mhu3.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -15,6 +15,7 @@ enum scp_cfgd_mod_mhu3_device_idx { SCP_CFGD_MOD_MHU3_EIDX_SCP_AP_S_CLUS0, SCP_CFGD_MOD_MHU3_EIDX_SCP_RSS_S, + SCP_CFGD_MOD_MHU3_EIDX_SCP_MCP_S, SCP_CFGD_MOD_MHU3_EIDX_COUNT }; diff --git a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_scmi.h b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_scmi.h index 82775ade673801b774e48afb1575eb7ef10431b2..7d849e3ff255035f73b6bf169766b9a679d81b7c 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_scmi.h +++ b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_scmi.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -11,17 +11,34 @@ #ifndef SCP_CFGD_SCMI_H #define SCP_CFGD_SCMI_H +#include + /* SCMI agent identifier indexes in the SCMI agent table */ enum scp_scmi_agent_idx { /* 0 is reserved for the platform */ SCP_SCMI_AGENT_IDX_PSCI = 1, + SCP_SCMI_AGENT_IDX_RSE, + SCP_SCMI_AGENT_IDX_MCP, SCP_SCMI_AGENT_IDX_COUNT, }; /* Module 'scmi' element indexes (SCMI services supported) */ enum scp_cfgd_mod_scmi_element_idx { SCP_CFGD_MOD_SCMI_EIDX_PSCI, + SCP_CFGD_MOD_SCMI_EIDX_MCP_SCMI_SEND, + SCP_CFGD_MOD_SCMI_EIDX_RSE_SCMI_SEND, +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + SCP_CFGD_MOD_SCMI_EIDX_MCP_SCMI_RECV, + SCP_CFGD_MOD_SCMI_EIDX_RSE_SCMI_RECV, +#endif SCP_CFGD_MOD_SCMI_EIDX_COUNT, }; +/* SCMI protocol requester agents */ +enum scmi_protocol_requester { + SCMI_PROTOCOL_REQUESTER_MCP, + SCMI_PROTOCOL_REQUESTER_RSE, + SCMI_PROTOCOL_REQUESTER_COUNT +}; + #endif /* SCP_CFGD_SCMI_H */ diff --git a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_timer.h b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_timer.h index a8ed5a6352e2c2d73e496725c419916890d84635..9432ac8543a5694e796a36030cb21049516481af 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_timer.h +++ b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_timer.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -11,8 +11,17 @@ #ifndef SCP_CFGD_TIMER_H #define SCP_CFGD_TIMER_H +/* Element indexes for SCP timer device */ +enum scp_cfgd_mod_timer_element_idx { + SCP_TIMER_ALARM_EIDX, + SCP_TIMER_ELEMENT_COUNT +}; + /* Sub-element indexes (alarms) for SCP timer device */ enum scp_cfgd_mod_timer_alarm_idx { +#ifdef BUILD_HAS_SCMI_NOTIFICATIONS + SCP_CFGD_SCMI_SYSPWR_MGMT_NOTIFY_ALARM_IDX, +#endif SCP_CFGD_MOD_TIMER_ALARM_IDX_COUNT, }; diff --git a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_transport.h b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_transport.h index 3b1dc9f681c1a7ecc93476c812565899c389c33f..155b59a0a7adc07db4c917992e9991020bc5d9db 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_transport.h +++ b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_cfgd_transport.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -16,6 +16,10 @@ enum scp_cfgd_mod_transport_element_idx { SCP_CFGD_MOD_TRANSPORT_EIDX_PSCI, SCP_CFGD_MOD_TRANSPORT_EIDX_SYSTEM, + SCP_CFGD_MOD_TRANSPORT_EIDX_RSE_SCMI_MSG_SEND_CH, + SCP_CFGD_MOD_TRANSPORT_EIDX_RSE_SCMI_MSG_RECV_CH, + SCP_CFGD_MOD_TRANSPORT_EIDX_MCP_SCMI_MSG_SEND_CH, + SCP_CFGD_MOD_TRANSPORT_EIDX_MCP_SCMI_MSG_RECV_CH, SCP_CFGD_MOD_TRANSPORT_EIDX_COUNT, }; diff --git a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_css_mmap.h b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_css_mmap.h index eb0c936918c54bb7b8f9b207e1a568f8366f12ae..21e27baa2a21cec2be3042058f8aa2ad9dac195b 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_css_mmap.h +++ b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_css_mmap.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -12,6 +12,8 @@ #ifndef SCP_CSS_MMAP_H #define SCP_CSS_MMAP_H +#include "css_common.h" + /* Base address and size of SCP's ITCM */ #define SCP_ITC_RAM_BASE (0x00000000) #define SCP_ITC_RAM_SIZE (256 * 1024) @@ -28,6 +30,8 @@ #define SCP_UART_BASE (0x44002000) #define SCP_SCP2AP_MHUV3_SEND_S_BASE (0x45020000) #define SCP_AP2SCP_MHUV3_RCV_S_BASE (0x45030000) +#define SCP_SCP2MCP_MHUV3_SEND_S_BASE (0x45800000) +#define SCP_MCP2SCP_MHUV3_RCV_S_BASE (0x45810000) #define SCP_SCP2RSS_MHUV3_SEND_S_BASE (0x46000000) #define SCP_RSS2SCP_MHUV3_RCV_S_BASE (0x46010000) #define SCP_POWER_CONTROL_BASE (0x50000000) @@ -65,7 +69,6 @@ #define SCP_ATW0_LCP_AND_CLUSTER_UTILITY_SIZE (256 * FWK_MIB) #define SCP_ATW0_AP_PERIPHERAL_SRAM_SIZE (128 * FWK_MIB) #define SCP_ATW0_AP_PERIPHERAL_GPC_SMMU_SIZE (1 * FWK_MIB) -#define SCP_ATW0_SYSTEM_CONTROL_SRAM_SIZE (4 * FWK_MIB) #define SCP_ATW0_ATU_MMIO_SIZE (1 * FWK_MIB) #define SCP_ATW0_LCP_AND_CLUSTER_UTILITY_BASE \ @@ -75,11 +78,11 @@ SCP_ATW0_LCP_AND_CLUSTER_UTILITY_SIZE) #define SCP_ATW0_AP_PERIPHERAL_GPC_SMMU_BASE \ (SCP_ATW0_AP_PERIPHERAL_SRAM_BASE + SCP_ATW0_AP_PERIPHERAL_SRAM_SIZE) -#define SCP_ATW0_SYSTEM_CONTROL_SRAM_BASE \ +#define SCP_ATW0_SHARED_SRAM_RSM_BASE \ (SCP_ATW0_AP_PERIPHERAL_GPC_SMMU_BASE + \ SCP_ATW0_AP_PERIPHERAL_GPC_SMMU_SIZE) #define SCP_ATW0_ATU_MMIO_BASE \ - (SCP_ATW0_SYSTEM_CONTROL_SRAM_BASE + SCP_ATW0_SYSTEM_CONTROL_SRAM_SIZE) + (SCP_ATW0_SHARED_SRAM_RSM_BASE + RSM_SHARED_SRAM_SIZE) /* * Offsets within SCP's Address Translation Window1 @@ -162,11 +165,10 @@ (SCP_LCP_CONTROL(n) + SCP_LCP_CONTROL_CPU_WAIT_OFFSET) /* - * System Control SRAM (shared between RSS, MCP, SCP and AP) is mapped by ATU in - * the SCP address translation window 0 at the address 0x7800_0000. + * Shared RSM SRAM (shared between RSS, MCP, SCP) is mapped by ATU in + * the SCP address translation window 0. */ -#define SCP_SYSTEM_CONTROL_SRAM_BASE \ - (SCP_ADDRESS_TRANSLATION_WINDOW0_BASE + SCP_ATW0_SYSTEM_CONTROL_SRAM_OFFSET) +#define SCP_SHARED_SRAM_RSM_BASE (SCP_ATW0_SHARED_SRAM_RSM_BASE) /* CMN config space is mapped in the SCP address translation window 1 */ #define SCP_CMN_BASE SCP_ATW1_CMN_BASE diff --git a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_fw_mmap.h b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_fw_mmap.h index 6c3d1a3e86b540d5a451fa236b54bf838352216b..c3493909f44f10cb556f0204ef1fef297509c6b6 100644 --- a/product/neoverse-rd/rdv3/scp_ramfw/include/scp_fw_mmap.h +++ b/product/neoverse-rd/rdv3/scp_ramfw/include/scp_fw_mmap.h @@ -1,6 +1,6 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause * @@ -12,6 +12,7 @@ #ifndef SCP_FW_MMAP_H #define SCP_FW_MMAP_H +#include "rsm_fw_mmap.h" #include "scp_css_mmap.h" #include @@ -62,4 +63,18 @@ #define SCP_SCMI_PAYLOAD_S_A2P_BASE (SCP_SDS_SECURE_BASE + SCP_SDS_SECURE_SIZE) #define SCP_SCMI_PAYLOAD_SIZE (128) +/* + * RSM SRAM in the AP memory map with base address of 0x2F000000 is mapped in + * the SCP's address translation window 0 (0x60000000 - 0x9FFFFFFF) at the + * offset 'SCP_ATW0_SHARED_SRAM_RSM_BASE' via ATU configuration. + */ + +/* SCP-MCP SCMI message payload base address (in RSM SRAM) */ +#define SCP_MCP_SCMI_MSG_PAYLOAD_BASE \ + (SCP_SHARED_SRAM_RSM_BASE + SCP_MCP_SCMI_MSG_PAYLOAD_OFFSET) + +/* Payload Area for SCP-RSE outband message */ +#define SCP_RSE_SCMI_MSG_PAYLOAD_BASE \ + (SCP_SHARED_SRAM_RSM_BASE + SCP_RSE_SCMI_MSG_PAYLOAD_OFFSET) + #endif /* SCP_FW_MMAP_H */