summaryrefslogtreecommitdiffstats
path: root/SecurityPkg
diff options
context:
space:
mode:
authorKun Qin <kun.q@outlook.com>2021-03-04 20:14:15 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-03-05 15:25:07 +0000
commit59a3ccb09e7a246913d88fbac31412f20f717a3c (patch)
tree31f8c2d66f9e7b0ec846d157e01bb9b612ea1347 /SecurityPkg
parent8802583c48e85c77a2782b4eda3b5ec5f2ff59ea (diff)
downloadedk2-59a3ccb09e7a246913d88fbac31412f20f717a3c.tar.gz
edk2-59a3ccb09e7a246913d88fbac31412f20f717a3c.tar.bz2
edk2-59a3ccb09e7a246913d88fbac31412f20f717a3c.zip
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>
Diffstat (limited to 'SecurityPkg')
-rw-r--r--SecurityPkg/SecurityPkg.dsc1
-rw-r--r--SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c6
-rw-r--r--SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf1
3 files changed, 8 insertions, 0 deletions
diff --git a/SecurityPkg/SecurityPkg.dsc b/SecurityPkg/SecurityPkg.dsc
index 74ec429662..a77665518b 100644
--- a/SecurityPkg/SecurityPkg.dsc
+++ b/SecurityPkg/SecurityPkg.dsc
@@ -67,6 +67,7 @@
VariableKeyLib|SecurityPkg/Library/VariableKeyLibNull/VariableKeyLibNull.inf
RpmcLib|SecurityPkg/Library/RpmcLibNull/RpmcLibNull.inf
TcgEventLogRecordLib|SecurityPkg/Library/TcgEventLogRecordLib/TcgEventLogRecordLib.inf
+ MmUnblockMemoryLib|MdePkg/Library/MmUnblockMemoryLib/MmUnblockMemoryLibNull.inf
[LibraryClasses.ARM]
#
diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
index 924c3b4edd..e8844e474a 100644
--- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
+++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.c
@@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/Tpm2DeviceLib.h>
#include <Library/Tpm2CommandLib.h>
#include <Library/UefiLib.h>
+#include <Library/MmUnblockMemoryLib.h>
//
// Physical Presence Interface Version supported by Platform
@@ -147,6 +148,11 @@ AssignOpRegion (
ZeroMem ((VOID *)(UINTN)MemoryAddress, Size);
OpRegion->RegionOffset = (UINT32) (UINTN) MemoryAddress;
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;
}
}
diff --git a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf
index 42ddb4bd1f..f1c6ae5b1c 100644
--- a/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf
+++ b/SecurityPkg/Tcg/Tcg2Acpi/Tcg2Acpi.inf
@@ -57,6 +57,7 @@
Tpm2CommandLib
Tcg2PhysicalPresenceLib
PcdLib
+ MmUnblockMemoryLib
[Guids]
gEfiTpmDeviceInstanceTpm20DtpmGuid ## PRODUCES ## GUID # TPM device identifier