public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Rebecca Cran" <rebecca@nuviainc.com>
To: devel@edk2.groups.io, Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>,
	Leif Lindholm <leif@nuviainc.com>, nd <nd@arm.com>,
	Sami Mujawar <sami.mujawar@arm.com>
Cc: Rebecca Cran <rebecca@nuviainc.com>
Subject: [PATCH v3 2/2] ArmPkg: Update SMC calls to use the new ArmCallSmc0/1/2/3 functions
Date: Mon, 13 Dec 2021 11:30:56 -0700	[thread overview]
Message-ID: <20211213183056.31444-3-rebecca@nuviainc.com> (raw)
In-Reply-To: <20211213183056.31444-1-rebecca@nuviainc.com>

New SMC helper functions have been added to reduce the amount of
template code. Update ArmSmcPsciResetSystemLib and
Smbios/ProcessorSubClassDxe to use them.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
---
 ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c      | 10 +----
 ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c | 40 ++++++++------------
 2 files changed, 18 insertions(+), 32 deletions(-)

diff --git a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
index 6688fca37a8b..af6738459e43 100644
--- a/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
+++ b/ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSystemLib.c
@@ -31,11 +31,8 @@ ResetCold (
   VOID
   )
 {
-  ARM_SMC_ARGS  ArmSmcArgs;
-
   // Send a PSCI 0.2 SYSTEM_RESET command
-  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
-  ArmCallSmc (&ArmSmcArgs);
+  ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_RESET, NULL, NULL, NULL);
 }
 
 /**
@@ -66,11 +63,8 @@ ResetShutdown (
   VOID
   )
 {
-  ARM_SMC_ARGS  ArmSmcArgs;
-
   // Send a PSCI 0.2 SYSTEM_OFF command
-  ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
-  ArmCallSmc (&ArmSmcArgs);
+  ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_OFF, NULL, NULL, NULL);
 }
 
 /**
diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
index 7a8c3ca56784..e0010a40e489 100644
--- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
+++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/SmbiosProcessorArmCommon.c
@@ -88,22 +88,18 @@ HasSmcArm64SocId (
   VOID
   )
 {
-  ARM_SMC_ARGS  Args;
-  INT32         SmcCallStatus;
-  BOOLEAN       Arm64SocIdSupported;
+  INT32    SmcCallStatus;
+  BOOLEAN  Arm64SocIdSupported;
+  UINTN    SmcParam;
 
   Arm64SocIdSupported = FALSE;
 
-  Args.Arg0 = SMCCC_VERSION;
-  ArmCallSmc (&Args);
-  SmcCallStatus = (INT32)Args.Arg0;
+  SmcCallStatus = ArmCallSmc0 (SMCCC_VERSION, NULL, NULL, NULL);
 
   if ((SmcCallStatus < 0) || ((SmcCallStatus >> 16) >= 1)) {
-    Args.Arg0 = SMCCC_ARCH_FEATURES;
-    Args.Arg1 = SMCCC_ARCH_SOC_ID;
-    ArmCallSmc (&Args);
-
-    if (Args.Arg0 >= 0) {
+    SmcParam      = SMCCC_ARCH_SOC_ID;
+    SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_FEATURES, &SmcParam, NULL, NULL);
+    if (SmcCallStatus >= 0) {
       Arm64SocIdSupported = TRUE;
     }
   }
@@ -125,30 +121,26 @@ SmbiosGetSmcArm64SocId (
   OUT INT32  *SocRevision
   )
 {
-  ARM_SMC_ARGS  Args;
-  INT32         SmcCallStatus;
-  EFI_STATUS    Status;
+  INT32       SmcCallStatus;
+  EFI_STATUS  Status;
+  UINTN       SmcParam;
 
   Status = EFI_SUCCESS;
 
-  Args.Arg0 = SMCCC_ARCH_SOC_ID;
-  Args.Arg1 = 0;
-  ArmCallSmc (&Args);
-  SmcCallStatus = (INT32)Args.Arg0;
+  SmcParam      = 0;
+  SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);
 
   if (SmcCallStatus >= 0) {
-    *Jep106Code = (INT32)Args.Arg0;
+    *Jep106Code = (INT32)SmcParam;
   } else {
     Status = EFI_UNSUPPORTED;
   }
 
-  Args.Arg0 = SMCCC_ARCH_SOC_ID;
-  Args.Arg1 = 1;
-  ArmCallSmc (&Args);
-  SmcCallStatus = (INT32)Args.Arg0;
+  SmcParam      = 1;
+  SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);
 
   if (SmcCallStatus >= 0) {
-    *SocRevision = (INT32)Args.Arg0;
+    *SocRevision = (INT32)SmcParam;
   } else {
     Status = EFI_UNSUPPORTED;
   }
-- 
2.31.1


  parent reply	other threads:[~2021-12-13 18:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-13 18:30 [PATCH v3 0/2] ArmPkg: Add SMC helper functions Rebecca Cran
2021-12-13 18:30 ` [PATCH v3 1/2] " Rebecca Cran
2021-12-13 18:30 ` Rebecca Cran [this message]
2021-12-14 11:31 ` [PATCH v3 0/2] " Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211213183056.31444-3-rebecca@nuviainc.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox