ArmPkg/ArmPsciResetSystemLib: Made the library only using SMC

Only ArmVirtualizationPkg based platforms are expected to use
the dynamic method to choose between SMC and HVC to invoke PSCI.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16204 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin
2014-10-10 11:22:50 +00:00
committed by oliviermartin
parent 3a0e4800a3
commit 9180ab73e6
9 changed files with 186 additions and 48 deletions

View File

@@ -1,8 +1,12 @@
/** @file
Support ResetSystem Runtime call using PSCI calls
Note: A similar library is implemented in
ArmPlatformPkg/ArmVirtualizationPkg/Library/ArmVirtualizationPsciResetSystemLib
So similar issues might exist in this implementation too.
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
Copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>
This program and the accompanying materials
@@ -21,22 +25,9 @@
#include <Library/DebugLib.h>
#include <Library/EfiResetSystemLib.h>
#include <Library/ArmSmcLib.h>
#include <Library/ArmHvcLib.h>
#include <IndustryStandard/ArmStdSmc.h>
STATIC UINT32 mArmPsciMethod;
RETURN_STATUS
EFIAPI
ArmPsciResetSystemLibConstructor (
VOID
)
{
mArmPsciMethod = PcdGet32 (PcdArmPsciMethod);
return RETURN_SUCCESS;
}
/**
Resets the entire platform.
@@ -58,10 +49,8 @@ LibResetSystem (
)
{
ARM_SMC_ARGS ArmSmcArgs;
ARM_HVC_ARGS ArmHvcArgs;
switch (ResetType) {
case EfiResetPlatformSpecific:
// Map the platform specific reset as reboot
case EfiResetWarm:
@@ -69,31 +58,17 @@ LibResetSystem (
case EfiResetCold:
// Send a PSCI 0.2 SYSTEM_RESET command
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_RESET;
break;
case EfiResetShutdown:
// Send a PSCI 0.2 SYSTEM_OFF command
ArmSmcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
ArmHvcArgs.Arg0 = ARM_SMC_ID_PSCI_SYSTEM_OFF;
break;
default:
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
switch (mArmPsciMethod) {
case 1:
ArmCallHvc (&ArmHvcArgs);
break;
case 2:
ArmCallSmc (&ArmSmcArgs);
break;
default:
DEBUG ((EFI_D_ERROR, "%a: no PSCI method defined\n", __FUNCTION__));
return EFI_UNSUPPORTED;
}
ArmCallSmc (&ArmSmcArgs);
// We should never be here
DEBUG ((EFI_D_ERROR, "%a: PSCI Reset failed\n", __FUNCTION__));