Marc Moreno Berengue | 20dab39 | 2017-11-29 13:18:58 +0000 | [diff] [blame] | 1 | /* |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2022, Arm Limited. All rights reserved. |
Marc Moreno Berengue | 20dab39 | 2017-11-29 13:18:58 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
Marc Moreno Berengue | ef20272 | 2018-08-10 13:43:43 +0100 | [diff] [blame] | 8 | #ifndef __TFM_PLAT_DEFS_H__ |
| 9 | #define __TFM_PLAT_DEFS_H__ |
Marc Moreno Berengue | 20dab39 | 2017-11-29 13:18:58 +0000 | [diff] [blame] | 10 | /** |
| 11 | * \note The interfaces defined in this file must be implemented for each |
| 12 | * target. |
| 13 | */ |
Marc Moreno Berengue | 20dab39 | 2017-11-29 13:18:58 +0000 | [diff] [blame] | 14 | |
| 15 | #include <stdint.h> |
| 16 | #include <limits.h> |
| 17 | |
Marc Moreno Berengue | 9926df8 | 2018-08-10 13:45:52 +0100 | [diff] [blame] | 18 | enum tfm_plat_err_t { |
| 19 | TFM_PLAT_ERR_SUCCESS = 0, |
Tamas Ban | d28286e | 2020-11-27 12:58:39 +0000 | [diff] [blame] | 20 | TFM_PLAT_ERR_SYSTEM_ERR = 0x3A5C, |
| 21 | TFM_PLAT_ERR_MAX_VALUE = 0x55A3, |
| 22 | TFM_PLAT_ERR_INVALID_INPUT = 0xA3C5, |
| 23 | TFM_PLAT_ERR_UNSUPPORTED = 0xC35A, |
Raef Coles | 79809c7 | 2022-03-02 13:48:20 +0000 | [diff] [blame] | 24 | TFM_PLAT_ERR_NOT_PERMITTED = 0xC5A3, |
Marc Moreno Berengue | 20dab39 | 2017-11-29 13:18:58 +0000 | [diff] [blame] | 25 | /* Following entry is only to ensure the error code of int size */ |
Marc Moreno Berengue | 9926df8 | 2018-08-10 13:45:52 +0100 | [diff] [blame] | 26 | TFM_PLAT_ERR_FORCE_INT_SIZE = INT_MAX |
Marc Moreno Berengue | 20dab39 | 2017-11-29 13:18:58 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
Xinyu Zhang | ae99e2d | 2023-07-28 14:03:29 +0800 | [diff] [blame^] | 29 | #if defined(TFM_ISOLATION_LEVEL) && (TFM_ISOLATION_LEVEL != 1) |
Edison Ai | 14dd137 | 2019-07-11 18:02:18 +0800 | [diff] [blame] | 30 | |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 31 | /*! |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 32 | * \def TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME) |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 33 | * |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 34 | * \brief This macro provides a mechanism to place a function code or a data |
| 35 | * variable in the code section (e.g. RO) of a specific secure partition |
Edison Ai | 14dd137 | 2019-07-11 18:02:18 +0800 | [diff] [blame] | 36 | * at linker time. |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 37 | * |
| 38 | * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest |
Edison Ai | bb614aa | 2018-11-21 15:15:00 +0800 | [diff] [blame] | 39 | * file "name" field. |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 40 | * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest |
| 41 | * file "type" field. |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 42 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 43 | #define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME, \ |
| 44 | TFM_PARTITION_TYPE) \ |
| 45 | __attribute__((section(TFM_PARTITION_NAME "_" TFM_PARTITION_TYPE "_ATTR_FN"))) |
Marc Moreno Berengue | 8e0fa7a | 2018-10-04 18:25:13 +0100 | [diff] [blame] | 46 | |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 47 | /*! |
| 48 | * \def TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME) |
| 49 | * |
| 50 | * \brief This macro provides a mechanism to place data variables in the RW data |
Edison Ai | 14dd137 | 2019-07-11 18:02:18 +0800 | [diff] [blame] | 51 | * section of a specific secure partition at linker time. |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 52 | * |
| 53 | * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest |
| 54 | * file "name" field. |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 55 | * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest |
| 56 | * file "type" field. |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 57 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 58 | #define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME, \ |
| 59 | TFM_PARTITION_TYPE) \ |
| 60 | __attribute__((section(TFM_PARTITION_NAME "_" TFM_PARTITION_TYPE "_ATTR_RW"))) |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 61 | |
| 62 | /*! |
| 63 | * \def TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME) |
| 64 | * |
| 65 | * \brief This macro provides a mechanism to place data variables in the ZI data |
Edison Ai | 14dd137 | 2019-07-11 18:02:18 +0800 | [diff] [blame] | 66 | * section of a specific secure partition at linker time. |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 67 | * |
| 68 | * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest |
| 69 | * file "name" field. |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 70 | * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest |
| 71 | * file "type" field. |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 72 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 73 | #define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME, \ |
| 74 | TFM_PARTITION_TYPE) \ |
| 75 | __attribute__((section(TFM_PARTITION_NAME "_" TFM_PARTITION_TYPE "_ATTR_ZI"))) |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 76 | #else |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 77 | #define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME, TFM_PARTITION_TYPE) |
| 78 | #define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME, TFM_PARTITION_TYPE) |
| 79 | #define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME, TFM_PARTITION_TYPE) |
Mate Toth-Pal | 9aae21d | 2019-02-11 15:39:30 +0100 | [diff] [blame] | 80 | #endif |
Marc Moreno Berengue | ef20272 | 2018-08-10 13:43:43 +0100 | [diff] [blame] | 81 | #endif /* __TFM_PLAT_DEFS_H__ */ |