public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: zwei4 <david.wei@intel.com>
To: edk2-devel@lists.01.org
Cc: David Wei <david.wei@intel.com>, Mang Guo <mang.guo@intel.com>
Subject: [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] DMAR Table Installation.
Date: Tue, 17 Jul 2018 09:53:39 +0800	[thread overview]
Message-ID: <20180717015339.15776-1-david.wei@intel.com> (raw)

Move DMAR table into a separate FFS file to make it easier to be located and installed at proper time by VT-d library.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: David Wei <david.wei@intel.com>
CC: Mang Guo <mang.guo@intel.com>
---
 .../Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c     |   4 +-
 .../Common/Acpi/AcpiTablesPCAT/AcpiTables.inf      |   4 +-
 .../PlatformDsc/Components.IA32.dsc                |   8 +-
 .../BroxtonPlatformPkg/PlatformDsc/Components.dsc  |  18 +-
 Platform/BroxtonPlatformPkg/PlatformPkg.fdf        |   6 +
 Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec   |   2 +
 .../SouthCluster/AcpiTableDmar/AcpiTableDmar.inf   |  32 +++
 .../SouthCluster/AcpiTableDmar}/Dmar.aslc          |   2 +-
 .../SouthCluster/AcpiTableDmar}/Dmar.h             |   2 +-
 .../SouthCluster/Library/DxeVtdLib/DxeVtdLib.c     | 260 +++++++++++++++++----
 .../SouthCluster/Library/DxeVtdLib/DxeVtdLib.inf   |  12 +-
 11 files changed, 294 insertions(+), 56 deletions(-)
 create mode 100644 Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf
 rename {Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar => Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar}/Dmar.aslc (95%)
 rename {Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar => Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar}/Dmar.h (90%)

diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c
index c18753b61c..6a4d675eb2 100644
--- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c
+++ b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlatform.c
@@ -1,7 +1,7 @@
 /** @file
   ACPI Platform Driver.
 
-  Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -1081,7 +1081,7 @@ OnReadyToBoot (
   //
   // Update the DMAR Table
   //
-  UpdateDmarOnReadyToBoot (SetupVarBuffer.VTdEnable);
+  // UpdateDmarOnReadyToBoot (SetupVarBuffer.VTdEnable);
 
   //
   // Publish ACPI 1.0 or 2.0 Tables
diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf
index 1e456e3405..ea5da05602 100644
--- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf
+++ b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTables.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Component information file for the ACPI tables.
 #
-#  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -29,8 +29,6 @@
   Madt/Madt30.aslc
   Mcfg/Mcfg.aslc
   Hpet/Hpet.aslc
-  Dmar/Dmar.aslc
-  Dmar/Dmar.h
   Lpit/Lpit.aslc
   Lpit/Lpit.h
   SsdtRtd3/RvpRtd3.asl
diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc
index 8615ebc5c0..1aec4a9244 100644
--- a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc
+++ b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.IA32.dsc
@@ -210,4 +210,10 @@
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   SourceLevelDebugPkg/DebugAgentPei/DebugAgentPei.inf
-!endif
\ No newline at end of file
+!endif
+
+#
+# VT-d for DMA Protection
+#
+$(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformVTdInfoPei/PlatformVTdInfoPei.inf
+IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
\ No newline at end of file
diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
index f1bb26b9d9..15b75be4a5 100644
--- a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
+++ b/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc
@@ -18,7 +18,7 @@
   #
   MdeModulePkg/Core/Dxe/DxeMain.inf {
     <PcdsPatchableInModule>
-      gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000046
+      gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000047
     <LibraryClasses>
   !if $(DXE_CRC32_SECTION_ENABLE) == TRUE
       NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
@@ -26,7 +26,6 @@
   !if $(LZMA_ENABLE) == TRUE
       NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
   !endif
-     DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf 
   }
   MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
     <LibraryClasses>
@@ -544,4 +543,17 @@
   # Application
   #
   $(PLATFORM_PACKAGE_COMMON)/Application/FirmwareUpdate/FirmwareUpdate.inf
-
+  MdeModulePkg/Application/VariableInfo/VariableInfo.inf
+  
+  #
+  # VT-d for DMA Protection
+  #
+  $(PLATFORM_SI_PACKAGE)/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf
+  $(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformVTdDxe/PlatformVTdDxe.inf {
+    <PcdsPatchableInModule>
+      gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x0
+  }
+  IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf {
+    <PcdsPatchableInModule>
+      gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x0
+  }
\ No newline at end of file
diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf b/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
index 2e42acacc0..ca22f75965 100644
--- a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
+++ b/Platform/BroxtonPlatformPkg/PlatformPkg.fdf
@@ -763,6 +763,12 @@ APRIORI DXE {
   #
   INF  $(PLATFORM_PACKAGE_COMMON)/Acpi/UsbTypeCDxe/UsbTypeCDxe.inf
 
+  
+  #
+  # VT-d for MDA Protection
+  #
+  INF RuleOverride = ACPITABLE $(PLATFORM_SI_PACKAGE)/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf
+
 [FV.FVOBB]
   BlockSize          = $(FLASH_BLOCK_SIZE)
   FvAlignment        = 16
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec b/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec
index a28765f233..05508a4c18 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec
@@ -242,6 +242,8 @@
   gEfiBpdtLibBp1DataGuid                = { 0x7a4ecf02, 0xa1cf, 0x4e42, { 0xb6, 0x33, 0xfe, 0x95, 0x54, 0xbb, 0x60, 0xf8 } }
   gEfiBpdtLibBp2DataGuid                = { 0x75b0886e, 0xcd6a, 0x469f, { 0xae, 0x0b, 0x8c, 0xed, 0x90, 0x33, 0xd1, 0x99 } }
   
+  gAcpiDmarTableFileGuid                = { 0x6767abfe, 0x27d2, 0x41b3, { 0xa0, 0x84, 0xb8, 0xa8, 0x98, 0x24, 0xd3, 0x5a } }
+
 [Includes.common]
   Include
   Library
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf
new file mode 100644
index 0000000000..1e9fafab5a
--- /dev/null
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf
@@ -0,0 +1,32 @@
+## @file
+#  Component information file for the ACPI tables.
+#
+#  Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD License
+#  which accompanies this distribution. The full text of the license may be found at
+#  http://opensource.org/licenses/bsd-license.php.
+#
+#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+##
+
+[defines]
+  INF_VERSION                    = 0x00010005
+  BASE_NAME                      = AcpiTableDmar
+  FILE_GUID                      = 6767ABFE-27D2-41B3-A084-B8A89824D35A
+  MODULE_TYPE                    = USER_DEFINED
+  VERSION_STRING                 = 1.0
+  EDK_RELEASE_VERSION            = 0x00020000
+  EFI_SPECIFICATION_VERSION      = 0x00020000
+
+[sources.common]
+  Dmar.aslc
+  Dmar.h
+
+[Packages]
+  MdePkg/MdePkg.dec
+  BroxtonPlatformPkg/PlatformPkg.dec
+  BroxtonSiPkg/BroxtonSiPkg.dec
diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dmar.aslc b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.aslc
similarity index 95%
rename from Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dmar.aslc
rename to Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.aslc
index 98ffab2c86..8c0e172cc5 100644
--- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dmar.aslc
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.aslc
@@ -1,7 +1,7 @@
 /** @file
   ACPI DMA address Remapping table
 
-  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dmar.h b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.h
similarity index 90%
rename from Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dmar.h
rename to Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.h
index 558a96408e..eb886320c4 100644
--- a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dmar.h
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.h
@@ -2,7 +2,7 @@
   This file describes the contents of the ACPI DMA address Remapping
   Some additional ACPI values are defined in Acpi1_0.h and Acpi2_0.h.
 
-  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.c b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.c
index a21816ec38..80f37a664b 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.c
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.c
@@ -1,7 +1,7 @@
 /** @file
   This code provides a initialization of Intel VT-d (Virtualization Technology for Directed I/O).
 
-  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
@@ -527,66 +527,164 @@ UpdateDmarOnReadyToBoot (
   BOOLEAN   VtEnable
   )
 {
-  EFI_ACPI_DESCRIPTION_HEADER     *Table;
-  EFI_ACPI_SUPPORT_PROTOCOL       *AcpiSupport;
+  EFI_ACPI_TABLE_PROTOCOL         *AcpiTableProtocol;
   EFI_ACPI_TABLE_VERSION          Version;
   EFI_STATUS                      Status;
-  UINT8                           Index;
-  UINTN                           Handle;
-
-  AcpiSupport = NULL;
+  UINT16                          Index;
+  EFI_HANDLE                      *HandleBuffer;
+  UINTN                           NumberOfHandles;
+  EFI_FV_FILETYPE                 FileType;
+  UINT32                          FvStatus;
+  EFI_FV_FILE_ATTRIBUTES          Attributes;
+  UINTN                           Size;
+  INTN                            Instance;
+  EFI_ACPI_COMMON_HEADER          *CurrentTable;
+  UINTN                           AcpiTableHandle;
+  EFI_FIRMWARE_VOLUME2_PROTOCOL   *FwVol;
+  EFI_ACPI_DESCRIPTION_HEADER     *DmarAcpiTable;
+
+  AcpiTableProtocol = NULL;
+  DmarAcpiTable = NULL;
   Index       = 0;
 
   //
   // Locate ACPI support protocol
   //
-  Status = gBS->LocateProtocol (&gEfiAcpiSupportProtocolGuid, NULL, (VOID **) &AcpiSupport);
+  Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
   ASSERT_EFI_ERROR (Status);
 
-  //
-  // Find the DMAR ACPI table
-  //
-  do {
-    Status = AcpiSupport->GetAcpiTable(AcpiSupport, Index, (VOID **) &Table, &Version, &Handle);
-    if (Status == EFI_NOT_FOUND) {
+  ///
+  /// Locate protocol.
+  /// There is little chance we can't find an FV protocol
+  ///
+  Status = gBS->LocateHandleBuffer (
+                  ByProtocol,
+                  &gEfiFirmwareVolume2ProtocolGuid,
+                  NULL,
+                  &NumberOfHandles,
+                  &HandleBuffer
+                  );
+  ASSERT_EFI_ERROR (Status);
+
+  ///
+  /// Looking for FV with ACPI storage file
+  ///
+  for (Index = 0; Index < NumberOfHandles; Index++) {
+    ///
+    /// Get the protocol on this handle
+    /// This should not fail because of LocateHandleBuffer
+    ///
+    Status = gBS->HandleProtocol (
+                    HandleBuffer[Index],
+                    &gEfiFirmwareVolume2ProtocolGuid,
+                    (VOID **) &FwVol
+                    );
+    ASSERT_EFI_ERROR (Status);
+
+    ///
+    /// See if it has the ACPI storage file
+    ///
+    Size      = 0;
+    FvStatus  = 0;
+    Status = FwVol->ReadFile (
+                      FwVol,
+                      &gAcpiDmarTableFileGuid,
+                      NULL,
+                      &Size,
+                      &FileType,
+                      &Attributes,
+                      &FvStatus
+                      );
+
+    ///
+    /// If we found it, then we are done
+    ///
+    if (Status == EFI_SUCCESS) {
       break;
     }
-    ASSERT_EFI_ERROR(Status);
-    Index++;
-  } while (Table->Signature != EFI_ACPI_VTD_DMAR_TABLE_SIGNATURE);
-
-  DEBUG ((DEBUG_INFO, "DMAR ACPI Table: Address = 0x%x, Version = %u, Handle = %u\n", Table, Version, Handle));
-
-  if (VtEnable) {
-    //
-    // Update the DMAR table structure
-    //
-    DEBUG ((DEBUG_INFO, "DMAR ACPI table to be Installed \n"));
-    DmarTableUpdate (Table, &Version);
-  } else {
-    //
-    // Uninstall DMAR table
-    //
-    DEBUG ((DEBUG_INFO, "DMAR ACPI table to be Uninstalled \n"));
-    Table = NULL;
   }
-
-  //
-  // Update the DMAR ACPI table
-  //
-  Status = AcpiSupport->SetAcpiTable (
-                          AcpiSupport,
-                          Table,
-                          TRUE,
-                          Version,
-                          &Handle
+  ///
+  /// Our exit status is determined by the success of the previous operations
+  /// If the protocol was found, Instance already points to it.
+  ///
+  ///
+  /// Free any allocated buffers
+  ///
+  FreePool (HandleBuffer);
+
+  ///
+  /// Sanity check that we found our data file
+  ///
+  ASSERT (FwVol);
+  if (FwVol == NULL) {
+    return;
+  }
+  ///
+  /// By default, a table belongs in all ACPI table versions published.
+  ///
+  Version = EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | EFI_ACPI_TABLE_VERSION_3_0;
+
+  ///
+  /// Read tables from the storage file.
+  ///
+  Instance      = 0;
+  CurrentTable  = NULL;
+
+  while (Status == EFI_SUCCESS) {
+    Status = FwVol->ReadSection (
+                      FwVol,
+                      &gAcpiDmarTableFileGuid,
+                      EFI_SECTION_RAW,
+                      Instance,
+                      (VOID **) &CurrentTable,
+                      &Size,
+                      &FvStatus
+                      );
+
+    if (!EFI_ERROR (Status)) {
+      ///
+      /// Check the Signature ID to modify the table
+      ///
+      switch (((EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable)->Signature) {
+
+        case EFI_ACPI_VTD_DMAR_TABLE_SIGNATURE:
+          DmarAcpiTable = (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable;
+          DmarTableUpdate (DmarAcpiTable, &Version);
+          break;
+
+        default:
+          break;
+      }
+      ///
+      /// Increment the instance
+      ///
+      Instance++;
+      CurrentTable = NULL;
+    }
+  }
+  ///
+  /// Update the VTD table in the ACPI tables.
+  ///
+  AcpiTableHandle = 0;
+  if (DmarAcpiTable != NULL) {
+    DEBUG ((DEBUG_INFO, "Installing DMAR ACPI table.\n"));
+    Status = AcpiTableProtocol->InstallAcpiTable (
+                          AcpiTableProtocol,
+                          DmarAcpiTable,
+                          DmarAcpiTable->Length,
+                          &AcpiTableHandle
                           );
+    ASSERT_EFI_ERROR (Status);
+  }
+
 
   if (!EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_INFO, "DMAR ACPI table was successfully updated\n"));
+    DEBUG ((DEBUG_INFO, "DMAR ACPI table has been successfully installed and updated.\n"));
   } else {
     DEBUG ((DEBUG_ERROR, "Error updating the DMAR ACPI table\n"));
   }
+
+  EfiEventGroupSignal (&gEfiAcpi10TableGuid);
 }
 
 
@@ -629,6 +727,77 @@ UpdateRmrrUsbAddress (
 }
 
 
+/**
+  Notification function of ACPI Table change.
+
+  This is a notification function registered on ACPI Table change event.
+
+  @param  Event        Event whose notification function is being invoked.
+  @param  Context      Pointer to the notification function's context.
+
+**/
+VOID
+EFIAPI
+PciEnumerationCompleteCallback (
+  IN EFI_EVENT        Event,
+  IN VOID             *Context
+  )
+{
+  EFI_STATUS          Status;
+  SC_POLICY_HOB         *ScPolicy;
+  EFI_PEI_HOB_POINTERS  HobPtr;
+  SC_VTD_CONFIG         *VtdConfig;
+
+  gBS->CloseEvent (Event);
+
+  //
+  // Get SC VT-d config block
+  //
+  HobPtr.Guid = GetFirstGuidHob (&gScPolicyHobGuid);
+  ASSERT (HobPtr.Guid != NULL);
+  ScPolicy = (SC_POLICY_HOB*) GET_GUID_HOB_DATA (HobPtr.Guid);
+  Status = GetConfigBlock ((VOID *) ScPolicy, &gVtdConfigGuid, (VOID *) &VtdConfig);
+
+  if ((BOOLEAN)(UINT8)(VtdConfig->VtdEnable) == TRUE) {
+    UpdateDmarOnReadyToBoot ((BOOLEAN)(UINT8)(VtdConfig->VtdEnable));
+  }
+  
+}
+
+VOID
+InstallAcpiDmarTable (
+  BOOLEAN VtdEnable
+)
+{
+
+  VOID        *CallbackNotifyReg;
+  EFI_EVENT   CallbackEvent;
+  EFI_STATUS  Status;
+
+  Status = gBS->CreateEvent (
+                  EVT_NOTIFY_SIGNAL,
+                  TPL_CALLBACK,
+                  PciEnumerationCompleteCallback,
+                  NULL,
+                  &CallbackEvent
+                  );
+
+  ASSERT_EFI_ERROR (Status);
+
+
+  Status = gBS->RegisterProtocolNotify (
+                  &gEfiPciEnumerationCompleteProtocolGuid,
+                  CallbackEvent,
+                  &CallbackNotifyReg
+                  );
+  ASSERT_EFI_ERROR (Status);
+
+
+  return;
+
+}
+
+
 /**
   Locate the VT-d ACPI tables data file and update it based on current configuration and capabilities.
 
@@ -676,6 +845,11 @@ VtdInit (
   //
   UpdateRmrrUsbAddress (VtdConfig);
 
+  //
+  // Register callback function for updating DMAR table.
+  //
+  InstallAcpiDmarTable ((BOOLEAN)(VtdConfig->VtdEnable));
+  
   DEBUG ((DEBUG_INFO, "VtdInit () - End\n"));
 
   return EFI_SUCCESS;
diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.inf b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.inf
index 4f22249ac7..801e094db0 100644
--- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.inf
+++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtdLib.inf
@@ -1,7 +1,7 @@
 ## @file
 #  Library for Intel VT-d.
 #
-#  Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.<BR>
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions of the BSD License
@@ -33,10 +33,18 @@
 [Guids]
   gVtdConfigGuid
   gScPolicyHobGuid
+  gEfiAcpi10TableGuid
+  gEfiAcpi20TableGuid
 
 [Protocols]
   gEfiAcpiSupportProtocolGuid     ## CONSUMES
-
+  gEfiFirmwareVolume2ProtocolGuid ## CONSUMES
+  gEfiPciEnumerationCompleteProtocolGuid ## CONSUMES
+  
+[Guids]
+  gAcpiDmarTableFileGuid
+  gEfiAcpi10TableGuid
+  
 [Packages]
   MdePkg/MdePkg.dec
   BroxtonSiPkg/BroxtonSiPkg.dec
-- 
2.14.1.windows.1



                 reply	other threads:[~2018-07-17  1:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180717015339.15776-1-david.wei@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox