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>
This commit is contained in:
Dun Tan 2024-05-24 15:00:30 +08:00 committed by mergify[bot]
parent f9950cceec
commit cb38d27f1d
2 changed files with 28 additions and 2 deletions

View File

@ -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

View File

@ -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);
@ -133,6 +135,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
//