blob: 2a90d9454f326c8374863d4172663c0fb54f8f04 [file] [log] [blame]
Marc Moreno Berengue20dab392017-11-29 13:18:58 +00001/*
Edison Aibb614aa2018-11-21 15:15:00 +08002 * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
Marc Moreno Berengue20dab392017-11-29 13:18:58 +00003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
Marc Moreno Berengueef202722018-08-10 13:43:43 +01008#ifndef __TFM_PLAT_DEFS_H__
9#define __TFM_PLAT_DEFS_H__
Marc Moreno Berengue20dab392017-11-29 13:18:58 +000010/**
11 * \note The interfaces defined in this file must be implemented for each
12 * target.
13 */
Marc Moreno Berengue20dab392017-11-29 13:18:58 +000014
15#include <stdint.h>
16#include <limits.h>
17
Marc Moreno Berengue9926df82018-08-10 13:45:52 +010018enum tfm_plat_err_t {
19 TFM_PLAT_ERR_SUCCESS = 0,
20 TFM_PLAT_ERR_SYSTEM_ERR,
Marc Moreno Berengue4cc81fc2018-08-10 14:32:01 +010021 TFM_PLAT_ERR_MAX_VALUE,
David Vincze2ff8c6a2019-05-21 11:53:00 +020022 TFM_PLAT_ERR_INVALID_INPUT,
23 TFM_PLAT_ERR_UNSUPPORTED,
Marc Moreno Berengue20dab392017-11-29 13:18:58 +000024 /* Following entry is only to ensure the error code of int size */
Marc Moreno Berengue9926df82018-08-10 13:45:52 +010025 TFM_PLAT_ERR_FORCE_INT_SIZE = INT_MAX
Marc Moreno Berengue20dab392017-11-29 13:18:58 +000026};
27
Mate Toth-Pal9aae21d2019-02-11 15:39:30 +010028#if defined(TFM_LVL) && (TFM_LVL != 1)
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010029/*!
Mate Toth-Pal9aae21d2019-02-11 15:39:30 +010030 * \def TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010031 *
Mate Toth-Pal9aae21d2019-02-11 15:39:30 +010032 * \brief This macro provides a mechanism to place a function code or a data
33 * variable in the code section (e.g. RO) of a specific secure partition
34 * at linker time in TF-M Level 3.
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010035 *
36 * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest
Edison Aibb614aa2018-11-21 15:15:00 +080037 * file "name" field.
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010038 */
Mate Toth-Pal9aae21d2019-02-11 15:39:30 +010039#define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010040 __attribute__((section(TFM_PARTITION_NAME"_ATTR_FN")))
41
Mate Toth-Pal9aae21d2019-02-11 15:39:30 +010042/*!
43 * \def TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
44 *
45 * \brief This macro provides a mechanism to place data variables in the RW data
46 * section of a specific secure partition at linker time in TF-M Level 3.
47 *
48 * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest
49 * file "name" field.
50 */
51#define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \
52 __attribute__((section(TFM_PARTITION_NAME"_ATTR_RW")))
53
54/*!
55 * \def TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
56 *
57 * \brief This macro provides a mechanism to place data variables in the ZI data
58 * section of a specific secure partition at linker time in TF-M Level 3.
59 *
60 * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest
61 * file "name" field.
62 */
63#define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \
64 __attribute__((section(TFM_PARTITION_NAME"_ATTR_ZI")))
65#else
66#define TFM_LINK_SET_RO_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
67#define TFM_LINK_SET_RW_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
68#define TFM_LINK_SET_ZI_IN_PARTITION_SECTION(TFM_PARTITION_NAME)
69#endif
Marc Moreno Berengueef202722018-08-10 13:43:43 +010070#endif /* __TFM_PLAT_DEFS_H__ */