ArmPkg: Update SMC calls to use the new ArmCallSmc0/1/2/3 functions

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>
This commit is contained in:
Rebecca Cran 2021-12-13 11:30:56 -07:00 committed by mergify[bot]
parent 4d30352445
commit c039fa7ff0
2 changed files with 18 additions and 32 deletions

View File

@ -31,11 +31,8 @@ ResetCold (
VOID VOID
) )
{ {
ARM_SMC_ARGS ArmSmcArgs;
// Send a PSCI 0.2 SYSTEM_RESET command // Send a PSCI 0.2 SYSTEM_RESET command
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET; ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_RESET, NULL, NULL, NULL);
ArmCallSmc (&ArmSmcArgs);
} }
/** /**
@ -66,11 +63,8 @@ ResetShutdown (
VOID VOID
) )
{ {
ARM_SMC_ARGS ArmSmcArgs;
// Send a PSCI 0.2 SYSTEM_OFF command // Send a PSCI 0.2 SYSTEM_OFF command
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF; ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_OFF, NULL, NULL, NULL);
ArmCallSmc (&ArmSmcArgs);
} }
/** /**

View File

@ -88,22 +88,18 @@ HasSmcArm64SocId (
VOID VOID
) )
{ {
ARM_SMC_ARGS Args; INT32 SmcCallStatus;
INT32 SmcCallStatus; BOOLEAN Arm64SocIdSupported;
BOOLEAN Arm64SocIdSupported; UINTN SmcParam;
Arm64SocIdSupported = FALSE; Arm64SocIdSupported = FALSE;
Args.Arg0 = SMCCC_VERSION; SmcCallStatus = ArmCallSmc0 (SMCCC_VERSION, NULL, NULL, NULL);
ArmCallSmc (&Args);
SmcCallStatus = (INT32)Args.Arg0;
if ((SmcCallStatus < 0) || ((SmcCallStatus >> 16) >= 1)) { if ((SmcCallStatus < 0) || ((SmcCallStatus >> 16) >= 1)) {
Args.Arg0 = SMCCC_ARCH_FEATURES; SmcParam = SMCCC_ARCH_SOC_ID;
Args.Arg1 = SMCCC_ARCH_SOC_ID; SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_FEATURES, &SmcParam, NULL, NULL);
ArmCallSmc (&Args); if (SmcCallStatus >= 0) {
if (Args.Arg0 >= 0) {
Arm64SocIdSupported = TRUE; Arm64SocIdSupported = TRUE;
} }
} }
@ -125,30 +121,26 @@ SmbiosGetSmcArm64SocId (
OUT INT32 *SocRevision OUT INT32 *SocRevision
) )
{ {
ARM_SMC_ARGS Args; INT32 SmcCallStatus;
INT32 SmcCallStatus; EFI_STATUS Status;
EFI_STATUS Status; UINTN SmcParam;
Status = EFI_SUCCESS; Status = EFI_SUCCESS;
Args.Arg0 = SMCCC_ARCH_SOC_ID; SmcParam = 0;
Args.Arg1 = 0; SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);
ArmCallSmc (&Args);
SmcCallStatus = (INT32)Args.Arg0;
if (SmcCallStatus >= 0) { if (SmcCallStatus >= 0) {
*Jep106Code = (INT32)Args.Arg0; *Jep106Code = (INT32)SmcParam;
} else { } else {
Status = EFI_UNSUPPORTED; Status = EFI_UNSUPPORTED;
} }
Args.Arg0 = SMCCC_ARCH_SOC_ID; SmcParam = 1;
Args.Arg1 = 1; SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);
ArmCallSmc (&Args);
SmcCallStatus = (INT32)Args.Arg0;
if (SmcCallStatus >= 0) { if (SmcCallStatus >= 0) {
*SocRevision = (INT32)Args.Arg0; *SocRevision = (INT32)SmcParam;
} else { } else {
Status = EFI_UNSUPPORTED; Status = EFI_UNSUPPORTED;
} }