[RFC PATCH v1 2/4] OvmfPkg: Handle TPM 2 physical presence codes much earlier


Stefan Berger
 

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.

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
.../PlatformBootManagerLib/BdsPlatform.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c b/OvmfPkg=
/Library/PlatformBootManagerLib/BdsPlatform.c
index 71f63b2448..5c1603ac19 100644
--- a/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -387,8 +387,17 @@ PlatformBootManagerBeforeConsole (
SaveS3BootScript ();=0D
}=0D
=0D
+ PlatformInitializeConsole (=0D
+ XenDetected() ? gXenPlatformConsole : gPlatformConsole);=0D
+=0D
+ //=0D
+ // Process TPM PPI request; this may require keyboard input=0D
+ //=0D
+ Tcg2PhysicalPresenceLibProcessRequest (NULL);=0D
+=0D
//=0D
// Prevent further changes to LockBoxes or SMRAM.=0D
+ // Any TPM 2 Physical Presence Interface opcode must be handled before.=
=0D
//=0D
Handle =3D NULL;=0D
Status =3D gBS->InstallProtocolInterface (&Handle,=0D
@@ -402,9 +411,6 @@ PlatformBootManagerBeforeConsole (
//=0D
EfiBootManagerDispatchDeferredImages ();=0D
=0D
- PlatformInitializeConsole (=0D
- XenDetected() ? gXenPlatformConsole : gPlatformConsole);=0D
-=0D
FrontPageTimeout =3D GetFrontPageTimeoutFromQemu ();=0D
PcdStatus =3D PcdSet16S (PcdPlatformBootTimeOut, FrontPageTimeout);=0D
ASSERT_RETURN_ERROR (PcdStatus);=0D
@@ -1511,11 +1517,6 @@ PlatformBootManagerAfterConsole (
//=0D
PciAcpiInitialization ();=0D
=0D
- //=0D
- // Process TPM PPI request=0D
- //=0D
- Tcg2PhysicalPresenceLibProcessRequest (NULL);=0D
-=0D
//=0D
// Process QEMU's -kernel command line option=0D
//=0D
--=20
2.31.1