Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 1 | /* |
Mate Toth-Pal | 7de74b5 | 2018-02-23 15:46:47 +0100 | [diff] [blame] | 2 | * Copyright (c) 2017-2018, Arm Limited. All rights reserved. |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __TFM_API_H__ |
| 9 | #define __TFM_API_H__ |
| 10 | |
| 11 | #ifdef __cplusplus |
| 12 | extern "C" { |
| 13 | #endif |
| 14 | |
Mate Toth-Pal | ce61afa | 2018-08-03 13:51:01 +0200 | [diff] [blame] | 15 | #include <stdint.h> |
| 16 | |
Mate Toth-Pal | 261df46 | 2018-08-07 12:02:42 +0200 | [diff] [blame] | 17 | #define TFM_INVALID_CLIENT_ID 0 |
| 18 | |
| 19 | /** |
| 20 | * \brief Checks if the provided client ID is a secure client ID. |
| 21 | * |
| 22 | * \param[in] client_id Client ID to check |
| 23 | * |
| 24 | * \return Returns 1 if the client Id is secure. Otherwise, returns 0. |
| 25 | */ |
| 26 | #define TFM_CLIENT_ID_IS_S(client_id) ((client_id)>0) |
| 27 | |
| 28 | /** |
| 29 | * \brief Checks if the provided client ID is a non-secure client ID. |
| 30 | * |
| 31 | * \param[in] client_id Client ID to check |
| 32 | * |
| 33 | * \return Returns 1 if the client Id is non-secure. Otherwise, returns 0. |
| 34 | */ |
| 35 | #define TFM_CLIENT_ID_IS_NS(client_id) ((client_id)<0) |
| 36 | |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 37 | /* FixMe: sort out DEBUG compile option and limit return value options |
| 38 | * on external interfaces */ |
| 39 | /* Note: |
| 40 | * TFM will only return values recognized and parsed by TFM core. |
| 41 | * Service return codes are not automatically passed on to REE. |
| 42 | * Any non-zero return value is interpreted as an error that may trigger |
| 43 | * TEE error handling flow. |
| 44 | */ |
| 45 | enum tfm_status_e |
| 46 | { |
| 47 | TFM_SUCCESS = 0, |
Mate Toth-Pal | 7de74b5 | 2018-02-23 15:46:47 +0100 | [diff] [blame] | 48 | TFM_PARTITION_BUSY, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 49 | TFM_ERROR_SECURE_DOMAIN_LOCKED, |
| 50 | TFM_ERROR_INVALID_PARAMETER, |
Mate Toth-Pal | 7de74b5 | 2018-02-23 15:46:47 +0100 | [diff] [blame] | 51 | TFM_ERROR_PARTITION_NON_REENTRANT, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 52 | TFM_ERROR_NS_THREAD_MODE_CALL, |
Miklos Balint | 1fdb12f | 2018-09-11 11:30:30 +0200 | [diff] [blame] | 53 | TFM_ERROR_NOT_INITIALIZED, |
| 54 | TFM_ERROR_NO_ACTIVE_PARTITION, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 55 | TFM_ERROR_INVALID_EXC_MODE, |
| 56 | TFM_SECURE_LOCK_FAILED, |
| 57 | TFM_SECURE_UNLOCK_FAILED, |
| 58 | TFM_ERROR_GENERIC = 0x1F, |
Mate Toth-Pal | 7de74b5 | 2018-02-23 15:46:47 +0100 | [diff] [blame] | 59 | TFM_PARTITION_SPECIFIC_ERROR_MIN, |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 60 | }; |
| 61 | |
| 62 | //==================== Secure function declarations ==========================// |
| 63 | |
Mate Toth-Pal | ce61afa | 2018-08-03 13:51:01 +0200 | [diff] [blame] | 64 | /** |
| 65 | * \brief Assign client ID to the current TZ context |
| 66 | * |
| 67 | * \param[in] ns_client_id The client ID to be assigned to the current |
| 68 | * context |
| 69 | * \return TFM_SUCCESS if the client ID assigned successfully, an error code |
| 70 | * according to \ref tfm_status_e in case of error. |
| 71 | * |
| 72 | * \note This function have to be called from handler mode. |
| 73 | */ |
| 74 | enum tfm_status_e tfm_register_client_id (int32_t ns_client_id); |
Ashutosh Singh | f4d8867 | 2017-11-29 13:35:43 +0000 | [diff] [blame] | 75 | |
| 76 | //================ End Secure function declarations ==========================// |
| 77 | |
| 78 | #ifdef __cplusplus |
| 79 | } |
| 80 | #endif |
| 81 | |
| 82 | #endif /* __TFM_API_H__ */ |