summaryrefslogtreecommitdiff
path: root/ArmPkg
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2014-09-16 00:51:17 +0000
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>2014-09-16 00:51:17 +0000
commit021da07b666c1b1ecac7e82ab9e416a1ddd964c0 (patch)
tree5c39b3f306ac71ebf27c507901e98e1eb865f680 /ArmPkg
parent2efbf710e27a78494cef38673b85ed360ec3b600 (diff)
downloadedk2-platforms-021da07b666c1b1ecac7e82ab9e416a1ddd964c0.tar.xz
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
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c14
-rw-r--r--ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf1
2 files changed, 14 insertions, 1 deletions
diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
index 48c8735a22..286d37fb47 100644
--- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
+++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
@@ -25,6 +25,18 @@
#include <IndustryStandard/ArmStdSmc.h>
+STATIC UINT32 mArmPsciMethod;
+
+RETURN_STATUS
+EFIAPI
+ArmPsciResetSystemLibConstructor (
+ VOID
+ )
+{
+ mArmPsciMethod = PcdGet32 (PcdArmPsciMethod);
+ return RETURN_SUCCESS;
+}
+
/**
Resets the entire platform.
@@ -69,7 +81,7 @@ LibResetSystem (
return EFI_UNSUPPORTED;
}
- switch (PcdGet32 (PcdArmPsciMethod)) {
+ switch (mArmPsciMethod) {
case 1:
ArmCallHvc (&ArmHvcArgs);
break;
diff --git a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
index bcea0aeb31..1a5bb6d10d 100644
--- a/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
+++ b/ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf
@@ -21,6 +21,7 @@
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = EfiResetSystemLib
+ CONSTRUCTOR = ArmPsciResetSystemLibConstructor
[Sources]
ArmPsciResetSystemLib.c