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