diff options
Diffstat (limited to 'interface')
-rw-r--r-- | interface/CMakeLists.txt | 9 | ||||
-rw-r--r-- | interface/include/multi_core/tfm_mailbox.h | 35 | ||||
-rw-r--r-- | interface/include/multi_core/tfm_mailbox_config.h.in | 36 |
3 files changed, 47 insertions, 33 deletions
diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 0351754767..188e651c95 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -61,3 +61,12 @@ target_sources(tfm_secure_api $<$<BOOL:${TFM_PSA_API}>:${CMAKE_CURRENT_SOURCE_DIR}/src/psa/psa_lifecycle.c> ${CMAKE_CURRENT_SOURCE_DIR}/src/log/tfm_log_raw.c ) + +###################### Export configurations to NS ############################# + +if (TFM_MULTI_CORE_TOPOLOGY OR FORWARD_PROT_MSG) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core/tfm_mailbox_config.h.in + ${CMAKE_CURRENT_SOURCE_DIR}/include/multi_core/tfm_mailbox_config.h + NEWLINE_STYLE UNIX + ) +endif() diff --git a/interface/include/multi_core/tfm_mailbox.h b/interface/include/multi_core/tfm_mailbox.h index 45eb97ef21..5824543bc5 100644 --- a/interface/include/multi_core/tfm_mailbox.h +++ b/interface/include/multi_core/tfm_mailbox.h @@ -18,45 +18,14 @@ #include <stdbool.h> #include <stdint.h> #include <stddef.h> -#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL -#include "device_cfg.h" -#endif + #include "psa/client.h" +#include "tfm_mailbox_config.h" #ifdef __cplusplus extern "C" { #endif -/* - * If multiple outstanding NS PSA Client calls is enabled, multi-core platform - * should define the number of mailbox queue slots NUM_MAILBOX_QUEUE_SLOT in - * platform device_cfg.h. - * Otherwise, NUM_MAILBOX_QUEUE_SLOT is defined as 1. - */ -#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL -#ifndef NUM_MAILBOX_QUEUE_SLOT -#error "Error: Platform doesn't define NUM_MAILBOX_QUEUE_SLOT for mailbox queue" -#endif - -#if (NUM_MAILBOX_QUEUE_SLOT < 2) -#error "Error: Invalid NUM_MAILBOX_QUEUE_SLOT. The value should be more than 1" -#endif - -/* - * The number of slots should be no more than the number of bits in - * mailbox_queue_status_t. - * Here the value is hardcoded. A better way is to define a sizeof() to - * calculate the bits in mailbox_queue_status_t and dump it with pragma message. - */ -#if (NUM_MAILBOX_QUEUE_SLOT > 32) -#error "Error: Invalid NUM_MAILBOX_QUEUE_SLOT. The value should be no more than 32" -#endif -#else /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */ -/* Force the number of mailbox queue slots as 1. */ -#undef NUM_MAILBOX_QUEUE_SLOT -#define NUM_MAILBOX_QUEUE_SLOT (1) -#endif /* TFM_MULTI_CORE_MULTI_CLIENT_CALL */ - /* PSA client call type value */ #define MAILBOX_PSA_FRAMEWORK_VERSION (0x1) #define MAILBOX_PSA_VERSION (0x2) diff --git a/interface/include/multi_core/tfm_mailbox_config.h.in b/interface/include/multi_core/tfm_mailbox_config.h.in new file mode 100644 index 0000000000..bd85ef6914 --- /dev/null +++ b/interface/include/multi_core/tfm_mailbox_config.h.in @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2020-2021, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _TFM_MAILBOX_CONFIG_ +#define _TFM_MAILBOX_CONFIG_ + +/* + * \note Don't modify this file. Change the build configuration value + * and re-build TF-M SPE side to update the value. + */ + +/* Get number of mailbox queue slots from build configuration */ +#cmakedefine NUM_MAILBOX_QUEUE_SLOT @NUM_MAILBOX_QUEUE_SLOT@ + +#ifndef NUM_MAILBOX_QUEUE_SLOT +#define NUM_MAILBOX_QUEUE_SLOT 1 +#endif + +#if (NUM_MAILBOX_QUEUE_SLOT < 1) +#error "Error: Invalid NUM_MAILBOX_QUEUE_SLOT. The value should be >= 1" +#endif + +/* + * The number of slots should be no more than the number of bits in + * mailbox_queue_status_t. + * Here the value is hardcoded. A better way is to define a sizeof() to + * calculate the bits in mailbox_queue_status_t and dump it with pragma message. + */ +#if (NUM_MAILBOX_QUEUE_SLOT > 32) +#error "Error: Invalid NUM_MAILBOX_QUEUE_SLOT. The value should be <= 32" +#endif + +#endif /* _TFM_MAILBOX_CONFIG_ */ |