SecurityPkg: Tcg2Acpi: Added unblock memory interface for NVS region

This changes added usage of MmUnblockMemoryLib to explicitly request
allocated NVS region to be accessible from MM environment. It will bring
in compatibility with architectures that supports full memory blockage
inside MM.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Qi Zhang <qi1.zhang@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>

Signed-off-by: Kun Qin <kun.q@outlook.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Message-Id: <MWHPR06MB31026F3F8C3FAA39D74CE4BAF3969@MWHPR06MB3102.namprd06.prod.outlook.com>
This commit is contained in:
Kun Qin 2021-03-04 20:14:15 -08:00 committed by mergify[bot]
parent 8802583c48
commit 59a3ccb09e
3 changed files with 8 additions and 0 deletions

View File

@ -67,6 +67,7 @@
VariableKeyLib|SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.inf VariableKeyLib|SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.inf
RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf
TcgEventLogRecordLib|SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.inf TcgEventLogRecordLib|SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.inf
MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
[LibraryClasses.ARM] [LibraryClasses.ARM]
# #

View File

@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/Tpm2DeviceLib.h> #include <Library/Tpm2DeviceLib.h>
#include <Library/Tpm2CommandLib.h> #include <Library/Tpm2CommandLib.h>
#include <Library/UefiLib.h> #include <Library/UefiLib.h>
#include <Library/MmUnblockMemoryLib.h>
// //
// Physical Presence Interface Version supported by Platform // Physical Presence Interface Version supported by Platform
@ -147,6 +148,11 @@ AssignOpRegion (
ZeroMem ((VOID *)(UINTN)MemoryAddress, Size); ZeroMem ((VOID *)(UINTN)MemoryAddress, Size);
OpRegion->RegionOffset = (UINT32) (UINTN) MemoryAddress; OpRegion->RegionOffset = (UINT32) (UINTN) MemoryAddress;
OpRegion->RegionLen = (UINT8) Size; OpRegion->RegionLen = (UINT8) Size;
// Request to unblock this region from MM core
Status = MmUnblockMemoryRequest (MemoryAddress, EFI_SIZE_TO_PAGES (Size));
if (Status != EFI_UNSUPPORTED && EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
}
break; break;
} }
} }

View File

@ -57,6 +57,7 @@
Tpm2CommandLib Tpm2CommandLib
Tcg2PhysicalPresenceLib Tcg2PhysicalPresenceLib
PcdLib PcdLib
MmUnblockMemoryLib
[Guids] [Guids]
gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCES ## GUID # TPM device identifier gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCES ## GUID # TPM device identifier