[edk2] [PATCH 2/2] IntelSiliconPkg/IntelVtd: Consume VTd policy PCD

Jiewen Yao posted 2 patches 7 years, 3 months ago
[edk2] [PATCH 2/2] IntelSiliconPkg/IntelVtd: Consume VTd policy PCD
Posted by Jiewen Yao 7 years, 3 months ago
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 IntelSiliconPkg/IntelVTdDxe/DmaProtection.c | 7 +++++--
 IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.c   | 4 ++++
 IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.inf | 3 +++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/IntelSiliconPkg/IntelVTdDxe/DmaProtection.c b/IntelSiliconPkg/IntelVTdDxe/DmaProtection.c
index 82ed4d2..f5de01f 100644
--- a/IntelSiliconPkg/IntelVTdDxe/DmaProtection.c
+++ b/IntelSiliconPkg/IntelVTdDxe/DmaProtection.c
@@ -437,8 +437,11 @@ OnExitBootServices (
 {
   DEBUG ((DEBUG_INFO, "Vtd OnExitBootServices\n"));
   DumpVtdRegsAll ();
-  DisableDmar ();
-  DumpVtdRegsAll ();
+
+  if ((PcdGet8(PcdVTdPolicyPropertyMask) & BIT1) == 0) {
+    DisableDmar ();
+    DumpVtdRegsAll ();
+  }
 }
 
 /**
diff --git a/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.c b/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.c
index 24b88c3..64693a8 100644
--- a/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.c
+++ b/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.c
@@ -352,6 +352,10 @@ IntelVTdInitialize (
   EFI_STATUS  Status;
   EFI_HANDLE  Handle;
 
+  if ((PcdGet8(PcdVTdPolicyPropertyMask) & BIT0) == 0) {
+    return EFI_UNSUPPORTED;
+  }
+
   InitializeDmaProtection ();
 
   Handle = NULL;
diff --git a/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.inf b/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.inf
index 697932e..d45fd67 100644
--- a/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.inf
+++ b/IntelSiliconPkg/IntelVTdDxe/IntelVTdDxe.inf
@@ -73,6 +73,9 @@
   gEfiPciEnumerationCompleteProtocolGuid      ## CONSUMES
   gEdkiiPlatformVTdPolicyProtocolGuid         ## SOMETIMES_CONSUMES
 
+[Pcd]
+  gIntelSiliconPkgTokenSpaceGuid.PcdVTdPolicyPropertyMask   ## CONSUMES
+
 [Depex]
   gEfiPciRootBridgeIoProtocolGuid AND
   gEfiAcpiSdtProtocolGuid
-- 
2.7.4.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel