1 /* 2 * Copyright (c) 2017-2022, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef __TFM_PLAT_DEFS_H__ 9 #define __TFM_PLAT_DEFS_H__ 10 /** 11 * \note The interfaces defined in this file must be implemented for each 12 * target. 13 */ 14 15 #include <stdint.h> 16 #include <limits.h> 17 18 enum tfm_plat_err_t { 19 TFM_PLAT_ERR_SUCCESS = 0, 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, 24 TFM_PLAT_ERR_NOT_PERMITTED = 0xC5A3, 25 /* Following entry is only to ensure the error code of int size */ 26 TFM_PLAT_ERR_FORCE_INT_SIZE = INT_MAX 27 }; 28 29 #if defined(TFM_ISOLATION_LEVEL) && (TFM_ISOLATION_LEVEL != 1) 30 31 /*! 32 * \def TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME) 33 * 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 36 * at linker time. 37 * 38 * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest 39 * file "name" field. 40 * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest 41 * file "type" field. 42 */ 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"))) 46 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 51 * section of a specific secure partition at linker time. 52 * 53 * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest 54 * file "name" field. 55 * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest 56 * file "type" field. 57 */ 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"))) 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 66 * section of a specific secure partition at linker time. 67 * 68 * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest 69 * file "name" field. 70 * \param[in] TFM_PARTITION_TYPE TF-M partition type assigned in the manifest 71 * file "type" field. 72 */ 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"))) 76 #else 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) 80 #endif 81 #endif /* __TFM_PLAT_DEFS_H__ */ 82