]>
Commit | Line | Data |
---|---|---|
3eb9473e | 1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004 - 2006, Intel Corporation \r | |
4 | All rights reserved. This program and the accompanying materials \r | |
5 | are licensed and made available under the terms and conditions of the BSD License \r | |
6 | which accompanies this distribution. The full text of the license may be found at \r | |
7 | http://opensource.org/licenses/bsd-license.php \r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | \r | |
12 | \r | |
13 | Module Name:\r | |
14 | \r | |
15 | EdkIIGlueHobLib.h\r | |
16 | \r | |
17 | Abstract: \r | |
18 | \r | |
19 | Public header file for Hob Lib\r | |
20 | \r | |
21 | --*/\r | |
22 | \r | |
23 | #ifndef __EDKII_GLUE_HOB_LIB_H__\r | |
24 | #define __EDKII_GLUE_HOB_LIB_H__\r | |
25 | \r | |
26 | \r | |
27 | #define GetFirstGuidHob(_GUID) GlueGetFirstGuidHob(_GUID)\r | |
28 | #define GetNextGuidHob(_GUID, _HobStart) GlueGetNextGuidHob(_GUID, _HobStart)\r | |
29 | #define BuildModuleHob(_MODULENAME, _MEMORYALLOCATIONMODULE, _MODULELENGTH, _ENTRYPOINT) GlueBuildModuleHob(_MODULENAME, _MEMORYALLOCATIONMODULE, _MODULELENGTH, _ENTRYPOINT)\r | |
30 | #define BuildMemoryAllocationHob(_BASEADDRESS, _LENGTH, _MEMORYTYPE) GlueBuildMemoryAllocationHob(_BASEADDRESS, _LENGTH, _MEMORYTYPE)\r | |
31 | \r | |
32 | \r | |
33 | /**\r | |
34 | Returns the pointer to the HOB list.\r | |
35 | \r | |
36 | This function returns the pointer to first HOB in the list.\r | |
37 | \r | |
38 | @return The pointer to the HOB list.\r | |
39 | \r | |
40 | **/\r | |
41 | VOID *\r | |
42 | EFIAPI\r | |
43 | GetHobList (\r | |
44 | VOID\r | |
45 | )\r | |
46 | ;\r | |
47 | \r | |
48 | /**\r | |
49 | Returns the next instance of a HOB type from the starting HOB.\r | |
50 | \r | |
51 | This function searches the first instance of a HOB type from the starting HOB pointer. \r | |
52 | If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r | |
53 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
54 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
55 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
56 | If HobStart is NULL, then ASSERT().\r | |
57 | \r | |
58 | @param Type The HOB type to return.\r | |
59 | @param HobStart The starting HOB pointer to search from.\r | |
60 | \r | |
61 | @return The next instance of a HOB type from the starting HOB.\r | |
62 | \r | |
63 | **/\r | |
64 | VOID *\r | |
65 | EFIAPI\r | |
66 | GetNextHob (\r | |
67 | IN UINT16 Type,\r | |
68 | IN CONST VOID *HobStart\r | |
69 | )\r | |
70 | ;\r | |
71 | \r | |
72 | /**\r | |
73 | Returns the first instance of a HOB type among the whole HOB list.\r | |
74 | \r | |
75 | This function searches the first instance of a HOB type among the whole HOB list. \r | |
76 | If there does not exist such HOB type in the HOB list, it will return NULL. \r | |
77 | \r | |
78 | @param Type The HOB type to return.\r | |
79 | \r | |
80 | @return The next instance of a HOB type from the starting HOB.\r | |
81 | \r | |
82 | **/\r | |
83 | VOID *\r | |
84 | EFIAPI\r | |
85 | GetFirstHob (\r | |
86 | IN UINT16 Type\r | |
87 | )\r | |
88 | ;\r | |
89 | \r | |
90 | /**\r | |
91 | This function searches the first instance of a HOB from the starting HOB pointer. \r | |
92 | Such HOB should satisfy two conditions: \r | |
93 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid. \r | |
94 | If there does not exist such HOB from the starting HOB pointer, it will return NULL. \r | |
95 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r | |
96 | to extract the data section and its size info respectively.\r | |
97 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
98 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
99 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
100 | If Guid is NULL, then ASSERT().\r | |
101 | If HobStart is NULL, then ASSERT().\r | |
102 | \r | |
103 | @param Guid The GUID to match with in the HOB list.\r | |
104 | @param HobStart A pointer to a Guid.\r | |
105 | \r | |
106 | @return The next instance of the matched GUID HOB from the starting HOB.\r | |
107 | \r | |
108 | **/\r | |
109 | VOID *\r | |
110 | EFIAPI\r | |
111 | GlueGetNextGuidHob (\r | |
112 | IN CONST EFI_GUID *Guid,\r | |
113 | IN CONST VOID *HobStart\r | |
114 | )\r | |
115 | ;\r | |
116 | \r | |
117 | /**\r | |
118 | This function searches the first instance of a HOB among the whole HOB list. \r | |
119 | Such HOB should satisfy two conditions:\r | |
120 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r | |
121 | If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r | |
122 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r | |
123 | to extract the data section and its size info respectively.\r | |
124 | If Guid is NULL, then ASSERT().\r | |
125 | \r | |
126 | @param Guid The GUID to match with in the HOB list.\r | |
127 | \r | |
128 | @return The first instance of the matched GUID HOB among the whole HOB list.\r | |
129 | \r | |
130 | **/\r | |
131 | VOID *\r | |
132 | EFIAPI\r | |
133 | GlueGetFirstGuidHob (\r | |
134 | IN CONST EFI_GUID *Guid\r | |
135 | )\r | |
136 | ;\r | |
137 | \r | |
138 | /**\r | |
139 | Get the Boot Mode from the HOB list.\r | |
140 | \r | |
141 | This function returns the system boot mode information from the \r | |
142 | PHIT HOB in HOB list.\r | |
143 | \r | |
144 | @param VOID\r | |
145 | \r | |
146 | @return The Boot Mode.\r | |
147 | \r | |
148 | **/\r | |
149 | EFI_BOOT_MODE\r | |
150 | EFIAPI\r | |
151 | GetBootModeHob (\r | |
152 | VOID\r | |
153 | )\r | |
154 | ;\r | |
155 | \r | |
156 | /**\r | |
157 | Builds a HOB for a loaded PE32 module.\r | |
158 | \r | |
159 | This function builds a HOB for a loaded PE32 module.\r | |
160 | It can only be invoked during PEI phase;\r | |
161 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
162 | If ModuleName is NULL, then ASSERT().\r | |
163 | If there is no additional space for HOB creation, then ASSERT().\r | |
164 | \r | |
165 | @param ModuleName The GUID File Name of the module.\r | |
166 | @param MemoryAllocationModule The 64 bit physical address of the module.\r | |
167 | @param ModuleLength The length of the module in bytes.\r | |
168 | @param EntryPoint The 64 bit physical address of the module entry point.\r | |
169 | \r | |
170 | **/\r | |
171 | VOID\r | |
172 | EFIAPI\r | |
173 | GlueBuildModuleHob (\r | |
174 | IN CONST EFI_GUID *ModuleName,\r | |
175 | IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r | |
176 | IN UINT64 ModuleLength,\r | |
177 | IN EFI_PHYSICAL_ADDRESS EntryPoint\r | |
178 | )\r | |
179 | ;\r | |
180 | \r | |
181 | /**\r | |
182 | Builds a HOB that describes a chunk of system memory.\r | |
183 | \r | |
184 | This function builds a HOB that describes a chunk of system memory.\r | |
185 | It can only be invoked during PEI phase;\r | |
186 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
187 | If there is no additional space for HOB creation, then ASSERT().\r | |
188 | \r | |
189 | @param ResourceType The type of resource described by this HOB.\r | |
190 | @param ResourceAttribute The resource attributes of the memory described by this HOB.\r | |
191 | @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r | |
192 | @param NumberOfBytes The length of the memory described by this HOB in bytes.\r | |
193 | \r | |
194 | **/\r | |
195 | VOID\r | |
196 | EFIAPI\r | |
197 | BuildResourceDescriptorHob (\r | |
198 | IN EFI_RESOURCE_TYPE ResourceType,\r | |
199 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r | |
200 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r | |
201 | IN UINT64 NumberOfBytes\r | |
202 | )\r | |
203 | ;\r | |
204 | \r | |
205 | /**\r | |
206 | Builds a GUID HOB with a certain data length.\r | |
207 | \r | |
208 | This function builds a customized HOB tagged with a GUID for identification \r | |
209 | and returns the start address of GUID HOB data so that caller can fill the customized data. \r | |
210 | The HOB Header and Name field is already stripped.\r | |
211 | It can only be invoked during PEI phase;\r | |
212 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
213 | If Guid is NULL, then ASSERT().\r | |
214 | If there is no additional space for HOB creation, then ASSERT().\r | |
215 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
216 | \r | |
217 | @param Guid The GUID to tag the customized HOB.\r | |
218 | @param DataLength The size of the data payload for the GUID HOB.\r | |
219 | \r | |
220 | @return The start address of GUID HOB data.\r | |
221 | \r | |
222 | **/\r | |
223 | VOID *\r | |
224 | EFIAPI\r | |
225 | BuildGuidHob (\r | |
226 | IN CONST EFI_GUID *Guid,\r | |
227 | IN UINTN DataLength\r | |
228 | )\r | |
229 | ;\r | |
230 | \r | |
231 | /**\r | |
232 | Copies a data buffer to a newly-built HOB.\r | |
233 | \r | |
234 | This function builds a customized HOB tagged with a GUID for identification,\r | |
235 | copies the input data to the HOB data field and returns the start address of the GUID HOB data.\r | |
236 | The HOB Header and Name field is already stripped.\r | |
237 | It can only be invoked during PEI phase;\r | |
238 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
239 | If Guid is NULL, then ASSERT().\r | |
240 | If Data is NULL and DataLength > 0, then ASSERT().\r | |
241 | If there is no additional space for HOB creation, then ASSERT().\r | |
242 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
243 | \r | |
244 | @param Guid The GUID to tag the customized HOB.\r | |
245 | @param Data The data to be copied into the data field of the GUID HOB.\r | |
246 | @param DataLength The size of the data payload for the GUID HOB.\r | |
247 | \r | |
248 | @return The start address of GUID HOB data.\r | |
249 | \r | |
250 | **/\r | |
251 | VOID *\r | |
252 | EFIAPI\r | |
253 | BuildGuidDataHob (\r | |
254 | IN CONST EFI_GUID *Guid,\r | |
255 | IN VOID *Data,\r | |
256 | IN UINTN DataLength\r | |
257 | )\r | |
258 | ;\r | |
259 | \r | |
260 | /**\r | |
261 | Builds a Firmware Volume HOB.\r | |
262 | \r | |
263 | This function builds a Firmware Volume HOB.\r | |
264 | It can only be invoked during PEI phase;\r | |
265 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
266 | If there is no additional space for HOB creation, then ASSERT().\r | |
267 | \r | |
268 | @param BaseAddress The base address of the Firmware Volume.\r | |
269 | @param Length The size of the Firmware Volume in bytes.\r | |
270 | \r | |
271 | **/\r | |
272 | VOID\r | |
273 | EFIAPI\r | |
274 | BuildFvHob (\r | |
275 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
276 | IN UINT64 Length\r | |
277 | )\r | |
278 | ;\r | |
279 | \r | |
280 | /**\r | |
281 | Builds a Capsule Volume HOB.\r | |
282 | \r | |
283 | This function builds a Capsule Volume HOB.\r | |
284 | It can only be invoked during PEI phase;\r | |
285 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
286 | If there is no additional space for HOB creation, then ASSERT().\r | |
287 | \r | |
288 | @param BaseAddress The base address of the Capsule Volume.\r | |
289 | @param Length The size of the Capsule Volume in bytes.\r | |
290 | \r | |
291 | **/\r | |
292 | VOID\r | |
293 | EFIAPI\r | |
294 | BuildCvHob (\r | |
295 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
296 | IN UINT64 Length\r | |
297 | )\r | |
298 | ;\r | |
299 | \r | |
300 | /**\r | |
301 | Builds a HOB for the CPU.\r | |
302 | \r | |
303 | This function builds a HOB for the CPU.\r | |
304 | It can only be invoked during PEI phase;\r | |
305 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
306 | If there is no additional space for HOB creation, then ASSERT().\r | |
307 | \r | |
308 | @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r | |
309 | @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r | |
310 | \r | |
311 | **/\r | |
312 | VOID\r | |
313 | EFIAPI\r | |
314 | BuildCpuHob (\r | |
315 | IN UINT8 SizeOfMemorySpace,\r | |
316 | IN UINT8 SizeOfIoSpace\r | |
317 | )\r | |
318 | ;\r | |
319 | \r | |
320 | /**\r | |
321 | Builds a HOB for the Stack.\r | |
322 | \r | |
323 | This function builds a HOB for the stack.\r | |
324 | It can only be invoked during PEI phase;\r | |
325 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
326 | If there is no additional space for HOB creation, then ASSERT().\r | |
327 | \r | |
328 | @param BaseAddress The 64 bit physical address of the Stack.\r | |
329 | @param Length The length of the stack in bytes.\r | |
330 | \r | |
331 | **/\r | |
332 | VOID\r | |
333 | EFIAPI\r | |
334 | BuildStackHob (\r | |
335 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
336 | IN UINT64 Length\r | |
337 | )\r | |
338 | ;\r | |
339 | \r | |
340 | /**\r | |
341 | Builds a HOB for the BSP store.\r | |
342 | \r | |
343 | This function builds a HOB for BSP store.\r | |
344 | It can only be invoked during PEI phase;\r | |
345 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
346 | If there is no additional space for HOB creation, then ASSERT().\r | |
347 | \r | |
348 | @param BaseAddress The 64 bit physical address of the BSP.\r | |
349 | @param Length The length of the BSP store in bytes.\r | |
350 | @param MemoryType Type of memory allocated by this HOB.\r | |
351 | \r | |
352 | **/\r | |
353 | VOID\r | |
354 | EFIAPI\r | |
355 | BuildBspStoreHob (\r | |
356 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
357 | IN UINT64 Length,\r | |
358 | IN EFI_MEMORY_TYPE MemoryType\r | |
359 | )\r | |
360 | ;\r | |
361 | \r | |
362 | /**\r | |
363 | Builds a HOB for the memory allocation.\r | |
364 | \r | |
365 | This function builds a HOB for the memory allocation.\r | |
366 | It can only be invoked during PEI phase;\r | |
367 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
368 | If there is no additional space for HOB creation, then ASSERT().\r | |
369 | \r | |
370 | @param BaseAddress The 64 bit physical address of the memory.\r | |
371 | @param Length The length of the memory allocation in bytes.\r | |
372 | @param MemoryType Type of memory allocated by this HOB.\r | |
373 | \r | |
374 | **/\r | |
375 | VOID\r | |
376 | EFIAPI\r | |
377 | GlueBuildMemoryAllocationHob (\r | |
378 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
379 | IN UINT64 Length,\r | |
380 | IN EFI_MEMORY_TYPE MemoryType\r | |
381 | )\r | |
382 | ;\r | |
383 | \r | |
384 | #endif\r |