summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDun Tan <dun.tan@intel.com>2024-05-24 15:00:30 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-07-02 03:31:31 +0000
commitcb38d27f1dbbd787d3606f6314b5f33a5cb86646 (patch)
treec7f4321f609a6c04eafc998bdf6eddd1a7cb6e36
parentf9950cceecc12d40298b0287f193c6e6ddb9a14b (diff)
downloadedk2-cb38d27f1dbbd787d3606f6314b5f33a5cb86646.zip
edk2-cb38d27f1dbbd787d3606f6314b5f33a5cb86646.tar.gz
edk2-cb38d27f1dbbd787d3606f6314b5f33a5cb86646.tar.bz2
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 <dun.tan@intel.com>
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf6
-rw-r--r--SecurityPkg/Tcg/Tcg2Config/Tcg2ConfigPeim.c24
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.<BR>
+# Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
# 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.<BR>
+Copyright (c) 2015 - 2024, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -16,6 +16,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/MemoryAllocationLib.h>
#include <Library/PeiServicesLib.h>
#include <Library/PcdLib.h>
+#include <Library/HobLib.h>
#include <Ppi/ReadOnlyVariable2.h>
#include <Ppi/TpmInitialized.h>
@@ -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);