2 The module entry point for Tcg2 configuration module.
4 Copyright (c) 2018, Red Hat, Inc.
5 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Guid/TpmInstance.h>
21 #include <Library/DebugLib.h>
22 #include <Library/PeiServicesLib.h>
23 #include <Library/Tpm2DeviceLib.h>
24 #include <Ppi/TpmInitialized.h>
26 STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpmSelectedPpi
= {
27 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
28 &gEfiTpmDeviceSelectedGuid
,
32 STATIC CONST EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList
= {
33 EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
,
34 &gPeiTpmInitializationDonePpiGuid
,
39 The entry point for Tcg2 configuration driver.
41 @param FileHandle Handle of the file being invoked.
42 @param PeiServices Describes the list of possible PEI Services.
46 Tcg2ConfigPeimEntryPoint (
47 IN EFI_PEI_FILE_HANDLE FileHandle
,
48 IN CONST EFI_PEI_SERVICES
**PeiServices
54 DEBUG ((DEBUG_INFO
, "%a\n", __FUNCTION__
));
56 Status
= Tpm2RequestUseTpm ();
57 if (!EFI_ERROR (Status
)) {
58 DEBUG ((DEBUG_INFO
, "%a: TPM2 detected\n", __FUNCTION__
));
59 Size
= sizeof(gEfiTpmDeviceInstanceTpm20DtpmGuid
);
63 &gEfiTpmDeviceInstanceTpm20DtpmGuid
65 ASSERT_EFI_ERROR (Status
);
67 DEBUG ((DEBUG_INFO
, "%a: no TPM2 detected\n", __FUNCTION__
));
68 // If no TPM2 was detected, we still need to install
69 // TpmInitializationDonePpi. Namely, Tcg2Pei will exit early upon
70 // seeing the default (all-bits-zero) contents of
71 // PcdTpmInstanceGuid, thus we have to install the PPI in its place,
72 // in order to unblock any dependent PEIMs.
73 Status
= PeiServicesInstallPpi (&mTpmInitializationDonePpiList
);
74 ASSERT_EFI_ERROR (Status
);
80 Status
= PeiServicesInstallPpi (&mTpmSelectedPpi
);
81 ASSERT_EFI_ERROR (Status
);