From 3c2dc30d1bc45eeef68d7d0e056a4b3928015ec0 Mon Sep 17 00:00:00 2001 From: Kun Qin Date: Thu, 4 Mar 2021 20:14:13 -0800 Subject: SecurityPkg: Tcg2Smm: Separate Tcg2Smm into 2 modules REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3169 This change separated the original Tcg2Smm module into 2 drivers: the SMM driver that registers callback for physical presence and memory clear; the Tcg2Acpi driver that patches and publishes ACPI table for runtime use. Tcg2Smm introduced an SMI root handler to allow Tcg2Acpi to communicate the NVS region used by Tpm.asl and exchange the registered SwSmiValue. Lastly, Tcg2Smm driver will publish gTcg2MmSwSmiRegisteredGuid at the end of entrypoint to ensure Tcg2Acpi to load after Tcg2Smm is ready to communicate. Cc: Jiewen Yao Cc: Jian J Wang Cc: Qi Zhang Cc: Rahul Kumar Signed-off-by: Kun Qin Reviewed-by: Jiewen Yao Message-Id: --- SecurityPkg/Include/Guid/TpmNvsMm.h | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 SecurityPkg/Include/Guid/TpmNvsMm.h (limited to 'SecurityPkg/Include') diff --git a/SecurityPkg/Include/Guid/TpmNvsMm.h b/SecurityPkg/Include/Guid/TpmNvsMm.h new file mode 100644 index 0000000000..64c0f5c346 --- /dev/null +++ b/SecurityPkg/Include/Guid/TpmNvsMm.h @@ -0,0 +1,68 @@ +/** @file + TPM NVS MM guid, used for exchanging information, including SWI value and NVS region + information, for patching TPM ACPI table. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) Microsoft Corporation. +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef TCG2_NVS_MM_H_ +#define TCG2_NVS_MM_H_ + +#define MM_TPM_NVS_HOB_GUID \ + { 0xc96c76eb, 0xbc78, 0x429c, { 0x9f, 0x4b, 0xda, 0x51, 0x78, 0xc2, 0x84, 0x57 }} + +extern EFI_GUID gTpmNvsMmGuid; + +#pragma pack(1) +typedef struct { + UINT8 SoftwareSmi; + UINT32 Parameter; + UINT32 Response; + UINT32 Request; + UINT32 RequestParameter; + UINT32 LastRequest; + UINT32 ReturnCode; +} PHYSICAL_PRESENCE_NVS; + +typedef struct { + UINT8 SoftwareSmi; + UINT32 Parameter; + UINT32 Request; + UINT32 ReturnCode; +} MEMORY_CLEAR_NVS; + +typedef struct { + PHYSICAL_PRESENCE_NVS PhysicalPresence; + MEMORY_CLEAR_NVS MemoryClear; + UINT32 PPRequestUserConfirm; + UINT32 TpmIrqNum; + BOOLEAN IsShortFormPkgLength; +} TCG_NVS; + +typedef struct { + UINT8 OpRegionOp; + UINT32 NameString; + UINT8 RegionSpace; + UINT8 DWordPrefix; + UINT32 RegionOffset; + UINT8 BytePrefix; + UINT8 RegionLen; +} AML_OP_REGION_32_8; + +typedef struct { + UINT64 Function; + UINT64 ReturnStatus; + EFI_PHYSICAL_ADDRESS TargetAddress; + UINT64 RegisteredPpSwiValue; + UINT64 RegisteredMcSwiValue; +} TPM_NVS_MM_COMM_BUFFER; +#pragma pack() + +typedef enum { + TpmNvsMmExchangeInfo, +} TPM_NVS_MM_FUNCTION; + +#endif // TCG2_NVS_MM_H_ -- cgit v1.2.3