From nobody Thu May 2 23:30:29 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1531792429868669.0580319169774; Mon, 16 Jul 2018 18:53:49 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 2A7492098877A; Mon, 16 Jul 2018 18:53:49 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9A3FB20988750 for ; Mon, 16 Jul 2018 18:53:47 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 18:53:46 -0700 Received: from zwei4-mobl1.ccr.corp.intel.com ([10.239.193.155]) by orsmga003.jf.intel.com with ESMTP; 16 Jul 2018 18:53:45 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=david.wei@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,364,1526367600"; d="scan'208";a="67479919" From: zwei4 To: edk2-devel@lists.01.org Date: Tue, 17 Jul 2018 09:53:39 +0800 Message-Id: <20180717015339.15776-1-david.wei@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 Subject: [edk2] [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] DMAR Table Installation. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Wei MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move DMAR table into a separate FFS file to make it easier to be located an= d installed at proper time by VT-d library. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: David Wei CC: Mang Guo --- .../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/AcpiTableD= mar/AcpiTableDmar.inf rename {Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar =3D> S= ilicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar}/Dmar.aslc (95%) rename {Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar =3D> S= ilicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar}/Dmar.h (90%) diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPl= atform.c b/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiPlatformDxe/AcpiPlat= form.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. =20 - Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.
+ Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License @@ -1081,7 +1081,7 @@ OnReadyToBoot ( // // Update the DMAR Table // - UpdateDmarOnReadyToBoot (SetupVarBuffer.VTdEnable); + // UpdateDmarOnReadyToBoot (SetupVarBuffer.VTdEnable); =20 // // Publish ACPI 1.0 or 2.0 Tables diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/AcpiTab= les.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.
+# Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD 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 @@ =20 !if $(SOURCE_DEBUG_ENABLE) =3D=3D TRUE SourceLevelDebugPkg/DebugAgentPei/DebugAgentPei.inf -!endif \ No newline at end of file +!endif + +# +# VT-d for DMA Protection +# +$(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformVTdInfoPei/PlatformVTd= InfoPei.inf +IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf \ No newline at end of file diff --git a/Platform/BroxtonPlatformPkg/PlatformDsc/Components.dsc b/Platf= orm/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 { - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000046 + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000047 !if $(DXE_CRC32_SECTION_ENABLE) =3D=3D TRUE NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu= idedSectionExtractLib.inf @@ -26,7 +26,6 @@ !if $(LZMA_ENABLE) =3D=3D TRUE NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCus= tomDecompressLib.inf !endif - DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf=20 } MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { @@ -544,4 +543,17 @@ # Application # $(PLATFORM_PACKAGE_COMMON)/Application/FirmwareUpdate/FirmwareUpdate.inf - + MdeModulePkg/Application/VariableInfo/VariableInfo.inf + =20 + # + # VT-d for DMA Protection + # + $(PLATFORM_SI_PACKAGE)/SouthCluster/AcpiTableDmar/AcpiTableDmar.inf + $(PLATFORM_PACKAGE_COMMON)/PlatformSettings/PlatformVTdDxe/PlatformVTdDx= e.inf { + + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x0 + } + IntelSiliconPkg/Feature/VTd/IntelVTdDxe/IntelVTdDxe.inf { + + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x0 + } \ No newline at end of file diff --git a/Platform/BroxtonPlatformPkg/PlatformPkg.fdf b/Platform/Broxton= PlatformPkg/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 =20 + =20 + # + # VT-d for MDA Protection + # + INF RuleOverride =3D ACPITABLE $(PLATFORM_SI_PACKAGE)/SouthCluster/AcpiT= ableDmar/AcpiTableDmar.inf + [FV.FVOBB] BlockSize =3D $(FLASH_BLOCK_SIZE) FvAlignment =3D 16 diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec b/Silicon/Bro= xtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec index a28765f233..05508a4c18 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/BroxtonSiPkg.dec @@ -242,6 +242,8 @@ gEfiBpdtLibBp1DataGuid =3D { 0x7a4ecf02, 0xa1cf, 0x4e42, = { 0xb6, 0x33, 0xfe, 0x95, 0x54, 0xbb, 0x60, 0xf8 } } gEfiBpdtLibBp2DataGuid =3D { 0x75b0886e, 0xcd6a, 0x469f, = { 0xae, 0x0b, 0x8c, 0xed, 0x90, 0x33, 0xd1, 0x99 } } =20 + gAcpiDmarTableFileGuid =3D { 0x6767abfe, 0x27d2, 0x41b3, = { 0xa0, 0x84, 0xb8, 0xa8, 0x98, 0x24, 0xd3, 0x5a } } + [Includes.common] Include Library diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Acp= iTableDmar.inf b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar= /AcpiTableDmar.inf new file mode 100644 index 0000000000..1e9fafab5a --- /dev/null +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/AcpiTableD= mar.inf @@ -0,0 +1,32 @@ +## @file +# Component information file for the ACPI tables. +# +# Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
+# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD License +# which accompanies this distribution. The full text of the license may b= e 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 IM= PLIED. +# +## + +[defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D AcpiTableDmar + FILE_GUID =3D 6767ABFE-27D2-41B3-A084-B8A89824D35A + MODULE_TYPE =3D USER_DEFINED + VERSION_STRING =3D 1.0 + EDK_RELEASE_VERSION =3D 0x00020000 + EFI_SPECIFICATION_VERSION =3D 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/Dm= ar.aslc b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.a= slc similarity index 95% rename from Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dma= r.aslc rename to Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.a= slc 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 =20 - Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License diff --git a/Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dm= ar.h b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/AcpiTableDmar/Dmar.h similarity index 90% rename from Platform/BroxtonPlatformPkg/Common/Acpi/AcpiTablesPCAT/Dmar/Dma= r.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. =20 - Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D License diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib= /DxeVtdLib.c b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdL= ib/DxeVtdLib.c index a21816ec38..80f37a664b 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtd= Lib.c +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtd= Lib.c @@ -1,7 +1,7 @@ /** @file This code provides a initialization of Intel VT-d (Virtualization Techno= logy for Directed I/O). =20 - Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.
+ Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made available under the terms and conditions of the BS= D 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 =3D 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 =3D NULL; + DmarAcpiTable =3D NULL; Index =3D 0; =20 // // Locate ACPI support protocol // - Status =3D gBS->LocateProtocol (&gEfiAcpiSupportProtocolGuid, NULL, (VOI= D **) &AcpiSupport); + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID = **) &AcpiTableProtocol); ASSERT_EFI_ERROR (Status); =20 - // - // Find the DMAR ACPI table - // - do { - Status =3D AcpiSupport->GetAcpiTable(AcpiSupport, Index, (VOID **) &Ta= ble, &Version, &Handle); - if (Status =3D=3D EFI_NOT_FOUND) { + /// + /// Locate protocol. + /// There is little chance we can't find an FV protocol + /// + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiFirmwareVolume2ProtocolGuid, + NULL, + &NumberOfHandles, + &HandleBuffer + ); + ASSERT_EFI_ERROR (Status); + + /// + /// Looking for FV with ACPI storage file + /// + for (Index =3D 0; Index < NumberOfHandles; Index++) { + /// + /// Get the protocol on this handle + /// This should not fail because of LocateHandleBuffer + /// + Status =3D gBS->HandleProtocol ( + HandleBuffer[Index], + &gEfiFirmwareVolume2ProtocolGuid, + (VOID **) &FwVol + ); + ASSERT_EFI_ERROR (Status); + + /// + /// See if it has the ACPI storage file + /// + Size =3D 0; + FvStatus =3D 0; + Status =3D FwVol->ReadFile ( + FwVol, + &gAcpiDmarTableFileGuid, + NULL, + &Size, + &FileType, + &Attributes, + &FvStatus + ); + + /// + /// If we found it, then we are done + /// + if (Status =3D=3D EFI_SUCCESS) { break; } - ASSERT_EFI_ERROR(Status); - Index++; - } while (Table->Signature !=3D EFI_ACPI_VTD_DMAR_TABLE_SIGNATURE); - - DEBUG ((DEBUG_INFO, "DMAR ACPI Table: Address =3D 0x%x, Version =3D %u, = Handle =3D %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 =3D NULL; } - - // - // Update the DMAR ACPI table - // - Status =3D AcpiSupport->SetAcpiTable ( - AcpiSupport, - Table, - TRUE, - Version, - &Handle + /// + /// Our exit status is determined by the success of the previous operati= ons + /// 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 =3D=3D NULL) { + return; + } + /// + /// By default, a table belongs in all ACPI table versions published. + /// + Version =3D EFI_ACPI_TABLE_VERSION_1_0B | EFI_ACPI_TABLE_VERSION_2_0 | E= FI_ACPI_TABLE_VERSION_3_0; + + /// + /// Read tables from the storage file. + /// + Instance =3D 0; + CurrentTable =3D NULL; + + while (Status =3D=3D EFI_SUCCESS) { + Status =3D 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 =3D (EFI_ACPI_DESCRIPTION_HEADER *) CurrentTable; + DmarTableUpdate (DmarAcpiTable, &Version); + break; + + default: + break; + } + /// + /// Increment the instance + /// + Instance++; + CurrentTable =3D NULL; + } + } + /// + /// Update the VTD table in the ACPI tables. + /// + AcpiTableHandle =3D 0; + if (DmarAcpiTable !=3D NULL) { + DEBUG ((DEBUG_INFO, "Installing DMAR ACPI table.\n")); + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + DmarAcpiTable, + DmarAcpiTable->Length, + &AcpiTableHandle ); + ASSERT_EFI_ERROR (Status); + } + =20 if (!EFI_ERROR (Status)) { - DEBUG ((DEBUG_INFO, "DMAR ACPI table was successfully updated\n")); + DEBUG ((DEBUG_INFO, "DMAR ACPI table has been successfully installed a= nd updated.\n")); } else { DEBUG ((DEBUG_ERROR, "Error updating the DMAR ACPI table\n")); } + + EfiEventGroupSignal (&gEfiAcpi10TableGuid); } =20 =20 @@ -629,6 +727,77 @@ UpdateRmrrUsbAddress ( } =20 =20 +/** + 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 =3D GetFirstGuidHob (&gScPolicyHobGuid); + ASSERT (HobPtr.Guid !=3D NULL); + ScPolicy =3D (SC_POLICY_HOB*) GET_GUID_HOB_DATA (HobPtr.Guid); + Status =3D GetConfigBlock ((VOID *) ScPolicy, &gVtdConfigGuid, (VOID *) = &VtdConfig); + + if ((BOOLEAN)(UINT8)(VtdConfig->VtdEnable) =3D=3D TRUE) { + UpdateDmarOnReadyToBoot ((BOOLEAN)(UINT8)(VtdConfig->VtdEnable)); + } + =20 +} + +VOID +InstallAcpiDmarTable ( + BOOLEAN VtdEnable +) +{ + + VOID *CallbackNotifyReg; + EFI_EVENT CallbackEvent; + EFI_STATUS Status; + + Status =3D gBS->CreateEvent ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + PciEnumerationCompleteCallback, + NULL, + &CallbackEvent + ); + + ASSERT_EFI_ERROR (Status); + + + Status =3D gBS->RegisterProtocolNotify ( + &gEfiPciEnumerationCompleteProtocolGuid, + CallbackEvent, + &CallbackNotifyReg + ); + ASSERT_EFI_ERROR (Status); + + + return; + +} + + /** Locate the VT-d ACPI tables data file and update it based on current con= figuration and capabilities. =20 @@ -676,6 +845,11 @@ VtdInit ( // UpdateRmrrUsbAddress (VtdConfig); =20 + // + // Register callback function for updating DMAR table. + // + InstallAcpiDmarTable ((BOOLEAN)(VtdConfig->VtdEnable)); + =20 DEBUG ((DEBUG_INFO, "VtdInit () - End\n")); =20 return EFI_SUCCESS; diff --git a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib= /DxeVtdLib.inf b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVt= dLib/DxeVtdLib.inf index 4f22249ac7..801e094db0 100644 --- a/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtd= Lib.inf +++ b/Silicon/BroxtonSoC/BroxtonSiPkg/SouthCluster/Library/DxeVtdLib/DxeVtd= Lib.inf @@ -1,7 +1,7 @@ ## @file # Library for Intel VT-d. # -# Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the B= SD License @@ -33,10 +33,18 @@ [Guids] gVtdConfigGuid gScPolicyHobGuid + gEfiAcpi10TableGuid + gEfiAcpi20TableGuid =20 [Protocols] gEfiAcpiSupportProtocolGuid ## CONSUMES - + gEfiFirmwareVolume2ProtocolGuid ## CONSUMES + gEfiPciEnumerationCompleteProtocolGuid ## CONSUMES + =20 +[Guids] + gAcpiDmarTableFileGuid + gEfiAcpi10TableGuid + =20 [Packages] MdePkg/MdePkg.dec BroxtonSiPkg/BroxtonSiPkg.dec --=20 2.14.1.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel