mirror of https://github.com/acidanthera/audk.git
UefiCpuPkg PiSmmCpuDxeSmm: Use new EfiLocateFirstAcpiTable()
https://bugzilla.tianocore.org/show_bug.cgi?id=967 Request to add a library function for GetAcpiTable() in order to get ACPI table using signature as input. After evaluation, we found there are many duplicated code to find ACPI table by signature in different modules. This patch updates PiSmmCpuDxeSmm to use new EfiLocateFirstAcpiTable() and remove the duplicated code. Cc: Younas khan <pmdyounaskhan786@gmail.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
cb6fe7bb8b
commit
4c214f8229
|
@ -4,7 +4,7 @@
|
|||
# This SMM driver performs SMM initialization, deploy SMM Entry Vector,
|
||||
# provides CPU specific services in SMM.
|
||||
#
|
||||
# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
|
@ -112,8 +112,6 @@
|
|||
|
||||
[Guids]
|
||||
gEfiAcpiVariableGuid ## SOMETIMES_CONSUMES ## HOB # it is used for S3 boot.
|
||||
gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||
gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable
|
||||
gEdkiiPiSmmMemoryAttributesTableGuid ## CONSUMES ## SystemTable
|
||||
gEfiMemoryAttributesTableGuid ## CONSUMES ## SystemTable
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
Enable SMM profile.
|
||||
|
||||
Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials
|
||||
|
@ -725,84 +725,6 @@ InitPaging (
|
|||
return ;
|
||||
}
|
||||
|
||||
/**
|
||||
To find FADT in ACPI tables.
|
||||
|
||||
@param AcpiTableGuid The GUID used to find ACPI table in UEFI ConfigurationTable.
|
||||
|
||||
@return FADT table pointer.
|
||||
**/
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *
|
||||
FindAcpiFadtTableByAcpiGuid (
|
||||
IN EFI_GUID *AcpiTableGuid
|
||||
)
|
||||
{
|
||||
EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *Rsdp;
|
||||
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
||||
UINTN Index;
|
||||
UINT32 Data32;
|
||||
Rsdp = NULL;
|
||||
Rsdt = NULL;
|
||||
Fadt = NULL;
|
||||
//
|
||||
// found ACPI table RSD_PTR from system table
|
||||
//
|
||||
for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {
|
||||
if (CompareGuid (&(gST->ConfigurationTable[Index].VendorGuid), AcpiTableGuid)) {
|
||||
//
|
||||
// A match was found.
|
||||
//
|
||||
Rsdp = gST->ConfigurationTable[Index].VendorTable;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Rsdp == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Rsdt = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN) Rsdp->RsdtAddress;
|
||||
if (Rsdt == NULL || Rsdt->Signature != EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (Index = sizeof (EFI_ACPI_DESCRIPTION_HEADER); Index < Rsdt->Length; Index = Index + sizeof (UINT32)) {
|
||||
|
||||
Data32 = *(UINT32 *) ((UINT8 *) Rsdt + Index);
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) (UINT32 *) (UINTN) Data32;
|
||||
if (Fadt->Header.Signature == EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (Fadt == NULL || Fadt->Header.Signature != EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return Fadt;
|
||||
}
|
||||
|
||||
/**
|
||||
To find FADT in ACPI tables.
|
||||
|
||||
@return FADT table pointer.
|
||||
**/
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *
|
||||
FindAcpiFadtTable (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
||||
|
||||
Fadt = FindAcpiFadtTableByAcpiGuid (&gEfiAcpi20TableGuid);
|
||||
if (Fadt != NULL) {
|
||||
return Fadt;
|
||||
}
|
||||
|
||||
return FindAcpiFadtTableByAcpiGuid (&gEfiAcpi10TableGuid);
|
||||
}
|
||||
|
||||
/**
|
||||
To get system port address of the SMI Command Port in FADT table.
|
||||
|
||||
|
@ -814,7 +736,9 @@ GetSmiCommandPort (
|
|||
{
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
||||
|
||||
Fadt = FindAcpiFadtTable ();
|
||||
Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) EfiLocateFirstAcpiTable (
|
||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE
|
||||
);
|
||||
ASSERT (Fadt != NULL);
|
||||
|
||||
mSmiCommandPort = Fadt->SmiCmd;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/** @file
|
||||
SMM profile internal header file.
|
||||
|
||||
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
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
|
@ -15,7 +15,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
#ifndef _SMM_PROFILE_INTERNAL_H_
|
||||
#define _SMM_PROFILE_INTERNAL_H_
|
||||
|
||||
#include <Guid/Acpi.h>
|
||||
#include <Protocol/SmmReadyToLock.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
|
|
Loading…
Reference in New Issue