blob: 30b8f5e4dbbfaad45bfa2610241bdbbaae03a188 [file] [log] [blame]
Xinyu Zhanga2fab0e2022-10-24 15:37:46 +08001/*
David Vincze37faec62025-01-20 18:07:12 +00002 * Copyright (c) 2022-2025, Arm Limited. All rights reserved.
Chris Brand72ee4c62024-01-08 16:56:55 -08003 * Copyright (c) 2023-2024 Cypress Semiconductor Corporation (an Infineon
Chris Brand80326b72023-03-15 13:07:49 -07004 * company) or an affiliate of Cypress Semiconductor Corporation. All rights
5 * reserved.
Xinyu Zhanga2fab0e2022-10-24 15:37:46 +08006 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 *
9 */
10
11#ifndef __CONFIG_BASE_H__
12#define __CONFIG_BASE_H__
13
Nicola Mazzucatob369b332025-01-02 09:11:57 +000014#include "tfm_hybrid_platform.h"
15
Xinyu Zhang77668dd2022-10-24 16:17:37 +080016/* Platform Partition Configs */
17
18/* Size of input buffer in platform service */
David Hu6d1a9b62023-02-22 16:54:04 +080019#ifndef PLATFORM_SERVICE_INPUT_BUFFER_SIZE
Xinyu Zhang77668dd2022-10-24 16:17:37 +080020#define PLATFORM_SERVICE_INPUT_BUFFER_SIZE 64
David Hu6d1a9b62023-02-22 16:54:04 +080021#endif
Xinyu Zhang77668dd2022-10-24 16:17:37 +080022
23/* Size of output buffer in platform service */
David Hu6d1a9b62023-02-22 16:54:04 +080024#ifndef PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE
Xinyu Zhang77668dd2022-10-24 16:17:37 +080025#define PLATFORM_SERVICE_OUTPUT_BUFFER_SIZE 64
David Hu6d1a9b62023-02-22 16:54:04 +080026#endif
Xinyu Zhang77668dd2022-10-24 16:17:37 +080027
28/* The stack size of the Platform Secure Partition */
David Hu6d1a9b62023-02-22 16:54:04 +080029#ifndef PLATFORM_SP_STACK_SIZE
Xinyu Zhang77668dd2022-10-24 16:17:37 +080030#define PLATFORM_SP_STACK_SIZE 0x500
David Hu6d1a9b62023-02-22 16:54:04 +080031#endif
Xinyu Zhang77668dd2022-10-24 16:17:37 +080032
33/* Disable Non-volatile counter module */
David Hu6d1a9b62023-02-22 16:54:04 +080034#ifndef PLATFORM_NV_COUNTER_MODULE_DISABLED
Xinyu Zhang77668dd2022-10-24 16:17:37 +080035#define PLATFORM_NV_COUNTER_MODULE_DISABLED 0
David Hu6d1a9b62023-02-22 16:54:04 +080036#endif
Xinyu Zhang77668dd2022-10-24 16:17:37 +080037
Xinyu Zhangd755b822022-10-25 11:18:09 +080038/* Crypto Partition Configs */
39
40/*
Antonio de Angelisc271e4a2024-11-15 14:35:40 +000041 * Heap size for the crypto backend. This is statically allocated
42 * inside the Crypto service and used as heap through the default
43 * Mbed TLS allocator
Xinyu Zhangd755b822022-10-25 11:18:09 +080044 */
David Hu6d1a9b62023-02-22 16:54:04 +080045#ifndef CRYPTO_ENGINE_BUF_SIZE
Antonio de Angelisc271e4a2024-11-15 14:35:40 +000046#define CRYPTO_ENGINE_BUF_SIZE 0x3000
David Hu6d1a9b62023-02-22 16:54:04 +080047#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080048
49/* The max number of concurrent operations that can be active (allocated) at any time in Crypto */
David Hu6d1a9b62023-02-22 16:54:04 +080050#ifndef CRYPTO_CONC_OPER_NUM
Xinyu Zhangd755b822022-10-25 11:18:09 +080051#define CRYPTO_CONC_OPER_NUM 8
David Hu6d1a9b62023-02-22 16:54:04 +080052#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080053
Jianliang Shen78ca8d42022-11-16 17:33:18 +080054/* Enable PSA Crypto random number generator module */
David Hu6d1a9b62023-02-22 16:54:04 +080055#ifndef CRYPTO_RNG_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080056#define CRYPTO_RNG_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080057#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080058
Jianliang Shen78ca8d42022-11-16 17:33:18 +080059/* Enable PSA Crypto Key module */
David Hu6d1a9b62023-02-22 16:54:04 +080060#ifndef CRYPTO_KEY_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080061#define CRYPTO_KEY_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080062#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080063
Jianliang Shen78ca8d42022-11-16 17:33:18 +080064/* Enable PSA Crypto AEAD module */
David Hu6d1a9b62023-02-22 16:54:04 +080065#ifndef CRYPTO_AEAD_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080066#define CRYPTO_AEAD_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080067#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080068
Jianliang Shen78ca8d42022-11-16 17:33:18 +080069/* Enable PSA Crypto MAC module */
David Hu6d1a9b62023-02-22 16:54:04 +080070#ifndef CRYPTO_MAC_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080071#define CRYPTO_MAC_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080072#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080073
Jianliang Shen78ca8d42022-11-16 17:33:18 +080074/* Enable PSA Crypto Hash module */
David Hu6d1a9b62023-02-22 16:54:04 +080075#ifndef CRYPTO_HASH_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080076#define CRYPTO_HASH_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080077#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080078
Jianliang Shen78ca8d42022-11-16 17:33:18 +080079/* Enable PSA Crypto Cipher module */
David Hu6d1a9b62023-02-22 16:54:04 +080080#ifndef CRYPTO_CIPHER_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080081#define CRYPTO_CIPHER_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080082#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080083
Jianliang Shen78ca8d42022-11-16 17:33:18 +080084/* Enable PSA Crypto asymmetric key signature module */
David Hu6d1a9b62023-02-22 16:54:04 +080085#ifndef CRYPTO_ASYM_SIGN_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080086#define CRYPTO_ASYM_SIGN_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080087#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080088
Jianliang Shen78ca8d42022-11-16 17:33:18 +080089/* Enable PSA Crypto asymmetric key encryption module */
David Hu6d1a9b62023-02-22 16:54:04 +080090#ifndef CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080091#define CRYPTO_ASYM_ENCRYPT_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080092#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080093
Jianliang Shen78ca8d42022-11-16 17:33:18 +080094/* Enable PSA Crypto key derivation module */
David Hu6d1a9b62023-02-22 16:54:04 +080095#ifndef CRYPTO_KEY_DERIVATION_MODULE_ENABLED
Jianliang Shen78ca8d42022-11-16 17:33:18 +080096#define CRYPTO_KEY_DERIVATION_MODULE_ENABLED 1
David Hu6d1a9b62023-02-22 16:54:04 +080097#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +080098
99/* Default size of the internal scratch buffer used for PSA FF IOVec allocations */
David Hu6d1a9b62023-02-22 16:54:04 +0800100#ifndef CRYPTO_IOVEC_BUFFER_SIZE
Xinyu Zhangd755b822022-10-25 11:18:09 +0800101#define CRYPTO_IOVEC_BUFFER_SIZE 5120
David Hu6d1a9b62023-02-22 16:54:04 +0800102#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +0800103
104/* Use stored NV seed to provide entropy */
David Hu6d1a9b62023-02-22 16:54:04 +0800105#ifndef CRYPTO_NV_SEED
Xinyu Zhangd755b822022-10-25 11:18:09 +0800106#define CRYPTO_NV_SEED 1
David Hu6d1a9b62023-02-22 16:54:04 +0800107#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +0800108
109/*
110 * Only enable multi-part operations in Hash, MAC, AEAD and symmetric ciphers,
111 * to optimize memory footprint in resource-constrained devices.
112 */
David Hu6d1a9b62023-02-22 16:54:04 +0800113#ifndef CRYPTO_SINGLE_PART_FUNCS_DISABLED
Xinyu Zhangd755b822022-10-25 11:18:09 +0800114#define CRYPTO_SINGLE_PART_FUNCS_DISABLED 0
David Hu6d1a9b62023-02-22 16:54:04 +0800115#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +0800116
Antonio de Angelisbb6f7112024-10-16 19:15:25 +0100117/*
118 * The service assumes that the client interface and internal
119 * interface towards the library that provides the PSA Crypto
120 * core component maintain the same ABI. This is not the default
121 * when using the Mbed TLS reference implementation
122 */
123#ifndef CRYPTO_LIBRARY_ABI_COMPAT
124#define CRYPTO_LIBRARY_ABI_COMPAT (0)
125#endif
126
Xinyu Zhangd755b822022-10-25 11:18:09 +0800127/* The stack size of the Crypto Secure Partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800128#ifndef CRYPTO_STACK_SIZE
Antonio de Angelis9b822182024-11-16 22:19:30 +0000129#define CRYPTO_STACK_SIZE 0x1800
David Hu6d1a9b62023-02-22 16:54:04 +0800130#endif
Xinyu Zhangd755b822022-10-25 11:18:09 +0800131
Xinyu Zhangff653722022-10-27 14:17:36 +0800132/* FWU Partition Configs */
133
134/* Size of the FWU internal data transfer buffer */
David Hu6d1a9b62023-02-22 16:54:04 +0800135#ifndef TFM_FWU_BUF_SIZE
Xinyu Zhangff653722022-10-27 14:17:36 +0800136#define TFM_FWU_BUF_SIZE PSA_FWU_MAX_WRITE_SIZE
David Hu6d1a9b62023-02-22 16:54:04 +0800137#endif
Xinyu Zhangff653722022-10-27 14:17:36 +0800138
139/* The stack size of the Firmware Update Secure Partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800140#ifndef FWU_STACK_SIZE
Xinyu Zhangff653722022-10-27 14:17:36 +0800141#define FWU_STACK_SIZE 0x600
David Hu6d1a9b62023-02-22 16:54:04 +0800142#endif
Xinyu Zhangff653722022-10-27 14:17:36 +0800143
Xinyu Zhangd15f99c2022-10-27 15:03:34 +0800144/* Attest Partition Configs */
145
146/* Include optional claims in initial attestation token */
David Hu6d1a9b62023-02-22 16:54:04 +0800147#ifndef ATTEST_INCLUDE_OPTIONAL_CLAIMS
Xinyu Zhangd15f99c2022-10-27 15:03:34 +0800148#define ATTEST_INCLUDE_OPTIONAL_CLAIMS 1
David Hu6d1a9b62023-02-22 16:54:04 +0800149#endif
Xinyu Zhangd15f99c2022-10-27 15:03:34 +0800150
151/* Include COSE key-id in initial attestation token */
David Hu6d1a9b62023-02-22 16:54:04 +0800152#ifndef ATTEST_INCLUDE_COSE_KEY_ID
Xinyu Zhangd15f99c2022-10-27 15:03:34 +0800153#define ATTEST_INCLUDE_COSE_KEY_ID 0
David Hu6d1a9b62023-02-22 16:54:04 +0800154#endif
Xinyu Zhangd15f99c2022-10-27 15:03:34 +0800155
156/* The stack size of the Initial Attestation Secure Partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800157#ifndef ATTEST_STACK_SIZE
Tamas Ban6bff4682024-09-25 15:15:26 +0200158#define ATTEST_STACK_SIZE 0x800
David Hu6d1a9b62023-02-22 16:54:04 +0800159#endif
Xinyu Zhangd15f99c2022-10-27 15:03:34 +0800160
161/* Set the initial attestation token profile */
David Hu6d1a9b62023-02-22 16:54:04 +0800162#if (!ATTEST_TOKEN_PROFILE_PSA_IOT_1) && \
163 (!ATTEST_TOKEN_PROFILE_PSA_2_0_0) && \
164 (!ATTEST_TOKEN_PROFILE_ARM_CCA)
Antonio de Angelis58fc26c2024-11-07 17:06:55 +0100165#define ATTEST_TOKEN_PROFILE_PSA_IOT_1 1
David Hu6d1a9b62023-02-22 16:54:04 +0800166#endif
Xinyu Zhangd15f99c2022-10-27 15:03:34 +0800167
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800168/* ITS Partition Configs */
169
170/* Create flash FS if it doesn't exist for Internal Trusted Storage partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800171#ifndef ITS_CREATE_FLASH_LAYOUT
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800172#define ITS_CREATE_FLASH_LAYOUT 1
David Hu6d1a9b62023-02-22 16:54:04 +0800173#endif
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800174
175/* Enable emulated RAM FS for platforms that don't have flash for Internal Trusted Storage partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800176#ifndef ITS_RAM_FS
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800177#define ITS_RAM_FS 0
David Hu6d1a9b62023-02-22 16:54:04 +0800178#endif
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800179
180/* Validate filesystem metadata every time it is read from flash */
David Hu6d1a9b62023-02-22 16:54:04 +0800181#ifndef ITS_VALIDATE_METADATA_FROM_FLASH
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800182#define ITS_VALIDATE_METADATA_FROM_FLASH 1
David Hu6d1a9b62023-02-22 16:54:04 +0800183#endif
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800184
185/* The maximum asset size to be stored in the Internal Trusted Storage */
David Hu6d1a9b62023-02-22 16:54:04 +0800186#ifndef ITS_MAX_ASSET_SIZE
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800187#define ITS_MAX_ASSET_SIZE 512
David Hu6d1a9b62023-02-22 16:54:04 +0800188#endif
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800189
190/*
191 * Size of the ITS internal data transfer buffer
192 * (Default to the max asset size so that all requests can be handled in one iteration.)
193 */
David Hu6d1a9b62023-02-22 16:54:04 +0800194#ifndef ITS_BUF_SIZE
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800195#define ITS_BUF_SIZE ITS_MAX_ASSET_SIZE
David Hu6d1a9b62023-02-22 16:54:04 +0800196#endif
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800197
198/* The maximum number of assets to be stored in the Internal Trusted Storage */
David Hu6d1a9b62023-02-22 16:54:04 +0800199#ifndef ITS_NUM_ASSETS
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800200#define ITS_NUM_ASSETS 10
David Hu6d1a9b62023-02-22 16:54:04 +0800201#endif
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800202
203/* The stack size of the Internal Trusted Storage Secure Partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800204#ifndef ITS_STACK_SIZE
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800205#define ITS_STACK_SIZE 0x720
David Hu6d1a9b62023-02-22 16:54:04 +0800206#endif
Xinyu Zhangc8fc2c02022-10-31 12:13:45 +0800207
Markus Swarowsky7de096f2023-03-16 10:32:02 +0100208/* The size of the authentication tag used when authentication/encryption of ITS files is enabled */
209#ifndef TFM_ITS_AUTH_TAG_LENGTH
210#define TFM_ITS_AUTH_TAG_LENGTH 16
211#endif
212
Gabor Tothdd6c4052024-09-13 14:06:19 +0200213/* The size of the key used when authentication/encryption of ITS files is enabled */
214#ifndef TFM_ITS_KEY_LENGTH
215#define TFM_ITS_KEY_LENGTH 16
216#endif
217
Markus Swarowsky7de096f2023-03-16 10:32:02 +0100218/* The size of the nonce used when ITS file encryption is enabled */
219#ifndef TFM_ITS_ENC_NONCE_LENGTH
220#define TFM_ITS_ENC_NONCE_LENGTH 12
221#endif
222
Xinyu Zhang07152702022-10-31 12:35:49 +0800223/* PS Partition Configs */
224
225/* Create flash FS if it doesn't exist for Protected Storage partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800226#ifndef PS_CREATE_FLASH_LAYOUT
Xinyu Zhang07152702022-10-31 12:35:49 +0800227#define PS_CREATE_FLASH_LAYOUT 1
David Hu6d1a9b62023-02-22 16:54:04 +0800228#endif
Xinyu Zhang07152702022-10-31 12:35:49 +0800229
230/* Enable emulated RAM FS for platforms that don't have flash for Protected Storage partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800231#ifndef PS_RAM_FS
Xinyu Zhang07152702022-10-31 12:35:49 +0800232#define PS_RAM_FS 0
David Hu6d1a9b62023-02-22 16:54:04 +0800233#endif
Xinyu Zhang07152702022-10-31 12:35:49 +0800234
235/* Enable rollback protection for Protected Storage partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800236#ifndef PS_ROLLBACK_PROTECTION
Xinyu Zhang07152702022-10-31 12:35:49 +0800237#define PS_ROLLBACK_PROTECTION 1
David Hu6d1a9b62023-02-22 16:54:04 +0800238#endif
Xinyu Zhang07152702022-10-31 12:35:49 +0800239
240/* Validate filesystem metadata every time it is read from flash */
David Hu6d1a9b62023-02-22 16:54:04 +0800241#ifndef PS_VALIDATE_METADATA_FROM_FLASH
Xinyu Zhang07152702022-10-31 12:35:49 +0800242#define PS_VALIDATE_METADATA_FROM_FLASH 1
David Hu6d1a9b62023-02-22 16:54:04 +0800243#endif
Xinyu Zhang07152702022-10-31 12:35:49 +0800244
245/* The maximum asset size to be stored in the Protected Storage */
David Hu6d1a9b62023-02-22 16:54:04 +0800246#ifndef PS_MAX_ASSET_SIZE
Xinyu Zhang07152702022-10-31 12:35:49 +0800247#define PS_MAX_ASSET_SIZE 2048
David Hu6d1a9b62023-02-22 16:54:04 +0800248#endif
Xinyu Zhang07152702022-10-31 12:35:49 +0800249
250/* The maximum number of assets to be stored in the Protected Storage */
David Hu6d1a9b62023-02-22 16:54:04 +0800251#ifndef PS_NUM_ASSETS
Xinyu Zhang07152702022-10-31 12:35:49 +0800252#define PS_NUM_ASSETS 10
David Hu6d1a9b62023-02-22 16:54:04 +0800253#endif
Xinyu Zhang07152702022-10-31 12:35:49 +0800254
255/* The stack size of the Protected Storage Secure Partition */
David Hu6d1a9b62023-02-22 16:54:04 +0800256#ifndef PS_STACK_SIZE
Xinyu Zhang07152702022-10-31 12:35:49 +0800257#define PS_STACK_SIZE 0x700
David Hu6d1a9b62023-02-22 16:54:04 +0800258#endif
Xinyu Zhang07152702022-10-31 12:35:49 +0800259
Chris Brand72ee4c62024-01-08 16:56:55 -0800260/* NS Agent Mailbox Partition Configs */
261
Sherry Zhang415d7132023-08-09 16:26:56 +0800262/* The stack size of the NS Agent Mailbox Secure Partition */
263#ifndef NS_AGENT_MAILBOX_STACK_SIZE
264#define NS_AGENT_MAILBOX_STACK_SIZE 0x800
265#endif
266
Chris Brandda938d82024-08-01 12:42:10 -0700267/* Whether the mailbox itself is in memory that is uncached in the SPE */
268#ifndef MAILBOX_IS_UNCACHED_S
269#define MAILBOX_IS_UNCACHED_S 1
270#endif
271
272/* Whether the mailbox itself is in memory that is uncached in the NSPE */
273#ifndef MAILBOX_IS_UNCACHED_NS
274#define MAILBOX_IS_UNCACHED_NS 1
275#endif
276
David Hue2cda482025-03-19 08:21:21 +0000277/*
278 * Whether the client ID translation can accept NS client ID == 0.
279 * NS client ID from NSPE is calculated as an offset of the client ID range in
280 * NS Agent mailbox client ID translation.
281 * Select this option to allow platforms to accept NS client ID == 0 as a valid
282 * offset.
283 */
284#ifndef MAILBOX_SUPPORT_NS_CLIENT_ID_ZERO
285#define MAILBOX_SUPPORT_NS_CLIENT_ID_ZERO 0
286#endif
287
Jackson Cooper-Driver92f631c2024-10-08 13:46:42 +0000288/* Secure Test Partition Configs */
289#ifdef TFM_PARTITION_DPE
290/* DPE tests require larger test partition stack */
291#define SECURE_TEST_PARTITION_STACK_SIZE 0x3000
292#else
David Vincze37faec62025-01-20 18:07:12 +0000293#define SECURE_TEST_PARTITION_STACK_SIZE 0x0F00
Jackson Cooper-Driver92f631c2024-10-08 13:46:42 +0000294#endif
295
Chris Brand72ee4c62024-01-08 16:56:55 -0800296/* SPM Configs */
Xinyu Zhangcdbe3622022-10-31 14:34:25 +0800297
Xinyu Zhang9a6d90a2023-03-22 17:32:27 +0800298#ifdef CONFIG_TFM_CONNECTION_POOL_ENABLE
Xinyu Zhangcdbe3622022-10-31 14:34:25 +0800299/* The maximal number of secure services that are connected or requested at the same time */
David Hu6d1a9b62023-02-22 16:54:04 +0800300#ifndef CONFIG_TFM_CONN_HANDLE_MAX_NUM
Chris Brand80326b72023-03-15 13:07:49 -0700301#define CONFIG_TFM_CONN_HANDLE_MAX_NUM 8
David Hu6d1a9b62023-02-22 16:54:04 +0800302#endif
Xinyu Zhang9a6d90a2023-03-22 17:32:27 +0800303#endif
Xinyu Zhangcdbe3622022-10-31 14:34:25 +0800304
Xinyu Zhang44dbfa62022-11-23 14:22:32 +0800305/* Disable the doorbell APIs */
David Hu6d1a9b62023-02-22 16:54:04 +0800306#ifndef CONFIG_TFM_DOORBELL_API
Chris Brand80326b72023-03-15 13:07:49 -0700307#define CONFIG_TFM_DOORBELL_API 0
308#endif
309
Nicola Mazzucatob369b332025-01-02 09:11:57 +0000310/*
311 * Scheduling type for Hybrid Platforms (Currently in Experimental Stage)
312 * Options can be found in spm/include/tfm_hybrid_platform.h
313 */
314#ifndef CONFIG_TFM_HYBRID_PLAT_SCHED_TYPE
315#define CONFIG_TFM_HYBRID_PLAT_SCHED_TYPE TFM_HYBRID_PLAT_SCHED_OFF
316#else
317
318#if (CONFIG_TFM_HYBRID_PLAT_SCHED_TYPE == TFM_HYBRID_PLAT_SCHED_OFF)
319 /* default, nothing to do, no overrides */
320#endif
321
322#if (CONFIG_TFM_HYBRID_PLAT_SCHED_TYPE == TFM_HYBRID_PLAT_SCHED_SPE)
323 #ifndef CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED
324 #define CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED 1
325 #define CONFIG_TFM_SPM_BACKEND_IPC 1
326 #endif
327#endif
328#if (CONFIG_TFM_HYBRID_PLAT_SCHED_TYPE == TFM_HYBRID_PLAT_SCHED_NSPE)
329 #ifndef CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED
330 #define CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED 0
331 #define CONFIG_TFM_SPM_BACKEND_IPC 1
332 #endif
333#endif
334
335#endif
336
Chris Brand80326b72023-03-15 13:07:49 -0700337/* Do not run the scheduler after handling a secure interrupt if the NSPE was pre-empted */
338#ifndef CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED
339#define CONFIG_TFM_SCHEDULE_WHEN_NS_INTERRUPTED 0
David Hu6d1a9b62023-02-22 16:54:04 +0800340#endif
Xinyu Zhangcdbe3622022-10-31 14:34:25 +0800341
Sherry Zhangf2a4f912023-09-12 15:38:12 +0800342/* Mask Non-Secure interrupts when executing in secure state. */
343#ifndef CONFIG_TFM_SECURE_THREAD_MASK_NS_INTERRUPT
344#define CONFIG_TFM_SECURE_THREAD_MASK_NS_INTERRUPT 0
345#endif
346
Roman Mazurak96585b82024-04-03 14:35:00 +0300347/*
348 * tfm_hal_post_partition_init_hook is called if this option is enabled.
349 * It's called by SPM right before starting scheduler.
350 */
351#ifndef CONFIG_TFM_POST_PARTITION_INIT_HOOK
352#define CONFIG_TFM_POST_PARTITION_INIT_HOOK 0
353#endif
354
Andrej Butok302da632023-07-14 12:57:08 +0200355/* Enable OTP/NV_COUNTERS emulation in RAM */
356#ifndef OTP_NV_COUNTERS_RAM_EMULATION
357#define OTP_NV_COUNTERS_RAM_EMULATION 0
358#endif
359
Aziz IDOMAR82772882024-04-09 14:19:52 +0100360/* Error Codes Configs */
361
362/* Enable unique error codes */
363#ifndef TFM_UNIQUE_ERROR_CODES
364#define TFM_UNIQUE_ERROR_CODES 0
365#endif
366
Xinyu Zhanga2fab0e2022-10-24 15:37:46 +0800367#endif /* __CONFIG_BASE_H__ */