From ae603e3a6a80834c2b65e92905bb3276cb121a8c Mon Sep 17 00:00:00 2001 From: Tintu Thomas Date: Tue, 19 Dec 2023 13:55:04 +0000 Subject: [PATCH 1/2] totalcompute: Move common configs out of scp_romfw and scp_ramfw * This will be helpful to unify common directory across TC platforms even with a single stage boot. * Conflicting files between romfw and ramfw have been moved to tc2/scp_romfw and kept the common directory in favor of ramfw. * fmw_notification file is a special override file for ramfw expected by the SCP framework. That has been moved under tc2/scp_ramfw. If not, it will break romfw. * Removed duplicate file scp_css_mmap since the same copy is already available in commmon include. Signed-off-by: Tintu Thomas --- .../{scp_ramfw => }/config_armv7m_mpu.c | 0 .../{scp_romfw => }/config_bootloader.c | 0 .../common/{scp_ramfw => }/config_mhu2.c | 0 .../common/{scp_ramfw => }/config_pl011.c | 0 .../{scp_ramfw => }/config_power_domain.c | 0 .../common/{scp_ramfw => }/config_ppu_v1.c | 0 .../common/{scp_ramfw => }/config_scmi.c | 0 .../{scp_ramfw => }/config_scmi_clock.c | 0 .../config_scmi_power_domain.c | 0 .../config_scmi_system_power.c | 0 .../{scp_ramfw => }/config_system_power.c | 0 .../common/{scp_romfw => }/config_timer.c | 0 .../common/{scp_ramfw => }/config_transport.c | 0 .../{scp_ramfw => include}/config_ppu_v1.h | 0 .../totalcompute/tc2/scp_ramfw/CMakeLists.txt | 24 +++++++++---------- .../{common => tc2}/scp_ramfw/fmw_memory.h | 0 .../scp_ramfw/fmw_notification.h | 0 .../totalcompute/tc2/scp_romfw/CMakeLists.txt | 11 ++++----- .../{common => tc2}/scp_romfw/config_pl011.c | 0 .../{common => tc2}/scp_romfw/fmw_memory.h | 0 20 files changed, 17 insertions(+), 18 deletions(-) rename product/totalcompute/common/{scp_ramfw => }/config_armv7m_mpu.c (100%) rename product/totalcompute/common/{scp_romfw => }/config_bootloader.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_mhu2.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_pl011.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_power_domain.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_ppu_v1.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_scmi.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_scmi_clock.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_scmi_power_domain.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_scmi_system_power.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_system_power.c (100%) rename product/totalcompute/common/{scp_romfw => }/config_timer.c (100%) rename product/totalcompute/common/{scp_ramfw => }/config_transport.c (100%) rename product/totalcompute/common/{scp_ramfw => include}/config_ppu_v1.h (100%) rename product/totalcompute/{common => tc2}/scp_ramfw/fmw_memory.h (100%) rename product/totalcompute/{common => tc2}/scp_ramfw/fmw_notification.h (100%) rename product/totalcompute/{common => tc2}/scp_romfw/config_pl011.c (100%) rename product/totalcompute/{common => tc2}/scp_romfw/fmw_memory.h (100%) diff --git a/product/totalcompute/common/scp_ramfw/config_armv7m_mpu.c b/product/totalcompute/common/config_armv7m_mpu.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_armv7m_mpu.c rename to product/totalcompute/common/config_armv7m_mpu.c diff --git a/product/totalcompute/common/scp_romfw/config_bootloader.c b/product/totalcompute/common/config_bootloader.c similarity index 100% rename from product/totalcompute/common/scp_romfw/config_bootloader.c rename to product/totalcompute/common/config_bootloader.c diff --git a/product/totalcompute/common/scp_ramfw/config_mhu2.c b/product/totalcompute/common/config_mhu2.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_mhu2.c rename to product/totalcompute/common/config_mhu2.c diff --git a/product/totalcompute/common/scp_ramfw/config_pl011.c b/product/totalcompute/common/config_pl011.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_pl011.c rename to product/totalcompute/common/config_pl011.c diff --git a/product/totalcompute/common/scp_ramfw/config_power_domain.c b/product/totalcompute/common/config_power_domain.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_power_domain.c rename to product/totalcompute/common/config_power_domain.c diff --git a/product/totalcompute/common/scp_ramfw/config_ppu_v1.c b/product/totalcompute/common/config_ppu_v1.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_ppu_v1.c rename to product/totalcompute/common/config_ppu_v1.c diff --git a/product/totalcompute/common/scp_ramfw/config_scmi.c b/product/totalcompute/common/config_scmi.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_scmi.c rename to product/totalcompute/common/config_scmi.c diff --git a/product/totalcompute/common/scp_ramfw/config_scmi_clock.c b/product/totalcompute/common/config_scmi_clock.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_scmi_clock.c rename to product/totalcompute/common/config_scmi_clock.c diff --git a/product/totalcompute/common/scp_ramfw/config_scmi_power_domain.c b/product/totalcompute/common/config_scmi_power_domain.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_scmi_power_domain.c rename to product/totalcompute/common/config_scmi_power_domain.c diff --git a/product/totalcompute/common/scp_ramfw/config_scmi_system_power.c b/product/totalcompute/common/config_scmi_system_power.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_scmi_system_power.c rename to product/totalcompute/common/config_scmi_system_power.c diff --git a/product/totalcompute/common/scp_ramfw/config_system_power.c b/product/totalcompute/common/config_system_power.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_system_power.c rename to product/totalcompute/common/config_system_power.c diff --git a/product/totalcompute/common/scp_romfw/config_timer.c b/product/totalcompute/common/config_timer.c similarity index 100% rename from product/totalcompute/common/scp_romfw/config_timer.c rename to product/totalcompute/common/config_timer.c diff --git a/product/totalcompute/common/scp_ramfw/config_transport.c b/product/totalcompute/common/config_transport.c similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_transport.c rename to product/totalcompute/common/config_transport.c diff --git a/product/totalcompute/common/scp_ramfw/config_ppu_v1.h b/product/totalcompute/common/include/config_ppu_v1.h similarity index 100% rename from product/totalcompute/common/scp_ramfw/config_ppu_v1.h rename to product/totalcompute/common/include/config_ppu_v1.h diff --git a/product/totalcompute/tc2/scp_ramfw/CMakeLists.txt b/product/totalcompute/tc2/scp_ramfw/CMakeLists.txt index 554244660..4e60cae75 100644 --- a/product/totalcompute/tc2/scp_ramfw/CMakeLists.txt +++ b/product/totalcompute/tc2/scp_ramfw/CMakeLists.txt @@ -69,24 +69,24 @@ endif() target_include_directories( tc2-bl2 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include" "${CMAKE_CURRENT_SOURCE_DIR}/../../common/include" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common" "${CMAKE_CURRENT_SOURCE_DIR}") # cmake-lint: disable=E1122 target_sources( tc2-bl2 - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_armv7m_mpu.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_pl011.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_scmi_power_domain.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_scmi_system_power.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_mhu2.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_power_domain.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_ppu_v1.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_scmi.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_scmi_clock.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_system_power.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_ramfw/config_transport.c" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_armv7m_mpu.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_pl011.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_scmi_power_domain.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_scmi_system_power.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_mhu2.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_power_domain.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_ppu_v1.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_scmi.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_scmi_clock.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_system_power.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_transport.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_sds.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_scmi_perf.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_gtimer.c" diff --git a/product/totalcompute/common/scp_ramfw/fmw_memory.h b/product/totalcompute/tc2/scp_ramfw/fmw_memory.h similarity index 100% rename from product/totalcompute/common/scp_ramfw/fmw_memory.h rename to product/totalcompute/tc2/scp_ramfw/fmw_memory.h diff --git a/product/totalcompute/common/scp_ramfw/fmw_notification.h b/product/totalcompute/tc2/scp_ramfw/fmw_notification.h similarity index 100% rename from product/totalcompute/common/scp_ramfw/fmw_notification.h rename to product/totalcompute/tc2/scp_ramfw/fmw_notification.h diff --git a/product/totalcompute/tc2/scp_romfw/CMakeLists.txt b/product/totalcompute/tc2/scp_romfw/CMakeLists.txt index 3d17fd0e9..205a6e5f0 100644 --- a/product/totalcompute/tc2/scp_romfw/CMakeLists.txt +++ b/product/totalcompute/tc2/scp_romfw/CMakeLists.txt @@ -1,6 +1,6 @@ # # Arm SCP/MCP Software -# Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved. +# Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # @@ -14,16 +14,16 @@ add_executable(tc2-bl1) target_include_directories( tc2-bl1 PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../include" "${CMAKE_CURRENT_SOURCE_DIR}/../../common/include" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_romfw" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common" "${CMAKE_CURRENT_SOURCE_DIR}") # cmake-lint: disable=E1122 target_sources( tc2-bl1 - PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_romfw/config_pl011.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_romfw/config_timer.c" - "${CMAKE_CURRENT_SOURCE_DIR}/../../common/scp_romfw/config_bootloader.c" + PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_timer.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_bootloader.c" + "${CMAKE_CURRENT_SOURCE_DIR}/config_pl011.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_ppu_v1.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_sds.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_cmn_booker.c" @@ -35,7 +35,6 @@ target_sources( "${CMAKE_CURRENT_SOURCE_DIR}/config_tc2_bl1.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_transport.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_mhu2.c") - # # Some of our firmware includes require CMSIS. # diff --git a/product/totalcompute/common/scp_romfw/config_pl011.c b/product/totalcompute/tc2/scp_romfw/config_pl011.c similarity index 100% rename from product/totalcompute/common/scp_romfw/config_pl011.c rename to product/totalcompute/tc2/scp_romfw/config_pl011.c diff --git a/product/totalcompute/common/scp_romfw/fmw_memory.h b/product/totalcompute/tc2/scp_romfw/fmw_memory.h similarity index 100% rename from product/totalcompute/common/scp_romfw/fmw_memory.h rename to product/totalcompute/tc2/scp_romfw/fmw_memory.h -- GitLab From c1f3e8e3b4327c2f13036881e1be94116de76119 Mon Sep 17 00:00:00 2001 From: Tintu Thomas Date: Thu, 29 Aug 2024 17:16:05 +0100 Subject: [PATCH 2/2] totalcompute: Remove duplicate config for pl011 There is only a single difference between romfw and ramfw pl011 configs. Ramfw has an extra field - `pd_id`. Guard `pd_id` with `BUILD_HAS_MOD_POWER_DOMAIN`. This ensures that the same config can be used for romfw as well, where no power domain is present. We need to split element config as a separate definition to avoid using a preprocessor directive as macro parameter. Otherwise, it will result in `cppcheck` failure `preprocessorErrorDirective`. Signed-off-by: Tintu Thomas --- product/totalcompute/common/config_pl011.c | 37 ++++++++++--------- .../totalcompute/tc2/scp_romfw/CMakeLists.txt | 2 +- .../totalcompute/tc2/scp_romfw/config_pl011.c | 32 ---------------- 3 files changed, 21 insertions(+), 50 deletions(-) delete mode 100644 product/totalcompute/tc2/scp_romfw/config_pl011.c diff --git a/product/totalcompute/common/config_pl011.c b/product/totalcompute/common/config_pl011.c index 9886306a4..d8d4b8868 100644 --- a/product/totalcompute/common/config_pl011.c +++ b/product/totalcompute/common/config_pl011.c @@ -1,11 +1,10 @@ /* * Arm SCP/MCP Software - * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ -#include "config_power_domain.h" #include "scp_mmap.h" #include @@ -15,20 +14,24 @@ #include #include -const struct fwk_module_config config_pl011 = { - .elements = FWK_MODULE_STATIC_ELEMENTS({ - [0] = { - .name = "uart", - .data = - &(struct mod_pl011_element_cfg){ - .reg_base = SCP_UART_BOARD_BASE, - .baud_rate_bps = 115200, - .clock_rate_hz = 24 * FWK_MHZ, - .clock_id = FWK_ID_NONE_INIT, - .pd_id = FWK_ID_NONE_INIT, - }, - }, +static const struct fwk_element config_pl011_elements[] = { + [0] = { + .name = "uart", + .data = + &(struct mod_pl011_element_cfg){ + .reg_base = SCP_UART_BOARD_BASE, + .baud_rate_bps = 115200, + .clock_rate_hz = 24 * FWK_MHZ, + .clock_id = FWK_ID_NONE_INIT, +#ifdef BUILD_HAS_MOD_POWER_DOMAIN + .pd_id = FWK_ID_NONE_INIT, +#endif + }, + }, + + [1] = { 0 }, +}; - [1] = { 0 }, - }), +const struct fwk_module_config config_pl011 = { + .elements = FWK_MODULE_STATIC_ELEMENTS_PTR(config_pl011_elements), }; diff --git a/product/totalcompute/tc2/scp_romfw/CMakeLists.txt b/product/totalcompute/tc2/scp_romfw/CMakeLists.txt index 205a6e5f0..7dfd748db 100644 --- a/product/totalcompute/tc2/scp_romfw/CMakeLists.txt +++ b/product/totalcompute/tc2/scp_romfw/CMakeLists.txt @@ -23,7 +23,7 @@ target_sources( tc2-bl1 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_timer.c" "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_bootloader.c" - "${CMAKE_CURRENT_SOURCE_DIR}/config_pl011.c" + "${CMAKE_CURRENT_SOURCE_DIR}/../../common/config_pl011.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_ppu_v1.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_sds.c" "${CMAKE_CURRENT_SOURCE_DIR}/config_cmn_booker.c" diff --git a/product/totalcompute/tc2/scp_romfw/config_pl011.c b/product/totalcompute/tc2/scp_romfw/config_pl011.c deleted file mode 100644 index 6058a0bd6..000000000 --- a/product/totalcompute/tc2/scp_romfw/config_pl011.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Arm SCP/MCP Software - * Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "scp_mmap.h" - -#include - -#include -#include -#include -#include - -const struct fwk_module_config config_pl011 = { - .elements = FWK_MODULE_STATIC_ELEMENTS({ - [0] = { - .name = "uart", - .data = - &(struct mod_pl011_element_cfg){ - .reg_base = SCP_UART_BOARD_BASE, - .baud_rate_bps = 115200, - .clock_rate_hz = 24 * FWK_MHZ, - .clock_id = FWK_ID_NONE_INIT, - }, - }, - - [1] = { 0 }, - }), -}; -- GitLab