Merge tag 'efi-next-for-v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
[sfrench/cifs-2.6.git] / drivers / firmware / efi / libstub / efistub.h
index fc18fd649ed771a9edad143b263bd4f887f5f467..27abb4ce029173f52cf204122ddd28093ae3e023 100644 (file)
@@ -843,14 +843,14 @@ struct efi_tcg2_event {
        /* u8[] event follows here */
 } __packed;
 
-struct efi_tcg2_tagged_event {
-       u32 tagged_event_id;
-       u32 tagged_event_data_size;
-       /* u8  tagged event data follows here */
-} __packed;
+/* from TCG PC Client Platform Firmware Profile Specification */
+typedef struct tdTCG_PCClientTaggedEvent {
+       u32     tagged_event_id;
+       u32     tagged_event_data_size;
+       u8      tagged_event_data[];
+} TCG_PCClientTaggedEvent;
 
 typedef struct efi_tcg2_event efi_tcg2_event_t;
-typedef struct efi_tcg2_tagged_event efi_tcg2_tagged_event_t;
 typedef union efi_tcg2_protocol efi_tcg2_protocol_t;
 
 union efi_tcg2_protocol {
@@ -882,6 +882,87 @@ union efi_tcg2_protocol {
        } mixed_mode;
 };
 
+typedef struct {
+       u8 major;
+       u8 minor;
+} efi_cc_version_t;
+
+typedef struct {
+       u8 type;
+       u8 sub_type;
+} efi_cc_type_t;
+
+/* EFI CC type/subtype defines */
+#define EFI_CC_TYPE_NONE               0
+#define EFI_CC_TYPE_AMD_SEV            1
+#define EFI_CC_TYPE_INTEL_TDX          2
+
+typedef u32 efi_cc_mr_index_t;
+
+struct efi_cc_event {
+       u32 event_size;
+       struct {
+               u32 header_size;
+               u16 header_version;
+               u32 mr_index;
+               u32 event_type;
+       } __packed event_header;
+       /* u8[] event follows here */
+} __packed;
+
+typedef struct efi_cc_event efi_cc_event_t;
+
+typedef u32 efi_cc_event_log_bitmap_t;
+typedef u32 efi_cc_event_log_format_t;
+typedef u32 efi_cc_event_algorithm_bitmap_t;
+
+typedef struct {
+       u8                              size;
+       efi_cc_version_t                structure_version;
+       efi_cc_version_t                protocol_version;
+       efi_cc_event_algorithm_bitmap_t hash_algorithm_bitmap;
+       efi_cc_event_log_bitmap_t       supported_event_logs;
+       efi_cc_type_t                   cc_type;
+} efi_cc_boot_service_cap_t;
+
+#define EFI_CC_EVENT_HEADER_VERSION    1
+
+#define EFI_CC_BOOT_HASH_ALG_SHA384    0x00000004
+
+#define EFI_CC_EVENT_LOG_FORMAT_TCG_2  0x00000002
+
+typedef union efi_cc_protocol efi_cc_protocol_t;
+
+union efi_cc_protocol {
+       struct {
+               efi_status_t
+               (__efiapi *get_capability)(efi_cc_protocol_t *,
+                                          efi_cc_boot_service_cap_t *);
+
+               efi_status_t
+               (__efiapi *get_event_log)(efi_cc_protocol_t *,
+                                         efi_cc_event_log_format_t,
+                                         efi_physical_addr_t *,
+                                         efi_physical_addr_t *,
+                                         efi_bool_t *);
+
+               efi_status_t
+               (__efiapi *hash_log_extend_event)(efi_cc_protocol_t *, u64,
+                                                 efi_physical_addr_t, u64,
+                                                 const efi_cc_event_t *);
+
+               efi_status_t
+               (__efiapi *map_pcr_to_mr_index)(efi_cc_protocol_t *, u32,
+                                               efi_cc_mr_index_t *);
+       };
+       struct {
+               u32 get_capability;
+               u32 get_event_log;
+               u32 hash_log_extend_event;
+               u32 map_pcr_to_mr_index;
+       } mixed_mode;
+};
+
 struct riscv_efi_boot_protocol {
        u64 revision;
 
@@ -1061,7 +1142,7 @@ static inline void
 efi_enable_reset_attack_mitigation(void) { }
 #endif
 
-void efi_retrieve_tpm2_eventlog(void);
+void efi_retrieve_eventlog(void);
 
 struct screen_info *alloc_screen_info(void);
 struct screen_info *__alloc_screen_info(void);