efi/libstub: Add Confidential Computing (CC) measurement typedefs
[sfrench/cifs-2.6.git] / drivers / firmware / efi / libstub / efistub.h
index 043a3ff435f35edb985fd6d1888ec4350e8a7a65..6b020aadcf948171376006d35b7546de4155ed68 100644 (file)
@@ -882,6 +882,85 @@ 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
+
+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;