[edk2-devel] [PATCH v2 2/6] ArmPkg: Correct return value of "SMCCC_ARCH_SOC_ID" Function ID call

Nhi Pham via groups.io nhi=os.amperecomputing.com at groups.io
Wed Aug 24 16:50:28 UTC 2022


From: Minh Nguyen <minhn at amperecomputing.com>

According to "SMC Calling Convention" specification, section 7.4,
return value of Arm Architecture Calls is stored at first argument of
SMC aguments (ARM_SMC_ARGS). This value can be negative values indicating
error or positive values (including zero) indicating success. Positive
value would contain information of respective Function ID (Section 7.3.4
and 7.4.4).

For that reason, "SMCCC_VERSION" and "SMCCC_ARCH_FEATURES"
Function ID calls read return value from "SmcCallStatus" variable
(Args.Arg0 - first argument of SMC call). But "SMCCC_ARCH_SOC_ID"
Function ID call is reading return value from "SmcParam" variable
(Args.Arg1 - second argument of SMC call) so it leads to unexpected
results of "Jep106Code" and "SocRevision". This patch is to correct it.

Signed-off-by: Nhi Pham <nhi at os.amperecomputing.com>
Reviewed-by: Rebecca Cran <rebecca at quicinc.com>
Reviewed-by: Sami Mujawar <sami.mujawar at arm.com>
---
 ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
index e0010a40e489..b961be213358 100644
--- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
+++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
@@ -2,7 +2,7 @@
   Functions for processor information common to ARM and AARCH64.

 

   Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>

-  Copyright (c) 2021, Ampere Computing LLC. All rights reserved.<BR>

+  Copyright (c) 2021 - 2022, Ampere Computing LLC. All rights reserved.<BR>

 

   SPDX-License-Identifier: BSD-2-Clause-Patent

 

@@ -131,7 +131,7 @@ SmbiosGetSmcArm64SocId (
   SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);

 

   if (SmcCallStatus >= 0) {

-    *Jep106Code = (INT32)SmcParam;

+    *Jep106Code = SmcCallStatus;

   } else {

     Status = EFI_UNSUPPORTED;

   }

@@ -140,7 +140,7 @@ SmbiosGetSmcArm64SocId (
   SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);

 

   if (SmcCallStatus >= 0) {

-    *SocRevision = (INT32)SmcParam;

+    *SocRevision = SmcCallStatus;

   } else {

     Status = EFI_UNSUPPORTED;

   }

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#92768): https://edk2.groups.io/g/devel/message/92768
Mute This Topic: https://groups.io/mt/93231051/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list