Platform: IOCTL for platform-specific services
Introduce new API function in HAL and a new generic platform
service to provide the means for platforms to implement proprietary
functions using a uniform framework and a single secure entry point.
Change-Id: I72ddbb3342ae851fe9851ccb27a54c8f4322b01f
Signed-off-by: Miklos Balint <miklos.balint@arm.com>
diff --git a/interface/include/tfm_platform_api.h b/interface/include/tfm_platform_api.h
index 7cc57ab..9c4e023 100644
--- a/interface/include/tfm_platform_api.h
+++ b/interface/include/tfm_platform_api.h
@@ -10,6 +10,7 @@
#include <limits.h>
#include <stdbool.h>
+#include <stdint.h>
#include "tfm_api.h"
#ifdef __cplusplus
@@ -20,7 +21,7 @@
* \brief TFM secure partition platform API version
*/
#define TFM_PLATFORM_API_VERSION_MAJOR (0)
-#define TFM_PLATFORM_API_VERSION_MINOR (2)
+#define TFM_PLATFORM_API_VERSION_MINOR (3)
/* The return value is shared with the TF-M partition status value.
* The Platform return codes shouldn't overlap with predefined TFM status
@@ -38,11 +39,14 @@
TFM_PLATFORM_ERR_SUCCESS = 0,
TFM_PLATFORM_ERR_SYSTEM_ERROR = TFM_PLATFORM_ERR_OFFSET,
TFM_PLATFORM_ERR_INVALID_PARAM,
+ TFM_PLATFORM_ERR_NOT_SUPPORTED,
/* Following entry is only to ensure the error code of int size */
TFM_PLATFORM_ERR_FORCE_INT_SIZE = INT_MAX
};
+typedef int32_t tfm_platform_ioctl_req_t;
+
/*!
* \brief Resets the system.
*
@@ -51,47 +55,18 @@
enum tfm_platform_err_t tfm_platform_system_reset(void);
/*!
- * \brief Sets pin alternate function for the given pins
+ * \brief Performs a platform-specific service
*
- * \param[in] alt_func Alternate function to set (allowed values vary
+ * \param[in] request Request identifier (valid values vary
* based on the platform)
- * \param[in] pin_mask Pin mask of the selected pins
- * \param[out] result Return error value
+ * \param[in] input Input buffer to the requested service (or NULL)
+ * \param[in,out] output Output buffer to the requested service (or NULL)
*
* \return Returns values as specified by the \ref tfm_platform_err_t
*/
-enum tfm_platform_err_t
-tfm_platform_set_pin_alt_func(uint32_t alt_func, uint64_t pin_mask,
- uint32_t *result);
-
-/*!
- * \brief Sets default in value to use when the alternate function is not
- * selected for the pin
- *
- * \param[in] alt_func Alternate function to use (allowed values vary
- * based on the platform)
- * \param[in] pin_value Pin value to use
- * \param[in] default_in_value Default in value to set
- * \param[out] result Return error value
- *
- * \return Returns values as specified by the \ref tfm_platform_err_t
- */
-enum tfm_platform_err_t
-tfm_platform_set_pin_default_in(uint32_t alt_func, uint32_t pin_value,
- bool default_in_value, uint32_t *result);
-
-/*!
- * \brief Sets pin mode for the selected pins
- *
- * \param[in] pin_mask Pin mask of the selected pins
- * \param[in] pin_mode Pin mode to set for the selected pins
- * \param[out] result Return error value
- *
- * \return Returns values as specified by the \ref tfm_platform_err_t
- */
-enum tfm_platform_err_t
-tfm_platform_set_pin_mode(uint64_t pin_mask, uint32_t pin_mode,
- uint32_t *result);
+enum tfm_platform_err_t tfm_platform_ioctl(tfm_platform_ioctl_req_t request,
+ psa_invec *input,
+ psa_outvec *output);
#ifdef __cplusplus