]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/BaseHobLibNull/BaseHobLibNull.c
MdeModulePkg: Change OPTIONAL keyword usage style
[mirror_edk2.git] / MdeModulePkg / Library / BaseHobLibNull / BaseHobLibNull.c
CommitLineData
775feb5f
AB
1/** @file\r
2 Provide Hob Library functions for build testing only.\r
3\r
4Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
5Copyright (c) 2018, Linaro, Ltd. All rights reserved.<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
775feb5f
AB
7\r
8**/\r
9\r
10#include <Uefi.h>\r
11#include <Pi/PiMultiPhase.h>\r
12\r
13#include <Library/DebugLib.h>\r
14#include <Library/HobLib.h>\r
15\r
16/**\r
17 Returns the pointer to the HOB list.\r
18\r
19 This function returns the pointer to first HOB in the list.\r
20 For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer\r
21 to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through\r
22 the EFI System Table by looking up theHOB list GUID in the System Configuration Table.\r
23 Since the System Configuration Table does not exist that the time the DXE Core is\r
24 launched, the DXE Core uses a global variable from the DXE Core Entry Point Library\r
25 to manage the pointer to the HOB list.\r
26\r
27 If the pointer to the HOB list is NULL, then ASSERT().\r
28\r
29 @return The pointer to the HOB list.\r
30\r
31**/\r
32VOID *\r
33EFIAPI\r
34GetHobList (\r
35 VOID\r
36 )\r
37{\r
38 ASSERT (FALSE);\r
39 return NULL;\r
40}\r
41\r
42/**\r
43 Returns the next instance of a HOB type from the starting HOB.\r
44\r
45 This function searches the first instance of a HOB type from the starting HOB pointer.\r
46 If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r
47 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
48 unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
49 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
50\r
51 If HobStart is NULL, then ASSERT().\r
52\r
53 @param Type The HOB type to return.\r
54 @param HobStart The starting HOB pointer to search from.\r
55\r
56 @return The next instance of a HOB type from the starting HOB.\r
57\r
58**/\r
59VOID *\r
60EFIAPI\r
61GetNextHob (\r
62 IN UINT16 Type,\r
63 IN CONST VOID *HobStart\r
64 )\r
65{\r
66 ASSERT (FALSE);\r
67 return NULL;\r
68}\r
69\r
70/**\r
71 Returns the first instance of a HOB type among the whole HOB list.\r
72\r
73 This function searches the first instance of a HOB type among the whole HOB list.\r
74 If there does not exist such HOB type in the HOB list, it will return NULL.\r
75\r
76 If the pointer to the HOB list is NULL, then ASSERT().\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
83VOID *\r
84EFIAPI\r
85GetFirstHob (\r
86 IN UINT16 Type\r
87 )\r
88{\r
89 ASSERT (FALSE);\r
90 return NULL;\r
91}\r
92\r
93/**\r
94 Returns the next instance of the matched GUID HOB from the starting HOB.\r
95\r
96 This function searches the first instance of a HOB from the starting HOB pointer.\r
97 Such HOB should satisfy two conditions:\r
98 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
99 If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
100 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
101 to extract the data section and its size information, respectively.\r
102 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
103 unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
104 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
105\r
106 If Guid is NULL, then ASSERT().\r
107 If HobStart is NULL, then ASSERT().\r
108\r
109 @param Guid The GUID to match with in the HOB list.\r
110 @param HobStart A pointer to a Guid.\r
111\r
112 @return The next instance of the matched GUID HOB from the starting HOB.\r
113\r
114**/\r
115VOID *\r
116EFIAPI\r
117GetNextGuidHob (\r
118 IN CONST EFI_GUID *Guid,\r
119 IN CONST VOID *HobStart\r
120 )\r
121{\r
122 ASSERT (FALSE);\r
123 return NULL;\r
124}\r
125\r
126/**\r
127 Returns the first instance of the matched GUID HOB among the whole HOB list.\r
128\r
129 This function searches the first instance of a HOB among the whole HOB list.\r
130 Such HOB should satisfy two conditions:\r
131 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
132 If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
133 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
134 to extract the data section and its size information, respectively.\r
135\r
136 If the pointer to the HOB list is NULL, then ASSERT().\r
137 If Guid is NULL, then ASSERT().\r
138\r
139 @param Guid The GUID to match with in the HOB list.\r
140\r
141 @return The first instance of the matched GUID HOB among the whole HOB list.\r
142\r
143**/\r
144VOID *\r
145EFIAPI\r
146GetFirstGuidHob (\r
147 IN CONST EFI_GUID *Guid\r
148 )\r
149{\r
150 ASSERT (FALSE);\r
151 return NULL;\r
152}\r
153\r
154/**\r
155 Get the system boot mode from the HOB list.\r
156\r
157 This function returns the system boot mode information from the\r
158 PHIT HOB in HOB list.\r
159\r
160 If the pointer to the HOB list is NULL, then ASSERT().\r
161\r
162 @param VOID.\r
163\r
164 @return The Boot Mode.\r
165\r
166**/\r
167EFI_BOOT_MODE\r
168EFIAPI\r
169GetBootModeHob (\r
170 VOID\r
171 )\r
172{\r
173 ASSERT (FALSE);\r
174 return MAX_UINT32;\r
175}\r
176\r
177/**\r
178 Builds a HOB for a loaded PE32 module.\r
179\r
180 This function builds a HOB for a loaded PE32 module.\r
181 It can only be invoked during PEI phase;\r
182 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
183\r
184 If ModuleName is NULL, then ASSERT().\r
185 If there is no additional space for HOB creation, then ASSERT().\r
186\r
187 @param ModuleName The GUID File Name of the module.\r
188 @param MemoryAllocationModule The 64 bit physical address of the module.\r
189 @param ModuleLength The length of the module in bytes.\r
190 @param EntryPoint The 64 bit physical address of the module entry point.\r
191\r
192**/\r
193VOID\r
194EFIAPI\r
195BuildModuleHob (\r
196 IN CONST EFI_GUID *ModuleName,\r
197 IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r
198 IN UINT64 ModuleLength,\r
199 IN EFI_PHYSICAL_ADDRESS EntryPoint\r
200 )\r
201{\r
202 ASSERT (FALSE);\r
203}\r
204\r
205/**\r
206 Builds a HOB that describes a chunk of system memory with Owner GUID.\r
207\r
208 This function builds a HOB that describes a chunk of system memory.\r
209 It can only be invoked during PEI phase;\r
210 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
211\r
212 If there is no additional space for HOB creation, then ASSERT().\r
213\r
214 @param ResourceType The type of resource described by this HOB.\r
215 @param ResourceAttribute The resource attributes of the memory described by this HOB.\r
216 @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r
217 @param NumberOfBytes The length of the memory described by this HOB in bytes.\r
218 @param OwnerGUID GUID for the owner of this resource.\r
219\r
220**/\r
221VOID\r
222EFIAPI\r
223BuildResourceDescriptorWithOwnerHob (\r
224 IN EFI_RESOURCE_TYPE ResourceType,\r
225 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r
226 IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r
227 IN UINT64 NumberOfBytes,\r
228 IN EFI_GUID *OwnerGUID\r
229 )\r
230{\r
231 ASSERT (FALSE);\r
232}\r
233\r
234/**\r
235 Builds a HOB that describes a chunk of system memory.\r
236\r
237 This function builds a HOB that describes a chunk of system memory.\r
238 It can only be invoked during PEI phase;\r
239 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
240\r
241 If there is no additional space for HOB creation, then ASSERT().\r
242\r
243 @param ResourceType The type of resource described by this HOB.\r
244 @param ResourceAttribute The resource attributes of the memory described by this HOB.\r
245 @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r
246 @param NumberOfBytes The length of the memory described by this HOB in bytes.\r
247\r
248**/\r
249VOID\r
250EFIAPI\r
251BuildResourceDescriptorHob (\r
252 IN EFI_RESOURCE_TYPE ResourceType,\r
253 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r
254 IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r
255 IN UINT64 NumberOfBytes\r
256 )\r
257{\r
258 ASSERT (FALSE);\r
259}\r
260\r
261/**\r
262 Builds a customized HOB tagged with a GUID for identification and returns\r
263 the start address of GUID HOB data.\r
264\r
265 This function builds a customized HOB tagged with a GUID for identification\r
266 and returns the start address of GUID HOB data so that caller can fill the customized data.\r
267 The HOB Header and Name field is already stripped.\r
268 It can only be invoked during PEI phase;\r
269 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
270\r
271 If Guid is NULL, then ASSERT().\r
272 If there is no additional space for HOB creation, then ASSERT().\r
273 If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
274 HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
275\r
276 @param Guid The GUID to tag the customized HOB.\r
277 @param DataLength The size of the data payload for the GUID HOB.\r
278\r
279 @retval NULL The GUID HOB could not be allocated.\r
280 @retval others The start address of GUID HOB data.\r
281\r
282**/\r
283VOID *\r
284EFIAPI\r
285BuildGuidHob (\r
286 IN CONST EFI_GUID *Guid,\r
287 IN UINTN DataLength\r
288 )\r
289{\r
290 ASSERT (FALSE);\r
291 return NULL;\r
292}\r
293\r
294/**\r
295 Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB\r
296 data field, and returns the start address of the GUID HOB data.\r
297\r
298 This function builds a customized HOB tagged with a GUID for identification and copies the input\r
299 data to the HOB data field and returns the start address of the GUID HOB data. It can only be\r
300 invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
301 The HOB Header and Name field is already stripped.\r
302 It can only be invoked during PEI phase;\r
303 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
304\r
305 If Guid is NULL, then ASSERT().\r
306 If Data is NULL and DataLength > 0, then ASSERT().\r
307 If there is no additional space for HOB creation, then ASSERT().\r
308 If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
309 HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
310\r
311 @param Guid The GUID to tag the customized HOB.\r
312 @param Data The data to be copied into the data field of the GUID HOB.\r
313 @param DataLength The size of the data payload for the GUID HOB.\r
314\r
315 @retval NULL The GUID HOB could not be allocated.\r
316 @retval others The start address of GUID HOB data.\r
317\r
318**/\r
319VOID *\r
320EFIAPI\r
321BuildGuidDataHob (\r
322 IN CONST EFI_GUID *Guid,\r
323 IN VOID *Data,\r
324 IN UINTN DataLength\r
325 )\r
326{\r
327 ASSERT (FALSE);\r
328 return NULL;\r
329}\r
330\r
331/**\r
332 Builds a Firmware Volume HOB.\r
333\r
334 This function builds a Firmware Volume HOB.\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\r
338 If there is no additional space for HOB creation, then ASSERT().\r
339 If the FvImage buffer is not at its required alignment, then ASSERT().\r
340\r
341 @param BaseAddress The base address of the Firmware Volume.\r
342 @param Length The size of the Firmware Volume in bytes.\r
343\r
344**/\r
345VOID\r
346EFIAPI\r
347BuildFvHob (\r
348 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
349 IN UINT64 Length\r
350 )\r
351{\r
352 ASSERT (FALSE);\r
353}\r
354\r
355/**\r
356 Builds a EFI_HOB_TYPE_FV2 HOB.\r
357\r
358 This function builds a EFI_HOB_TYPE_FV2 HOB.\r
359 It can only be invoked during PEI phase;\r
360 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
361\r
362 If there is no additional space for HOB creation, then ASSERT().\r
363 If the FvImage buffer is not at its required alignment, then ASSERT().\r
364\r
365 @param BaseAddress The base address of the Firmware Volume.\r
366 @param Length The size of the Firmware Volume in bytes.\r
367 @param FvName The name of the Firmware Volume.\r
368 @param FileName The name of the file.\r
369\r
370**/\r
371VOID\r
372EFIAPI\r
373BuildFv2Hob (\r
374 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
375 IN UINT64 Length,\r
376 IN CONST EFI_GUID *FvName,\r
377 IN CONST EFI_GUID *FileName\r
378 )\r
379{\r
380 ASSERT (FALSE);\r
381}\r
382\r
383/**\r
384 Builds a EFI_HOB_TYPE_FV3 HOB.\r
385\r
386 This function builds a EFI_HOB_TYPE_FV3 HOB.\r
387 It can only be invoked during PEI phase;\r
388 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
389\r
390 If there is no additional space for HOB creation, then ASSERT().\r
391 If the FvImage buffer is not at its required alignment, then ASSERT().\r
392\r
393 @param BaseAddress The base address of the Firmware Volume.\r
394 @param Length The size of the Firmware Volume in bytes.\r
395 @param AuthenticationStatus The authentication status.\r
396 @param ExtractedFv TRUE if the FV was extracted as a file within\r
397 another firmware volume. FALSE otherwise.\r
398 @param FvName The name of the Firmware Volume.\r
399 Valid only if IsExtractedFv is TRUE.\r
400 @param FileName The name of the file.\r
401 Valid only if IsExtractedFv is TRUE.\r
402\r
403**/\r
404VOID\r
405EFIAPI\r
406BuildFv3Hob (\r
407 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
408 IN UINT64 Length,\r
409 IN UINT32 AuthenticationStatus,\r
410 IN BOOLEAN ExtractedFv,\r
e3917e22 411 IN CONST EFI_GUID *FvName OPTIONAL,\r
775feb5f
AB
412 IN CONST EFI_GUID *FileName OPTIONAL\r
413 )\r
414{\r
415 ASSERT (FALSE);\r
416}\r
417\r
418/**\r
419 Builds a Capsule Volume HOB.\r
420\r
421 This function builds a Capsule Volume HOB.\r
422 It can only be invoked during PEI phase;\r
423 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
424\r
425 If the platform does not support Capsule Volume HOBs, then ASSERT().\r
426 If there is no additional space for HOB creation, then ASSERT().\r
427\r
428 @param BaseAddress The base address of the Capsule Volume.\r
429 @param Length The size of the Capsule Volume in bytes.\r
430\r
431**/\r
432VOID\r
433EFIAPI\r
434BuildCvHob (\r
435 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
436 IN UINT64 Length\r
437 )\r
438{\r
439 ASSERT (FALSE);\r
440}\r
441\r
442/**\r
443 Builds a HOB for the CPU.\r
444\r
445 This function builds a HOB for the CPU.\r
446 It can only be invoked during PEI phase;\r
447 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
448\r
449 If there is no additional space for HOB creation, then ASSERT().\r
450\r
451 @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r
452 @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r
453\r
454**/\r
455VOID\r
456EFIAPI\r
457BuildCpuHob (\r
458 IN UINT8 SizeOfMemorySpace,\r
459 IN UINT8 SizeOfIoSpace\r
460 )\r
461{\r
462 ASSERT (FALSE);\r
463}\r
464\r
465/**\r
466 Builds a HOB for the Stack.\r
467\r
468 This function builds a HOB for the stack.\r
469 It can only be invoked during PEI phase;\r
470 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
471\r
472 If there is no additional space for HOB creation, then ASSERT().\r
473\r
474 @param BaseAddress The 64 bit physical address of the Stack.\r
475 @param Length The length of the stack in bytes.\r
476\r
477**/\r
478VOID\r
479EFIAPI\r
480BuildStackHob (\r
481 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
482 IN UINT64 Length\r
483 )\r
484{\r
485 ASSERT (FALSE);\r
486}\r
487\r
488/**\r
489 Builds a HOB for the BSP store.\r
490\r
491 This function builds a HOB for BSP store.\r
492 It can only be invoked during PEI phase;\r
493 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
494\r
495 If there is no additional space for HOB creation, then ASSERT().\r
496\r
497 @param BaseAddress The 64 bit physical address of the BSP.\r
498 @param Length The length of the BSP store in bytes.\r
499 @param MemoryType The type of memory allocated by this HOB.\r
500\r
501**/\r
502VOID\r
503EFIAPI\r
504BuildBspStoreHob (\r
505 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
506 IN UINT64 Length,\r
507 IN EFI_MEMORY_TYPE MemoryType\r
508 )\r
509{\r
510 ASSERT (FALSE);\r
511}\r
512\r
513/**\r
514 Builds a HOB for the memory allocation.\r
515\r
516 This function builds a HOB for the memory allocation.\r
517 It can only be invoked during PEI phase;\r
518 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
519\r
520 If there is no additional space for HOB creation, then ASSERT().\r
521\r
522 @param BaseAddress The 64 bit physical address of the memory.\r
523 @param Length The length of the memory allocation in bytes.\r
524 @param MemoryType The type of memory allocated by this HOB.\r
525\r
526**/\r
527VOID\r
528EFIAPI\r
529BuildMemoryAllocationHob (\r
530 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
531 IN UINT64 Length,\r
532 IN EFI_MEMORY_TYPE MemoryType\r
533 )\r
534{\r
535 ASSERT (FALSE);\r
536}\r