1 /*++ 2 3 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR> 4 This program and the accompanying materials 5 are licensed and made available under the terms and conditions of the BSD License 6 which accompanies this distribution. The full text of the license may be found at 7 http://opensource.org/licenses/bsd-license.php 8 9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 11 12 Module Name: 13 14 PeiHob.h 15 16 Abstract: 17 18 PEI Hand Off Block (HOB) definition. 19 20 The HOB is a memory data structure used to hand-off system information from 21 PEI to DXE (the next phase). 22 23 --*/ 24 25 #ifndef _PEI_HOB_H_ 26 #define _PEI_HOB_H_ 27 28 #include "BootMode.h" 29 30 // 31 // Every Hob must start with this data structure. 32 // 33 typedef struct { 34 UINT16 HobType; 35 UINT16 HobLength; 36 UINT32 Reserved; 37 } EFI_HOB_GENERIC_HEADER; 38 39 // 40 // End of HOB List HOB 41 // 42 #define EFI_HOB_TYPE_END_OF_HOB_LIST 0xffff 43 44 // 45 // Handoff Information Table HOB 46 // 47 #define EFI_HOB_TYPE_HANDOFF 0x0001 48 49 #define EFI_HOB_HANDOFF_TABLE_VERSION 0x0009 50 51 typedef UINT32 EFI_BOOT_MODE; 52 53 typedef struct { 54 EFI_HOB_GENERIC_HEADER Header; 55 UINT32 Version; 56 EFI_BOOT_MODE BootMode; 57 EFI_PHYSICAL_ADDRESS EfiMemoryTop; 58 EFI_PHYSICAL_ADDRESS EfiMemoryBottom; 59 EFI_PHYSICAL_ADDRESS EfiFreeMemoryTop; 60 EFI_PHYSICAL_ADDRESS EfiFreeMemoryBottom; 61 EFI_PHYSICAL_ADDRESS EfiEndOfHobList; 62 } EFI_HOB_HANDOFF_INFO_TABLE; 63 64 // 65 // Memory Descriptor HOB 66 // 67 #define EFI_HOB_TYPE_MEMORY_ALLOCATION 0x0002 68 69 typedef struct { 70 EFI_GUID Name; 71 EFI_PHYSICAL_ADDRESS MemoryBaseAddress; 72 UINT64 MemoryLength; 73 EFI_MEMORY_TYPE MemoryType; 74 UINT8 Reserved[4]; 75 } EFI_HOB_MEMORY_ALLOCATION_HEADER; 76 77 typedef struct { 78 EFI_HOB_GENERIC_HEADER Header; 79 EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor; 80 // 81 // Additional data pertaining to the "Name" Guid memory 82 // may go here. 83 // 84 } EFI_HOB_MEMORY_ALLOCATION; 85 86 typedef struct { 87 EFI_HOB_GENERIC_HEADER Header; 88 EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor; 89 } EFI_HOB_MEMORY_ALLOCATION_BSP_STORE; 90 91 typedef struct { 92 EFI_HOB_GENERIC_HEADER Header; 93 EFI_HOB_MEMORY_ALLOCATION_HEADER AllocDescriptor; 94 } EFI_HOB_MEMORY_ALLOCATION_STACK; 95 96 typedef struct { 97 EFI_HOB_GENERIC_HEADER Header; 98 EFI_HOB_MEMORY_ALLOCATION_HEADER MemoryAllocationHeader; 99 EFI_GUID ModuleName; 100 EFI_PHYSICAL_ADDRESS EntryPoint; 101 } EFI_HOB_MEMORY_ALLOCATION_MODULE; 102 103 #define EFI_HOB_TYPE_RESOURCE_DESCRIPTOR 0x0003 104 105 typedef UINT32 EFI_RESOURCE_TYPE; 106 107 #define EFI_RESOURCE_SYSTEM_MEMORY 0 108 #define EFI_RESOURCE_MEMORY_MAPPED_IO 1 109 #define EFI_RESOURCE_IO 2 110 #define EFI_RESOURCE_FIRMWARE_DEVICE 3 111 #define EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 4 112 #define EFI_RESOURCE_MEMORY_RESERVED 5 113 #define EFI_RESOURCE_IO_RESERVED 6 114 #define EFI_RESOURCE_MAX_MEMORY_TYPE 7 115 116 typedef UINT32 EFI_RESOURCE_ATTRIBUTE_TYPE; 117 118 #define EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001 119 #define EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002 120 #define EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004 121 #define EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008 122 #define EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010 123 #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020 124 #define EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040 125 #define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080 126 #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100 127 #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200 128 #define EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400 129 #define EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800 130 #define EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000 131 #define EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000 132 #define EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000 133 #define EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000 134 #define EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000 135 #define EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000 136 // 137 // The following values are defined in PI 1.2 errata B. 138 // 139 #define EFI_RESOURCE_ATTRIBUTE_READ_PROTECTABLE 0x00100000 140 #define EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTABLE 0x00200000 141 #define EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTABLE 0x00400000 142 143 typedef struct { 144 EFI_HOB_GENERIC_HEADER Header; 145 EFI_GUID Owner; 146 EFI_RESOURCE_TYPE ResourceType; 147 EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute; 148 EFI_PHYSICAL_ADDRESS PhysicalStart; 149 UINT64 ResourceLength; 150 } EFI_HOB_RESOURCE_DESCRIPTOR; 151 152 // 153 // GUID Extension HOB 154 // The HobLength is variable as it includes the GUID specific data. 155 // 156 #define EFI_HOB_TYPE_GUID_EXTENSION 0x0004 157 158 typedef struct { 159 EFI_HOB_GENERIC_HEADER Header; 160 EFI_GUID Name; 161 162 // 163 // Guid specific data goes here 164 // 165 } EFI_HOB_GUID_TYPE; 166 167 // 168 // Firmware Volume HOB 169 // 170 #define EFI_HOB_TYPE_FV 0x0005 171 172 typedef struct { 173 EFI_HOB_GENERIC_HEADER Header; 174 EFI_PHYSICAL_ADDRESS BaseAddress; 175 UINT64 Length; 176 } EFI_HOB_FIRMWARE_VOLUME; 177 178 // 179 // CPU HOB 180 // 181 #define EFI_HOB_TYPE_CPU 0x0006 182 183 typedef struct { 184 EFI_HOB_GENERIC_HEADER Header; 185 UINT8 SizeOfMemorySpace; 186 UINT8 SizeOfIoSpace; 187 UINT8 Reserved[6]; 188 } EFI_HOB_CPU; 189 190 // 191 // PEI Core Memory Pool HOB 192 // The HobLength is variable as the HOB contains pool allocations by 193 // the PeiServices AllocatePool function 194 // 195 #define EFI_HOB_TYPE_PEI_MEMORY_POOL 0x0007 196 197 typedef struct { 198 EFI_HOB_GENERIC_HEADER Header; 199 } EFI_HOB_MEMORY_POOL; 200 201 // 202 // Capsule volume HOB -- identical to a firmware volume 203 // 204 #define EFI_HOB_TYPE_CV 0x0008 205 206 typedef struct { 207 EFI_HOB_GENERIC_HEADER Header; 208 EFI_PHYSICAL_ADDRESS BaseAddress; 209 UINT64 Length; 210 } EFI_HOB_CAPSULE_VOLUME; 211 212 #if (PI_SPECIFICATION_VERSION >= 0x00010000) 213 214 #define EFI_HOB_TYPE_FV2 0x0009 215 216 typedef struct { 217 EFI_HOB_GENERIC_HEADER Header; 218 EFI_PHYSICAL_ADDRESS BaseAddress; 219 UINT64 Length; 220 EFI_GUID FvName; 221 EFI_GUID FileName; 222 } EFI_HOB_FIRMWARE_VOLUME2; 223 224 #define EFI_HOB_TYPE_LOAD_PEIM_UNUSED 0x000A 225 226 #endif 227 228 #define EFI_HOB_TYPE_UNUSED 0xFFFE 229 230 // 231 // Union of all the possible HOB Types 232 // 233 typedef union { 234 EFI_HOB_GENERIC_HEADER *Header; 235 EFI_HOB_HANDOFF_INFO_TABLE *HandoffInformationTable; 236 EFI_HOB_MEMORY_ALLOCATION *MemoryAllocation; 237 EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *MemoryAllocationBspStore; 238 EFI_HOB_MEMORY_ALLOCATION_STACK *MemoryAllocationStack; 239 EFI_HOB_MEMORY_ALLOCATION_MODULE *MemoryAllocationModule; 240 EFI_HOB_RESOURCE_DESCRIPTOR *ResourceDescriptor; 241 EFI_HOB_GUID_TYPE *Guid; 242 EFI_HOB_FIRMWARE_VOLUME *FirmwareVolume; 243 #if (PI_SPECIFICATION_VERSION >= 0x00010000) 244 EFI_HOB_FIRMWARE_VOLUME2 *FirmwareVolume2; 245 #endif 246 EFI_HOB_CPU *Cpu; 247 EFI_HOB_MEMORY_POOL *Pool; 248 EFI_HOB_CAPSULE_VOLUME *CapsuleVolume; 249 UINT8 *Raw; 250 } EFI_PEI_HOB_POINTERS; 251 252 #define GET_HOB_TYPE(Hob) ((Hob).Header->HobType) 253 #define GET_HOB_LENGTH(Hob) ((Hob).Header->HobLength) 254 #define GET_NEXT_HOB(Hob) ((Hob).Raw + GET_HOB_LENGTH (Hob)) 255 #define END_OF_HOB_LIST(Hob) (GET_HOB_TYPE (Hob) == EFI_HOB_TYPE_END_OF_HOB_LIST) 256 257 #endif 258