aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMingyang Sun <mingyang.sun@arm.com>2021-06-04 17:49:56 +0800
committerKen Liu <ken.liu@arm.com>2021-06-08 08:47:39 +0200
commit61f8fbc280ebb103ac48ecda84dd2ef77852dc69 (patch)
treea5528bd664e95cee7175a6673ee9e09dfb2751fd /platform
parent327bc844621fe6d6702c55479e35348c6c8bfa11 (diff)
downloadtrusted-firmware-m-61f8fbc280ebb103ac48ecda84dd2ef77852dc69.tar.gz
HAL: Replace the 'idx' input param with 'privileged'
In tfm_spm_hal_configure_default_isolation(), a partition index is passed in to query the partition privilege. Change to pass in privilege directly instead of the partition index. Change-Id: Id046431cc8e224a94e83a71564ba2843fabf8ed7 Signed-off-by: Mingyang Sun <mingyang.sun@arm.com>
Diffstat (limited to 'platform')
-rw-r--r--platform/ext/target/arm/mps2/an519/spm_hal.c6
-rw-r--r--platform/ext/target/arm/mps2/an521/spm_hal.c7
-rw-r--r--platform/ext/target/arm/mps2/fvp_sse300/spm_hal.c5
-rw-r--r--platform/ext/target/arm/mps3/an524/spm_hal.c6
-rw-r--r--platform/ext/target/arm/mps3/an547/spm_hal.c5
-rw-r--r--platform/ext/target/arm/musca_b1/secure_enclave/spm_hal.c6
-rw-r--r--platform/ext/target/arm/musca_b1/sse_200/spm_hal.c5
-rw-r--r--platform/ext/target/arm/musca_s1/spm_hal.c6
-rw-r--r--platform/ext/target/cypress/psoc64/spm_hal.c6
-rw-r--r--platform/ext/target/nordic_nrf/common/core/spm_hal.c6
-rw-r--r--platform/ext/target/nuvoton/common/spm_hal.c6
-rw-r--r--platform/ext/target/nxp/common/spm_hal.c5
-rw-r--r--platform/ext/target/stm/common/stm32l5xx/secure/spm_hal.c4
-rw-r--r--platform/include/tfm_spm_hal.h14
14 files changed, 36 insertions, 51 deletions
diff --git a/platform/ext/target/arm/mps2/an519/spm_hal.c b/platform/ext/target/arm/mps2/an519/spm_hal.c
index 02cd47a97..c192152c7 100644
--- a/platform/ext/target/arm/mps2/an519/spm_hal.c
+++ b/platform/ext/target/arm/mps2/an519/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -22,11 +22,9 @@ extern ARM_DRIVER_MPC Driver_SRAM1_MPC;
extern const struct memory_region_limits memory_regions;
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
- bool privileged = tfm_is_partition_privileged(partition_idx);
-
if (!platform_data) {
return TFM_PLAT_ERR_INVALID_INPUT;
}
diff --git a/platform/ext/target/arm/mps2/an521/spm_hal.c b/platform/ext/target/arm/mps2/an521/spm_hal.c
index 58dee4d88..9390b46fe 100644
--- a/platform/ext/target/arm/mps2/an521/spm_hal.c
+++ b/platform/ext/target/arm/mps2/an521/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -33,16 +33,15 @@ uint32_t periph_num_count = 0;
#ifdef TFM_FIH_PROFILE_ON
fih_int tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
#else /* TFM_FIH_PROFILE_ON */
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
#endif /* TFM_FIH_PROFILE_ON */
{
fih_int fih_rc = FIH_FAILURE;
- bool privileged = tfm_is_partition_privileged(partition_idx);
#if defined(CONFIG_TFM_ENABLE_MEMORY_PROTECT) && (TFM_LVL != 1)
struct mpu_armv8m_region_cfg_t region_cfg;
#endif
diff --git a/platform/ext/target/arm/mps2/fvp_sse300/spm_hal.c b/platform/ext/target/arm/mps2/fvp_sse300/spm_hal.c
index 6b2d8a6d4..ff26d6fc7 100644
--- a/platform/ext/target/arm/mps2/fvp_sse300/spm_hal.c
+++ b/platform/ext/target/arm/mps2/fvp_sse300/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -27,11 +27,10 @@ uint32_t periph_num_count = 0;
#endif /* CONFIG_TFM_ENABLE_MEMORY_PROTECT */
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
#if defined(CONFIG_TFM_ENABLE_MEMORY_PROTECT) && (TFM_LVL != 1)
- bool privileged = tfm_is_partition_privileged(partition_idx);
struct mpu_armv8m_region_cfg_t region_cfg;
#endif
diff --git a/platform/ext/target/arm/mps3/an524/spm_hal.c b/platform/ext/target/arm/mps3/an524/spm_hal.c
index 8abe9d8a5..30907b20d 100644
--- a/platform/ext/target/arm/mps3/an524/spm_hal.c
+++ b/platform/ext/target/arm/mps3/an524/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -33,11 +33,9 @@
extern const struct memory_region_limits memory_regions;
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
- bool privileged = tfm_is_partition_privileged(partition_idx);
-
if (!platform_data) {
return TFM_PLAT_ERR_INVALID_INPUT;
}
diff --git a/platform/ext/target/arm/mps3/an547/spm_hal.c b/platform/ext/target/arm/mps3/an547/spm_hal.c
index 840deac1b..e8c8c8d68 100644
--- a/platform/ext/target/arm/mps3/an547/spm_hal.c
+++ b/platform/ext/target/arm/mps3/an547/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -29,11 +29,10 @@ uint32_t periph_num_count = 0;
#endif /* CONFIG_TFM_ENABLE_MEMORY_PROTECT */
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
#if defined(CONFIG_TFM_ENABLE_MEMORY_PROTECT) && (TFM_LVL != 1)
- bool privileged = tfm_is_partition_privileged(partition_idx);
struct mpu_armv8m_region_cfg_t region_cfg;
#endif
diff --git a/platform/ext/target/arm/musca_b1/secure_enclave/spm_hal.c b/platform/ext/target/arm/musca_b1/secure_enclave/spm_hal.c
index b80007853..207db15c1 100644
--- a/platform/ext/target/arm/musca_b1/secure_enclave/spm_hal.c
+++ b/platform/ext/target/arm/musca_b1/secure_enclave/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
* Copyright (c) 2019-2020, Cypress Semiconductor Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -21,12 +21,12 @@
extern const struct memory_region_limits memory_regions;
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
/* Nothing to do, there is no isolation HW in this platform to be
* configured by Secure Enclave */
- (void) partition_idx;
+ (void) privileged;
(void) platform_data;
return TFM_PLAT_ERR_SUCCESS;
}
diff --git a/platform/ext/target/arm/musca_b1/sse_200/spm_hal.c b/platform/ext/target/arm/musca_b1/sse_200/spm_hal.c
index 42c10cffe..58ac54603 100644
--- a/platform/ext/target/arm/musca_b1/sse_200/spm_hal.c
+++ b/platform/ext/target/arm/musca_b1/sse_200/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -33,10 +33,9 @@ uint32_t periph_num_count = 0;
#endif /* CONFIG_TFM_ENABLE_MEMORY_PROTECT */
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
- bool privileged = tfm_is_partition_privileged(partition_idx);
#if defined(CONFIG_TFM_ENABLE_MEMORY_PROTECT) && (TFM_LVL != 1)
struct mpu_armv8m_region_cfg_t region_cfg;
#endif
diff --git a/platform/ext/target/arm/musca_s1/spm_hal.c b/platform/ext/target/arm/musca_s1/spm_hal.c
index dba21775c..46f0de0d2 100644
--- a/platform/ext/target/arm/musca_s1/spm_hal.c
+++ b/platform/ext/target/arm/musca_s1/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -25,11 +25,9 @@ extern const struct memory_region_limits memory_regions;
struct mpu_armv8m_dev_t dev_mpu_s = { MPU_BASE };
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
- bool privileged = tfm_is_partition_privileged(partition_idx);
-
if (!platform_data) {
return TFM_PLAT_ERR_INVALID_INPUT;
}
diff --git a/platform/ext/target/cypress/psoc64/spm_hal.c b/platform/ext/target/cypress/psoc64/spm_hal.c
index 7b4e2fed8..b996368fc 100644
--- a/platform/ext/target/cypress/psoc64/spm_hal.c
+++ b/platform/ext/target/cypress/psoc64/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
* Copyright (c) 2019-2020, Cypress Semiconductor Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -35,10 +35,10 @@
extern const struct memory_region_limits memory_regions;
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
- (void) partition_idx; /* Unused parameter */
+ (void) privileged; /* Unused parameter */
if (!platform_data) {
return TFM_PLAT_ERR_INVALID_INPUT;
}
diff --git a/platform/ext/target/nordic_nrf/common/core/spm_hal.c b/platform/ext/target/nordic_nrf/common/core/spm_hal.c
index d38100d31..5b9aa9c11 100644
--- a/platform/ext/target/nordic_nrf/common/core/spm_hal.c
+++ b/platform/ext/target/nordic_nrf/common/core/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
* Copyright (c) 2020, Nordic Semiconductor ASA. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -29,7 +29,7 @@ static uint32_t periph_num_count = 0;
#endif /* CONFIG_TFM_ENABLE_MEMORY_PROTECT */
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
if (!platform_data) {
@@ -38,7 +38,7 @@ enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
#if defined(CONFIG_TFM_ENABLE_MEMORY_PROTECT) && (TFM_LVL != 1)
- if (!tfm_is_partition_privileged(partition_idx)) {
+ if (!privileged) {
struct mpu_armv8m_region_cfg_t region_cfg;
region_cfg.region_nr = PARTITION_REGION_PERIPH_START + periph_num_count;
diff --git a/platform/ext/target/nuvoton/common/spm_hal.c b/platform/ext/target/nuvoton/common/spm_hal.c
index 500593bbf..9772399d3 100644
--- a/platform/ext/target/nuvoton/common/spm_hal.c
+++ b/platform/ext/target/nuvoton/common/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -22,11 +22,9 @@ extern ARM_DRIVER_MPC Driver_SRAM1_MPC;
extern const struct memory_region_limits memory_regions;
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
- bool privileged = tfm_is_partition_privileged(partition_idx);
-
if (!platform_data) {
return TFM_PLAT_ERR_INVALID_INPUT;
}
diff --git a/platform/ext/target/nxp/common/spm_hal.c b/platform/ext/target/nxp/common/spm_hal.c
index b9a6e9891..fee91a905 100644
--- a/platform/ext/target/nxp/common/spm_hal.c
+++ b/platform/ext/target/nxp/common/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
* Copyright 2019-2020 NXP. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
@@ -30,10 +30,9 @@ uint32_t periph_num_count = 0;
#endif /* CONFIG_TFM_ENABLE_MEMORY_PROTECT */
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
- bool privileged = tfm_is_partition_privileged(partition_idx);
#if defined(CONFIG_TFM_ENABLE_MEMORY_PROTECT) && (TFM_LVL != 1)
struct mpu_armv8m_region_cfg_t region_cfg;
#endif
diff --git a/platform/ext/target/stm/common/stm32l5xx/secure/spm_hal.c b/platform/ext/target/stm/common/stm32l5xx/secure/spm_hal.c
index 94cab01c9..638d0cfdf 100644
--- a/platform/ext/target/stm/common/stm32l5xx/secure/spm_hal.c
+++ b/platform/ext/target/stm/common/stm32l5xx/secure/spm_hal.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -19,7 +19,7 @@
extern const struct memory_region_limits memory_regions;
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data)
{
/* plat data are ignored */
diff --git a/platform/include/tfm_spm_hal.h b/platform/include/tfm_spm_hal.h
index 11da3c9aa..57304926b 100644
--- a/platform/include/tfm_spm_hal.h
+++ b/platform/include/tfm_spm_hal.h
@@ -51,20 +51,19 @@ fih_int tfm_spm_hal_setup_isolation_hw(void);
/**
* \brief Configure peripherals for a partition based on the platform data and
- * partition index from the DB
+ * partition privilege
*
* This function is called during partition initialisation (before calling the
* init function for the partition)
*
- * \param[in] partition_idx The index of the partition that this peripheral
- * is assigned to.
+ * \param[in] privileged Whether the partition is privileged.
* \param[in] platform_data The platform fields of the partition DB record to
* be used for configuration.
*
* \return Returns values as specified by FIH specific platform error code
*/
fih_int tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool privileged,
const struct platform_data_t *platform_data);
/**
* \brief Configures the system debug properties.
@@ -106,20 +105,19 @@ enum tfm_plat_err_t tfm_spm_hal_setup_isolation_hw(void);
/**
* \brief Configure peripherals for a partition based on the platform data and
- * partition index from the DB
+ * partition privilege
*
* This function is called during partition initialisation (before calling the
* init function for the partition)
*
- * \param[in] partition_idx The index of the partition that this peripheral
- * is assigned to.
+ * \param[in] privileged Whether the partition is privileged.
* \param[in] platform_data The platform fields of the partition DB record to
* be used for configuration.
*
* \return Returns values as specified by the \ref tfm_plat_err_t
*/
enum tfm_plat_err_t tfm_spm_hal_configure_default_isolation(
- uint32_t partition_idx,
+ bool priviledged,
const struct platform_data_t *platform_data);
/**
* \brief Configures the system debug properties.