diff options
author | David Hu <david.hu@arm.com> | 2020-11-27 20:59:52 +0800 |
---|---|---|
committer | David Hu <david.hu@arm.com> | 2021-01-22 02:21:55 +0000 |
commit | 8b526d4544a8d1e3aa98ac2101b1f818cc0dd888 (patch) | |
tree | aafcc530e661ec27e640c8e8b2975f53c6988cf9 /interface/include | |
parent | 04969a400441dd2e41212a4e2937d17873bb3765 (diff) | |
download | trusted-firmware-m-8b526d4544a8d1e3aa98ac2101b1f818cc0dd888.tar.gz |
Build: Improve the setting of number of mailbox queue slots
Move configuration of number of mailbox queue slots from platform's
device_cfg.h into a common header file tfm_mailbox_config.h.
tfm_mailbox_config.h is automatically generated during build. The
value of NUM_MAILBOX_QUEUE_SLOT is passed from build configuration
and then set in tfm_mailbox_config.h.
Change-Id: I9a3ac465b71b316accf6cd41cea80745eec8607c
Signed-off-by: David Hu <david.hu@arm.com>
Diffstat (limited to 'interface/include')
-rw-r--r-- | interface/include/multi_core/tfm_mailbox.h | 35 | ||||
-rw-r--r-- | interface/include/multi_core/tfm_mailbox_config.h.in | 36 |
2 files changed, 38 insertions, 33 deletions
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_ */ |