]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/Tcg2ConfigPei: skip TPM-1.2 detection when building for ARM/AARCH64
authorLaszlo Ersek <lersek@redhat.com>
Wed, 20 May 2020 22:58:41 +0000 (00:58 +0200)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 21 May 2020 12:23:37 +0000 (12:23 +0000)
Dating back to commits f5cb3767038e and ddd34a818315d, the
"ArmVirtPkg/ArmVirtQemu.dsc" platform includes the
"OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf" module when the TPM2_ENABLE
build flag is defined.

This was regressed in commit 89236992913f, which added a Tpm12DeviceLib
dependency to Tcg2ConfigPei. "ArmVirtQemu.dsc" does not resolve that class
to any instance, so now we get a build failure:

> build.py...
> ArmVirtPkg/ArmVirtQemu.dsc(...): error 4000: Instance of library class
> [Tpm12DeviceLib] is not found
>         in [OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf] [AARCH64]
>         consumed by module [OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf]

The TPM-1.2 code in OvmfPkg/Tcg2ConfigPei is limited to a special use case
(a kind of physical TPM-1.2 assignment), and that has never applied to
"ArmVirtQemu.dsc".

Short-circuit the TPM-1.2 detection in the ARM/AARCH64 builds of
OvmfPkg/Tcg2ConfigPei, removing the Tpm12DeviceLib dependency.

Functionally, this patch is a no-op on IA32 / X64.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Eric Auger <eric.auger@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Simon Hardy <simon.hardy@itdev.co.uk>
Cc: Stefan Berger <stefanb@linux.ibm.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2728
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20200520225841.17793-4-lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Tested-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
OvmfPkg/Tcg/Tcg2Config/Tcg2ConfigPei.inf
OvmfPkg/Tcg/Tcg2Config/Tpm12Support.h
OvmfPkg/Tcg/Tcg2Config/Tpm12SupportNull.c [new file with mode: 0644]

index aa996b7da7783e909cd17fcc76a42b6dd6052fbb..194ebfba6409352453bfd63d5b8e8ea2a5ff691e 100644 (file)
 \r
 [Sources]\r
   Tcg2ConfigPeim.c\r
-  Tpm12Support.c\r
   Tpm12Support.h\r
 \r
+[Sources.IA32, Sources.X64]\r
+  Tpm12Support.c\r
+\r
+[Sources.ARM, Sources.AARCH64]\r
+  Tpm12SupportNull.c\r
+\r
 [Packages]\r
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
   BaseLib\r
   DebugLib\r
   PeiServicesLib\r
-  Tpm12DeviceLib\r
   Tpm2DeviceLib\r
 \r
+[LibraryClasses.IA32, LibraryClasses.X64]\r
+  Tpm12DeviceLib\r
+\r
 [Guids]\r
   gEfiTpmDeviceSelectedGuid           ## PRODUCES ## GUID # Used as a PPI GUID\r
   gEfiTpmDeviceInstanceTpm20DtpmGuid  ## SOMETIMES_CONSUMES\r
index c739775d23539f77c9f944cc74386e8e5806b5a6..d92c4325308107ebb7470e4d18cfb60f35308e0d 100644 (file)
 /**\r
   Detect the presence of a TPM with interface version 1.2.\r
 \r
+  @retval EFI_UNSUPPORTED  The platform that includes this particular\r
+                           implementation of the function does not support\r
+                           TPM-1.2.\r
+\r
   @retval EFI_SUCCESS      TPM-1.2 available. The Tpm12RequestUseTpm() and\r
                            Tpm12SubmitCommand(TPM_ORD_GetTicks) operations\r
                            (from the Tpm12DeviceLib class) have succeeded.\r
diff --git a/OvmfPkg/Tcg/Tcg2Config/Tpm12SupportNull.c b/OvmfPkg/Tcg/Tcg2Config/Tpm12SupportNull.c
new file mode 100644 (file)
index 0000000..7bb377b
--- /dev/null
@@ -0,0 +1,25 @@
+/** @file\r
+  Null implementation of InternalTpm12Detect(), always returning\r
+  EFI_UNSUPPORTED.\r
+\r
+  Copyright (C) 2020, Red Hat, Inc.\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#include "Tpm12Support.h"\r
+\r
+/**\r
+  Detect the presence of a TPM with interface version 1.2.\r
+\r
+  @retval EFI_UNSUPPORTED  The platform that includes this particular\r
+                           implementation of the function does not support\r
+                           TPM-1.2.\r
+**/\r
+EFI_STATUS\r
+InternalTpm12Detect (\r
+  VOID\r
+  )\r
+{\r
+  return EFI_UNSUPPORTED;\r
+}\r