]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Include/EfiTpm.h
Add in the 1st version of ECP.
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Include / EfiTpm.h
diff --git a/EdkCompatibilityPkg/Foundation/Include/EfiTpm.h b/EdkCompatibilityPkg/Foundation/Include/EfiTpm.h
new file mode 100644 (file)
index 0000000..67379aa
--- /dev/null
@@ -0,0 +1,144 @@
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation                                                         \r
+All rights reserved. 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
+\r
+Module Name:\r
+\r
+  EfiTpm.h\r
+\r
+Abstract:\r
+\r
+  EFI definition according to TCG_EFI_Platform_1_20_Final\r
+\r
+  See http://trustedcomputinggroup.org for latest specification updates\r
+\r
+--*/\r
+\r
+#ifndef _EFI_TPM_H_\r
+#define _EFI_TPM_H_\r
+\r
+#include <Tiano.h>\r
+\r
+//\r
+// The start of TPM return codes\r
+//\r
+#define TPM_BASE                    (EFI_MAX_BIT + (EFI_MAX_BIT >> 1))\r
+#include <IndustryStandard/Tpm12.h>\r
+\r
+//\r
+// Standard event types\r
+//\r
+#define EV_POST_CODE                ((TCG_EVENTTYPE) 0x00000001)\r
+#define EV_SEPARATOR                ((TCG_EVENTTYPE) 0x00000004)\r
+#define EV_S_CRTM_CONTENTS          ((TCG_EVENTTYPE) 0x00000007)\r
+#define EV_S_CRTM_VERSION           ((TCG_EVENTTYPE) 0x00000008)\r
+\r
+//\r
+// EFI specific event types\r
+//\r
+#define EV_EFI_EVENT_BASE                   ((TCG_EVENTTYPE) 0x80000000)\r
+#define EV_EFI_VARIABLE_DRIVER_CONFIG       (EV_EFI_EVENT_BASE + 1)\r
+#define EV_EFI_VARIABLE_BOOT                (EV_EFI_EVENT_BASE + 2)\r
+#define EV_EFI_BOOT_SERVICES_APPLICATION    (EV_EFI_EVENT_BASE + 3)\r
+#define EV_EFI_BOOT_SERVICES_DRIVER         (EV_EFI_EVENT_BASE + 4)\r
+#define EV_EFI_RUNTIME_SERVICES_DRIVER      (EV_EFI_EVENT_BASE + 5)\r
+#define EV_EFI_GPT_EVENT                    (EV_EFI_EVENT_BASE + 6)\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
+\r
+//\r
+// Set structure alignment to 1-byte\r
+//\r
+#pragma pack (push, 1)\r
+\r
+typedef UINT32                     TCG_EVENTTYPE;\r
+\r
+#define TCG_DIGEST                 TPM_DIGEST\r
+#define TCG_PCRINDEX               TPM_PCRINDEX\r
+\r
+//\r
+// TCG_PCR_EVENT\r
+//\r
+typedef struct tdTCG_PCR_EVENT {\r
+  TCG_PCRINDEX                      PCRIndex;  // PCRIndex event extended to\r
+  TCG_EVENTTYPE                     EventType; // TCG EFI event type\r
+  TCG_DIGEST                        Digest;    // Value extended into PCRIndex\r
+  UINT32                            EventSize; // Size of the event data\r
+  UINT8                             Event[1];  // The event data\r
+} TCG_PCR_EVENT;\r
+\r
+//\r
+// TCG_PCR_EVENT_HDR\r
+//\r
+typedef struct tdTCG_PCR_EVENT_HDR {\r
+  TCG_PCRINDEX                      PCRIndex;\r
+  TCG_EVENTTYPE                     EventType;\r
+  TCG_DIGEST                        Digest;\r
+  UINT32                            EventSize;\r
+} TCG_PCR_EVENT_HDR;\r
+\r
+//\r
+// EFI_PLATFORM_FIRMWARE_BLOB\r
+//\r
+// BlobLength should be of type UINTN but we use UINT64 here\r
+// because PEI is 32-bit while DXE is 64-bit on x64 platforms\r
+//\r
+typedef struct tdEFI_PLATFORM_FIRMWARE_BLOB {\r
+  EFI_PHYSICAL_ADDRESS              BlobBase;\r
+  UINT64                            BlobLength;\r
+} EFI_PLATFORM_FIRMWARE_BLOB;\r
+\r
+//\r
+// EFI_IMAGE_LOAD_EVENT\r
+//\r
+// This structure is used in EV_EFI_BOOT_SERVICES_APPLICATION,\r
+// EV_EFI_BOOT_SERVICES_DRIVER and EV_EFI_RUNTIME_SERVICES_DRIVER\r
+//\r
+typedef struct tdEFI_IMAGE_LOAD_EVENT {\r
+  EFI_PHYSICAL_ADDRESS              ImageLocationInMemory;\r
+  UINTN                             ImageLengthInMemory;\r
+  UINTN                             ImageLinkTimeAddress;\r
+  UINTN                             LengthOfDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL          DevicePath[1];\r
+} EFI_IMAGE_LOAD_EVENT;\r
+\r
+//\r
+// EFI_HANDOFF_TABLE_POINTERS\r
+//\r
+// This structure is used in EV_EFI_HANDOFF_TABLES event to facilitate\r
+// the measurement of given configuration tables.\r
+//\r
+typedef struct tdEFI_HANDOFF_TABLE_POINTERS {\r
+  UINTN                            NumberOfTables;\r
+  EFI_CONFIGURATION_TABLE           TableEntry[1];\r
+} EFI_HANDOFF_TABLE_POINTERS;\r
+\r
+//\r
+// EFI_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
+//\r
+typedef struct tdEFI_VARIABLE_DATA {\r
+  EFI_GUID                          VariableName;\r
+  UINTN                             UnicodeNameLength;\r
+  UINTN                             VariableDataLength;\r
+  CHAR16                            UnicodeName[1];\r
+  INT8                              VariableData[1];  // Driver or platform-specific data\r
+} EFI_VARIABLE_DATA;\r
+\r
+//\r
+// Restore original structure alignment\r
+//\r
+#pragma pack (pop)\r
+\r
+#endif  // _EFI_TPM_H_\r