X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=SecurityPkg%2FTcg%2FTcg2Config%2FTcg2ConfigDriver.c;h=10d1c5cc78004aec40393ee701b42c17b19b1053;hp=34828eed7d648598d4f089df6eda0381aa2f1351;hb=d6b926e76e3d639ac37610e97d33ff9e3a6281eb;hpb=3613af913983148a3865e758c2c058912320e4c2 diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c index 34828eed7d..10d1c5cc78 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigDriver.c @@ -1,14 +1,8 @@ /** @file The module entry point for Tcg2 configuration module. -Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
-This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -82,6 +76,7 @@ InitializeTcg2VersionInfo ( TCG2_VERSION Tcg2Version; UINTN DataSize; UINT64 PcdTcg2PpiVersion; + UINT8 PcdTpm2AcpiTableRev; // // Get the PCD value before initializing efi varstore configuration data. @@ -93,6 +88,8 @@ InitializeTcg2VersionInfo ( AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer)) ); + PcdTpm2AcpiTableRev = PcdGet8 (PcdTpm2AcpiTableRev); + // // Initialize efi varstore configuration data. // @@ -137,7 +134,7 @@ InitializeTcg2VersionInfo ( } } else { // - // EFI variable doesn't exist. + // EFI variable doesn't exist or variable size is not expected. // // @@ -175,6 +172,10 @@ InitializeTcg2VersionInfo ( DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer default value is not same with the default value in VFR\n")); DEBUG ((DEBUG_WARN, "WARNING: The default value in VFR has be chosen\n")); } + if (PcdTpm2AcpiTableRev != Tcg2Version.Tpm2AcpiTableRev) { + DEBUG ((DEBUG_WARN, "WARNING: PcdTpm2AcpiTableRev default value is not same with the default value in VFR\n")); + DEBUG ((DEBUG_WARN, "WARNING: The default value in VFR has be chosen\n")); + } } } FreePool (ConfigRequestHdr); @@ -182,7 +183,7 @@ InitializeTcg2VersionInfo ( // // Get the PCD value again. // If the PCD value is not equal to the value in variable, - // the PCD is not DynamicHii type and maps to the setup option. + // the PCD is not DynamicHii type and does not map to the setup option. // PcdTcg2PpiVersion = 0; CopyMem ( @@ -191,7 +192,7 @@ InitializeTcg2VersionInfo ( AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer)) ); if (PcdTcg2PpiVersion != Tcg2Version.PpiVersion) { - DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer is not DynamicHii type and maps to TCG2_VERSION.PpiVersion\n")); + DEBUG ((DEBUG_WARN, "WARNING: PcdTcgPhysicalPresenceInterfaceVer is not DynamicHii type and does not map to TCG2_VERSION.PpiVersion\n")); DEBUG ((DEBUG_WARN, "WARNING: The TCG2 PPI version configuring from setup page will not work\n")); } @@ -206,6 +207,29 @@ InitializeTcg2VersionInfo ( ASSERT (FALSE); break; } + + // + // Get the PcdTpm2AcpiTableRev value again. + // If the PCD value is not equal to the value in variable, + // the PCD is not DynamicHii type and does not map to TCG2_VERSION Variable. + // + PcdTpm2AcpiTableRev = PcdGet8 (PcdTpm2AcpiTableRev); + if (PcdTpm2AcpiTableRev != Tcg2Version.Tpm2AcpiTableRev) { + DEBUG ((DEBUG_WARN, "WARNING: PcdTpm2AcpiTableRev is not DynamicHii type and does not map to TCG2_VERSION.Tpm2AcpiTableRev\n")); + DEBUG ((DEBUG_WARN, "WARNING: The Tpm2 ACPI Revision configuring from setup page will not work\n")); + } + + switch (PcdTpm2AcpiTableRev) { + case EFI_TPM2_ACPI_TABLE_REVISION_3: + HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_ACPI_REVISION_STATE_CONTENT), L"Rev 3", NULL); + break; + case EFI_TPM2_ACPI_TABLE_REVISION_4: + HiiSetString (PrivateData->HiiHandle, STRING_TOKEN (STR_TPM2_ACPI_REVISION_STATE_CONTENT), L"Rev 4", NULL); + break; + default: + ASSERT (FALSE); + break; + } } /** @@ -216,7 +240,7 @@ InitializeTcg2VersionInfo ( @retval EFI_ALREADY_STARTED The driver already exists in system. @retval EFI_OUT_OF_RESOURCES Fail to execute entry point due to lack of resources. - @retval EFI_SUCCES All the related protocols are installed on the driver. + @retval EFI_SUCCESS All the related protocols are installed on the driver. @retval Others Fail to install protocols as indicated. **/ @@ -247,7 +271,7 @@ Tcg2ConfigDriverEntryPoint ( if (!EFI_ERROR (Status)) { return EFI_ALREADY_STARTED; } - + // // Create a private data structure. // @@ -256,7 +280,7 @@ Tcg2ConfigDriverEntryPoint ( mTcg2ConfigPrivateDate = PrivateData; // // Install private GUID. - // + // Status = gBS->InstallMultipleProtocolInterfaces ( &ImageHandle, &gEfiCallerIdGuid, @@ -368,7 +392,7 @@ Tcg2ConfigDriverEntryPoint ( ); ASSERT_EFI_ERROR (Status); } - + // // Install Tcg2 configuration form // @@ -384,8 +408,8 @@ Tcg2ConfigDriverEntryPoint ( ErrorExit: if (PrivateData != NULL) { UninstallTcg2ConfigForm (PrivateData); - } - + } + return Status; } @@ -411,20 +435,20 @@ Tcg2ConfigDriverUnload ( ImageHandle, &gEfiCallerIdGuid, (VOID **) &PrivateData - ); + ); if (EFI_ERROR (Status)) { - return Status; + return Status; } - + ASSERT (PrivateData->Signature == TCG2_CONFIG_PRIVATE_DATA_SIGNATURE); gBS->UninstallMultipleProtocolInterfaces ( - &ImageHandle, + ImageHandle, &gEfiCallerIdGuid, PrivateData, NULL ); - + UninstallTcg2ConfigForm (PrivateData); return EFI_SUCCESS;