Mingyang Sun | eab7eae | 2021-09-30 13:06:52 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | {{utilities.donotedit_warning}} |
| 9 | |
| 10 | #ifndef __CONFIG_IMPL_H__ |
| 11 | #define __CONFIG_IMPL_H__ |
| 12 | |
| 13 | {% if ipc_partition_num > 0 and sfn_partition_num == 0 %} |
Ken Liu | 82e3eac | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 14 | #define {{"%-56s"|format("CONFIG_TFM_SPM_BACKEND_IPC")}} 1 |
Ken Liu | e07c3b7 | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 15 | |
| 16 | #if TFM_LVL > 1 |
Ken Liu | 82e3eac | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 17 | #define {{"%-56s"|format("CONFIG_TFM_PSA_API_SUPERVISOR_CALL")}} 1 |
Ken Liu | e07c3b7 | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 18 | #else |
| 19 | #define {{"%-56s"|format("CONFIG_TFM_PSA_API_THREAD_CALL")}} 1 |
| 20 | #define {{"%-56s"|format("CONFIG_TFM_SPM_THREAD_STACK_SIZE")}} 1024 |
| 21 | #endif |
Ken Liu | 82e3eac | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 22 | |
Mingyang Sun | eab7eae | 2021-09-30 13:06:52 +0800 | [diff] [blame] | 23 | {% elif sfn_partition_num > 0 and ipc_partition_num == 0 %} |
Ken Liu | e07c3b7 | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 24 | #define {{"%-56s"|format("CONFIG_TFM_SPM_BACKEND_SFN")}} 1 |
Mingyang Sun | eab7eae | 2021-09-30 13:06:52 +0800 | [diff] [blame] | 25 | |
| 26 | #if TFM_LVL > 1 |
| 27 | #error "High isolation level SFN model is not supported." |
| 28 | #endif |
| 29 | |
Mingyang Sun | c9a96c0 | 2021-10-14 10:32:05 +0800 | [diff] [blame^] | 30 | {% set total_stk = namespace(size=0) %} |
| 31 | {% for partition in partitions %} |
| 32 | {% if "0x" in partition.manifest.stack_size or "0X" in partition.manifest.stack_size %} |
| 33 | {% set total_stk.size = total_stk.size + partition.manifest.stack_size|int(base=16) %} |
| 34 | {% else %} |
| 35 | {% set total_stk.size = total_stk.size + partition.manifest.stack_size|int(base=10) %} |
| 36 | {% endif %} |
| 37 | {% endfor %} |
| 38 | #define {{"%-36s"|format("SUM_OF_PARTITION_STACK_SIZES")}} ((({{"0x%x"|format(total_stk.size)}} >> 1) + 0x7) & (~0x7)) |
| 39 | |
Mingyang Sun | eab7eae | 2021-09-30 13:06:52 +0800 | [diff] [blame] | 40 | {% elif sfn_partition_num > 0 and ipc_partition_num > 0 %} |
| 41 | #error "IPC and SFN co-work not supported yet." |
| 42 | {% else %} |
Ken Liu | 82e3eac | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 43 | #error "Invalid partition number input, check configurations." |
Mingyang Sun | eab7eae | 2021-09-30 13:06:52 +0800 | [diff] [blame] | 44 | {% endif %} |
Ken Liu | 82e3eac | 2021-10-14 16:19:13 +0800 | [diff] [blame] | 45 | #include "psa_interface_redirect.h" |
Mingyang Sun | eab7eae | 2021-09-30 13:06:52 +0800 | [diff] [blame] | 46 | |
| 47 | #endif /* __CONFIG_IMPL_H__ */ |