Blame SOURCES/edk2-OvmfPkg-create-Tcg12ConfigPei.inf.patch

75d8e7
From 0ecb863aaca8d71a35763645ced278589666ada2 Mon Sep 17 00:00:00 2001
75d8e7
From: Gerd Hoffmann <kraxel@redhat.com>
75d8e7
Date: Wed, 15 Dec 2021 12:39:19 +0100
75d8e7
Subject: [PATCH 4/6] OvmfPkg: create Tcg12ConfigPei.inf
75d8e7
75d8e7
RH-Author: Gerd Hoffmann <kraxel@redhat.com>
75d8e7
RH-MergeRequest: 9: backport tpm build updates, disable tpm 1.2 support
75d8e7
RH-Commit: [4/6] 92926b9a05aaff38aab9a2aeee211be736863ab9 (kraxel/centos-edk2)
75d8e7
RH-Bugzilla: 1935497
75d8e7
RH-Acked-by: Oliver Steffen <None>
75d8e7
75d8e7
Split Tcg2ConfigPei.inf into two variants: Tcg12ConfigPei.inf with
75d8e7
TPM 1.2 support included and Tcg2ConfigPei.inf supporting TPM 2.0 only.
75d8e7
This allows x86 builds to choose whenever TPM 1.2 support should be
75d8e7
included or not by picking the one or the other inf file.
75d8e7
75d8e7
Switch x86 builds to Tcg12ConfigPei.inf, so they continue to
75d8e7
have TPM 1.2 support.
75d8e7
75d8e7
No functional change.
75d8e7
75d8e7
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
75d8e7
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
75d8e7
Tested-by: Stefan Berger <stefanb@linux.ibm.com>
75d8e7
(cherry picked from commit b81938877276e808b6535e612b320eee559c4c2f)
75d8e7
---
75d8e7
 OvmfPkg/OvmfTpmComponentsPei.dsc.inc      |  2 +-
75d8e7
 OvmfPkg/OvmfTpmPei.fdf.inc                |  2 +-
75d8e7
 OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf | 56 +++++++++++++++++++++++
75d8e7
 OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf  | 11 +----
75d8e7
 4 files changed, 59 insertions(+), 12 deletions(-)
75d8e7
 create mode 100644 OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf
75d8e7
75d8e7
diff --git a/OvmfPkg/OvmfTpmComponentsPei.dsc.inc b/OvmfPkg/OvmfTpmComponentsPei.dsc.inc
75d8e7
index 99fa7c13b3..87d491da50 100644
75d8e7
--- a/OvmfPkg/OvmfTpmComponentsPei.dsc.inc
75d8e7
+++ b/OvmfPkg/OvmfTpmComponentsPei.dsc.inc
75d8e7
@@ -4,7 +4,7 @@
75d8e7
 
75d8e7
 !if $(TPM_ENABLE) == TRUE
75d8e7
   OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPei.inf
75d8e7
-  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
75d8e7
+  OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf
75d8e7
   SecurityPkg/Tcg/TcgPei/TcgPei.inf
