]>
Commit | Line | Data |
---|---|---|
70a51d71 SV |
1 | /** @file\r |
2 | HOB Library implementation for Standalone MM Core.\r | |
3 | \r | |
4 | Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
5 | Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR>\r | |
6 | \r | |
7 | This program and the accompanying materials\r | |
8 | are licensed and made available under the terms and conditions of the BSD License\r | |
9 | which accompanies this distribution. The full text of the license may be found at\r | |
10 | http://opensource.org/licenses/bsd-license.php.\r | |
11 | \r | |
12 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
13 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
14 | \r | |
15 | **/\r | |
16 | \r | |
17 | #include <PiMm.h>\r | |
18 | \r | |
19 | #include <Library/HobLib.h>\r | |
20 | #include <Library/DebugLib.h>\r | |
21 | #include <Library/BaseMemoryLib.h>\r | |
22 | \r | |
23 | #include <Guid/MemoryAllocationHob.h>\r | |
24 | \r | |
25 | //\r | |
26 | // Cache copy of HobList pointer.\r | |
27 | //\r | |
28 | VOID *gHobList = NULL;\r | |
29 | \r | |
30 | /**\r | |
31 | Returns the pointer to the HOB list.\r | |
32 | \r | |
33 | This function returns the pointer to first HOB in the list.\r | |
34 | If the pointer to the HOB list is NULL, then ASSERT().\r | |
35 | \r | |
36 | @return The pointer to the HOB list.\r | |
37 | \r | |
38 | **/\r | |
39 | VOID *\r | |
40 | EFIAPI\r | |
41 | GetHobList (\r | |
42 | VOID\r | |
43 | )\r | |
44 | {\r | |
45 | ASSERT (gHobList != NULL);\r | |
46 | return gHobList;\r | |
47 | }\r | |
48 | \r | |
49 | /**\r | |
50 | Returns the next instance of a HOB type from the starting HOB.\r | |
51 | \r | |
52 | This function searches the first instance of a HOB type from the starting HOB pointer.\r | |
53 | If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r | |
54 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
55 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
56 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
57 | \r | |
58 | If HobStart is NULL, then ASSERT().\r | |
59 | \r | |
60 | @param Type The HOB type to return.\r | |
61 | @param HobStart The starting HOB pointer to search from.\r | |
62 | \r | |
63 | @return The next instance of a HOB type from the starting HOB.\r | |
64 | \r | |
65 | **/\r | |
66 | VOID *\r | |
67 | EFIAPI\r | |
68 | GetNextHob (\r | |
69 | IN UINT16 Type,\r | |
70 | IN CONST VOID *HobStart\r | |
71 | )\r | |
72 | {\r | |
73 | EFI_PEI_HOB_POINTERS Hob;\r | |
74 | \r | |
75 | ASSERT (HobStart != NULL);\r | |
76 | \r | |
77 | Hob.Raw = (UINT8 *) HobStart;\r | |
78 | //\r | |
79 | // Parse the HOB list until end of list or matching type is found.\r | |
80 | //\r | |
81 | while (!END_OF_HOB_LIST (Hob)) {\r | |
82 | if (Hob.Header->HobType == Type) {\r | |
83 | return Hob.Raw;\r | |
84 | }\r | |
85 | Hob.Raw = GET_NEXT_HOB (Hob);\r | |
86 | }\r | |
87 | return NULL;\r | |
88 | }\r | |
89 | \r | |
90 | /**\r | |
91 | Returns the first instance of a HOB type among the whole HOB list.\r | |
92 | \r | |
93 | This function searches the first instance of a HOB type among the whole HOB list.\r | |
94 | If there does not exist such HOB type in the HOB list, it will return NULL.\r | |
95 | \r | |
96 | If the pointer to the HOB list is NULL, then ASSERT().\r | |
97 | \r | |
98 | @param Type The HOB type to return.\r | |
99 | \r | |
100 | @return The next instance of a HOB type from the starting HOB.\r | |
101 | \r | |
102 | **/\r | |
103 | VOID *\r | |
104 | EFIAPI\r | |
105 | GetFirstHob (\r | |
106 | IN UINT16 Type\r | |
107 | )\r | |
108 | {\r | |
109 | VOID *HobList;\r | |
110 | \r | |
111 | HobList = GetHobList ();\r | |
112 | return GetNextHob (Type, HobList);\r | |
113 | }\r | |
114 | \r | |
115 | /**\r | |
116 | Returns the next instance of the matched GUID HOB from the starting HOB.\r | |
117 | \r | |
118 | This function searches the first instance of a HOB from the starting HOB pointer.\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 such a HOB from the starting HOB pointer does not exist, 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 information, respectively.\r | |
124 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
125 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
126 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
127 | \r | |
128 | If Guid is NULL, then ASSERT().\r | |
129 | If HobStart is NULL, then ASSERT().\r | |
130 | \r | |
131 | @param Guid The GUID to match with in the HOB list.\r | |
132 | @param HobStart A pointer to a Guid.\r | |
133 | \r | |
134 | @return The next instance of the matched GUID HOB from the starting HOB.\r | |
135 | \r | |
136 | **/\r | |
137 | VOID *\r | |
138 | EFIAPI\r | |
139 | GetNextGuidHob (\r | |
140 | IN CONST EFI_GUID *Guid,\r | |
141 | IN CONST VOID *HobStart\r | |
142 | )\r | |
143 | {\r | |
144 | EFI_PEI_HOB_POINTERS GuidHob;\r | |
145 | \r | |
146 | GuidHob.Raw = (UINT8 *) HobStart;\r | |
147 | while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {\r | |
148 | if (CompareGuid (Guid, &GuidHob.Guid->Name)) {\r | |
149 | break;\r | |
150 | }\r | |
151 | GuidHob.Raw = GET_NEXT_HOB (GuidHob);\r | |
152 | }\r | |
153 | return GuidHob.Raw;\r | |
154 | }\r | |
155 | \r | |
156 | /**\r | |
157 | Returns the first instance of the matched GUID HOB among the whole HOB list.\r | |
158 | \r | |
159 | This function searches the first instance of a HOB among the whole HOB list.\r | |
160 | Such HOB should satisfy two conditions:\r | |
161 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r | |
162 | If such a HOB from the starting HOB pointer does not exist, it will return NULL.\r | |
163 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r | |
164 | to extract the data section and its size information, respectively.\r | |
165 | \r | |
166 | If the pointer to the HOB list is NULL, then ASSERT().\r | |
167 | If Guid is NULL, then ASSERT().\r | |
168 | \r | |
169 | @param Guid The GUID to match with in the HOB list.\r | |
170 | \r | |
171 | @return The first instance of the matched GUID HOB among the whole HOB list.\r | |
172 | \r | |
173 | **/\r | |
174 | VOID *\r | |
175 | EFIAPI\r | |
176 | GetFirstGuidHob (\r | |
177 | IN CONST EFI_GUID *Guid\r | |
178 | )\r | |
179 | {\r | |
180 | VOID *HobList;\r | |
181 | \r | |
182 | HobList = GetHobList ();\r | |
183 | return GetNextGuidHob (Guid, HobList);\r | |
184 | }\r | |
185 | \r | |
186 | /**\r | |
187 | Get the system boot mode from the HOB list.\r | |
188 | \r | |
189 | This function returns the system boot mode information from the\r | |
190 | PHIT HOB in HOB list.\r | |
191 | \r | |
192 | If the pointer to the HOB list is NULL, then ASSERT().\r | |
193 | \r | |
194 | @param VOID\r | |
195 | \r | |
196 | @return The Boot Mode.\r | |
197 | \r | |
198 | **/\r | |
199 | EFI_BOOT_MODE\r | |
200 | EFIAPI\r | |
201 | GetBootModeHob (\r | |
202 | VOID\r | |
203 | )\r | |
204 | {\r | |
205 | EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r | |
206 | \r | |
207 | HandOffHob = (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();\r | |
208 | \r | |
209 | return HandOffHob->BootMode;\r | |
210 | }\r | |
211 | \r | |
212 | VOID *\r | |
213 | CreateHob (\r | |
214 | IN UINT16 HobType,\r | |
215 | IN UINT16 HobLength\r | |
216 | )\r | |
217 | {\r | |
218 | EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r | |
219 | EFI_HOB_GENERIC_HEADER *HobEnd;\r | |
220 | EFI_PHYSICAL_ADDRESS FreeMemory;\r | |
221 | VOID *Hob;\r | |
222 | \r | |
223 | HandOffHob = GetHobList ();\r | |
224 | \r | |
225 | HobLength = (UINT16)((HobLength + 0x7) & (~0x7));\r | |
226 | \r | |
227 | FreeMemory = HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryBottom;\r | |
228 | \r | |
229 | if (FreeMemory < HobLength) {\r | |
230 | return NULL;\r | |
231 | }\r | |
232 | \r | |
233 | Hob = (VOID*) (UINTN) HandOffHob->EfiEndOfHobList;\r | |
234 | ((EFI_HOB_GENERIC_HEADER*) Hob)->HobType = HobType;\r | |
235 | ((EFI_HOB_GENERIC_HEADER*) Hob)->HobLength = HobLength;\r | |
236 | ((EFI_HOB_GENERIC_HEADER*) Hob)->Reserved = 0;\r | |
237 | \r | |
238 | HobEnd = (EFI_HOB_GENERIC_HEADER*) ((UINTN)Hob + HobLength);\r | |
239 | HandOffHob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;\r | |
240 | \r | |
241 | HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST;\r | |
242 | HobEnd->HobLength = sizeof (EFI_HOB_GENERIC_HEADER);\r | |
243 | HobEnd->Reserved = 0;\r | |
244 | HobEnd++;\r | |
245 | HandOffHob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd;\r | |
246 | \r | |
247 | return Hob;\r | |
248 | }\r | |
249 | \r | |
250 | /**\r | |
251 | Builds a HOB for a loaded PE32 module.\r | |
252 | \r | |
253 | This function builds a HOB for a loaded PE32 module.\r | |
254 | If ModuleName is NULL, then ASSERT().\r | |
255 | If there is no additional space for HOB creation, then ASSERT().\r | |
256 | \r | |
257 | @param ModuleName The GUID File Name of the module.\r | |
258 | @param MemoryAllocationModule The 64 bit physical address of the module.\r | |
259 | @param ModuleLength The length of the module in bytes.\r | |
260 | @param EntryPoint The 64 bit physical address of the module entry point.\r | |
261 | \r | |
262 | **/\r | |
263 | VOID\r | |
264 | EFIAPI\r | |
265 | BuildModuleHob (\r | |
266 | IN CONST EFI_GUID *ModuleName,\r | |
267 | IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r | |
268 | IN UINT64 ModuleLength,\r | |
269 | IN EFI_PHYSICAL_ADDRESS EntryPoint\r | |
270 | )\r | |
271 | {\r | |
272 | EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob;\r | |
273 | \r | |
274 | ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&\r | |
275 | ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0));\r | |
276 | \r | |
277 | Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));\r | |
278 | \r | |
279 | CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);\r | |
280 | Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;\r | |
281 | Hob->MemoryAllocationHeader.MemoryLength = ModuleLength;\r | |
282 | Hob->MemoryAllocationHeader.MemoryType = EfiBootServicesCode;\r | |
283 | \r | |
284 | //\r | |
285 | // Zero the reserved space to match HOB spec\r | |
286 | //\r | |
287 | ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));\r | |
288 | \r | |
289 | CopyGuid (&Hob->ModuleName, ModuleName);\r | |
290 | Hob->EntryPoint = EntryPoint;\r | |
291 | }\r | |
292 | \r | |
293 | /**\r | |
294 | Builds a HOB that describes a chunk of system memory.\r | |
295 | \r | |
296 | This function builds a HOB that describes a chunk of system memory.\r | |
297 | If there is no additional space for HOB creation, then ASSERT().\r | |
298 | \r | |
299 | @param ResourceType The type of resource described by this HOB.\r | |
300 | @param ResourceAttribute The resource attributes of the memory described by this HOB.\r | |
301 | @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r | |
302 | @param NumberOfBytes The length of the memory described by this HOB in bytes.\r | |
303 | \r | |
304 | **/\r | |
305 | VOID\r | |
306 | EFIAPI\r | |
307 | BuildResourceDescriptorHob (\r | |
308 | IN EFI_RESOURCE_TYPE ResourceType,\r | |
309 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r | |
310 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r | |
311 | IN UINT64 NumberOfBytes\r | |
312 | )\r | |
313 | {\r | |
314 | EFI_HOB_RESOURCE_DESCRIPTOR *Hob;\r | |
315 | \r | |
316 | Hob = CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));\r | |
317 | ASSERT (Hob != NULL);\r | |
318 | \r | |
319 | Hob->ResourceType = ResourceType;\r | |
320 | Hob->ResourceAttribute = ResourceAttribute;\r | |
321 | Hob->PhysicalStart = PhysicalStart;\r | |
322 | Hob->ResourceLength = NumberOfBytes;\r | |
323 | }\r | |
324 | \r | |
325 | /**\r | |
326 | Builds a GUID HOB with a certain data length.\r | |
327 | \r | |
328 | This function builds a customized HOB tagged with a GUID for identification\r | |
329 | and returns the start address of GUID HOB data so that caller can fill the customized data.\r | |
330 | The HOB Header and Name field is already stripped.\r | |
331 | If Guid is NULL, then ASSERT().\r | |
332 | If there is no additional space for HOB creation, then ASSERT().\r | |
333 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
334 | \r | |
335 | @param Guid The GUID to tag the customized HOB.\r | |
336 | @param DataLength The size of the data payload for the GUID HOB.\r | |
337 | \r | |
338 | @return The start address of GUID HOB data.\r | |
339 | \r | |
340 | **/\r | |
341 | VOID *\r | |
342 | EFIAPI\r | |
343 | BuildGuidHob (\r | |
344 | IN CONST EFI_GUID *Guid,\r | |
345 | IN UINTN DataLength\r | |
346 | )\r | |
347 | {\r | |
348 | EFI_HOB_GUID_TYPE *Hob;\r | |
349 | \r | |
350 | //\r | |
351 | // Make sure that data length is not too long.\r | |
352 | //\r | |
353 | ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE)));\r | |
354 | \r | |
355 | Hob = CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));\r | |
356 | CopyGuid (&Hob->Name, Guid);\r | |
357 | return Hob + 1;\r | |
358 | }\r | |
359 | \r | |
360 | \r | |
361 | /**\r | |
362 | Copies a data buffer to a newly-built HOB.\r | |
363 | \r | |
364 | This function builds a customized HOB tagged with a GUID for identification,\r | |
365 | copies the input data to the HOB data field and returns the start address of the GUID HOB data.\r | |
366 | The HOB Header and Name field is already stripped.\r | |
367 | If Guid is NULL, then ASSERT().\r | |
368 | If Data is NULL and DataLength > 0, then ASSERT().\r | |
369 | If there is no additional space for HOB creation, then ASSERT().\r | |
370 | If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r | |
371 | \r | |
372 | @param Guid The GUID to tag the customized HOB.\r | |
373 | @param Data The data to be copied into the data field of the GUID HOB.\r | |
374 | @param DataLength The size of the data payload for the GUID HOB.\r | |
375 | \r | |
376 | @return The start address of GUID HOB data.\r | |
377 | \r | |
378 | **/\r | |
379 | VOID *\r | |
380 | EFIAPI\r | |
381 | BuildGuidDataHob (\r | |
382 | IN CONST EFI_GUID *Guid,\r | |
383 | IN VOID *Data,\r | |
384 | IN UINTN DataLength\r | |
385 | )\r | |
386 | {\r | |
387 | VOID *HobData;\r | |
388 | \r | |
389 | ASSERT (Data != NULL || DataLength == 0);\r | |
390 | \r | |
391 | HobData = BuildGuidHob (Guid, DataLength);\r | |
392 | \r | |
393 | return CopyMem (HobData, Data, DataLength);\r | |
394 | }\r | |
395 | \r | |
396 | /**\r | |
397 | Builds a Firmware Volume HOB.\r | |
398 | \r | |
399 | This function builds a Firmware Volume HOB.\r | |
400 | If there is no additional space for HOB creation, then ASSERT().\r | |
401 | \r | |
402 | @param BaseAddress The base address of the Firmware Volume.\r | |
403 | @param Length The size of the Firmware Volume in bytes.\r | |
404 | \r | |
405 | **/\r | |
406 | VOID\r | |
407 | EFIAPI\r | |
408 | BuildFvHob (\r | |
409 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
410 | IN UINT64 Length\r | |
411 | )\r | |
412 | {\r | |
413 | EFI_HOB_FIRMWARE_VOLUME *Hob;\r | |
414 | \r | |
415 | Hob = CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME));\r | |
416 | \r | |
417 | Hob->BaseAddress = BaseAddress;\r | |
418 | Hob->Length = Length;\r | |
419 | }\r | |
420 | \r | |
421 | \r | |
422 | /**\r | |
423 | Builds a EFI_HOB_TYPE_FV2 HOB.\r | |
424 | \r | |
425 | This function builds a EFI_HOB_TYPE_FV2 HOB.\r | |
426 | If there is no additional space for HOB creation, then ASSERT().\r | |
427 | \r | |
428 | @param BaseAddress The base address of the Firmware Volume.\r | |
429 | @param Length The size of the Firmware Volume in bytes.\r | |
430 | @param FvName The name of the Firmware Volume.\r | |
431 | @param FileName The name of the file.\r | |
432 | \r | |
433 | **/\r | |
434 | VOID\r | |
435 | EFIAPI\r | |
436 | BuildFv2Hob (\r | |
437 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
438 | IN UINT64 Length,\r | |
439 | IN CONST EFI_GUID *FvName,\r | |
440 | IN CONST EFI_GUID *FileName\r | |
441 | )\r | |
442 | {\r | |
443 | EFI_HOB_FIRMWARE_VOLUME2 *Hob;\r | |
444 | \r | |
445 | Hob = CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2));\r | |
446 | \r | |
447 | Hob->BaseAddress = BaseAddress;\r | |
448 | Hob->Length = Length;\r | |
449 | CopyGuid (&Hob->FvName, FvName);\r | |
450 | CopyGuid (&Hob->FileName, FileName);\r | |
451 | }\r | |
452 | \r | |
453 | \r | |
454 | /**\r | |
455 | Builds a HOB for the CPU.\r | |
456 | \r | |
457 | This function builds a HOB for the CPU.\r | |
458 | If there is no additional space for HOB creation, then ASSERT().\r | |
459 | \r | |
460 | @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r | |
461 | @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r | |
462 | \r | |
463 | **/\r | |
464 | VOID\r | |
465 | EFIAPI\r | |
466 | BuildCpuHob (\r | |
467 | IN UINT8 SizeOfMemorySpace,\r | |
468 | IN UINT8 SizeOfIoSpace\r | |
469 | )\r | |
470 | {\r | |
471 | EFI_HOB_CPU *Hob;\r | |
472 | \r | |
473 | Hob = CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU));\r | |
474 | \r | |
475 | Hob->SizeOfMemorySpace = SizeOfMemorySpace;\r | |
476 | Hob->SizeOfIoSpace = SizeOfIoSpace;\r | |
477 | \r | |
478 | //\r | |
479 | // Zero the reserved space to match HOB spec\r | |
480 | //\r | |
481 | ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));\r | |
482 | }\r | |
483 | \r | |
484 | /**\r | |
485 | Builds a HOB for the memory allocation.\r | |
486 | \r | |
487 | This function builds a HOB for the memory allocation.\r | |
488 | If there is no additional space for HOB creation, then ASSERT().\r | |
489 | \r | |
490 | @param BaseAddress The 64 bit physical address of the memory.\r | |
491 | @param Length The length of the memory allocation in bytes.\r | |
492 | @param MemoryType Type of memory allocated by this HOB.\r | |
493 | \r | |
494 | **/\r | |
495 | VOID\r | |
496 | EFIAPI\r | |
497 | BuildMemoryAllocationHob (\r | |
498 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
499 | IN UINT64 Length,\r | |
500 | IN EFI_MEMORY_TYPE MemoryType\r | |
501 | )\r | |
502 | {\r | |
503 | EFI_HOB_MEMORY_ALLOCATION *Hob;\r | |
504 | \r | |
505 | ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&\r | |
506 | ((Length & (EFI_PAGE_SIZE - 1)) == 0));\r | |
507 | \r | |
508 | Hob = CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMORY_ALLOCATION));\r | |
509 | \r | |
510 | ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));\r | |
511 | Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;\r | |
512 | Hob->AllocDescriptor.MemoryLength = Length;\r | |
513 | Hob->AllocDescriptor.MemoryType = MemoryType;\r | |
514 | //\r | |
515 | // Zero the reserved space to match HOB spec\r | |
516 | //\r | |
517 | ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));\r | |
518 | }\r | |
519 | \r | |
520 | /**\r | |
521 | Builds a HOB that describes a chunk of system memory with Owner GUID.\r | |
522 | \r | |
523 | This function builds a HOB that describes a chunk of system memory.\r | |
524 | If there is no additional space for HOB creation, then ASSERT().\r | |
525 | \r | |
526 | @param ResourceType The type of resource described by this HOB.\r | |
527 | @param ResourceAttribute The resource attributes of the memory described by this HOB.\r | |
528 | @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r | |
529 | @param NumberOfBytes The length of the memory described by this HOB in bytes.\r | |
530 | @param OwnerGUID GUID for the owner of this resource.\r | |
531 | \r | |
532 | **/\r | |
533 | VOID\r | |
534 | EFIAPI\r | |
535 | BuildResourceDescriptorWithOwnerHob (\r | |
536 | IN EFI_RESOURCE_TYPE ResourceType,\r | |
537 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r | |
538 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r | |
539 | IN UINT64 NumberOfBytes,\r | |
540 | IN EFI_GUID *OwnerGUID\r | |
541 | )\r | |
542 | {\r | |
543 | ASSERT (FALSE);\r | |
544 | }\r | |
545 | \r | |
546 | /**\r | |
547 | Builds a Capsule Volume HOB.\r | |
548 | \r | |
549 | This function builds a Capsule Volume HOB.\r | |
550 | If the platform does not support Capsule Volume HOBs, then ASSERT().\r | |
551 | If there is no additional space for HOB creation, then ASSERT().\r | |
552 | \r | |
553 | @param BaseAddress The base address of the Capsule Volume.\r | |
554 | @param Length The size of the Capsule Volume in bytes.\r | |
555 | \r | |
556 | **/\r | |
557 | VOID\r | |
558 | EFIAPI\r | |
559 | BuildCvHob (\r | |
560 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
561 | IN UINT64 Length\r | |
562 | )\r | |
563 | {\r | |
564 | ASSERT (FALSE);\r | |
565 | }\r | |
566 | \r | |
567 | \r | |
568 | /**\r | |
569 | Builds a HOB for the BSP store.\r | |
570 | \r | |
571 | This function builds a HOB for BSP store.\r | |
572 | If there is no additional space for HOB creation, then ASSERT().\r | |
573 | \r | |
574 | @param BaseAddress The 64 bit physical address of the BSP.\r | |
575 | @param Length The length of the BSP store in bytes.\r | |
576 | @param MemoryType Type of memory allocated by this HOB.\r | |
577 | \r | |
578 | **/\r | |
579 | VOID\r | |
580 | EFIAPI\r | |
581 | BuildBspStoreHob (\r | |
582 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
583 | IN UINT64 Length,\r | |
584 | IN EFI_MEMORY_TYPE MemoryType\r | |
585 | )\r | |
586 | {\r | |
587 | ASSERT (FALSE);\r | |
588 | }\r | |
589 | \r | |
590 | /**\r | |
591 | Builds a HOB for the Stack.\r | |
592 | \r | |
593 | This function builds a HOB for the stack.\r | |
594 | If there is no additional space for HOB creation, then ASSERT().\r | |
595 | \r | |
596 | @param BaseAddress The 64 bit physical address of the Stack.\r | |
597 | @param Length The length of the stack in bytes.\r | |
598 | \r | |
599 | **/\r | |
600 | VOID\r | |
601 | EFIAPI\r | |
602 | BuildStackHob (\r | |
603 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
604 | IN UINT64 Length\r | |
605 | )\r | |
606 | {\r | |
607 | ASSERT (FALSE);\r | |
608 | }\r |