blob: 9c4e023f0e6d2eebec53dfa5a780b8dcda01be11 [file] [log] [blame]
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +01001/*
Tamas Kaman262dc7b2019-03-20 13:37:12 +01002 * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#ifndef __TFM_PLATFORM_API__
9#define __TFM_PLATFORM_API__
10
11#include <limits.h>
Tamas Kaman262dc7b2019-03-20 13:37:12 +010012#include <stdbool.h>
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020013#include <stdint.h>
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010014#include "tfm_api.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20/**
21 * \brief TFM secure partition platform API version
22 */
23#define TFM_PLATFORM_API_VERSION_MAJOR (0)
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020024#define TFM_PLATFORM_API_VERSION_MINOR (3)
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010025
26/* The return value is shared with the TF-M partition status value.
27 * The Platform return codes shouldn't overlap with predefined TFM status
28 * values.
29 */
30#define TFM_PLATFORM_ERR_OFFSET (TFM_PARTITION_SPECIFIC_ERROR_MIN)
31
32/*!
33 * \enum tfm_platform_err_t
34 *
35 * \brief Platform service error types
36 *
37 */
38enum tfm_platform_err_t {
39 TFM_PLATFORM_ERR_SUCCESS = 0,
40 TFM_PLATFORM_ERR_SYSTEM_ERROR = TFM_PLATFORM_ERR_OFFSET,
Tamas Kaman262dc7b2019-03-20 13:37:12 +010041 TFM_PLATFORM_ERR_INVALID_PARAM,
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020042 TFM_PLATFORM_ERR_NOT_SUPPORTED,
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010043
44 /* Following entry is only to ensure the error code of int size */
45 TFM_PLATFORM_ERR_FORCE_INT_SIZE = INT_MAX
46};
47
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020048typedef int32_t tfm_platform_ioctl_req_t;
49
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010050/*!
51 * \brief Resets the system.
52 *
53 * \return Returns values as specified by the \ref tfm_platform_err_t
54 */
55enum tfm_platform_err_t tfm_platform_system_reset(void);
56
Tamas Kaman262dc7b2019-03-20 13:37:12 +010057/*!
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020058 * \brief Performs a platform-specific service
Tamas Kaman262dc7b2019-03-20 13:37:12 +010059 *
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020060 * \param[in] request Request identifier (valid values vary
Tamas Kaman262dc7b2019-03-20 13:37:12 +010061 * based on the platform)
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020062 * \param[in] input Input buffer to the requested service (or NULL)
63 * \param[in,out] output Output buffer to the requested service (or NULL)
Tamas Kaman262dc7b2019-03-20 13:37:12 +010064 *
65 * \return Returns values as specified by the \ref tfm_platform_err_t
66 */
Miklos Balintc7b1b6c2019-04-24 12:38:36 +020067enum tfm_platform_err_t tfm_platform_ioctl(tfm_platform_ioctl_req_t request,
68 psa_invec *input,
69 psa_outvec *output);
Tamas Kaman262dc7b2019-03-20 13:37:12 +010070
71
Marc Moreno Berengue8e0fa7a2018-10-04 18:25:13 +010072#ifdef __cplusplus
73}
74#endif
75
76#endif /* __TFM_PLATFORM_API__ */