aboutsummaryrefslogtreecommitdiff
path: root/services
diff options
context:
space:
mode:
authorManish V Badarkhe <Manish.Badarkhe@arm.com>2020-04-28 13:25:56 +0100
committerManish V Badarkhe <manish.badarkhe@arm.com>2020-05-05 08:23:16 +0000
commita718c3d677f8b3a65db766406e8c7df25af02529 (patch)
tree69a985d7028f1291c5e151b07a9d18bc4adf1041 /services
parent658086747dc638e3012a052293e855339d211a95 (diff)
downloadtrusted-firmware-a-a718c3d677f8b3a65db766406e8c7df25af02529.tar.gz
Fix SMCCC_ARCH_SOC_ID implementation
Commit 0e753437e75b ("Implement SMCCC_ARCH_SOC_ID SMC call") executes and return the result of SMCCC_ARCH_SOC_ID(soc_id_type) to the SMCCC_ARCH_FEATURES(SMCCC_ARCH_SOC_ID) itself. Moreover it expect to pass soc_id_type for SMCCC_ARCH_FEATURES(SMCCC_ARCH_SOC_ID) which is incorrect. Fix the implementation by returning SMC_OK for SMCCC_ARCH_FEATURES(SMCCC_ARCH_SOC_ID) always and move the current implementation under "smccc_arch_id" function which gets called from SMC handler on receiving "SMCCC_ARCH_SOC_ID" command. This change is tested over linux operating system Change-Id: I61a980045081eae786b907d408767ba9ecec3468 Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Manish V Badarkhe <Manish.Badarkhe@arm.com>
Diffstat (limited to 'services')
-rw-r--r--services/arm_arch_svc/arm_arch_svc_setup.c28
1 files changed, 18 insertions, 10 deletions
diff --git a/services/arm_arch_svc/arm_arch_svc_setup.c b/services/arm_arch_svc/arm_arch_svc_setup.c
index ba539309de..588656d57f 100644
--- a/services/arm_arch_svc/arm_arch_svc_setup.c
+++ b/services/arm_arch_svc/arm_arch_svc_setup.c
@@ -19,20 +19,13 @@ static int32_t smccc_version(void)
return MAKE_SMCCC_VERSION(SMCCC_MAJOR_VERSION, SMCCC_MINOR_VERSION);
}
-static int32_t smccc_arch_features(u_register_t arg1, u_register_t arg2)
+static int32_t smccc_arch_features(u_register_t arg1)
{
switch (arg1) {
case SMCCC_VERSION:
case SMCCC_ARCH_FEATURES:
- return SMC_OK;
case SMCCC_ARCH_SOC_ID:
- if (arg2 == SMCCC_GET_SOC_REVISION) {
- return plat_get_soc_revision();
- }
- if (arg2 == SMCCC_GET_SOC_VERSION) {
- return plat_get_soc_version();
- }
- return SMC_ARCH_CALL_INVAL_PARAM;
+ return SMC_OK;
#if WORKAROUND_CVE_2017_5715
case SMCCC_ARCH_WORKAROUND_1:
if (check_wa_cve_2017_5715() == ERRATA_NOT_APPLIES)
@@ -87,6 +80,19 @@ static int32_t smccc_arch_features(u_register_t arg1, u_register_t arg2)
}
}
+/* return soc revision or soc version on success otherwise
+ * return invalid parameter */
+static int32_t smccc_arch_id(u_register_t arg1)
+{
+ if (arg1 == SMCCC_GET_SOC_REVISION) {
+ return plat_get_soc_revision();
+ }
+ if (arg1 == SMCCC_GET_SOC_VERSION) {
+ return plat_get_soc_version();
+ }
+ return SMC_ARCH_CALL_INVAL_PARAM;
+}
+
/*
* Top-level Arm Architectural Service SMC handler.
*/
@@ -103,7 +109,9 @@ static uintptr_t arm_arch_svc_smc_handler(uint32_t smc_fid,
case SMCCC_VERSION:
SMC_RET1(handle, smccc_version());
case SMCCC_ARCH_FEATURES:
- SMC_RET1(handle, smccc_arch_features(x1, x2));
+ SMC_RET1(handle, smccc_arch_features(x1));
+ case SMCCC_ARCH_SOC_ID:
+ SMC_RET1(handle, smccc_arch_id(x1));
#if WORKAROUND_CVE_2017_5715
case SMCCC_ARCH_WORKAROUND_1:
/*