From 8fefa25a84c409042bd2fbdf9738cbefdc75a0ab Mon Sep 17 00:00:00 2001 From: Michael Schwarcz Date: Thu, 28 Feb 2019 12:02:07 +0200 Subject: [PATCH] TF-M: Remove not-used platform headers --- .../platform/ext/driver/Driver_Common.h | 69 -------- .../platform/ext/driver/Driver_MPC.h | 153 ------------------ .../platform/ext/driver/Driver_PPC.h | 116 ------------- .../platform/include/tfm_plat_boot_seed.h | 56 ------- .../platform/include/tfm_plat_defs.h | 38 ----- .../platform/include/tfm_plat_device_id.h | 52 ------ 6 files changed, 484 deletions(-) delete mode 100644 components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_Common.h delete mode 100644 components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_MPC.h delete mode 100644 components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_PPC.h delete mode 100644 components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_boot_seed.h delete mode 100644 components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_defs.h delete mode 100644 components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_device_id.h diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_Common.h b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_Common.h deleted file mode 100644 index cdf44b3325..0000000000 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_Common.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2013-2016 ARM Limited. All rights reserved. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the License); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * $Date: 2. Jan 2014 - * $Revision: V2.00 - * - * Project: Common Driver definitions - */ - -/* History: - * Version 2.00 - * Changed prefix ARM_DRV -> ARM_DRIVER - * Added General return codes definitions - * Version 1.10 - * Namespace prefix ARM_ added - * Version 1.00 - * Initial release - */ - -#ifndef __DRIVER_COMMON_H -#define __DRIVER_COMMON_H - -#include -#include -#include - -#define ARM_DRIVER_VERSION_MAJOR_MINOR(major,minor) (((major) << 8) | (minor)) - -/** -\brief Driver Version -*/ -typedef struct _ARM_DRIVER_VERSION { - uint16_t api; ///< API version - uint16_t drv; ///< Driver version -} ARM_DRIVER_VERSION; - -/* General return codes */ -#define ARM_DRIVER_OK 0 ///< Operation succeeded -#define ARM_DRIVER_ERROR -1 ///< Unspecified error -#define ARM_DRIVER_ERROR_BUSY -2 ///< Driver is busy -#define ARM_DRIVER_ERROR_TIMEOUT -3 ///< Timeout occurred -#define ARM_DRIVER_ERROR_UNSUPPORTED -4 ///< Operation not supported -#define ARM_DRIVER_ERROR_PARAMETER -5 ///< Parameter error -#define ARM_DRIVER_ERROR_SPECIFIC -6 ///< Start of driver specific errors - -/** -\brief General power states -*/ -typedef enum _ARM_POWER_STATE { - ARM_POWER_OFF, ///< Power off: no operation possible - ARM_POWER_LOW, ///< Low Power mode: retain state, detect and signal wake-up events - ARM_POWER_FULL ///< Power on: full operation at maximum performance -} ARM_POWER_STATE; - -#endif /* __DRIVER_COMMON_H */ diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_MPC.h b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_MPC.h deleted file mode 100644 index 9ed84ba745..0000000000 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_MPC.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2016-2018 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef __DRIVER_MPC_H -#define __DRIVER_MPC_H - -#include "Driver_Common.h" - -/* API version */ -#define ARM_MPC_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1,0) - -/* Error code returned by the driver functions */ -#define ARM_MPC_ERR_NOT_INIT (ARM_DRIVER_ERROR_SPECIFIC - 1) ///< MPC not initialized */ -#define ARM_MPC_ERR_NOT_IN_RANGE (ARM_DRIVER_ERROR_SPECIFIC - 2) ///< Address does not belong to a range controlled by the MPC */ -#define ARM_MPC_ERR_NOT_ALIGNED (ARM_DRIVER_ERROR_SPECIFIC - 3) ///< Address is not aligned on the block size of this MPC */ -#define ARM_MPC_ERR_INVALID_RANGE (ARM_DRIVER_ERROR_SPECIFIC - 4) ///< The given address range to configure is invalid -#define ARM_MPC_ERR_RANGE_SEC_ATTR_NON_COMPATIBLE (ARM_DRIVER_ERROR_SPECIFIC - 4) ///< The given range cannot be accessed with the wanted security attributes */ -#define ARM_MPC_ERR_UNSPECIFIED (ARM_DRIVER_ERROR_SPECIFIC - 5) ///< Unspecified error */ - -/* Security attribute used in various place of the API */ -typedef enum _ARM_MPC_SEC_ATTR { - ARM_MPC_ATTR_SECURE, ///< Secure attribute - ARM_MPC_ATTR_NONSECURE, ///< Non-secure attribute - /* Used when getting the configuration of a memory range and some blocks are - * secure whereas some other are non secure */ - ARM_MPC_ATTR_MIXED, ///< Mixed attribute -} ARM_MPC_SEC_ATTR; - -/* Function documentation */ -/** - \fn ARM_DRIVER_VERSION ARM_MPC_GetVersion (void) - \brief Get driver version. - \return \ref ARM_DRIVER_VERSION - - \fn int32_t ARM_MPC_Initialize (void) - \brief Initialize MPC Interface. - \return Returns error code. - - \fn int32_t ARM_MPC_Uninitialize (void) - \brief De-initialize MPC Interface. The controlled memory region - should not be accessed after a call to this function, as - it is allowed to configure everything to be secure (to - prevent information leak for example). - \return Returns error code. - - \fn int32_t ARM_MPC_GetBlockSize (uint32_t* blk_size) - \brief Get the block size of the MPC. All regions must be aligned - on this block size (base address and limit+1 address). - \param[out] blk_size: The block size in bytes. - \return Returns error code. - - \fn int32_t ARM_MPC_GetCtrlConfig (uint32_t* ctrl_val) - \brief Get some information on how the MPC IP is configured. - \param[out] ctrl_val: MPC control configuration - \return Returns error code. - - \fn int32_t ARM_MPC_SetCtrlConfig (uint32_t ctrl) - \brief Set new control configuration for the MPC IP. - \param[in] ctrl: New control configuration. - \return Returns error code. - - \fn int32_t ARM_MPC_ConfigRegion (uintptr_t base, - uintptr_t limit, - ARM_MPC_SEC_ATTR attr) - \brief Configure a memory region (base and limit included). - Both base and limit addresses must belong to the same - memory range, and this range must be managed by this MPC. - Also, some ranges are only allowed to be configured as - secure/non-secure, because of hardware requirements - (security aliases), and only a relevant security attribute - is therefore allowed for such ranges. - \param[in] base: Base address of the region to configure. This - bound is included in the configured region. - This must be aligned on the block size of this MPC. - \param[in] limit: Limit address of the region to configure. This - bound is included in the configured region. - Limit+1 must be aligned on the block size of this MPC. - \param[in] attr: Wanted security attribute of the region. - \return Returns error code. - - \fn int32_t ARM_MPC_GetRegionConfig (uintptr_t base, - uintptr_t limit, - ARM_MPC_SEC_ATTR *attr) - \brief Gets a memory region (base and limit included). - \param[in] base: Base address of the region to poll. This - bound is included. It does not need to be aligned - in any way. - \param[in] limit: Limit address of the region to poll. This - bound is included. (limit+1) does not need to be aligned - in any way. - \param[out] attr: Security attribute of the region. - If the region has mixed secure/non-secure, - a special value is returned (\ref ARM_MPC_SEC_ATTR). - - In case base and limit+1 addresses are not aligned on - the block size, the enclosing region with base and - limit+1 aligned on block size will be queried. - In case of early termination of the function (error), the - security attribute will be set to ARM_MPC_ATTR_MIXED. - \return Returns error code. - - \fn int32_t ARM_MPC_EnableInterrupt (void) - \brief Enable MPC interrupt. - \return Returns error code. - - \fn void ARM_MPC_DisableInterrupt (void) - \brief Disable MPC interrupt. - - \fn void ARM_MPC_ClearInterrupt (void) - \brief Clear MPC interrupt. - - \fn uint32_t ARM_MPC_InterruptState (void) - \brief MPC interrupt state. - \return Returns 1 if the interrupt is active, 0 otherwise. - - \fn int32_t ARM_MPC_LockDown (void) - \brief Lock down the MPC configuration. - \return Returns error code. -*/ - -/** - * \brief Access structure of the MPC Driver. - */ -typedef struct _ARM_DRIVER_MPC { - ARM_DRIVER_VERSION (*GetVersion) (void); ///< Pointer to \ref ARM_MPC_GetVersion : Get driver version. - int32_t (*Initialize) (void); ///< Pointer to \ref ARM_MPC_Initialize : Initialize the MPC Interface. - int32_t (*Uninitialize) (void); ///< Pointer to \ref ARM_MPC_Uninitialize : De-initialize the MPC Interface. - int32_t (*GetBlockSize) (uint32_t* blk_size); ///< Pointer to \ref ARM_MPC_GetBlockSize : Get MPC block size - int32_t (*GetCtrlConfig) (uint32_t* ctrl_val); ///< Pointer to \ref ARM_MPC_GetCtrlConfig : Get the MPC control configuration flags. - int32_t (*SetCtrlConfig) (uint32_t ctrl); ///< Pointer to \ref ARM_MPC_SetCtrlConfig : Set the MPC control configuration flags. - int32_t (*ConfigRegion) (uintptr_t base, uintptr_t limit, ARM_MPC_SEC_ATTR attr); ///< Pointer to \ref ARM_MPC_ConfigRegion : Configure a region using the driver for the specific MPC. - int32_t (*GetRegionConfig) (uintptr_t base, uintptr_t limit, ARM_MPC_SEC_ATTR *attr); ///< Pointer to \ref ARM_MPC_GetRegionConfig : Get the configuration of a specific region on this MPC. - int32_t (*EnableInterrupt) (void); ///< Pointer to \ref ARM_MPC_EnableInterrupt : Enable MPC interrupt. - void (*DisableInterrupt) (void); ///< Pointer to \ref ARM_MPC_DisableInterrupt : Disable MPC interrupt. - void (*ClearInterrupt) (void); ///< Pointer to \ref ARM_MPC_ClearInterrupt : Clear MPC interrupt. - uint32_t (*InterruptState) (void); ///< Pointer to \ref ARM_MPC_InterruptState : MPC interrupt State. - int32_t (*LockDown) (void); ///< Pointer to \ref ARM_MPC_LockDown : Lock down the MPC configuration. -} const ARM_DRIVER_MPC; - -#endif /* __DRIVER_MPC_H */ - diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_PPC.h b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_PPC.h deleted file mode 100644 index e689b2ebde..0000000000 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/ext/driver/Driver_PPC.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2016 ARM Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __CMSIS_PPC_DRV_H__ -#define __CMSIS_PPC_DRV_H__ - -#include "Driver_Common.h" - -/* API version */ -#define ARM_PPC_API_VERSION ARM_DRIVER_VERSION_MAJOR_MINOR(1,0) - -/* Security attribute used to configure the peripheral */ -typedef enum _ARM_PPC_SecAttr { - ARM_PPC_SECURE_ONLY, ///< Secure access - ARM_PPC_NONSECURE_ONLY, ///< Non-secure access -} ARM_PPC_SecAttr; - -/* Privilege attribute used to configure the peripheral */ -typedef enum _ARM_PPC_PrivAttr { - ARM_PPC_PRIV_AND_NONPRIV, ///< Privilege and non-privilege access - ARM_PPC_PRIV_ONLY, ///< Privilege only access -} ARM_PPC_PrivAttr; - -/* Function documentation */ -/** - \fn ARM_DRIVER_VERSION ARM_PPC_GetVersion (void) - \brief Get driver version. - \return \ref ARM_DRIVER_VERSION - - \fn int32_t ARM_PPC_Initialize (void) - \brief Initialize PPC Interface. - \return Returns ARM error code. - - \fn int32_t ARM_PPC_Uninitialize (void) - \brief De-initialize MPC Interface. - \return Returns ARM error code. - - \fn int32_t ARM_PPC_ConfigPeriph (uint8_t periph, - ARM_PPC_SecAttr sec_attr, - ARM_PPC_PrivAttr priv_attr) - \brief Configures a peripheral controlled by the given PPC. - \param[in] periph: Peripheral position in SPCTRL and NSPCTRL registers. - \param[in] sec_attr: Secure attribute value. - \param[in] priv_attr: Privilege attrivute value. - - Secure Privilege Control Block ( SPCTRL ) - Non-Secure Privilege Control Block ( NSPCTRL ) - - \return Returns ARM error code. - - \fn int32_t ARM_PPC_IsPeriphSecure (uint8_t periph) - \brief Check if the peripheral is configured to be secure. - \param[in] periph: Peripheral position in SPCTRL and NSPCTRL registers. - - Secure Privilege Control Block ( SPCTRL ) - Non-Secure Privilege Control Block ( NSPCTRL ) - - \return Returns 1 if the peripheral is configured as secure, - 0 for non-secure. - - \fn uint32_t ARM_PPC_IsPeriphPrivOnly (uint8_t periph) - \brief Check if the peripheral is configured to be privilege only. - \param[in] periph: Peripheral position in SPCTRL and NSPCTRL registers. - - Secure Privilege Control Block ( SPCTRL ) - Non-Secure Privilege Control Block ( NSPCTRL ) - - \return Returns 1 if the peripheral is configured as privilege access - only, 0 for privilege and unprivilege access mode. - - \fn int32_t ARM_PPC_EnableInterrupt (void) - \brief Enable PPC interrupt. - \return Returns ARM error code. - - \fn void ARM_PPC_DisableInterrupt (void) - \brief Disable PPC interrupt. - - \fn void ARM_PPC_ClearInterrupt (void) - \brief Clear PPC interrupt. - - \fn int32_t ARM_PPC_InterruptState (void) - \brief PPC interrupt state. - \return Returns 1 if the interrupt is active, 0 otherwise. -*/ - -/** - * \brief Access structure of the MPC Driver. - */ -typedef struct _ARM_DRIVER_PPC { - ARM_DRIVER_VERSION (*GetVersion) (void); ///< Pointer to \ref ARM_PPC_GetVersion : Get driver version. - int32_t (*Initialize) (void); ///< Pointer to \ref ARM_PPC_Initialize : Initialize the PPC Interface. - int32_t (*Uninitialize) (void); ///< Pointer to \ref ARM_PPC_Uninitialize : De-initialize the PPC Interface. - int32_t (*ConfigPeriph) (uint8_t periph, ARM_PPC_SecAttr sec_attr, ARM_PPC_PrivAttr priv_attr); ///< Pointer to \ref ARM_PPC_ConfigPeriph : Configure a peripheral controlled by the PPC. - uint32_t (*IsPeriphSecure) (uint8_t periph); ///< Pointer to \ref IsPeriphSecure : Check if the peripheral is configured to be secure. - uint32_t (*IsPeriphPrivOnly) (uint8_t periph); ///< Pointer to \ref IsPeriphPrivOnly : Check if the peripheral is configured to be privilege only. - int32_t (*EnableInterrupt) (void); ///< Pointer to \ref ARM_PPC_EnableInterrupt : Enable PPC interrupt. - void (*DisableInterrupt) (void); ///< Pointer to \ref ARM_PPC_DisableInterrupt : Disable PPC interrupt. - void (*ClearInterrupt) (void); ///< Pointer to \ref ARM_PPC_ClearInterrupt : Clear PPC interrupt. - uint32_t (*InterruptState) (void); ///< Pointer to \ref ARM_PPC_InterruptState : PPC interrupt State. -} const ARM_DRIVER_PPC; - -#endif /* __CMSIS_PPC_DRV_H__ */ - diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_boot_seed.h b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_boot_seed.h deleted file mode 100644 index 11b79f0ebb..0000000000 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_boot_seed.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_BOOT_SEED_H__ -#define __TFM_PLAT_BOOT_SEED_H__ -/** - * \file tfm_plat_boot_seed.h - * - * Boot seed is used by a validating entity to ensure multiple reports were - * generated in the same boot session. Boot seed is a random number, generated - * only once during a boot cycle and its value is constant in the same cycle. - * Size recommendation is 256-bit to meet the statistically improbable property. - * Boot seed can be generated by secure boot loader an included to the measured - * boot state or can be generated by PRoT SW. - */ - -/** - * \note The interfaces defined in this file must be implemented for each - * SoC. - */ - -#include -#include "tfm_plat_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/*! - * \def BOOT_SEED_SIZE - * - * \brief Size of boot seed in bytes. - */ -#define BOOT_SEED_SIZE (32u) - -/** - * \brief Gets the boot seed, which is a constant random number during a boot - * cycle. - * - * \param[in] size The required size of boot seed in bytes - * \param[out] buf Pointer to the buffer to store boot seed - * - * \return TFM_PLAT_ERR_SUCCESS if the value is generated correctly. Otherwise, - * it returns TFM_PLAT_ERR_SYSTEM_ERR. - */ -enum tfm_plat_err_t tfm_plat_get_boot_seed(uint32_t size, uint8_t *buf); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_BOOT_SEED_H__ */ diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_defs.h b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_defs.h deleted file mode 100644 index f0b4297a24..0000000000 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_defs.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2017-2019, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_DEFS_H__ -#define __TFM_PLAT_DEFS_H__ -/** - * \note The interfaces defined in this file must be implemented for each - * target. - */ - -#include -#include - -enum tfm_plat_err_t { - TFM_PLAT_ERR_SUCCESS = 0, - TFM_PLAT_ERR_SYSTEM_ERR, - TFM_PLAT_ERR_MAX_VALUE, - /* Following entry is only to ensure the error code of int size */ - TFM_PLAT_ERR_FORCE_INT_SIZE = INT_MAX -}; - -/*! - * \def TFM_LINK_SET_OBJECT_IN_PARTITION_SECTION(TFM_PARTITION_NAME) - * - * \brief This macro provides a mechanism to place a function code in a specific - * secure partition at linker time in TF-M Level 3. - * - * \param[in] TFM_PARTITION_NAME TF-M partition name assigned in the manifest - * file "name" field. - */ -#define TFM_LINK_SET_OBJECT_IN_PARTITION_SECTION(TFM_PARTITION_NAME) \ - __attribute__((section(TFM_PARTITION_NAME"_ATTR_FN"))) - -#endif /* __TFM_PLAT_DEFS_H__ */ diff --git a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_device_id.h b/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_device_id.h deleted file mode 100644 index eb7d1baa50..0000000000 --- a/components/TARGET_PSA/TARGET_TFM/COMPONENT_SPE/platform/include/tfm_plat_device_id.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2018, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - * - */ - -#ifndef __TFM_PLAT_DEVICE_ID_H__ -#define __TFM_PLAT_DEVICE_ID_H__ -/** - * \file tfm_plat_device_id.h - * Provide the Universal Entity ID (UEID) of the device. - * It identifies the entire device or a submodule or subsystem. Must be - * universally and globally unique and immutable. Variable length with a - * maximum size of 33 bytes: 1 type byte and 256 bits. - */ - -/** - * \note The interfaces defined in this file must be implemented for each - * SoC. - */ - -#include -#include "tfm_plat_defs.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \def DEVICE_ID_MAX_SIZE - * - * \brief Maximum size of device ID in bytes - */ -#define DEVICE_ID_MAX_SIZE (33u) - -/** - * \brief Get the UEID of the device. - * - * \param[in] size The size of the buffer in bytes to store the UEID - * \param[out] buf Pointer to the buffer to store the UEID - * - * \return The size of device ID in bytes, if buffer big enough to store the - * ID, otherwise -1. - */ -int32_t tfm_plat_get_device_id(uint32_t size, uint8_t *buf); - -#ifdef __cplusplus -} -#endif - -#endif /* __TFM_PLAT_DEVICE_ID_H__ */