diff options
author | Dun Tan <dun.tan@intel.com> | 2024-08-21 10:05:34 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2024-08-27 06:14:36 +0000 |
commit | 5a06afa7dd8ba8e99178fec9525be9e3fd2a4d3a (patch) | |
tree | 916ff0a95710e40ea72567f026849730e7f97d79 /SecurityPkg/Tcg/Tcg2Config | |
parent | fadb9dcb9dc734418d4e88296cdc609bb298df41 (diff) | |
download | edk2-5a06afa7dd8ba8e99178fec9525be9e3fd2a4d3a.tar.gz edk2-5a06afa7dd8ba8e99178fec9525be9e3fd2a4d3a.tar.bz2 edk2-5a06afa7dd8ba8e99178fec9525be9e3fd2a4d3a.zip |
SecurityPkg: Allocate EfiACPIMemoryNVS buffer for TCG2
Allocate EfiACPIMemoryNVS buffer for TCG2 related usage in
Tcg2ConfigPeim. The buffer will be used in Tcg2Acpi driver
to retrive information from SMM environment.
Previously, the buffer used in Tcg2Acpi driver is AcpiNvs
type. But I mistakenly thought the Runtime Data type buffer
should also work. So I used API AllocateRuntimePages() to
allocate buffer in 9a76c7945b7 and consume the buffer in
e939ecf6c1. Recently we found that if the buffer type is
Runtime Data instead of AcpiNvs, BSOD issue happened after
boot into OS.
So this commit is to Allocate EfiACPIMemoryNVS buffer for
TCG2 usage in SMM to align with the initial code logic.
Signed-off-by: Dun Tan <dun.tan@intel.com>
Diffstat (limited to 'SecurityPkg/Tcg/Tcg2Config')
-rw-r--r-- | SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c index 0e4dd3e7fd..92243ec894 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c @@ -75,21 +75,25 @@ BuildTcg2AcpiCommunicateBufferHob ( {
TCG2_ACPI_COMMUNICATE_BUFFER *Tcg2AcpiCommunicateBufferHob;
EFI_STATUS Status;
- VOID *Buffer;
+ EFI_PHYSICAL_ADDRESS Buffer;
UINTN Pages;
Pages = EFI_SIZE_TO_PAGES (sizeof (TCG_NVS));
- Buffer = AllocateRuntimePages (Pages);
- ASSERT (Buffer != NULL);
+ Status = PeiServicesAllocatePages (
+ EfiACPIMemoryNVS,
+ Pages,
+ &Buffer
+ );
+ ASSERT_EFI_ERROR (Status);
- Status = MmUnblockMemoryRequest ((UINTN)Buffer, Pages);
+ Status = MmUnblockMemoryRequest (Buffer, Pages);
if ((Status != EFI_UNSUPPORTED) && EFI_ERROR (Status)) {
return Status;
}
Tcg2AcpiCommunicateBufferHob = BuildGuidHob (&gEdkiiTcg2AcpiCommunicateBufferHobGuid, sizeof (TCG2_ACPI_COMMUNICATE_BUFFER));
ASSERT (Tcg2AcpiCommunicateBufferHob != NULL);
- Tcg2AcpiCommunicateBufferHob->Tcg2AcpiCommunicateBuffer = (UINTN)Buffer;
+ Tcg2AcpiCommunicateBufferHob->Tcg2AcpiCommunicateBuffer = Buffer;
Tcg2AcpiCommunicateBufferHob->Pages = Pages;
return EFI_SUCCESS;
|