diff mbox

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

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

Commit Message

Ard Biesheuvel May 1, 2015, 3:35 p.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>
---
 .../Library/ArmVExpressSysConfigLib/ArmVExpressSysConfig.c          | 6 ++++++
 .../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..87ecb63c6c23 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