Fix DMA does not work issue when system memory is not
greater than 4G.

Cc: Jiewen Yao <jiewen....@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.z...@intel.com>
---
 IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c 
b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
index cecb5d23efbf..7f64d5e418f6 100644
--- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
+++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c
@@ -286,11 +286,14 @@ CreateSecondLevelPagingEntry (
   if (SecondLevelPagingEntry == NULL) {
     return NULL;
   }
-  SecondLevelPagingEntry = CreateSecondLevelPagingEntryTable (VtdIndex, 
SecondLevelPagingEntry, SIZE_4GB, mAbove4GMemoryLimit, IoMmuAccess);
-  if (SecondLevelPagingEntry == NULL) {
-    return NULL;
-  }
 
+  if (mAbove4GMemoryLimit != 0) {
+    ASSERT (mAbove4GMemoryLimit > BASE_4GB);
+    SecondLevelPagingEntry = CreateSecondLevelPagingEntryTable (VtdIndex, 
SecondLevelPagingEntry, SIZE_4GB, mAbove4GMemoryLimit, IoMmuAccess);
+    if (SecondLevelPagingEntry == NULL) {
+      return NULL;
+    }
+  }
   return SecondLevelPagingEntry;
 }
 
-- 
2.7.0.windows.1

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

Reply via email to