From cb38d27f1dbbd787d3606f6314b5f33a5cb86646 Mon Sep 17 00:00:00 2001 From: Dun Tan Date: Fri, 24 May 2024 15:00:30 +0800 Subject: SecurityPkg/Tcg2ConfigPei: Build two new HOBs Build following two new HOBs: gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid gEdkiiTpmInstanceHobGuid The two HOBs will be used by Tcg2StandaloneMm driver to avoid using the related dynamic PCDs. Signed-off-by: Dun Tan --- SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf | 6 +++++- SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf index f2aa323..b0c9c44 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf @@ -4,7 +4,7 @@ # This module initializes TPM device type based on variable and detection. # NOTE: This module is only for reference only, each platform should have its own setup page. # -# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -46,6 +46,7 @@ TimerLib Tpm12CommandLib Tpm12DeviceLib + HobLib [Guids] ## SOMETIMES_CONSUMES ## Variable:L"TCG2_CONFIGURATION" @@ -53,6 +54,8 @@ gTcg2ConfigFormSetGuid gEfiTpmDeviceSelectedGuid ## PRODUCES ## GUID # Used as a PPI GUID gEfiTpmDeviceInstanceNoneGuid ## SOMETIMES_CONSUMES ## GUID # TPM device identifier + gEdkiiTpmInstanceHobGuid + gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid [Ppis] gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES @@ -62,6 +65,7 @@ gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## PRODUCES gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy ## PRODUCES gEfiSecurityPkgTokenSpaceGuid.PcdTpmAutoDetection ## CONSUMES + gEfiSecurityPkgTokenSpaceGuid.PcdTcgPhysicalPresenceInterfaceVer [Depex] gEfiPeiMasterBootModePpiGuid AND diff --git a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c index 21a01f0..9840deb 100644 --- a/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c +++ b/SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c @@ -1,7 +1,7 @@ /** @file The module entry point for Tcg2 configuration module. -Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -16,6 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include @@ -73,6 +74,7 @@ Tcg2ConfigPeimEntryPoint ( TCG2_CONFIGURATION Tcg2Configuration; UINTN Index; UINT8 TpmDevice; + VOID *Hob; Status = PeiServicesLocatePpi (&gEfiPeiReadOnlyVariable2PpiGuid, 0, NULL, (VOID **)&VariablePpi); ASSERT_EFI_ERROR (Status); @@ -134,6 +136,26 @@ Tcg2ConfigPeimEntryPoint ( } // + // Build Hob for PcdTpmInstanceGuid + // + Hob = BuildGuidDataHob ( + &gEdkiiTpmInstanceHobGuid, + PcdGetPtr (PcdTpmInstanceGuid), + sizeof (EFI_GUID) + ); + ASSERT (Hob != NULL); + + // + // Build Hob for PcdTcgPhysicalPresenceInterfaceVer + // + Hob = BuildGuidDataHob ( + &gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid, + PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer), + AsciiStrSize ((CHAR8 *)PcdGetPtr (PcdTcgPhysicalPresenceInterfaceVer)) + ); + ASSERT (Hob != NULL); + + // // Selection done // Status = PeiServicesInstallPpi (&gTpmSelectedPpi); -- cgit v1.1