/** @file\r
Initialize TPM device and measure FVs before handing off control to DXE.\r
\r
-Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2020, Intel Corporation. All rights reserved.<BR>\r
SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
#include <Ppi/FirmwareVolume.h>\r
#include <Ppi/EndOfPeiPhase.h>\r
#include <Ppi/FirmwareVolumeInfoMeasurementExcluded.h>\r
+#include <Ppi/Tcg.h>\r
\r
#include <Guid/TcgEventHob.h>\r
#include <Guid/MeasuredFvHob.h>\r
NULL\r
};\r
\r
+/**\r
+ Do a hash operation on a data buffer, extend a specific TPM PCR with the hash result,\r
+ and build a GUIDed HOB recording the event which will be passed to the DXE phase and\r
+ added into the Event Log.\r
+\r
+ @param[in] This Indicates the calling context\r
+ @param[in] Flags Bitmap providing additional information.\r
+ @param[in] HashData Physical address of the start of the data buffer\r
+ to be hashed, extended, and logged.\r
+ @param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData.\r
+ @param[in] NewEventHdr Pointer to a TCG_PCR_EVENT_HDR data structure.\r
+ @param[in] NewEventData Pointer to the new event data.\r
+\r
+ @retval EFI_SUCCESS Operation completed successfully.\r
+ @retval EFI_OUT_OF_RESOURCES No enough memory to log the new event.\r
+ @retval EFI_DEVICE_ERROR The command was unsuccessful.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+HashLogExtendEvent (\r
+ IN EDKII_TCG_PPI *This,\r
+ IN UINT64 Flags,\r
+ IN UINT8 *HashData,\r
+ IN UINTN HashDataLen,\r
+ IN TCG_PCR_EVENT_HDR *NewEventHdr,\r
+ IN UINT8 *NewEventData\r
+ );\r
+\r
+EDKII_TCG_PPI mEdkiiTcgPpi = {\r
+ HashLogExtendEvent\r
+};\r
+\r
+EFI_PEI_PPI_DESCRIPTOR mTcgPpiList = {\r
+ EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
+ &gEdkiiTcgPpiGuid,\r
+ &mEdkiiTcgPpi\r
+};\r
+\r
//\r
// Number of firmware blobs to grow by each time we run out of room\r
//\r
and build a GUIDed HOB recording the event which will be passed to the DXE phase and\r
added into the Event Log.\r
\r
- @param[in] PeiServices Describes the list of possible PEI Services.\r
+ @param[in] This Indicates the calling context.\r
+ @param[in] Flags Bitmap providing additional information.\r
@param[in] HashData Physical address of the start of the data buffer\r
to be hashed, extended, and logged.\r
@param[in] HashDataLen The length, in bytes, of the buffer referenced by HashData.\r
\r
**/\r
EFI_STATUS\r
+EFIAPI\r
HashLogExtendEvent (\r
- IN EFI_PEI_SERVICES **PeiServices,\r
+ IN EDKII_TCG_PPI *This,\r
+ IN UINT64 Flags,\r
IN UINT8 *HashData,\r
IN UINTN HashDataLen,\r
IN TCG_PCR_EVENT_HDR *NewEventHdr,\r
TcgEventHdr.EventSize = (UINT32) StrSize((CHAR16*)PcdGetPtr (PcdFirmwareVersionString));\r
\r
return HashLogExtendEvent (\r
- PeiServices,\r
+ &mEdkiiTcgPpi,\r
+ 0,\r
(UINT8*)PcdGetPtr (PcdFirmwareVersionString),\r
TcgEventHdr.EventSize,\r
&TcgEventHdr,\r
TcgEventHdr.EventSize = sizeof (FvBlob);\r
\r
Status = HashLogExtendEvent (\r
- (EFI_PEI_SERVICES **) GetPeiServicesTablePointer(),\r
+ &mEdkiiTcgPpi,\r
+ 0,\r
(UINT8*) (UINTN) FvBlob.BlobBase,\r
(UINTN) FvBlob.BlobLength,\r
&TcgEventHdr,\r
Status = PeiServicesNotifyPpi (&mNotifyList[0]);\r
ASSERT_EFI_ERROR (Status);\r
\r
+ //\r
+ // install Tcg Services\r
+ //\r
+ Status = PeiServicesInstallPpi (&mTcgPpiList);\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
return Status;\r
}\r
\r