]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPsciResetSystemLib: read PSCI method in constructor
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Tue, 16 Sep 2014 00:51:17 +0000 (00:51 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 16 Sep 2014 00:51:17 +0000 (00:51 +0000)
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

ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.c
ArmPkg/Library/ArmPsciResetSystemLib/ArmPsciResetSystemLib.inf

index 48c8735a227091e575a2ee70088e3ec51f1cc4a2..286d37fb47b1bf5cf2e999443dd1ecd1968e98b8 100644 (file)
 \r
 #include <IndustryStandard/ArmStdSmc.h>\r
 \r
+STATIC UINT32 mArmPsciMethod;\r
+\r
+RETURN_STATUS\r
+EFIAPI\r
+ArmPsciResetSystemLibConstructor (\r
+  VOID\r
+  )\r
+{\r
+  mArmPsciMethod = PcdGet32 (PcdArmPsciMethod);\r
+  return RETURN_SUCCESS;\r
+}\r
+\r
 /**\r
   Resets the entire platform.\r
 \r
@@ -69,7 +81,7 @@ LibResetSystem (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
-  switch (PcdGet32 (PcdArmPsciMethod)) {\r
+  switch (mArmPsciMethod) {\r
   case 1:\r
     ArmCallHvc (&ArmHvcArgs);\r
     break;\r
index bcea0aeb31aca2ac8048f72ea40465ad0622301f..1a5bb6d10dc276aa49cd8fc69ac96cbd484d07b0 100644 (file)
@@ -21,6 +21,7 @@
   MODULE_TYPE                    = BASE\r
   VERSION_STRING                 = 1.0\r
   LIBRARY_CLASS                  = EfiResetSystemLib\r
+  CONSTRUCTOR                    = ArmPsciResetSystemLibConstructor\r
 \r
 [Sources]\r
   ArmPsciResetSystemLib.c\r