diff mbox

[edk2,v2,2/2] ArmVExpressPkg: disallow the use of ArmVExpressSysConfigLib at runtime

Message ID 1430377926-18431-3-git-send-email-ard.biesheuvel@linaro.org
State New
Headers show

Commit Message

Ard Biesheuvel April 30, 2015, 7:12 a.m. UTC
The ArmVExpressSysConfigLib library does not (and cannot) runtime
remap its MMIO registers, so return RETURN_UNSUPPORTED when trying
to use it after calling SetVirtualAddressMap().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c      | 6 ++++++
 ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf | 1 +
 2 files changed, 7 insertions(+)
diff mbox

Patch

diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c
index 6dfbacd11762..83b71aa2c1ad 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c
+++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c
@@ -13,8 +13,10 @@ 
 **/
 
 #include <Base.h>
+#include <Uefi.h>
 #include <Library/IoLib.h>
 #include <Library/DebugLib.h>
+#include <Library/UefiRuntimeLib.h>
 
 #include <Library/ArmPlatformSysConfigLib.h>
 #include <ArmPlatform.h>
@@ -72,6 +74,10 @@  AccessSysCfgRegister (
 {
   UINT32          SysCfgCtrl;
 
+  if (EfiGoneVirtual()) {
+    return RETURN_UNSUPPORTED;
+  }
+
   // Clear the COMPLETE bit
   MmioAnd32(ARM_VE_SYS_CFGSTAT_REG, ~SYS_CFGSTAT_COMPLETE);
 
diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
index c1647756efbe..268202cc2038 100644
--- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
+++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressSysConfigLib/ArmVExpressSysConfigLib.inf
@@ -33,3 +33,4 @@ 
 [LibraryClasses]
   BaseLib
   IoLib
+  UefiRuntimeLib