ArmPsciResetSystemLib: read PSCI method in constructor

As this library is used in the implementation of a Runtime Service,
make sure to access dynamic PCDs only in the constructor.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16108 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ard Biesheuvel 2014-09-16 00:51:17 +00:00 committed by oliviermartin
parent 2efbf710e2
commit 021da07b66
2 changed files with 14 additions and 1 deletions

View File

@ -25,6 +25,18 @@
#include <IndustryStandard/ArmStdSmc.h> #include <IndustryStandard/ArmStdSmc.h>
STATIC UINT32 mArmPsciMethod;
RETURN_STATUS
EFIAPI
ArmPsciResetSystemLibConstructor (
VOID
)
{
mArmPsciMethod = PcdGet32 (PcdArmPsciMethod);
return RETURN_SUCCESS;
}
/** /**
Resets the entire platform. Resets the entire platform.
@ -69,7 +81,7 @@ LibResetSystem (
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
switch (PcdGet32 (PcdArmPsciMethod)) { switch (mArmPsciMethod) {
case 1: case 1:
ArmCallHvc (&ArmHvcArgs); ArmCallHvc (&ArmHvcArgs);
break; break;

View File

@ -21,6 +21,7 @@
MODULE_TYPE = BASE MODULE_TYPE = BASE
VERSION_STRING = 1.0 VERSION_STRING = 1.0
LIBRARY_CLASS = EfiResetSystemLib LIBRARY_CLASS = EfiResetSystemLib
CONSTRUCTOR = ArmPsciResetSystemLibConstructor
[Sources] [Sources]
ArmPsciResetSystemLib.c ArmPsciResetSystemLib.c