From 1d4c17a6ef1a06023cb533d108556c419bdb1fed Mon Sep 17 00:00:00 2001 From: Star Zeng Date: Wed, 17 Jan 2018 19:33:30 +0800 Subject: [PATCH 1/1] IntelSiliconPkg IntelVTdDxe: Fix DMA does not work issue Fix DMA does not work issue when system memory is not greater than 4G. Cc: Jiewen Yao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao --- .../Feature/VTd/IntelVTdDxe/TranslationTable.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c index cecb5d23ef..7bdc4a5146 100644 --- a/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c +++ b/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/TranslationTable.c @@ -286,9 +286,13 @@ 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.39.2