--- /dev/null
+/** @file\r
+ TdxHelper Functions which are used in PEI phase\r
+\r
+ Copyright (c) 2022 - 2023, Intel Corporation. All rights reserved.<BR>\r
+\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
+\r
+**/\r
+\r
+#include <Base.h>\r
+#include <PiPei.h>\r
+\r
+/**\r
+ Build the GuidHob for tdx measurements which were done in SEC phase.\r
+ The measurement values are stored in WorkArea.\r
+\r
+ @retval EFI_SUCCESS The GuidHob is built successfully\r
+ @retval Others Other errors as indicated\r
+**/\r
+EFI_STATUS\r
+InternalBuildGuidHobForTdxMeasurement (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ In Tdx guest, some information need to be passed from host VMM to guest\r
+ firmware. For example, the memory resource, etc. These information are\r
+ prepared by host VMM and put in TdHob which is described in TdxMetadata.\r
+ TDVF processes the TdHob to accept memories.\r
+\r
+ @retval EFI_SUCCESS Successfully process the TdHob\r
+ @retval Others Other error as indicated\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperProcessTdHob (\r
+ VOID\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ In Tdx guest, TdHob is passed from host VMM to guest firmware and it contains\r
+ the information of the memory resource. From the security perspective before\r
+ it is consumed, it should be measured and extended.\r
+ *\r
+ * @retval EFI_SUCCESS Successfully measure the TdHob\r
+ * @retval Others Other error as indicated\r
+ */\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperMeasureTdHob (\r
+ VOID\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ * In Tdx guest, Configuration FV (CFV) is treated as external input because it\r
+ * may contain the data provided by VMM. From the sucurity perspective Cfv image\r
+ * should be measured before it is consumed.\r
+ *\r
+ * @retval EFI_SUCCESS Successfully measure the CFV image\r
+ * @retval Others Other error as indicated\r
+ */\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperMeasureCfvImage (\r
+ VOID\r
+ )\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
+\r
+/**\r
+ Build the GuidHob for tdx measurements which were done in SEC phase.\r
+ The measurement values are stored in WorkArea.\r
+\r
+ @retval EFI_SUCCESS The GuidHob is built successfully\r
+ @retval Others Other errors as indicated\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+TdxHelperBuildGuidHobForTdxMeasurement (\r
+ VOID\r
+ )\r
+{\r
+ return InternalBuildGuidHobForTdxMeasurement ();\r
+}\r
--- /dev/null
+## @file\r
+# TdxHelperLib PEI instance\r
+#\r
+# This module provides Tdx helper functions in PEI phase.\r
+# Copyright (c) 2021 - 2023, Intel Corporation. All rights reserved.<BR>\r
+#\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = PeiTdxHelperLib\r
+ FILE_GUID = 4d22289d-3bde-4501-a737-7719f3215065\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = TdxHelperLib|PEIM\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = X64\r
+#\r
+\r
+[Sources]\r
+ PeiTdxHelper.c\r
+ TdxMeasurementHob.c\r
+\r
+[Packages]\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ MdePkg/MdePkg.dec\r
+ OvmfPkg/OvmfPkg.dec\r
+ SecurityPkg/SecurityPkg.dec\r
+\r
+[LibraryClasses]\r
+ BaseLib\r
+ DebugLib\r
+ HobLib\r
+ PcdLib\r
+\r
+[FixedPcd]\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecGhcbBase\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFlashNvStorageVariableBase\r
+ gUefiOvmfPkgTokenSpaceGuid.PcdCfvRawDataSize\r
+\r
+[Guids]\r
+ gCcEventEntryHobGuid\r