UefiCpuPkg/PiSmmCpuDxeSmm: Get SMRAM info from gEfiSmmSmramMemoryGuid
MM can not use the SMM Access Protocol, so get SMRAM info from gEfiSmmSmramMemoryGuid instead of via SMM Access Protocol for both SMM and MM. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Yuanhao Xie <yuanhao.xie@intel.com>
This commit is contained in:
parent
8ccf7f65e5
commit
c8a1295d3e
|
@ -1282,7 +1282,6 @@ CpuSmramRangeCompare (
|
|||
}
|
||||
|
||||
/**
|
||||
|
||||
Find out SMRAM information including SMRR base and SMRR size.
|
||||
|
||||
@param SmrrBase SMRR base
|
||||
|
@ -1295,35 +1294,24 @@ FindSmramInfo (
|
|||
OUT UINT32 *SmrrSize
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
EFI_SMM_ACCESS2_PROTOCOL *SmmAccess;
|
||||
EFI_SMRAM_DESCRIPTOR *CurrentSmramRange;
|
||||
UINTN Index;
|
||||
UINT64 MaxSize;
|
||||
BOOLEAN Found;
|
||||
EFI_SMRAM_DESCRIPTOR SmramDescriptor;
|
||||
VOID *GuidHob;
|
||||
EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *DescriptorBlock;
|
||||
EFI_SMRAM_DESCRIPTOR *CurrentSmramRange;
|
||||
UINTN Index;
|
||||
UINT64 MaxSize;
|
||||
BOOLEAN Found;
|
||||
EFI_SMRAM_DESCRIPTOR SmramDescriptor;
|
||||
|
||||
//
|
||||
// Get SMM Access Protocol
|
||||
//
|
||||
Status = gBS->LocateProtocol (&gEfiSmmAccess2ProtocolGuid, NULL, (VOID **)&SmmAccess);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
ASSERT (SmrrBase != NULL && SmrrSize != NULL);
|
||||
|
||||
//
|
||||
// Get SMRAM information
|
||||
//
|
||||
Size = 0;
|
||||
Status = SmmAccess->GetCapabilities (SmmAccess, &Size, NULL);
|
||||
ASSERT (Status == EFI_BUFFER_TOO_SMALL);
|
||||
|
||||
mSmmCpuSmramRanges = (EFI_SMRAM_DESCRIPTOR *)AllocatePool (Size);
|
||||
ASSERT (mSmmCpuSmramRanges != NULL);
|
||||
|
||||
Status = SmmAccess->GetCapabilities (SmmAccess, &Size, mSmmCpuSmramRanges);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
mSmmCpuSmramRangeCount = Size / sizeof (EFI_SMRAM_DESCRIPTOR);
|
||||
GuidHob = GetFirstGuidHob (&gEfiSmmSmramMemoryGuid);
|
||||
ASSERT (GuidHob != NULL);
|
||||
DescriptorBlock = (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *)GET_GUID_HOB_DATA (GuidHob);
|
||||
mSmmCpuSmramRangeCount = DescriptorBlock->NumberOfSmmReservedRegions;
|
||||
mSmmCpuSmramRanges = DescriptorBlock->Descriptor;
|
||||
|
||||
//
|
||||
// Sort the mSmmCpuSmramRanges
|
||||
|
@ -1373,7 +1361,7 @@ FindSmramInfo (
|
|||
}
|
||||
} while (Found);
|
||||
|
||||
DEBUG ((DEBUG_INFO, "SMRR Base: 0x%x, SMRR Size: 0x%x\n", *SmrrBase, *SmrrSize));
|
||||
DEBUG ((DEBUG_INFO, "%a: SMRR Base = 0x%x, SMRR Size = 0x%x\n", __func__, *SmrrBase, *SmrrSize));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||
|
||||
#include <Protocol/SmmConfiguration.h>
|
||||
#include <Protocol/SmmCpu.h>
|
||||
#include <Protocol/SmmAccess2.h>
|
||||
#include <Protocol/SmmReadyToLock.h>
|
||||
#include <Protocol/SmmCpuService.h>
|
||||
#include <Protocol/SmmMemoryAttribute.h>
|
||||
|
@ -25,6 +24,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
|||
#include <Guid/AcpiS3Context.h>
|
||||
#include <Guid/MemoryAttributesTable.h>
|
||||
#include <Guid/PiSmmMemoryAttributesTable.h>
|
||||
#include <Guid/SmramMemoryReserve.h>
|
||||
#include <Guid/SmmBaseHob.h>
|
||||
#include <Guid/MpInformation2.h>
|
||||
|
||||
|
|
|
@ -102,7 +102,6 @@
|
|||
SmmCpuSyncLib
|
||||
|
||||
[Protocols]
|
||||
gEfiSmmAccess2ProtocolGuid ## CONSUMES
|
||||
gEfiSmmConfigurationProtocolGuid ## PRODUCES
|
||||
gEfiSmmCpuProtocolGuid ## PRODUCES
|
||||
gEfiSmmReadyToLockProtocolGuid ## NOTIFY
|
||||
|
@ -118,6 +117,7 @@
|
|||
gEfiMemoryAttributesTableGuid ## CONSUMES ## SystemTable
|
||||
gSmmBaseHobGuid ## CONSUMES
|
||||
gMpInformation2HobGuid ## CONSUMES # Assume the HOB must has been created
|
||||
gEfiSmmSmramMemoryGuid
|
||||
|
||||
[FeaturePcd]
|
||||
gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmDebug ## CONSUMES
|
||||
|
|
Loading…
Reference in New Issue