1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved. 4 * 5 * @par Reference(s): 6 * - UEFI Platform Initialization Specification 7 * (https://uefi.org/specs/PI/1.8/index.html) 8 */ 9 10 #ifndef __HOB_H 11 #define __HOB_H 12 13 #include <efi/efi_types.h> 14 #include <efi/hob_guid.h> 15 #include <efi/mmram.h> 16 #include <efi/mpinfo.h> 17 18 #include <tee_api_types.h> 19 #include <types_ext.h> 20 21 #define HOB_ALIGN 8 22 23 /***************************************************************************** 24 * Hob Generic Header * 25 *****************************************************************************/ 26 27 /** 28 * HobType values of EFI_HOB_GENERIC_HEADER. 29 */ 30 #define EFI_HOB_TYPE_HANDOFF 0x0001 31 #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002 32 #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003 33 #define EFI_HOB_TYPE_GUID_EXTENSION 0x0004 34 #define EFI_HOB_TYPE_FV 0x0005 35 #define EFI_HOB_TYPE_CPU 0x0006 36 #define EFI_HOB_TYPE_MEMORY_POOL 0x0007 37 #define EFI_HOB_TYPE_FV2 0x0009 38 #define EFI_HOB_TYPE_LOAD_PEIM_UNUSED 0x000A 39 #define EFI_HOB_TYPE_UEFI_CAPSULE 0x000B 40 #define EFI_HOB_TYPE_FV3 0x000C 41 #define EFI_HOB_TYPE_UNUSED 0xFFFE 42 #define EFI_HOB_TYPE_END_OF_HOB_LIST 0xFFFF 43 44 struct efi_hob_generic_header { 45 uint16_t hob_type; 46 uint16_t hob_length; 47 uint32_t reserved; 48 }; 49 50 /***************************************************************************** 51 * PHIT Hob. * 52 *****************************************************************************/ 53 54 #define EFI_HOB_HANDOFF_TABLE_VERSION 0x000a 55 56 struct efi_hob_handoff_info_table { 57 struct efi_hob_generic_header header; 58 uint32_t version; 59 efi_boot_mode_t boot_mode; 60 efi_physical_address_t efi_memory_top; 61 efi_physical_address_t efi_memory_bottom; 62 efi_physical_address_t efi_free_memory_top; 63 efi_physical_address_t efi_free_memory_bottom; 64 efi_physical_address_t efi_end_of_hob_list; 65 }; 66 67 /***************************************************************************** 68 * Resource Descriptor Hob. * 69 *****************************************************************************/ 70 71 struct efi_hob_resource_descriptor { 72 struct efi_hob_generic_header header; 73 TEE_UUID owner; 74 efi_resource_type_t resource_type; 75 efi_resource_attribute_type_t resource_attribute; 76 efi_physical_address_t physical_start; 77 uint64_t resource_length; 78 }; 79 80 /***************************************************************************** 81 * Guid Extension Hob. * 82 *****************************************************************************/ 83 struct efi_hob_guid_type { 84 struct efi_hob_generic_header header; 85 TEE_UUID name; 86 /** 87 * Guid specific data goes here. 88 */ 89 }; 90 91 /***************************************************************************** 92 * Firmware Volume Hob. * 93 *****************************************************************************/ 94 struct efi_hob_firmware_volume { 95 struct efi_hob_generic_header header; 96 efi_physical_address_t base_address; 97 uint64_t length; 98 /** 99 * Guid specific data goes here. 100 */ 101 }; 102 103 /***************************************************************************** 104 * Interfaces. * 105 *****************************************************************************/ 106 struct efi_hob_handoff_info_table * 107 efi_create_hob_list(vaddr_t mem_begin, size_t mem_len, 108 vaddr_t mem_free_begin, size_t mem_free_len); 109 110 TEE_Result 111 efi_create_resource_desc_hob(struct efi_hob_handoff_info_table *hob_table, 112 efi_resource_type_t resource_type, 113 efi_resource_attribute_type_t resource_attribute, 114 efi_physical_address_t phy_addr_start, 115 uint64_t resource_length); 116 117 TEE_Result efi_create_guid_hob(struct efi_hob_handoff_info_table *hob_table, 118 TEE_UUID *guid, uint16_t data_length, 119 void **data); 120 121 TEE_Result efi_create_fv_hob(struct efi_hob_handoff_info_table *hob_table, 122 efi_physical_address_t base_addr, uint64_t size); 123 124 #endif /*__HOB_H */ 125