]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / IndustryStandard / UefiTcgPlatform.h
index cc65ea1a91b22adbf9d5eed3230b83865a01ef0a..3f1d444aed0289fde28cc28cce5bc7d67443b2eb 100644 (file)
@@ -1,14 +1,8 @@
 /** @file\r
   TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final\r
 \r
-  Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
-  This program and the accompanying materials\r
-  are licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #define __UEFI_TCG_PLATFORM_H__\r
 \r
 #include <IndustryStandard/Tpm12.h>\r
+#include <IndustryStandard/Tpm20.h>\r
 #include <Uefi.h>\r
 \r
 //\r
 // Standard event types\r
 //\r
+#define EV_PREBOOT_CERT             ((TCG_EVENTTYPE) 0x00000000)\r
 #define EV_POST_CODE                ((TCG_EVENTTYPE) 0x00000001)\r
+#define EV_NO_ACTION                ((TCG_EVENTTYPE) 0x00000003)\r
 #define EV_SEPARATOR                ((TCG_EVENTTYPE) 0x00000004)\r
+#define EV_ACTION                   ((TCG_EVENTTYPE) 0x00000005)\r
 #define EV_S_CRTM_CONTENTS          ((TCG_EVENTTYPE) 0x00000007)\r
 #define EV_S_CRTM_VERSION           ((TCG_EVENTTYPE) 0x00000008)\r
+#define EV_CPU_MICROCODE            ((TCG_EVENTTYPE) 0x00000009)\r
+#define EV_PLATFORM_CONFIG_FLAGS    ((TCG_EVENTTYPE) 0x0000000A)\r
+#define EV_TABLE_OF_DEVICES         ((TCG_EVENTTYPE) 0x0000000B)\r
+#define EV_COMPACT_HASH             ((TCG_EVENTTYPE) 0x0000000C)\r
+#define EV_NONHOST_CODE             ((TCG_EVENTTYPE) 0x0000000F)\r
+#define EV_NONHOST_CONFIG           ((TCG_EVENTTYPE) 0x00000010)\r
+#define EV_NONHOST_INFO             ((TCG_EVENTTYPE) 0x00000011)\r
+#define EV_OMIT_BOOT_DEVICE_EVENTS  ((TCG_EVENTTYPE) 0x00000012)\r
 \r
 //\r
 // EFI specific event types\r
 #define EV_EFI_ACTION                       (EV_EFI_EVENT_BASE + 7)\r
 #define EV_EFI_PLATFORM_FIRMWARE_BLOB       (EV_EFI_EVENT_BASE + 8)\r
 #define EV_EFI_HANDOFF_TABLES               (EV_EFI_EVENT_BASE + 9)\r
+#define EV_EFI_HCRTM_EVENT                  (EV_EFI_EVENT_BASE + 0x10)\r
+#define EV_EFI_VARIABLE_AUTHORITY           (EV_EFI_EVENT_BASE + 0xE0)\r
 \r
 #define EFI_CALLING_EFI_APPLICATION         \\r
   "Calling EFI Application from Boot Option"\r
-#define EFI_RETURNING_FROM_EFI_APPLICATOIN  \\r
+#define EFI_RETURNING_FROM_EFI_APPLICATION  \\r
   "Returning from EFI Application from Boot Option"\r
 #define EFI_EXIT_BOOT_SERVICES_INVOCATION   \\r
   "Exit Boot Services Invocation"\r
 #define EFI_EXIT_BOOT_SERVICES_SUCCEEDED    \\r
   "Exit Boot Services Returned with Success"\r
 \r
+\r
+#define EV_POSTCODE_INFO_POST_CODE    "POST CODE"\r
+#define POST_CODE_STR_LEN             (sizeof(EV_POSTCODE_INFO_POST_CODE) - 1)\r
+\r
+#define EV_POSTCODE_INFO_SMM_CODE     "SMM CODE"\r
+#define SMM_CODE_STR_LEN              (sizeof(EV_POSTCODE_INFO_SMM_CODE) - 1)\r
+\r
+#define EV_POSTCODE_INFO_ACPI_DATA    "ACPI DATA"\r
+#define ACPI_DATA_LEN                 (sizeof(EV_POSTCODE_INFO_ACPI_DATA) - 1)\r
+\r
+#define EV_POSTCODE_INFO_BIS_CODE     "BIS CODE"\r
+#define BIS_CODE_LEN                  (sizeof(EV_POSTCODE_INFO_BIS_CODE) - 1)\r
+\r
+#define EV_POSTCODE_INFO_UEFI_PI      "UEFI PI"\r
+#define UEFI_PI_LEN                   (sizeof(EV_POSTCODE_INFO_UEFI_PI) - 1)\r
+\r
+#define EV_POSTCODE_INFO_OPROM        "Embedded Option ROM"\r
+#define OPROM_LEN                     (sizeof(EV_POSTCODE_INFO_OPROM) - 1)\r
+\r
+#define FIRMWARE_DEBUGGER_EVENT_STRING      "UEFI Debug Mode"\r
+#define FIRMWARE_DEBUGGER_EVENT_STRING_LEN  (sizeof(FIRMWARE_DEBUGGER_EVENT_STRING) - 1)\r
+\r
 //\r
 // Set structure alignment to 1-byte\r
 //\r
@@ -124,6 +154,7 @@ typedef struct tdEFI_HANDOFF_TABLE_POINTERS {
 /// This structure serves as the header for measuring variables. The name of the\r
 /// variable (in Unicode format) should immediately follow, then the variable\r
 /// data.\r
+/// This is defined in TCG EFI Platform Spec for TPM1.1 or 1.2 V1.22\r
 ///\r
 typedef struct tdEFI_VARIABLE_DATA {\r
   EFI_GUID                          VariableName;\r
@@ -133,12 +164,168 @@ typedef struct tdEFI_VARIABLE_DATA {
   INT8                              VariableData[1];  ///< Driver or platform-specific data\r
 } EFI_VARIABLE_DATA;\r
 \r
+///\r
+/// UEFI_VARIABLE_DATA\r
+///\r
+/// This structure serves as the header for measuring variables. The name of the\r
+/// variable (in Unicode format) should immediately follow, then the variable\r
+/// data.\r
+/// This is defined in TCG PC Client Firmware Profile Spec 00.21\r
+///\r
+typedef struct tdUEFI_VARIABLE_DATA {\r
+  EFI_GUID                          VariableName;\r
+  UINT64                            UnicodeNameLength;\r
+  UINT64                            VariableDataLength;\r
+  CHAR16                            UnicodeName[1];\r
+  INT8                              VariableData[1];  ///< Driver or platform-specific data\r
+} UEFI_VARIABLE_DATA;\r
+\r
+//\r
+// For TrEE1.0 compatibility\r
+//\r
+typedef struct {\r
+  EFI_GUID                          VariableName;\r
+  UINT64                            UnicodeNameLength;   // The TCG Definition used UINTN\r
+  UINT64                            VariableDataLength;  // The TCG Definition used UINTN\r
+  CHAR16                            UnicodeName[1];\r
+  INT8                              VariableData[1];\r
+} EFI_VARIABLE_DATA_TREE;\r
+\r
 typedef struct tdEFI_GPT_DATA {\r
   EFI_PARTITION_TABLE_HEADER  EfiPartitionHeader;\r
-  UINTN                       NumberOfPartitions; \r
+  UINTN                       NumberOfPartitions;\r
   EFI_PARTITION_ENTRY         Partitions[1];\r
 } EFI_GPT_DATA;\r
 \r
+//\r
+// Crypto Agile Log Entry Format\r
+//\r
+typedef struct tdTCG_PCR_EVENT2 {\r
+  TCG_PCRINDEX        PCRIndex;\r
+  TCG_EVENTTYPE       EventType;\r
+  TPML_DIGEST_VALUES  Digest;\r
+  UINT32              EventSize;\r
+  UINT8               Event[1];\r
+} TCG_PCR_EVENT2;\r
+\r
+//\r
+// TCG PCR Event2 Header\r
+// Follow TCG EFI Protocol Spec 5.2 Crypto Agile Log Entry Format\r
+//\r
+typedef struct tdTCG_PCR_EVENT2_HDR{\r
+  TCG_PCRINDEX        PCRIndex;\r
+  TCG_EVENTTYPE       EventType;\r
+  TPML_DIGEST_VALUES  Digests;\r
+  UINT32              EventSize;\r
+} TCG_PCR_EVENT2_HDR;\r
+\r
+//\r
+// Log Header Entry Data\r
+//\r
+typedef struct {\r
+  //\r
+  // TCG defined hashing algorithm ID.\r
+  //\r
+  UINT16              algorithmId;\r
+  //\r
+  // The size of the digest for the respective hashing algorithm.\r
+  //\r
+  UINT16              digestSize;\r
+} TCG_EfiSpecIdEventAlgorithmSize;\r
+\r
+#define TCG_EfiSpecIDEventStruct_SIGNATURE_02 "Spec ID Event02"\r
+#define TCG_EfiSpecIDEventStruct_SIGNATURE_03 "Spec ID Event03"\r
+\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM12   1\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM12   2\r
+#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM12          2\r
+\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MAJOR_TPM2   2\r
+#define TCG_EfiSpecIDEventStruct_SPEC_VERSION_MINOR_TPM2   0\r
+#define TCG_EfiSpecIDEventStruct_SPEC_ERRATA_TPM2          0\r
+\r
+typedef struct {\r
+  UINT8               signature[16];\r
+  //\r
+  // The value for the Platform Class.\r
+  // The enumeration is defined in the TCG ACPI Specification Client Common Header.\r
+  //\r
+  UINT32              platformClass;\r
+  //\r
+  // The TCG EFI Platform Specification minor version number this BIOS supports.\r
+  // Any BIOS supporting version (1.22) MUST set this value to 02h.\r
+  // Any BIOS supporting version (2.0) SHALL set this value to 0x00.\r
+  //\r
+  UINT8               specVersionMinor;\r
+  //\r
+  // The TCG EFI Platform Specification major version number this BIOS supports.\r
+  // Any BIOS supporting version (1.22) MUST set this value to 01h.\r
+  // Any BIOS supporting version (2.0) SHALL set this value to 0x02.\r
+  //\r
+  UINT8               specVersionMajor;\r
+  //\r
+  // The TCG EFI Platform Specification errata for this specification this BIOS supports.\r
+  // Any BIOS supporting version and errata (1.22) MUST set this value to 02h.\r
+  // Any BIOS supporting version and errata (2.0) SHALL set this value to 0x00.\r
+  //\r
+  UINT8               specErrata;\r
+  //\r
+  // Specifies the size of the UINTN fields used in various data structures used in this specification.\r
+  // 0x01 indicates UINT32 and 0x02 indicates UINT64.\r
+  //\r
+  UINT8               uintnSize;\r
+  //\r
+  // This field is added in "Spec ID Event03".\r
+  // The number of hashing algorithms used in this event log (except the first event).\r
+  // All events in this event log use all hashing algorithms defined here.\r
+  //\r
+//UINT32              numberOfAlgorithms;\r
+  //\r
+  // This field is added in "Spec ID Event03".\r
+  // An array of size numberOfAlgorithms of value pairs.\r
+  //\r
+//TCG_EfiSpecIdEventAlgorithmSize digestSize[numberOfAlgorithms];\r
+  //\r
+  // Size in bytes of the VendorInfo field.\r
+  // Maximum value SHALL be FFh bytes.\r
+  //\r
+//UINT8               vendorInfoSize;\r
+  //\r
+  // Provided for use by the BIOS implementer.\r
+  // The value might be used, for example, to provide more detailed information about the specific BIOS such as BIOS revision numbers, etc.\r
+  // The values within this field are not standardized and are implementer-specific.\r
+  // Platform-specific or -unique information SHALL NOT be provided in this field.\r
+  //\r
+//UINT8               vendorInfo[vendorInfoSize];\r
+} TCG_EfiSpecIDEventStruct;\r
+\r
+\r
+\r
+#define TCG_EfiStartupLocalityEvent_SIGNATURE      "StartupLocality"\r
+\r
+\r
+//\r
+// PC Client PTP spec Table 8 Relationship between Locality and Locality Attribute\r
+//\r
+#define LOCALITY_0_INDICATOR        0x01\r
+#define LOCALITY_1_INDICATOR        0x02\r
+#define LOCALITY_2_INDICATOR        0x03\r
+#define LOCALITY_3_INDICATOR        0x04\r
+#define LOCALITY_4_INDICATOR        0x05\r
+\r
+\r
+//\r
+// Startup Locality Event\r
+//\r
+typedef struct tdTCG_EfiStartupLocalityEvent{\r
+  UINT8       Signature[16];\r
+  //\r
+  // The Locality Indicator which sent the TPM2_Startup command\r
+  //\r
+  UINT8       StartupLocality;\r
+} TCG_EfiStartupLocalityEvent;\r
+\r
+\r
 //\r
 // Restore original structure alignment\r
 //\r