mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-08 05:43:53 +00:00
refactor(tc): add plat_rse_comms_init
The same way it is done for neoverse_rd, create a plat_rse_comms_init() function to call rse_comms_init(). Signed-off-by: Yann Gautier <yann.gautier@st.com> Change-Id: I12f3b8a38a5369decb4b97f8aceeb0dc81cbea28
This commit is contained in:
parent
a773955094
commit
5b46aaccec
12 changed files with 68 additions and 35 deletions
12
plat/arm/board/tc/include/tc_rse_comms.h
Normal file
12
plat/arm/board/tc/include/tc_rse_comms.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef TC_RSE_COMMS_H
|
||||
#define TC_RSE_COMMS_H
|
||||
|
||||
int plat_rse_comms_init(void);
|
||||
|
||||
#endif /* TC_RSE_COMMS_H */
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2023-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -7,11 +7,11 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <plat/common/platform.h>
|
||||
#include "rse_platform_api.h"
|
||||
|
||||
#include <platform_def.h>
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
int nv_counter_test(void)
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ int nv_counter_test(void)
|
|||
uint32_t new_val;
|
||||
uint32_t id;
|
||||
|
||||
status = rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE, PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
status = plat_rse_comms_init();
|
||||
if (status != PSA_SUCCESS) {
|
||||
printf("Failed to initialize RSE communication channel - psa_status = %d\n", status);
|
||||
return -1;
|
||||
|
|
|
@ -249,9 +249,12 @@ $(eval $(call TOOL_ADD_PAYLOAD,${TC_HW_CONFIG},--hw-config,${TC_HW_CONFIG}))
|
|||
$(info Including rse_comms.mk)
|
||||
include drivers/arm/rse/rse_comms.mk
|
||||
|
||||
BL1_SOURCES += ${RSE_COMMS_SOURCES}
|
||||
BL2_SOURCES += ${RSE_COMMS_SOURCES}
|
||||
BL1_SOURCES += ${RSE_COMMS_SOURCES} \
|
||||
plat/arm/board/tc/tc_rse_comms.c
|
||||
BL2_SOURCES += ${RSE_COMMS_SOURCES} \
|
||||
plat/arm/board/tc/tc_rse_comms.c
|
||||
BL31_SOURCES += ${RSE_COMMS_SOURCES} \
|
||||
plat/arm/board/tc/tc_rse_comms.c \
|
||||
lib/psa/rse_platform.c
|
||||
|
||||
# Include Measured Boot makefile before any Crypto library makefile.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2022-2024, Arm Limited. All rights reserved.
|
||||
# Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved.
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
@ -9,7 +9,8 @@ ifeq (${PLATFORM_TEST},rse-nv-counters)
|
|||
include drivers/arm/rse/rse_comms.mk
|
||||
|
||||
# Test code.
|
||||
BL31_SOURCES += plat/arm/board/tc/nv_counter_test.c
|
||||
BL31_SOURCES += plat/arm/board/tc/nv_counter_test.c \
|
||||
plat/arm/board/tc/tc_rse_comms.c
|
||||
|
||||
# Code under testing.
|
||||
BL31_SOURCES += lib/psa/rse_platform.c \
|
||||
|
@ -22,7 +23,8 @@ else ifeq (${PLATFORM_TEST},rse-rotpk)
|
|||
include drivers/arm/rse/rse_comms.mk
|
||||
|
||||
# Test code.
|
||||
BL31_SOURCES += plat/arm/board/tc/rotpk_test.c
|
||||
BL31_SOURCES += plat/arm/board/tc/rotpk_test.c \
|
||||
plat/arm/board/tc/tc_rse_comms.c
|
||||
|
||||
# Code under testing.
|
||||
BL31_SOURCES += lib/psa/rse_platform.c \
|
||||
|
@ -75,6 +77,7 @@ else ifeq (${PLATFORM_TEST},tfm-testsuite)
|
|||
${TC_BASE}/rse_ap_tests.c \
|
||||
${TC_BASE}/rse_ap_testsuites.c \
|
||||
${TC_BASE}/rse_ap_test_stubs.c \
|
||||
${TC_BASE}/tc_rse_comms.c \
|
||||
$(TF_M_TESTS_PATH)/tests_reg/test/framework/test_framework.c \
|
||||
$(MEASURED_BOOT_TESTS_PATH)/measured_boot_common.c \
|
||||
$(MEASURED_BOOT_TESTS_PATH)/measured_boot_tests_common.c \
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2023-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -7,10 +7,10 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <plat/common/platform.h>
|
||||
#include <rse_platform_api.h>
|
||||
#include <tc_plat.h>
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
static void print_hex(const char *key_id_name, size_t key_size, const uint8_t *key_buf)
|
||||
{
|
||||
|
@ -33,9 +33,10 @@ int rotpk_test(void)
|
|||
{.key_id = RSE_BUILTIN_KEY_ID_HOST_CCA_ROTPK, .key_id_name = "CCA-ROTPK"}
|
||||
};
|
||||
|
||||
status = rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE, PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
status = plat_rse_comms_init();
|
||||
if (status != PSA_SUCCESS) {
|
||||
printf("Failed to initialize RSE communication channel - psa_status = %d\n", status);
|
||||
printf("Failed to initialize RSE communication channel - psa_status = %d\n",
|
||||
status);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -43,7 +44,8 @@ int rotpk_test(void)
|
|||
status = rse_platform_key_read(key_ids[i].key_id, key_buf,
|
||||
sizeof(key_buf), &key_size);
|
||||
if (status != PSA_SUCCESS) {
|
||||
printf("Failed to retrieve %s - psa_status = %d\n", key_ids[i].key_id_name, status);
|
||||
printf("Failed to retrieve %s - psa_status = %d\n", key_ids[i].key_id_name,
|
||||
status);
|
||||
return -1;
|
||||
}
|
||||
print_hex(key_ids[i].key_id_name, key_size, key_buf);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Arm Ltd. All rights reserved.
|
||||
* Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -10,9 +10,9 @@
|
|||
#include <mbedtls_common.h>
|
||||
#include <plat/common/platform.h>
|
||||
#include <psa/crypto.h>
|
||||
#include <rse_comms.h>
|
||||
|
||||
#include "rse_ap_testsuites.h"
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
static struct test_suite_t test_suites[] = {
|
||||
{.freg = register_testsuite_delegated_attest},
|
||||
|
@ -32,7 +32,7 @@ static int run_tests(void)
|
|||
size_t i;
|
||||
|
||||
/* Initialize test environment. */
|
||||
rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE, PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
plat_rse_comms_init();
|
||||
mbedtls_init();
|
||||
status = psa_crypto_init();
|
||||
if (status != PSA_SUCCESS) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <common/debug.h>
|
||||
#include <drivers/arm/css/sds.h>
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <drivers/delay_timer.h>
|
||||
#include <drivers/generic_delay_timer.h>
|
||||
#include <drivers/measured_boot/metadata.h>
|
||||
|
@ -19,6 +18,7 @@
|
|||
#include <tools_share/zero_oid.h>
|
||||
|
||||
#include "tc_dpe.h"
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
struct dpe_metadata tc_dpe_metadata[] = {
|
||||
{
|
||||
|
@ -122,8 +122,7 @@ void plat_dpe_get_context_handle(int *ctx_handle)
|
|||
void bl1_plat_mboot_init(void)
|
||||
{
|
||||
/* Initialize the communication channel between AP and RSE */
|
||||
(void)rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE,
|
||||
PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
(void)plat_rse_comms_init();
|
||||
|
||||
dpe_init(tc_dpe_metadata);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2024, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <drivers/measured_boot/metadata.h>
|
||||
#include <drivers/measured_boot/rse/rse_measured_boot.h>
|
||||
#include <tools_share/zero_oid.h>
|
||||
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
#include <platform_def.h>
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
/* Table with platform specific image IDs and metadata. Intentionally not a
|
||||
* const struct, some members might set by bootloaders during trusted boot.
|
||||
|
@ -47,8 +47,7 @@ struct rse_mboot_metadata tc_rse_mboot_metadata[] = {
|
|||
void bl1_plat_mboot_init(void)
|
||||
{
|
||||
/* Initialize the communication channel between AP and RSE */
|
||||
(void)rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE,
|
||||
PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
(void)plat_rse_comms_init();
|
||||
|
||||
rse_measured_boot_init(tc_rse_mboot_metadata);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2024, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -7,7 +7,6 @@
|
|||
#include <stdint.h>
|
||||
|
||||
#include <common/debug.h>
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <drivers/measured_boot/metadata.h>
|
||||
#include <drivers/measured_boot/rse/dice_prot_env.h>
|
||||
#include <plat/arm/common/plat_arm.h>
|
||||
|
@ -16,6 +15,7 @@
|
|||
#include <tools_share/tbbr_oid.h>
|
||||
|
||||
#include "tc_dpe.h"
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
/*
|
||||
* The content and the values of this array depends on:
|
||||
|
@ -254,8 +254,7 @@ void bl2_plat_mboot_init(void)
|
|||
#endif
|
||||
|
||||
/* Initialize the communication channel between AP and RSE */
|
||||
(void)rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE,
|
||||
PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
(void)plat_rse_comms_init();
|
||||
|
||||
dpe_init(tc_dpe_metadata);
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2024, Arm Limited. All rights reserved.
|
||||
* Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <drivers/measured_boot/metadata.h>
|
||||
#include <drivers/measured_boot/rse/rse_measured_boot.h>
|
||||
#include <tools_share/tbbr_oid.h>
|
||||
|
||||
#include <plat/common/common_def.h>
|
||||
#include <platform_def.h>
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
/* TC specific table with image IDs and metadata. Intentionally not a
|
||||
* const struct, some members might set by bootloaders during trusted boot.
|
||||
|
@ -53,8 +53,7 @@ struct rse_mboot_metadata tc_rse_mboot_metadata[] = {
|
|||
void bl2_plat_mboot_init(void)
|
||||
{
|
||||
/* Initialize the communication channel between AP and RSE */
|
||||
(void)rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE,
|
||||
PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
(void)plat_rse_comms_init();
|
||||
|
||||
rse_measured_boot_init(tc_rse_mboot_metadata);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2020-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -27,8 +27,8 @@
|
|||
#endif /* PLATFORM_TEST_TFM_TESTSUITE */
|
||||
#include <psa/error.h>
|
||||
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <plat/common/platform.h>
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
#ifdef PLATFORM_TEST_TFM_TESTSUITE
|
||||
/*
|
||||
|
@ -126,7 +126,7 @@ void bl31_platform_setup(void)
|
|||
#endif
|
||||
|
||||
/* Initialise RSE communication channel */
|
||||
status = rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE, PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
status = plat_rse_comms_init();
|
||||
if (status != PSA_SUCCESS) {
|
||||
ERROR("Failed to initialize RSE communication channel - psa_status = %d\n", status);
|
||||
}
|
||||
|
|
17
plat/arm/board/tc/tc_rse_comms.c
Normal file
17
plat/arm/board/tc/tc_rse_comms.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#include <common/debug.h>
|
||||
#include <drivers/arm/rse_comms.h>
|
||||
#include <platform_def.h>
|
||||
#include <tc_rse_comms.h>
|
||||
|
||||
int plat_rse_comms_init(void)
|
||||
{
|
||||
VERBOSE("Initializing the rse_comms now\n");
|
||||
/* Initialize the communication channel between AP and RSE */
|
||||
return rse_comms_init(PLAT_RSE_AP_SND_MHU_BASE, PLAT_RSE_AP_RCV_MHU_BASE);
|
||||
}
|
Loading…
Add table
Reference in a new issue