SecurityPkg: Tcg2Smm: Make TCG2 PP version configurable

Make TCG2 PP version configurable to meet different request. Current default version is 1.3.
http://www.trustedcomputinggroup.org/physical-presence-interface_1-30_0-52/

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
This commit is contained in:
Zhang, Chao B
2016-06-08 15:35:16 +08:00
parent 988715a3a7
commit cd64301398
5 changed files with 54 additions and 3 deletions

View File

@@ -250,6 +250,41 @@ AssignOpRegion (
return (VOID *) (UINTN) MemoryAddress;
}
/**
Patch version string of Physical Presence interface supported by platform. The initial string tag in TPM
ACPI table is "$PV".
@param[in, out] Table The TPM item in ACPI table.
@param[in] PPVer Version string of Physical Presence interface supported by platform.
@return The allocated address for the found region.
**/
EFI_STATUS
UpdatePPVersion (
EFI_ACPI_DESCRIPTION_HEADER *Table,
CHAR8 *PPVer
)
{
EFI_STATUS Status;
UINT8 *DataPtr;
//
// Patch some pointers for the ASL code before loading the SSDT.
//
for (DataPtr = (UINT8 *)(Table + 1);
DataPtr <= (UINT8 *) ((UINT8 *) Table + Table->Length - PHYSICAL_PRESENCE_VERSION_SIZE);
DataPtr += 1) {
if (AsciiStrCmp(DataPtr, PHYSICAL_PRESENCE_VERSION_TAG) == 0) {
Status = AsciiStrCpyS(DataPtr, PHYSICAL_PRESENCE_VERSION_SIZE, PPVer);
DEBUG((EFI_D_INFO, "TPM2 Physical Presence Interface Version update status 0x%x\n", Status));
return Status;
}
}
return EFI_NOT_FOUND;
}
/**
Initialize and publish TPM items in ACPI table.
@@ -277,6 +312,11 @@ PublishAcpiTable (
);
ASSERT_EFI_ERROR (Status);
//
// Update Table version before measuring it to PCR
//
Status = UpdatePPVersion(Table, (CHAR8 *)PcdGetPtr(PcdTcgPhysicalPresenceInterfaceVer));
ASSERT_EFI_ERROR (Status);
//
// Measure to PCR[0] with event EV_POST_CODE ACPI DATA
@@ -297,7 +337,7 @@ PublishAcpiTable (
ASSERT (mTcgNvs != NULL);
//
// Publish the TPM ACPI table
// Publish the TPM ACPI table. Table is re-checksumed.
//
Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable);
ASSERT_EFI_ERROR (Status);