summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Library/PlatformBootManagerLib
diff options
context:
space:
mode:
authorStefan Berger <stefanb@linux.vnet.ibm.com>2021-09-15 09:25:04 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-09-30 00:00:08 +0000
commitb8675deaa819631db2667df63f89799fe65fc906 (patch)
tree61251e78c00515abe72ed38dd6ff5c01a7b82659 /OvmfPkg/Library/PlatformBootManagerLib
parent499c4608b13df0738213329722cdcb0ac838f3ad (diff)
downloadedk2-b8675deaa819631db2667df63f89799fe65fc906.tar.gz
edk2-b8675deaa819631db2667df63f89799fe65fc906.tar.bz2
edk2-b8675deaa819631db2667df63f89799fe65fc906.zip
OvmfPkg: Handle TPM 2 physical presence opcodes much earlier
Handle the TPM 2 physical presence interface (PPI) opcodes in PlatformBootManagerBeforeConsole() before the TPM 2 platform hierarchy is disabled. Since the handling of the PPI opcodes may require inter- action with the user, initialize the keyboard before handling PPI codes. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Peter Grehan <grehan@freebsd.org> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Erdem Aktas <erdemaktas@google.com> Cc: James Bottomley <jejb@linux.ibm.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Min Xu <min.m.xu@intel.com> Cc: Tom Lendacky <thomas.lendacky@amd.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Stefan Berger <stefanb@linux.ibm.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Diffstat (limited to 'OvmfPkg/Library/PlatformBootManagerLib')
-rw-r--r--OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 71f63b2448..4448722e19 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -387,8 +387,19 @@ PlatformBootManagerBeforeConsole (
SaveS3BootScript ();
}
+ // We need to connect all trusted consoles for TCG PP. Here we treat all
+ // consoles in OVMF to be trusted consoles.
+ PlatformInitializeConsole (
+ XenDetected() ? gXenPlatformConsole : gPlatformConsole);
+
+ //
+ // Process TPM PPI request; this may require keyboard input
+ //
+ Tcg2PhysicalPresenceLibProcessRequest (NULL);
+
//
// Prevent further changes to LockBoxes or SMRAM.
+ // Any TPM 2 Physical Presence Interface opcode must be handled before.
//
Handle = NULL;
Status = gBS->InstallProtocolInterface (&Handle,
@@ -402,9 +413,6 @@ PlatformBootManagerBeforeConsole (
//
EfiBootManagerDispatchDeferredImages ();
- PlatformInitializeConsole (
- XenDetected() ? gXenPlatformConsole : gPlatformConsole);
-
FrontPageTimeout = GetFrontPageTimeoutFromQemu ();
PcdStatus = PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);
ASSERT_RETURN_ERROR (PcdStatus);
@@ -1512,11 +1520,6 @@ PlatformBootManagerAfterConsole (
PciAcpiInitialization ();
//
- // Process TPM PPI request
- //
- Tcg2PhysicalPresenceLibProcessRequest (NULL);
-
- //
// Process QEMU's -kernel command line option
//
TryRunningQemuKernel ();