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