diff options
author | Tom Rini <trini@konsulko.com> | 2021-08-23 19:44:12 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-23 19:44:12 +0300 |
commit | 4865db07169126ca0205f1a6265adf01bd69b3df (patch) | |
tree | 0e655eaf50b9edc572509c8feea58b2401fc01f9 /include | |
parent | 18f4e858762d3fc858c1a076616208aa4ab6c9be (diff) | |
parent | 9a4b3c8e914dbb9d06640d8e04db8a06dedca051 (diff) | |
download | u-boot-4865db07169126ca0205f1a6265adf01bd69b3df.tar.xz |
Merge tag 'efi-2021-10-rc3' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2021-10-rc3
Documentation:
* Rename Freescale to NXP
* Document structures used for the UEFI TCG2 protocol
UEFI:
* Device paths must use EfiBootServicesData
Diffstat (limited to 'include')
-rw-r--r-- | include/efi.h | 36 | ||||
-rw-r--r-- | include/efi_api.h | 2 | ||||
-rw-r--r-- | include/efi_loader.h | 9 | ||||
-rw-r--r-- | include/efi_tcg2.h | 57 |
4 files changed, 89 insertions, 15 deletions
diff --git a/include/efi.h b/include/efi.h index 6417a9b8c5..18c13e0370 100644 --- a/include/efi.h +++ b/include/efi.h @@ -125,8 +125,36 @@ struct efi_table_hdr { u32 reserved; }; +/* Allocation types for calls to boottime->allocate_pages*/ +/** + * enum efi_allocate_type - address restriction for memory allocation + */ +enum efi_allocate_type { + /** + * @EFI_ALLOCATE_ANY_PAGES: + * Allocate any block of sufficient size. Ignore memory address. + */ + EFI_ALLOCATE_ANY_PAGES, + /** + * @EFI_ALLOCATE_MAX_ADDRESS: + * Allocate a memory block with an uppermost address less or equal + * to the indicated address. + */ + EFI_ALLOCATE_MAX_ADDRESS, + /** + * @EFI_ALLOCATE_ADDRESS: + * Allocate a memory block starting at the indicatged adress. + */ + EFI_ALLOCATE_ADDRESS, + /** + * @EFI_MAX_ALLOCATE_TYPE: + * Value use for range checking. + */ + EFI_MAX_ALLOCATE_TYPE, +}; + /* Enumeration of memory types introduced in UEFI */ -enum efi_mem_type { +enum efi_memory_type { EFI_RESERVED_MEMORY_TYPE, /* * The code portions of a loaded application. @@ -224,12 +252,6 @@ struct efi_mem_desc { #define EFI_MEMORY_DESCRIPTOR_VERSION 1 -/* Allocation types for calls to boottime->allocate_pages*/ -#define EFI_ALLOCATE_ANY_PAGES 0 -#define EFI_ALLOCATE_MAX_ADDRESS 1 -#define EFI_ALLOCATE_ADDRESS 2 -#define EFI_MAX_ALLOCATE_TYPE 3 - /* Types and defines for Time Services */ #define EFI_TIME_ADJUST_DAYLIGHT 0x1 #define EFI_TIME_IN_DAYLIGHT 0x2 diff --git a/include/efi_api.h b/include/efi_api.h index 38ac47f164..c8f959bb72 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -249,7 +249,7 @@ struct efi_memory_range { struct efi_memory_range_capsule { struct efi_capsule_header *header; /* EFI_MEMORY_TYPE: 0x80000000-0xFFFFFFFF */ - enum efi_mem_type os_requested_memory_type; + enum efi_memory_type os_requested_memory_type; u64 number_of_memory_ranges; struct efi_memory_range memory_ranges[]; } __packed; diff --git a/include/efi_loader.h b/include/efi_loader.h index 32cb8d0f1e..c440962fe5 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -676,13 +676,14 @@ struct efi_device_path *efi_get_dp_from_boot(const efi_guid_t guid); /* Generic EFI memory allocator, call this to get memory */ void *efi_alloc(uint64_t len, int memory_type); /* More specific EFI memory allocator, called by EFI payloads */ -efi_status_t efi_allocate_pages(int type, int memory_type, efi_uintn_t pages, - uint64_t *memory); +efi_status_t efi_allocate_pages(enum efi_allocate_type type, + enum efi_memory_type memory_type, + efi_uintn_t pages, uint64_t *memory); /* EFI memory free function. */ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages); /* EFI memory allocator for small allocations */ -efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, - void **buffer); +efi_status_t efi_allocate_pool(enum efi_memory_type pool_type, + efi_uintn_t size, void **buffer); /* EFI pool memory free function. */ efi_status_t efi_free_pool(void *buffer); /* Returns the EFI memory map */ diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h index 497ba3ce94..b6b958da51 100644 --- a/include/efi_tcg2.h +++ b/include/efi_tcg2.h @@ -3,6 +3,13 @@ * Defines data structures and APIs that allow an OS to interact with UEFI * firmware to query information about the device * + * This file refers the following TCG specification. + * - TCG PC Client Platform Firmware Profile Specification + * https://trustedcomputinggroup.org/resource/pc-client-specific-platform-firmware-profile-specification/ + * + * - TCG EFI Protocol Specification + * https://trustedcomputinggroup.org/resource/tcg-efi-protocol-specification/ + * * Copyright (c) 2020, Linaro Limited */ @@ -36,11 +43,23 @@ typedef u32 efi_tcg_event_log_bitmap; typedef u32 efi_tcg_event_log_format; typedef u32 efi_tcg_event_algorithm_bitmap; +/** + * struct tdEFI_TCG2_VERSION - structure of EFI TCG2 version + * @major: major version + * @minor: minor version + */ struct efi_tcg2_version { u8 major; u8 minor; }; +/** + * struct tdEFI_TCG2_EVENT_HEADER - structure of EFI TCG2 event header + * @header_size: size of the event header + * @header_version: header version + * @pcr_index: index of the PCR that is extended + * @event_type: type of the event that is extended + */ struct efi_tcg2_event_header { u32 header_size; u16 header_version; @@ -48,12 +67,27 @@ struct efi_tcg2_event_header { u32 event_type; } __packed; +/** + * struct tdEFI_TCG2_EVENT - structure of EFI TCG2 event + * @size: total size of the event including the size component, the header + * and the event data + * @header: event header + * @event: event to add + */ struct efi_tcg2_event { u32 size; struct efi_tcg2_event_header header; u8 event[]; } __packed; +/** + * struct tdUEFI_IMAGE_LOAD_EVENT - structure of PE/COFF image measurement + * @image_location_in_memory: image address + * @image_length_in_memory: image size + * @image_link_time_address: image link time address + * @length_of_device_path: devive path size + * @device_path: device path + */ struct uefi_image_load_event { efi_physical_addr_t image_location_in_memory; u64 image_length_in_memory; @@ -62,6 +96,23 @@ struct uefi_image_load_event { struct efi_device_path device_path[]; }; +/** + * struct tdEFI_TCG2_BOOT_SERVICE_CAPABILITY - protocol capability information + * @size: allocated size of the structure + * @structure_version: version of this structure + * @protocol_version: version of the EFI TCG2 protocol. + * @hash_algorithm_bitmap: supported hash algorithms + * @supported_event_logs: bitmap of supported event log formats + * @tpm_present_flag: false = TPM not present + * @max_command_size: max size (in bytes) of a command + * that can be sent to the TPM + * @max_response_size: max size (in bytes) of a response that + * can be provided by the TPM + * @manufacturer_id: 4-byte Vendor ID + * @number_of_pcr_banks: maximum number of PCR banks + * @active_pcr_banks: bitmap of currently active + * PCR banks (hashing algorithms). + */ struct efi_tcg2_boot_service_capability { u8 size; struct efi_tcg2_version structure_version; @@ -86,7 +137,7 @@ struct efi_tcg2_boot_service_capability { #define TCG_EFI_SPEC_ID_EVENT_SPEC_VERSION_ERRATA_TPM2 2 /** - * struct TCG_EfiSpecIdEventAlgorithmSize + * struct TCG_EfiSpecIdEventAlgorithmSize - hashing algorithm information * * @algorithm_id: algorithm defined in enum tpm2_algorithms * @digest_size: size of the algorithm @@ -97,7 +148,7 @@ struct tcg_efi_spec_id_event_algorithm_size { } __packed; /** - * struct TCG_EfiSpecIDEventStruct + * struct TCG_EfiSpecIDEventStruct - content of the event log header * * @signature: signature, set to Spec ID Event03 * @platform_class: class defined in TCG ACPI Specification @@ -130,7 +181,7 @@ struct tcg_efi_spec_id_event { } __packed; /** - * struct tdEFI_TCG2_FINAL_EVENTS_TABLE + * struct tdEFI_TCG2_FINAL_EVENTS_TABLE - log entries after Get Event Log * @version: version number for this structure * @number_of_events: number of events recorded after invocation of * GetEventLog() |