75d8e7
   SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf {
75d8e7
     <LibraryClasses>
75d8e7
diff --git a/OvmfPkg/OvmfTpmPei.fdf.inc b/OvmfPkg/OvmfTpmPei.fdf.inc
75d8e7
index 9aefd73d21..709a608cc3 100644
75d8e7
--- a/OvmfPkg/OvmfTpmPei.fdf.inc
75d8e7
+++ b/OvmfPkg/OvmfTpmPei.fdf.inc
75d8e7
@@ -4,7 +4,7 @@
75d8e7
 
75d8e7
 !if $(TPM_ENABLE) == TRUE
75d8e7
 INF  OvmfPkg/Tcg/TpmMmioSevDecryptPei/TpmMmioSevDecryptPei.inf
75d8e7
-INF  OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
75d8e7
+INF  OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf
75d8e7
 INF  SecurityPkg/Tcg/TcgPei/TcgPei.inf
75d8e7
 INF  SecurityPkg/Tcg/Tcg2Pei/Tcg2Pei.inf
75d8e7
 INF  SecurityPkg/Tcg/Tcg2PlatformPei/Tcg2PlatformPei.inf
75d8e7
diff --git a/OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf b/OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf
75d8e7
new file mode 100644
75d8e7
index 0000000000..e8e0b88e60
75d8e7
--- /dev/null
75d8e7
+++ b/OvmfPkg/Tcg/Tcg2Config/Tcg12ConfigPei.inf
75d8e7
@@ -0,0 +1,56 @@
75d8e7
+## @file
75d8e7
+# Set TPM device type - supports TPM 1.2 and 2.0
75d8e7
+#
75d8e7
+# In SecurityPkg, this module initializes the TPM device type based on a UEFI
75d8e7
+# variable and/or hardware detection. In OvmfPkg, the module only performs TPM
75d8e7
+# hardware detection.
75d8e7
+#
75d8e7
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
75d8e7
+# Copyright (C) 2018, Red Hat, Inc.
75d8e7
+#
75d8e7
+# SPDX-License-Identifier: BSD-2-Clause-Patent
75d8e7
+##
75d8e7
+
75d8e7
+[Defines]
75d8e7
+  INF_VERSION                    = 0x00010005
75d8e7
+  BASE_NAME                      = Tcg2ConfigPei
75d8e7
+  FILE_GUID                      = 8AD3148F-945F-46B4-8ACD-71469EA73945
75d8e7
+  MODULE_TYPE                    = PEIM
75d8e7
+  VERSION_STRING                 = 1.0
75d8e7
+  ENTRY_POINT                    = Tcg2ConfigPeimEntryPoint
75d8e7
+
75d8e7
+[Sources]
75d8e7
+  Tcg2ConfigPeim.c
75d8e7
+  Tpm12Support.h
75d8e7
+  Tpm12Support.c
75d8e7
+
75d8e7
+[Packages]
75d8e7
+  MdePkg/MdePkg.dec
75d8e7
+  MdeModulePkg/MdeModulePkg.dec
75d8e7
+  OvmfPkg/OvmfPkg.dec
75d8e7
+  SecurityPkg/SecurityPkg.dec
75d8e7
+
75d8e7
+[LibraryClasses]
75d8e7
+  PeimEntryPoint
75d8e7
+  DebugLib
75d8e7
+  PeiServicesLib
75d8e7
+  Tpm2DeviceLib
75d8e7
+  BaseLib
75d8e7
+  Tpm12DeviceLib
75d8e7
+
75d8e7
+[Guids]
75d8e7
+  gEfiTpmDeviceSelectedGuid           ## PRODUCES ## GUID # Used as a PPI GUID
75d8e7
+  gEfiTpmDeviceInstanceTpm20DtpmGuid  ## SOMETIMES_CONSUMES
75d8e7
+  gEfiTpmDeviceInstanceTpm12Guid      ## SOMETIMES_CONSUMES
75d8e7
+
75d8e7
+[Ppis]
75d8e7
+  gPeiTpmInitializationDonePpiGuid    ## SOMETIMES_PRODUCES
75d8e7
+
75d8e7
+[Pcd]
75d8e7
+  gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid                 ## PRODUCES
75d8e7
+
75d8e7
+[Depex.IA32, Depex.X64]
75d8e7
+  gOvmfTpmMmioAccessiblePpiGuid
75d8e7
+
75d8e7
+[Depex.ARM, Depex.AARCH64]
75d8e7
+  gOvmfTpmDiscoveredPpiGuid
75d8e7
diff --git a/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf b/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
75d8e7
index 39d1deeed1..51078c9813 100644
75d8e7
--- a/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
75d8e7
+++ b/OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
75d8e7
@@ -1,5 +1,5 @@
75d8e7
 ## @file
75d8e7
-# Set TPM device type
75d8e7
+# Set TPM device type - supports TPM 2.0 only
75d8e7
 #
75d8e7
 # In SecurityPkg, this module initializes the TPM device type based on a UEFI
75d8e7
 # variable and/or hardware detection. In OvmfPkg, the module only performs TPM
75d8e7
@@ -22,11 +22,6 @@
75d8e7
 [Sources]
75d8e7
   Tcg2ConfigPeim.c
75d8e7
   Tpm12Support.h
75d8e7
-
75d8e7
-[Sources.IA32, Sources.X64]
75d8e7
-  Tpm12Support.c
75d8e7
-
75d8e7
-[Sources.ARM, Sources.AARCH64]
75d8e7
   Tpm12SupportNull.c
75d8e7
 
75d8e7
 [Packages]
75d8e7
@@ -41,10 +36,6 @@
75d8e7
   PeiServicesLib
75d8e7
   Tpm2DeviceLib
75d8e7
 
75d8e7
-[LibraryClasses.IA32, LibraryClasses.X64]
75d8e7
-  BaseLib
75d8e7
-  Tpm12DeviceLib
75d8e7
-
75d8e7
 [Guids]
75d8e7
   gEfiTpmDeviceSelectedGuid           ## PRODUCES ## GUID # Used as a PPI GUID
75d8e7
   gEfiTpmDeviceInstanceTpm20DtpmGuid  ## SOMETIMES_CONSUMES
75d8e7
-- 
75d8e7
2.27.0
75d8e7