From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web08.47933.1638771381922780383 for ; Sun, 05 Dec 2021 22:16:22 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: k.kavyax.sravanthi@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10189"; a="224508192" X-IronPort-AV: E=Sophos;i="5.87,290,1631602800"; d="scan'208";a="224508192" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 22:16:21 -0800 X-IronPort-AV: E=Sophos;i="5.87,290,1631602800"; d="scan'208";a="542282705" Received: from ksravanx-mobl1.gar.corp.intel.com ([10.215.128.173]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2021 22:16:18 -0800 From: "kavya" To: devel@edk2.groups.io Cc: kavya , Chasel Chiu , Nate DeSimone , Liming Gao , Eric Dong Subject: [Patch V2] MinPlatformPkg: Check if Acpi table is already installed. Date: Mon, 6 Dec 2021 11:46:10 +0530 Message-Id: <20211206061610.3316-1-k.kavyax.sravanthi@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Check if Acpi table is already installed by locating the first ACPI table in XSDT/RSDT based on Signature Cc: Chasel Chiu Cc: Nate DeSimone Cc: Liming Gao Cc: Eric Dong Signed-off-by: kavya Reviewed-by: Zhiguang Liu --- Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c index 785cf4c2f9..dcbb8b7c7f 100644 --- a/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c +++ b/Platform/Intel/MinPlatformPkg/Acpi/AcpiTables/AcpiPlatform.c @@ -1048,12 +1048,21 @@ InstallMcfgFromScratch ( { EFI_STATUS Status; EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HEADER *McfgTable; + EFI_ACPI_COMMON_HEADER *Mcfg; EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ADDRESS_ALLOCATION_STRUCTURE *Segment; UINTN Index; UINTN SegmentCount; PCI_SEGMENT_INFO *PciSegmentInfo; UINTN TableHandle; + Mcfg = (EFI_ACPI_COMMON_HEADER *) EfiLocateFirstAcpiTable ( + EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE + ); + if (Mcfg != NULL) { + DEBUG ((DEBUG_INFO, "MCFG table already installed\n")); + return EFI_SUCCESS; + } + PciSegmentInfo = GetPciSegmentInfo (&SegmentCount); McfgTable = AllocateZeroPool ( @@ -1365,6 +1374,7 @@ UpdateLocalTable ( { EFI_STATUS Status; EFI_ACPI_COMMON_HEADER *CurrentTable; + EFI_ACPI_COMMON_HEADER *Table; EFI_ACPI_TABLE_VERSION Version; UINTN TableHandle; UINTN Index; @@ -1372,6 +1382,14 @@ UpdateLocalTable ( for (Index = 0; Index < sizeof(mLocalTable)/sizeof(mLocalTable[0]); Index++) { CurrentTable = mLocalTable[Index]; + Table = (EFI_ACPI_COMMON_HEADER *) EfiLocateFirstAcpiTable (CurrentTable->Signature); + if (Table != NULL) { + DEBUG ((DEBUG_INFO, "Acpi table with signature=%c%c%c%c already installed\n", + ((CHAR8*)&CurrentTable->Signature)[0], ((CHAR8*)&CurrentTable->Signature)[1], + ((CHAR8*)&CurrentTable->Signature)[2], ((CHAR8*)&CurrentTable->Signature)[3])); + continue; + } + PlatformUpdateTables (CurrentTable, &Version); TableHandle = 0; -- 2.16.2.windows.1