1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Defines data structures and APIs that allow an OS to interact with UEFI
4 * firmware to query information about the device
6 * Copyright (c) 2020, Linaro Limited
9 #if !defined _EFI_TCG2_PROTOCOL_H_
10 #define _EFI_TCG2_PROTOCOL_H_
14 #define EFI_TCG2_PROTOCOL_GUID \
15 EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, \
16 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
19 #define TCG2_EVENT_LOG_FORMAT_TCG_2 0x00000002
21 /* Algorithm Registry */
22 #define EFI_TCG2_BOOT_HASH_ALG_SHA1 0x00000001
23 #define EFI_TCG2_BOOT_HASH_ALG_SHA256 0x00000002
24 #define EFI_TCG2_BOOT_HASH_ALG_SHA384 0x00000004
25 #define EFI_TCG2_BOOT_HASH_ALG_SHA512 0x00000008
26 #define EFI_TCG2_BOOT_HASH_ALG_SM3_256 0x00000010
28 typedef u32 efi_tcg_event_log_bitmap;
29 typedef u32 efi_tcg_event_log_format;
30 typedef u32 efi_tcg_event_algorithm_bitmap;
32 struct efi_tcg2_version {
37 struct efi_tcg2_event_header {
44 struct efi_tcg2_event {
46 struct efi_tcg2_event_header header;
50 struct efi_tcg2_boot_service_capability {
52 struct efi_tcg2_version structure_version;
53 struct efi_tcg2_version protocol_version;
54 efi_tcg_event_algorithm_bitmap hash_algorithm_bitmap;
55 efi_tcg_event_log_bitmap supported_event_logs;
58 u16 max_response_size;
60 u32 number_of_pcr_banks;
61 efi_tcg_event_algorithm_bitmap active_pcr_banks;
64 #define boot_service_capability_min \
65 sizeof(struct efi_tcg2_boot_service_capability) - \
66 offsetof(struct efi_tcg2_boot_service_capability, number_of_pcr_banks)
68 struct efi_tcg2_protocol {
69 efi_status_t (EFIAPI * get_capability)(struct efi_tcg2_protocol *this,
70 struct efi_tcg2_boot_service_capability *capability);
71 efi_status_t (EFIAPI * get_eventlog)(struct efi_tcg2_protocol *this,
72 efi_tcg_event_log_format log_format,
73 u64 *event_log_location, u64 *event_log_last_entry,
74 bool *event_log_truncated);
75 efi_status_t (EFIAPI * hash_log_extend_event)(struct efi_tcg2_protocol *this,
76 u64 flags, u64 data_to_hash,
78 struct efi_tcg2_event *efi_tcg_event);
79 efi_status_t (EFIAPI * submit_command)(struct efi_tcg2_protocol *this,
80 u32 input_parameter_block_size,
81 u8 *input_parameter_block,
82 u32 output_parameter_block_size,
83 u8 *output_parameter_block);
84 efi_status_t (EFIAPI * get_active_pcr_banks)(struct efi_tcg2_protocol *this,
85 u32 *active_pcr_banks);
86 efi_status_t (EFIAPI * set_active_pcr_banks)(struct efi_tcg2_protocol *this,
87 u32 active_pcr_banks);
88 efi_status_t (EFIAPI * get_result_of_set_active_pcr_banks)(struct efi_tcg2_protocol *this,
89 u32 *operation_present,