aboutsummaryrefslogtreecommitdiffstats
path: root/plat
diff options
context:
space:
mode:
authorJeenu Viswambharan <jeenu.viswambharan@arm.com>2017-09-19 09:27:18 +0100
committerJeenu Viswambharan <jeenu.viswambharan@arm.com>2017-11-13 08:38:51 +0000
commit71e7a4e568e5f73f67cb571e6dfab3015b986c7b (patch)
tree417ba08368fd9bc96d3ea123c1663dfe5ea41d66 /plat
parentb7cb133e5c56f149024a56873216f0c198aa9635 (diff)
downloadplatform_external_arm-trusted-firmware-71e7a4e568e5f73f67cb571e6dfab3015b986c7b.tar.gz
platform_external_arm-trusted-firmware-71e7a4e568e5f73f67cb571e6dfab3015b986c7b.tar.bz2
platform_external_arm-trusted-firmware-71e7a4e568e5f73f67cb571e6dfab3015b986c7b.zip
ARM platforms: Make arm_validate_ns_entrypoint() common
The function arm_validate_ns_entrypoint() validates a given non-secure physical address. This function however specifically returns PSCI error codes. Non-secure physical address validation is potentially useful across ARM platforms, even for non-PSCI use cases. Therefore make this function common by returning 0 for success or -1 otherwise. Having made the function common, make arm_validate_psci_entrypoint() a wrapper around arm_validate_ns_entrypoint() which only translates return value into PSCI error codes. This wrapper is now used where arm_validate_ns_entrypoint() was currently used for PSCI entry point validation. Change-Id: Ic781fc3105d6d199fd8f53f01aba5baea0ebc310 Signed-off-by: Jeenu Viswambharan <jeenu.viswambharan@arm.com>
Diffstat (limited to 'plat')
-rw-r--r--plat/arm/board/fvp/fvp_pm.c2
-rw-r--r--plat/arm/common/arm_pm.c22
-rw-r--r--plat/arm/css/common/css_pm.c2
3 files changed, 17 insertions, 9 deletions
diff --git a/plat/arm/board/fvp/fvp_pm.c b/plat/arm/board/fvp/fvp_pm.c
index faeb1b777..0ab5b8207 100644
--- a/plat/arm/board/fvp/fvp_pm.c
+++ b/plat/arm/board/fvp/fvp_pm.c
@@ -398,7 +398,7 @@ plat_psci_ops_t plat_arm_psci_pm_ops = {
.system_off = fvp_system_off,
.system_reset = fvp_system_reset,
.validate_power_state = fvp_validate_power_state,
- .validate_ns_entrypoint = arm_validate_ns_entrypoint,
+ .validate_ns_entrypoint = arm_validate_psci_entrypoint,
.translate_power_state_by_mpidr = fvp_translate_power_state_by_mpidr,
.get_node_hw_state = fvp_node_hw_state,
.get_sys_suspend_power_state = fvp_get_sys_suspend_power_state,
diff --git a/plat/arm/common/arm_pm.c b/plat/arm/common/arm_pm.c
index 5e7e047a5..44ac5b5d6 100644
--- a/plat/arm/common/arm_pm.c
+++ b/plat/arm/common/arm_pm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -112,7 +112,7 @@ int arm_validate_power_state(unsigned int power_state,
/*******************************************************************************
* ARM standard platform handler called to check the validity of the non secure
- * entrypoint.
+ * entrypoint. Returns 0 if the entrypoint is valid, or -1 otherwise.
******************************************************************************/
int arm_validate_ns_entrypoint(uintptr_t entrypoint)
{
@@ -121,15 +121,23 @@ int arm_validate_ns_entrypoint(uintptr_t entrypoint)
* secure DRAM.
*/
if ((entrypoint >= ARM_NS_DRAM1_BASE) && (entrypoint <
- (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE)))
- return PSCI_E_SUCCESS;
+ (ARM_NS_DRAM1_BASE + ARM_NS_DRAM1_SIZE))) {
+ return 0;
+ }
#ifndef AARCH32
if ((entrypoint >= ARM_DRAM2_BASE) && (entrypoint <
- (ARM_DRAM2_BASE + ARM_DRAM2_SIZE)))
- return PSCI_E_SUCCESS;
+ (ARM_DRAM2_BASE + ARM_DRAM2_SIZE))) {
+ return 0;
+ }
#endif
- return PSCI_E_INVALID_ADDRESS;
+ return -1;
+}
+
+int arm_validate_psci_entrypoint(uintptr_t entrypoint)
+{
+ return arm_validate_ns_entrypoint(entrypoint) == 0 ? PSCI_E_SUCCESS :
+ PSCI_E_INVALID_ADDRESS;
}
/******************************************************************************
diff --git a/plat/arm/css/common/css_pm.c b/plat/arm/css/common/css_pm.c
index 4104dd73f..4a615e1c9 100644
--- a/plat/arm/css/common/css_pm.c
+++ b/plat/arm/css/common/css_pm.c
@@ -299,7 +299,7 @@ plat_psci_ops_t plat_arm_psci_pm_ops = {
.system_off = css_system_off,
.system_reset = css_system_reset,
.validate_power_state = css_validate_power_state,
- .validate_ns_entrypoint = arm_validate_ns_entrypoint,
+ .validate_ns_entrypoint = arm_validate_psci_entrypoint,
.translate_power_state_by_mpidr = css_translate_power_state_by_mpidr,
.get_node_hw_state = css_node_hw_state,
.get_sys_suspend_power_state = css_get_sys_suspend_power_state,