]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Core/Dxe/DxeMain.h
MdeModulePkg: Use EfiEventEmptyFunction from UefiLib
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / DxeMain.h
... / ...
CommitLineData
1/** @file\r
2 The internal header file includes the common header files, defines\r
3 internal structure and functions used by DxeCore module.\r
4\r
5Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _DXE_MAIN_H_\r
17#define _DXE_MAIN_H_\r
18\r
19\r
20\r
21#include <PiDxe.h>\r
22\r
23#include <Protocol/LoadedImage.h>\r
24#include <Protocol/GuidedSectionExtraction.h>\r
25#include <Protocol/DevicePath.h>\r
26#include <Protocol/Runtime.h>\r
27#include <Protocol/LoadFile.h>\r
28#include <Protocol/LoadFile2.h>\r
29#include <Protocol/DriverBinding.h>\r
30#include <Protocol/VariableWrite.h>\r
31#include <Protocol/PlatformDriverOverride.h>\r
32#include <Protocol/Variable.h>\r
33#include <Protocol/Timer.h>\r
34#include <Protocol/SimpleFileSystem.h>\r
35#include <Protocol/Bds.h>\r
36#include <Protocol/RealTimeClock.h>\r
37#include <Protocol/WatchdogTimer.h>\r
38#include <Protocol/FirmwareVolume2.h>\r
39#include <Protocol/MonotonicCounter.h>\r
40#include <Protocol/StatusCode.h>\r
41#include <Protocol/Decompress.h>\r
42#include <Protocol/LoadPe32Image.h>\r
43#include <Protocol/Security.h>\r
44#include <Protocol/Security2.h>\r
45#include <Protocol/Ebc.h>\r
46#include <Protocol/Reset.h>\r
47#include <Protocol/Cpu.h>\r
48#include <Protocol/Metronome.h>\r
49#include <Protocol/FirmwareVolumeBlock.h>\r
50#include <Protocol/Capsule.h>\r
51#include <Protocol/BusSpecificDriverOverride.h>\r
52#include <Protocol/DriverFamilyOverride.h>\r
53#include <Protocol/TcgService.h>\r
54#include <Protocol/HiiPackageList.h>\r
55#include <Protocol/SmmBase2.h>\r
56#include <Guid/MemoryTypeInformation.h>\r
57#include <Guid/FirmwareFileSystem2.h>\r
58#include <Guid/FirmwareFileSystem3.h>\r
59#include <Guid/HobList.h>\r
60#include <Guid/DebugImageInfoTable.h>\r
61#include <Guid/FileInfo.h>\r
62#include <Guid/Apriori.h>\r
63#include <Guid/DxeServices.h>\r
64#include <Guid/MemoryAllocationHob.h>\r
65#include <Guid/EventLegacyBios.h>\r
66#include <Guid/EventGroup.h>\r
67#include <Guid/EventExitBootServiceFailed.h>\r
68#include <Guid/LoadModuleAtFixedAddress.h>\r
69#include <Guid/IdleLoopEvent.h>\r
70#include <Guid/VectorHandoffTable.h>\r
71#include <Ppi/VectorHandoffInfo.h>\r
72#include <Guid/MemoryProfile.h>\r
73\r
74#include <Library/DxeCoreEntryPoint.h>\r
75#include <Library/DebugLib.h>\r
76#include <Library/UefiLib.h>\r
77#include <Library/BaseLib.h>\r
78#include <Library/HobLib.h>\r
79#include <Library/PerformanceLib.h>\r
80#include <Library/UefiDecompressLib.h>\r
81#include <Library/ExtractGuidedSectionLib.h>\r
82#include <Library/CacheMaintenanceLib.h>\r
83#include <Library/BaseMemoryLib.h>\r
84#include <Library/PeCoffLib.h>\r
85#include <Library/PeCoffGetEntryPointLib.h>\r
86#include <Library/PeCoffExtraActionLib.h>\r
87#include <Library/PcdLib.h>\r
88#include <Library/MemoryAllocationLib.h>\r
89#include <Library/DevicePathLib.h>\r
90#include <Library/UefiBootServicesTableLib.h>\r
91#include <Library/ReportStatusCodeLib.h>\r
92#include <Library/TimerLib.h>\r
93#include <Library/DxeServicesLib.h>\r
94#include <Library/DebugAgentLib.h>\r
95#include <Library/CpuExceptionHandlerLib.h>\r
96\r
97\r
98//\r
99// attributes for reserved memory before it is promoted to system memory\r
100//\r
101#define EFI_MEMORY_PRESENT 0x0100000000000000ULL\r
102#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL\r
103#define EFI_MEMORY_TESTED 0x0400000000000000ULL\r
104\r
105//\r
106// range for memory mapped port I/O on IPF\r
107//\r
108#define EFI_MEMORY_PORT_IO 0x4000000000000000ULL\r
109\r
110\r
111///\r
112/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression\r
113/// to save time. A EFI_DEP_PUSH is evaluated one an\r
114/// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2\r
115/// Driver Execution Environment Core Interface use 0xff\r
116/// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be\r
117/// defined to a new value that is not conflicting with PI spec.\r
118///\r
119#define EFI_DEP_REPLACE_TRUE 0xff\r
120\r
121///\r
122/// Define the initial size of the dependency expression evaluation stack\r
123///\r
124#define DEPEX_STACK_SIZE_INCREMENT 0x1000\r
125\r
126#if defined (MDE_CPU_IPF)\r
127///\r
128/// For Itanium machines make the default allocations 8K aligned\r
129///\r
130#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)\r
131#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)\r
132\r
133#elif defined (MDE_CPU_AARCH64)\r
134///\r
135/// 64-bit ARM systems allow the OS to execute with 64 KB page size,\r
136/// so for improved interoperability with the firmware, align the\r
137/// runtime regions to 64 KB as well\r
138///\r
139#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (SIZE_64KB)\r
140#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)\r
141\r
142#else\r
143///\r
144/// For generic EFI machines make the default allocations 4K aligned\r
145///\r
146#define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)\r
147#define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)\r
148\r
149#endif\r
150\r
151typedef struct {\r
152 EFI_GUID *ProtocolGuid;\r
153 VOID **Protocol;\r
154 EFI_EVENT Event;\r
155 VOID *Registration;\r
156 BOOLEAN Present;\r
157} EFI_CORE_PROTOCOL_NOTIFY_ENTRY;\r
158\r
159//\r
160// DXE Dispatcher Data structures\r
161//\r
162\r
163#define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')\r
164typedef struct {\r
165 UINTN Signature;\r
166 LIST_ENTRY Link; // mFvHandleList\r
167 EFI_HANDLE Handle;\r
168 EFI_GUID FvNameGuid;\r
169} KNOWN_HANDLE;\r
170\r
171\r
172#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')\r
173typedef struct {\r
174 UINTN Signature;\r
175 LIST_ENTRY Link; // mDriverList\r
176\r
177 LIST_ENTRY ScheduledLink; // mScheduledQueue\r
178\r
179 EFI_HANDLE FvHandle;\r
180 EFI_GUID FileName;\r
181 EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;\r
182 EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
183\r
184 VOID *Depex;\r
185 UINTN DepexSize;\r
186\r
187 BOOLEAN Before;\r
188 BOOLEAN After;\r
189 EFI_GUID BeforeAfterGuid;\r
190\r
191 BOOLEAN Dependent;\r
192 BOOLEAN Unrequested;\r
193 BOOLEAN Scheduled;\r
194 BOOLEAN Untrusted;\r
195 BOOLEAN Initialized;\r
196 BOOLEAN DepexProtocolError;\r
197\r
198 EFI_HANDLE ImageHandle;\r
199 BOOLEAN IsFvImage;\r
200\r
201} EFI_CORE_DRIVER_ENTRY;\r
202\r
203//\r
204//The data structure of GCD memory map entry\r
205//\r
206#define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')\r
207typedef struct {\r
208 UINTN Signature;\r
209 LIST_ENTRY Link;\r
210 EFI_PHYSICAL_ADDRESS BaseAddress;\r
211 UINT64 EndAddress;\r
212 UINT64 Capabilities;\r
213 UINT64 Attributes;\r
214 EFI_GCD_MEMORY_TYPE GcdMemoryType;\r
215 EFI_GCD_IO_TYPE GcdIoType;\r
216 EFI_HANDLE ImageHandle;\r
217 EFI_HANDLE DeviceHandle;\r
218} EFI_GCD_MAP_ENTRY;\r
219\r
220\r
221#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')\r
222\r
223typedef struct {\r
224 UINTN Signature;\r
225 /// Image handle\r
226 EFI_HANDLE Handle; \r
227 /// Image type\r
228 UINTN Type; \r
229 /// If entrypoint has been called\r
230 BOOLEAN Started; \r
231 /// The image's entry point\r
232 EFI_IMAGE_ENTRY_POINT EntryPoint; \r
233 /// loaded image protocol\r
234 EFI_LOADED_IMAGE_PROTOCOL Info; \r
235 /// Location in memory\r
236 EFI_PHYSICAL_ADDRESS ImageBasePage; \r
237 /// Number of pages\r
238 UINTN NumberOfPages; \r
239 /// Original fixup data\r
240 CHAR8 *FixupData; \r
241 /// Tpl of started image\r
242 EFI_TPL Tpl; \r
243 /// Status returned by started image\r
244 EFI_STATUS Status; \r
245 /// Size of ExitData from started image\r
246 UINTN ExitDataSize; \r
247 /// Pointer to exit data from started image\r
248 VOID *ExitData; \r
249 /// Pointer to pool allocation for context save/restore\r
250 VOID *JumpBuffer; \r
251 /// Pointer to buffer for context save/restore\r
252 BASE_LIBRARY_JUMP_BUFFER *JumpContext; \r
253 /// Machine type from PE image\r
254 UINT16 Machine; \r
255 /// EBC Protocol pointer\r
256 EFI_EBC_PROTOCOL *Ebc; \r
257 /// Runtime image list\r
258 EFI_RUNTIME_IMAGE_ENTRY *RuntimeData; \r
259 /// Pointer to Loaded Image Device Path Protocol\r
260 EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath; \r
261 /// PeCoffLoader ImageContext\r
262 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; \r
263 /// Status returned by LoadImage() service.\r
264 EFI_STATUS LoadImageStatus;\r
265} LOADED_IMAGE_PRIVATE_DATA;\r
266\r
267#define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
268 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r
269\r
270//\r
271// DXE Core Global Variables\r
272//\r
273extern EFI_SYSTEM_TABLE *gDxeCoreST;\r
274extern EFI_RUNTIME_SERVICES *gDxeCoreRT;\r
275extern EFI_DXE_SERVICES *gDxeCoreDS;\r
276extern EFI_HANDLE gDxeCoreImageHandle;\r
277\r
278extern BOOLEAN gMemoryMapTerminated;\r
279\r
280extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;\r
281\r
282extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime;\r
283extern EFI_CPU_ARCH_PROTOCOL *gCpu;\r
284extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer;\r
285extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome;\r
286extern EFI_TIMER_ARCH_PROTOCOL *gTimer;\r
287extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity;\r
288extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2;\r
289extern EFI_BDS_ARCH_PROTOCOL *gBds;\r
290extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2;\r
291\r
292extern EFI_TPL gEfiCurrentTpl;\r
293\r
294extern EFI_GUID *gDxeCoreFileName;\r
295extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;\r
296\r
297extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];\r
298\r
299extern BOOLEAN gDispatcherRunning;\r
300extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;\r
301\r
302extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable;\r
303extern BOOLEAN gLoadFixedAddressCodeMemoryReady;\r
304//\r
305// Service Initialization Functions\r
306//\r
307\r
308\r
309\r
310/**\r
311 Called to initialize the pool.\r
312\r
313**/\r
314VOID\r
315CoreInitializePool (\r
316 VOID\r
317 );\r
318\r
319\r
320/**\r
321 Called to initialize the memory map and add descriptors to\r
322 the current descriptor list.\r
323 The first descriptor that is added must be general usable\r
324 memory as the addition allocates heap.\r
325\r
326 @param Type The type of memory to add\r
327 @param Start The starting address in the memory range Must be\r
328 page aligned\r
329 @param NumberOfPages The number of pages in the range\r
330 @param Attribute Attributes of the memory to add\r
331\r
332 @return None. The range is added to the memory map\r
333\r
334**/\r
335VOID\r
336CoreAddMemoryDescriptor (\r
337 IN EFI_MEMORY_TYPE Type,\r
338 IN EFI_PHYSICAL_ADDRESS Start,\r
339 IN UINT64 NumberOfPages,\r
340 IN UINT64 Attribute\r
341 );\r
342\r
343\r
344/**\r
345 Release memory lock on mGcdMemorySpaceLock.\r
346\r
347**/\r
348VOID\r
349CoreReleaseGcdMemoryLock (\r
350 VOID\r
351 );\r
352\r
353\r
354/**\r
355 Acquire memory lock on mGcdMemorySpaceLock.\r
356\r
357**/\r
358VOID\r
359CoreAcquireGcdMemoryLock (\r
360 VOID\r
361 );\r
362\r
363\r
364/**\r
365 External function. Initializes memory services based on the memory\r
366 descriptor HOBs. This function is responsible for priming the memory\r
367 map, so memory allocations and resource allocations can be made.\r
368 The first part of this function can not depend on any memory services\r
369 until at least one memory descriptor is provided to the memory services.\r
370\r
371 @param HobStart The start address of the HOB.\r
372 @param MemoryBaseAddress Start address of memory region found to init DXE\r
373 core.\r
374 @param MemoryLength Length of memory region found to init DXE core.\r
375\r
376 @retval EFI_SUCCESS Memory services successfully initialized.\r
377\r
378**/\r
379EFI_STATUS\r
380CoreInitializeMemoryServices (\r
381 IN VOID **HobStart,\r
382 OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,\r
383 OUT UINT64 *MemoryLength\r
384 );\r
385\r
386\r
387\r
388/**\r
389 External function. Initializes the GCD and memory services based on the memory\r
390 descriptor HOBs. This function is responsible for priming the GCD map and the\r
391 memory map, so memory allocations and resource allocations can be made. The\r
392 HobStart will be relocated to a pool buffer.\r
393\r
394 @param HobStart The start address of the HOB\r
395 @param MemoryBaseAddress Start address of memory region found to init DXE\r
396 core.\r
397 @param MemoryLength Length of memory region found to init DXE core.\r
398\r
399 @retval EFI_SUCCESS GCD services successfully initialized.\r
400\r
401**/\r
402EFI_STATUS\r
403CoreInitializeGcdServices (\r
404 IN OUT VOID **HobStart,\r
405 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,\r
406 IN UINT64 MemoryLength\r
407 );\r
408\r
409\r
410/**\r
411 Initializes "event" support.\r
412\r
413 @retval EFI_SUCCESS Always return success\r
414\r
415**/\r
416EFI_STATUS\r
417CoreInitializeEventServices (\r
418 VOID\r
419 );\r
420\r
421\r
422/**\r
423 Add the Image Services to EFI Boot Services Table and install the protocol\r
424 interfaces for this image.\r
425\r
426 @param HobStart The HOB to initialize\r
427\r
428 @return Status code.\r
429\r
430**/\r
431EFI_STATUS\r
432CoreInitializeImageServices (\r
433 IN VOID *HobStart\r
434 );\r
435\r
436\r
437/**\r
438 Creates an event that is fired everytime a Protocol of a specific type is installed.\r
439\r
440**/\r
441VOID\r
442CoreNotifyOnProtocolInstallation (\r
443 VOID\r
444 );\r
445\r
446\r
447/**\r
448 Return TRUE if all AP services are available.\r
449\r
450 @retval EFI_SUCCESS All AP services are available\r
451 @retval EFI_NOT_FOUND At least one AP service is not available\r
452\r
453**/\r
454EFI_STATUS\r
455CoreAllEfiServicesAvailable (\r
456 VOID\r
457 );\r
458\r
459\r
460/**\r
461 Calcualte the 32-bit CRC in a EFI table using the service provided by the\r
462 gRuntime service.\r
463\r
464 @param Hdr Pointer to an EFI standard header\r
465\r
466**/\r
467VOID\r
468CalculateEfiHdrCrc (\r
469 IN OUT EFI_TABLE_HEADER *Hdr\r
470 );\r
471\r
472\r
473/**\r
474 Called by the platform code to process a tick.\r
475\r
476 @param Duration The number of 100ns elapsed since the last call\r
477 to TimerTick\r
478\r
479**/\r
480VOID\r
481EFIAPI\r
482CoreTimerTick (\r
483 IN UINT64 Duration\r
484 );\r
485\r
486\r
487/**\r
488 Initialize the dispatcher. Initialize the notification function that runs when\r
489 an FV2 protocol is added to the system.\r
490\r
491**/\r
492VOID\r
493CoreInitializeDispatcher (\r
494 VOID\r
495 );\r
496\r
497\r
498/**\r
499 This is the POSTFIX version of the dependency evaluator. This code does\r
500 not need to handle Before or After, as it is not valid to call this\r
501 routine in this case. The SOR is just ignored and is a nop in the grammer.\r
502 POSTFIX means all the math is done on top of the stack.\r
503\r
504 @param DriverEntry DriverEntry element to update.\r
505\r
506 @retval TRUE If driver is ready to run.\r
507 @retval FALSE If driver is not ready to run or some fatal error\r
508 was found.\r
509\r
510**/\r
511BOOLEAN\r
512CoreIsSchedulable (\r
513 IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r
514 );\r
515\r
516\r
517/**\r
518 Preprocess dependency expression and update DriverEntry to reflect the\r
519 state of Before, After, and SOR dependencies. If DriverEntry->Before\r
520 or DriverEntry->After is set it will never be cleared. If SOR is set\r
521 it will be cleared by CoreSchedule(), and then the driver can be\r
522 dispatched.\r
523\r
524 @param DriverEntry DriverEntry element to update .\r
525\r
526 @retval EFI_SUCCESS It always works.\r
527\r
528**/\r
529EFI_STATUS\r
530CorePreProcessDepex (\r
531 IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r
532 );\r
533\r
534\r
535\r
536/**\r
537 Terminates all boot services.\r
538\r
539 @param ImageHandle Handle that identifies the exiting image.\r
540 @param MapKey Key to the latest memory map.\r
541\r
542 @retval EFI_SUCCESS Boot Services terminated\r
543 @retval EFI_INVALID_PARAMETER MapKey is incorrect.\r
544\r
545**/\r
546EFI_STATUS\r
547EFIAPI\r
548CoreExitBootServices (\r
549 IN EFI_HANDLE ImageHandle,\r
550 IN UINTN MapKey\r
551 );\r
552\r
553\r
554/**\r
555 Make sure the memory map is following all the construction rules,\r
556 it is the last time to check memory map error before exit boot services.\r
557\r
558 @param MapKey Memory map key\r
559\r
560 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction\r
561 rules.\r
562 @retval EFI_SUCCESS Valid memory map.\r
563\r
564**/\r
565EFI_STATUS\r
566CoreTerminateMemoryMap (\r
567 IN UINTN MapKey\r
568 );\r
569\r
570\r
571/**\r
572 Signals all events in the EventGroup.\r
573\r
574 @param EventGroup The list to signal\r
575\r
576**/\r
577VOID\r
578CoreNotifySignalList (\r
579 IN EFI_GUID *EventGroup\r
580 );\r
581\r
582\r
583\r
584/**\r
585 Boot Service called to add, modify, or remove a system configuration table from\r
586 the EFI System Table.\r
587\r
588 @param Guid Pointer to the GUID for the entry to add, update, or\r
589 remove\r
590 @param Table Pointer to the configuration table for the entry to add,\r
591 update, or remove, may be NULL.\r
592\r
593 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.\r
594 @return EFI_INVALID_PARAMETER Input GUID not valid.\r
595 @return EFI_NOT_FOUND Attempted to delete non-existant entry\r
596 @return EFI_OUT_OF_RESOURCES Not enough memory available\r
597\r
598**/\r
599EFI_STATUS\r
600EFIAPI\r
601CoreInstallConfigurationTable (\r
602 IN EFI_GUID *Guid,\r
603 IN VOID *Table\r
604 );\r
605\r
606\r
607\r
608/**\r
609 Raise the task priority level to the new level.\r
610 High level is implemented by disabling processor interrupts.\r
611\r
612 @param NewTpl New task priority level\r
613\r
614 @return The previous task priority level\r
615\r
616**/\r
617EFI_TPL\r
618EFIAPI\r
619CoreRaiseTpl (\r
620 IN EFI_TPL NewTpl\r
621 );\r
622\r
623\r
624\r
625/**\r
626 Lowers the task priority to the previous value. If the new\r
627 priority unmasks events at a higher priority, they are dispatched.\r
628\r
629 @param NewTpl New, lower, task priority\r
630\r
631**/\r
632VOID\r
633EFIAPI\r
634CoreRestoreTpl (\r
635 IN EFI_TPL NewTpl\r
636 );\r
637\r
638\r
639\r
640/**\r
641 Introduces a fine-grained stall.\r
642\r
643 @param Microseconds The number of microseconds to stall execution.\r
644\r
645 @retval EFI_SUCCESS Execution was stalled for at least the requested\r
646 amount of microseconds.\r
647 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet\r
648\r
649**/\r
650EFI_STATUS\r
651EFIAPI\r
652CoreStall (\r
653 IN UINTN Microseconds\r
654 );\r
655\r
656\r
657\r
658/**\r
659 Sets the system's watchdog timer.\r
660\r
661 @param Timeout The number of seconds to set the watchdog timer to.\r
662 A value of zero disables the timer.\r
663 @param WatchdogCode The numeric code to log on a watchdog timer timeout\r
664 event. The firmware reserves codes 0x0000 to 0xFFFF.\r
665 Loaders and operating systems may use other timeout\r
666 codes.\r
667 @param DataSize The size, in bytes, of WatchdogData.\r
668 @param WatchdogData A data buffer that includes a Null-terminated Unicode\r
669 string, optionally followed by additional binary data.\r
670 The string is a description that the call may use to\r
671 further indicate the reason to be logged with a\r
672 watchdog event.\r
673\r
674 @return EFI_SUCCESS Timeout has been set\r
675 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet\r
676 @return EFI_UNSUPPORTED System does not have a timer (currently not used)\r
677 @return EFI_DEVICE_ERROR Could not complete due to hardware error\r
678\r
679**/\r
680EFI_STATUS\r
681EFIAPI\r
682CoreSetWatchdogTimer (\r
683 IN UINTN Timeout,\r
684 IN UINT64 WatchdogCode,\r
685 IN UINTN DataSize,\r
686 IN CHAR16 *WatchdogData OPTIONAL\r
687 );\r
688\r
689\r
690\r
691/**\r
692 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which\r
693 Calls the private one which contains a BOOLEAN parameter for notifications\r
694\r
695 @param UserHandle The handle to install the protocol handler on,\r
696 or NULL if a new handle is to be allocated\r
697 @param Protocol The protocol to add to the handle\r
698 @param InterfaceType Indicates whether Interface is supplied in\r
699 native form.\r
700 @param Interface The interface for the protocol being added\r
701\r
702 @return Status code\r
703\r
704**/\r
705EFI_STATUS\r
706EFIAPI\r
707CoreInstallProtocolInterface (\r
708 IN OUT EFI_HANDLE *UserHandle,\r
709 IN EFI_GUID *Protocol,\r
710 IN EFI_INTERFACE_TYPE InterfaceType,\r
711 IN VOID *Interface\r
712 );\r
713\r
714\r
715/**\r
716 Installs a protocol interface into the boot services environment.\r
717\r
718 @param UserHandle The handle to install the protocol handler on,\r
719 or NULL if a new handle is to be allocated\r
720 @param Protocol The protocol to add to the handle\r
721 @param InterfaceType Indicates whether Interface is supplied in\r
722 native form.\r
723 @param Interface The interface for the protocol being added\r
724 @param Notify indicates whether notify the notification list\r
725 for this protocol\r
726\r
727 @retval EFI_INVALID_PARAMETER Invalid parameter\r
728 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
729 @retval EFI_SUCCESS Protocol interface successfully installed\r
730\r
731**/\r
732EFI_STATUS\r
733CoreInstallProtocolInterfaceNotify (\r
734 IN OUT EFI_HANDLE *UserHandle,\r
735 IN EFI_GUID *Protocol,\r
736 IN EFI_INTERFACE_TYPE InterfaceType,\r
737 IN VOID *Interface,\r
738 IN BOOLEAN Notify\r
739 );\r
740\r
741\r
742\r
743/**\r
744 Installs a list of protocol interface into the boot services environment.\r
745 This function calls InstallProtocolInterface() in a loop. If any error\r
746 occures all the protocols added by this function are removed. This is\r
747 basically a lib function to save space.\r
748\r
749 @param Handle The handle to install the protocol handlers on,\r
750 or NULL if a new handle is to be allocated\r
751 @param ... EFI_GUID followed by protocol instance. A NULL\r
752 terminates the list. The pairs are the\r
753 arguments to InstallProtocolInterface(). All the\r
754 protocols are added to Handle.\r
755\r
756 @retval EFI_SUCCESS All the protocol interface was installed.\r
757 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
758 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r
759 the handle database.\r
760 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
761 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.\r
762\r
763**/\r
764EFI_STATUS\r
765EFIAPI\r
766CoreInstallMultipleProtocolInterfaces (\r
767 IN OUT EFI_HANDLE *Handle,\r
768 ...\r
769 );\r
770\r
771\r
772\r
773/**\r
774 Uninstalls a list of protocol interface in the boot services environment.\r
775 This function calls UnisatllProtocolInterface() in a loop. This is\r
776 basically a lib function to save space.\r
777\r
778 @param Handle The handle to uninstall the protocol\r
779 @param ... EFI_GUID followed by protocol instance. A NULL\r
780 terminates the list. The pairs are the\r
781 arguments to UninstallProtocolInterface(). All\r
782 the protocols are added to Handle.\r
783\r
784 @return Status code\r
785\r
786**/\r
787EFI_STATUS\r
788EFIAPI\r
789CoreUninstallMultipleProtocolInterfaces (\r
790 IN EFI_HANDLE Handle,\r
791 ...\r
792 );\r
793\r
794\r
795\r
796/**\r
797 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.\r
798\r
799 @param UserHandle Handle on which the interface is to be\r
800 reinstalled\r
801 @param Protocol The numeric ID of the interface\r
802 @param OldInterface A pointer to the old interface\r
803 @param NewInterface A pointer to the new interface\r
804\r
805 @retval EFI_SUCCESS The protocol interface was installed\r
806 @retval EFI_NOT_FOUND The OldInterface on the handle was not found\r
807 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
808\r
809**/\r
810EFI_STATUS\r
811EFIAPI\r
812CoreReinstallProtocolInterface (\r
813 IN EFI_HANDLE UserHandle,\r
814 IN EFI_GUID *Protocol,\r
815 IN VOID *OldInterface,\r
816 IN VOID *NewInterface\r
817 );\r
818\r
819\r
820\r
821/**\r
822 Uninstalls all instances of a protocol:interfacer from a handle.\r
823 If the last protocol interface is remove from the handle, the\r
824 handle is freed.\r
825\r
826 @param UserHandle The handle to remove the protocol handler from\r
827 @param Protocol The protocol, of protocol:interface, to remove\r
828 @param Interface The interface, of protocol:interface, to remove\r
829\r
830 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
831 @retval EFI_SUCCESS Protocol interface successfully uninstalled.\r
832\r
833**/\r
834EFI_STATUS\r
835EFIAPI\r
836CoreUninstallProtocolInterface (\r
837 IN EFI_HANDLE UserHandle,\r
838 IN EFI_GUID *Protocol,\r
839 IN VOID *Interface\r
840 );\r
841\r
842\r
843\r
844/**\r
845 Queries a handle to determine if it supports a specified protocol.\r
846\r
847 @param UserHandle The handle being queried.\r
848 @param Protocol The published unique identifier of the protocol.\r
849 @param Interface Supplies the address where a pointer to the\r
850 corresponding Protocol Interface is returned.\r
851\r
852 @return The requested protocol interface for the handle\r
853\r
854**/\r
855EFI_STATUS\r
856EFIAPI\r
857CoreHandleProtocol (\r
858 IN EFI_HANDLE UserHandle,\r
859 IN EFI_GUID *Protocol,\r
860 OUT VOID **Interface\r
861 );\r
862\r
863\r
864\r
865/**\r
866 Locates the installed protocol handler for the handle, and\r
867 invokes it to obtain the protocol interface. Usage information\r
868 is registered in the protocol data base.\r
869\r
870 @param UserHandle The handle to obtain the protocol interface on\r
871 @param Protocol The ID of the protocol\r
872 @param Interface The location to return the protocol interface\r
873 @param ImageHandle The handle of the Image that is opening the\r
874 protocol interface specified by Protocol and\r
875 Interface.\r
876 @param ControllerHandle The controller handle that is requiring this\r
877 interface.\r
878 @param Attributes The open mode of the protocol interface\r
879 specified by Handle and Protocol.\r
880\r
881 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
882 @retval EFI_SUCCESS Get the protocol interface.\r
883\r
884**/\r
885EFI_STATUS\r
886EFIAPI\r
887CoreOpenProtocol (\r
888 IN EFI_HANDLE UserHandle,\r
889 IN EFI_GUID *Protocol,\r
890 OUT VOID **Interface OPTIONAL,\r
891 IN EFI_HANDLE ImageHandle,\r
892 IN EFI_HANDLE ControllerHandle,\r
893 IN UINT32 Attributes\r
894 );\r
895\r
896\r
897\r
898/**\r
899 Return information about Opened protocols in the system\r
900\r
901 @param UserHandle The handle to close the protocol interface on\r
902 @param Protocol The ID of the protocol\r
903 @param EntryBuffer A pointer to a buffer of open protocol\r
904 information in the form of\r
905 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.\r
906 @param EntryCount Number of EntryBuffer entries\r
907\r
908**/\r
909EFI_STATUS\r
910EFIAPI\r
911CoreOpenProtocolInformation (\r
912 IN EFI_HANDLE UserHandle,\r
913 IN EFI_GUID *Protocol,\r
914 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
915 OUT UINTN *EntryCount\r
916 );\r
917\r
918\r
919\r
920/**\r
921 Closes a protocol on a handle that was opened using OpenProtocol().\r
922\r
923 @param UserHandle The handle for the protocol interface that was\r
924 previously opened with OpenProtocol(), and is\r
925 now being closed.\r
926 @param Protocol The published unique identifier of the protocol.\r
927 It is the caller's responsibility to pass in a\r
928 valid GUID.\r
929 @param AgentHandle The handle of the agent that is closing the\r
930 protocol interface.\r
931 @param ControllerHandle If the agent that opened a protocol is a driver\r
932 that follows the EFI Driver Model, then this\r
933 parameter is the controller handle that required\r
934 the protocol interface. If the agent does not\r
935 follow the EFI Driver Model, then this parameter\r
936 is optional and may be NULL.\r
937\r
938 @retval EFI_SUCCESS The protocol instance was closed.\r
939 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a\r
940 valid EFI_HANDLE.\r
941 @retval EFI_NOT_FOUND Can not find the specified protocol or\r
942 AgentHandle.\r
943\r
944**/\r
945EFI_STATUS\r
946EFIAPI\r
947CoreCloseProtocol (\r
948 IN EFI_HANDLE UserHandle,\r
949 IN EFI_GUID *Protocol,\r
950 IN EFI_HANDLE AgentHandle,\r
951 IN EFI_HANDLE ControllerHandle\r
952 );\r
953\r
954\r
955\r
956/**\r
957 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
958 from pool.\r
959\r
960 @param UserHandle The handle from which to retrieve the list of\r
961 protocol interface GUIDs.\r
962 @param ProtocolBuffer A pointer to the list of protocol interface GUID\r
963 pointers that are installed on Handle.\r
964 @param ProtocolBufferCount A pointer to the number of GUID pointers present\r
965 in ProtocolBuffer.\r
966\r
967 @retval EFI_SUCCESS The list of protocol interface GUIDs installed\r
968 on Handle was returned in ProtocolBuffer. The\r
969 number of protocol interface GUIDs was returned\r
970 in ProtocolBufferCount.\r
971 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
972 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
973 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.\r
974 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.\r
975 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
976 results.\r
977\r
978**/\r
979EFI_STATUS\r
980EFIAPI\r
981CoreProtocolsPerHandle (\r
982 IN EFI_HANDLE UserHandle,\r
983 OUT EFI_GUID ***ProtocolBuffer,\r
984 OUT UINTN *ProtocolBufferCount\r
985 );\r
986\r
987\r
988\r
989/**\r
990 Add a new protocol notification record for the request protocol.\r
991\r
992 @param Protocol The requested protocol to add the notify\r
993 registration\r
994 @param Event The event to signal\r
995 @param Registration Returns the registration record\r
996\r
997 @retval EFI_INVALID_PARAMETER Invalid parameter\r
998 @retval EFI_SUCCESS Successfully returned the registration record\r
999 that has been added\r
1000\r
1001**/\r
1002EFI_STATUS\r
1003EFIAPI\r
1004CoreRegisterProtocolNotify (\r
1005 IN EFI_GUID *Protocol,\r
1006 IN EFI_EVENT Event,\r
1007 OUT VOID **Registration\r
1008 );\r
1009\r
1010\r
1011/**\r
1012 Removes all the events in the protocol database that match Event.\r
1013\r
1014 @param Event The event to search for in the protocol\r
1015 database.\r
1016\r
1017 @return EFI_SUCCESS when done searching the entire database.\r
1018\r
1019**/\r
1020EFI_STATUS\r
1021CoreUnregisterProtocolNotify (\r
1022 IN EFI_EVENT Event\r
1023 );\r
1024\r
1025\r
1026/**\r
1027 Locates the requested handle(s) and returns them in Buffer.\r
1028\r
1029 @param SearchType The type of search to perform to locate the\r
1030 handles\r
1031 @param Protocol The protocol to search for\r
1032 @param SearchKey Dependant on SearchType\r
1033 @param BufferSize On input the size of Buffer. On output the\r
1034 size of data returned.\r
1035 @param Buffer The buffer to return the results in\r
1036\r
1037 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is\r
1038 returned in BufferSize.\r
1039 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1040 @retval EFI_SUCCESS Successfully found the requested handle(s) and\r
1041 returns them in Buffer.\r
1042\r
1043**/\r
1044EFI_STATUS\r
1045EFIAPI\r
1046CoreLocateHandle (\r
1047 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
1048 IN EFI_GUID *Protocol OPTIONAL,\r
1049 IN VOID *SearchKey OPTIONAL,\r
1050 IN OUT UINTN *BufferSize,\r
1051 OUT EFI_HANDLE *Buffer\r
1052 );\r
1053\r
1054\r
1055\r
1056/**\r
1057 Locates the handle to a device on the device path that best matches the specified protocol.\r
1058\r
1059 @param Protocol The protocol to search for.\r
1060 @param DevicePath On input, a pointer to a pointer to the device\r
1061 path. On output, the device path pointer is\r
1062 modified to point to the remaining part of the\r
1063 devicepath.\r
1064 @param Device A pointer to the returned device handle.\r
1065\r
1066 @retval EFI_SUCCESS The resulting handle was returned.\r
1067 @retval EFI_NOT_FOUND No handles matched the search.\r
1068 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1069\r
1070**/\r
1071EFI_STATUS\r
1072EFIAPI\r
1073CoreLocateDevicePath (\r
1074 IN EFI_GUID *Protocol,\r
1075 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
1076 OUT EFI_HANDLE *Device\r
1077 );\r
1078\r
1079\r
1080\r
1081/**\r
1082 Function returns an array of handles that support the requested protocol\r
1083 in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
1084 that allocates a buffer for the caller.\r
1085\r
1086 @param SearchType Specifies which handle(s) are to be returned.\r
1087 @param Protocol Provides the protocol to search by. This\r
1088 parameter is only valid for SearchType\r
1089 ByProtocol.\r
1090 @param SearchKey Supplies the search key depending on the\r
1091 SearchType.\r
1092 @param NumberHandles The number of handles returned in Buffer.\r
1093 @param Buffer A pointer to the buffer to return the requested\r
1094 array of handles that support Protocol.\r
1095\r
1096 @retval EFI_SUCCESS The result array of handles was returned.\r
1097 @retval EFI_NOT_FOUND No handles match the search.\r
1098 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
1099 matching results.\r
1100 @retval EFI_INVALID_PARAMETER One or more parameters are not valid.\r
1101\r
1102**/\r
1103EFI_STATUS\r
1104EFIAPI\r
1105CoreLocateHandleBuffer (\r
1106 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
1107 IN EFI_GUID *Protocol OPTIONAL,\r
1108 IN VOID *SearchKey OPTIONAL,\r
1109 IN OUT UINTN *NumberHandles,\r
1110 OUT EFI_HANDLE **Buffer\r
1111 );\r
1112\r
1113\r
1114\r
1115/**\r
1116 Return the first Protocol Interface that matches the Protocol GUID. If\r
1117 Registration is passed in, return a Protocol Instance that was just add\r
1118 to the system. If Registration is NULL return the first Protocol Interface\r
1119 you find.\r
1120\r
1121 @param Protocol The protocol to search for\r
1122 @param Registration Optional Registration Key returned from\r
1123 RegisterProtocolNotify()\r
1124 @param Interface Return the Protocol interface (instance).\r
1125\r
1126 @retval EFI_SUCCESS If a valid Interface is returned\r
1127 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1128 @retval EFI_NOT_FOUND Protocol interface not found\r
1129\r
1130**/\r
1131EFI_STATUS\r
1132EFIAPI\r
1133CoreLocateProtocol (\r
1134 IN EFI_GUID *Protocol,\r
1135 IN VOID *Registration OPTIONAL,\r
1136 OUT VOID **Interface\r
1137 );\r
1138\r
1139\r
1140/**\r
1141 return handle database key.\r
1142\r
1143\r
1144 @return Handle database key.\r
1145\r
1146**/\r
1147UINT64\r
1148CoreGetHandleDatabaseKey (\r
1149 VOID\r
1150 );\r
1151\r
1152\r
1153/**\r
1154 Go connect any handles that were created or modified while a image executed.\r
1155\r
1156 @param Key The Key to show that the handle has been\r
1157 created/modified\r
1158\r
1159**/\r
1160VOID\r
1161CoreConnectHandlesByKey (\r
1162 UINT64 Key\r
1163 );\r
1164\r
1165\r
1166\r
1167/**\r
1168 Connects one or more drivers to a controller.\r
1169\r
1170 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
1171 @param DriverImageHandle A pointer to an ordered list handles that support the\r
1172 EFI_DRIVER_BINDING_PROTOCOL.\r
1173 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
1174 controller specified by ControllerHandle.\r
1175 @param Recursive If TRUE, then ConnectController() is called recursively\r
1176 until the entire tree of controllers below the controller specified\r
1177 by ControllerHandle have been created. If FALSE, then\r
1178 the tree of controllers is only expanded one level.\r
1179\r
1180 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
1181 2) No drivers were connected to ControllerHandle, but\r
1182 RemainingDevicePath is not NULL, and it is an End Device\r
1183 Path Node.\r
1184 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
1185 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
1186 present in the system.\r
1187 2) No drivers were connected to ControllerHandle.\r
1188 @retval EFI_SECURITY_VIOLATION \r
1189 The user has no permission to start UEFI device drivers on the device path \r
1190 associated with the ControllerHandle or specified by the RemainingDevicePath.\r
1191\r
1192**/\r
1193EFI_STATUS\r
1194EFIAPI\r
1195CoreConnectController (\r
1196 IN EFI_HANDLE ControllerHandle,\r
1197 IN EFI_HANDLE *DriverImageHandle OPTIONAL,\r
1198 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,\r
1199 IN BOOLEAN Recursive\r
1200 );\r
1201\r
1202\r
1203\r
1204/**\r
1205 Disonnects a controller from a driver\r
1206\r
1207 @param ControllerHandle ControllerHandle The handle of\r
1208 the controller from which\r
1209 driver(s) are to be\r
1210 disconnected.\r
1211 @param DriverImageHandle DriverImageHandle The driver to\r
1212 disconnect from ControllerHandle.\r
1213 @param ChildHandle ChildHandle The handle of the\r
1214 child to destroy.\r
1215\r
1216 @retval EFI_SUCCESS One or more drivers were\r
1217 disconnected from the controller.\r
1218 @retval EFI_SUCCESS On entry, no drivers are managing\r
1219 ControllerHandle.\r
1220 @retval EFI_SUCCESS DriverImageHandle is not NULL,\r
1221 and on entry DriverImageHandle is\r
1222 not managing ControllerHandle.\r
1223 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
1224 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,\r
1225 and it is not a valid EFI_HANDLE.\r
1226 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it\r
1227 is not a valid EFI_HANDLE.\r
1228 @retval EFI_OUT_OF_RESOURCES There are not enough resources\r
1229 available to disconnect any\r
1230 drivers from ControllerHandle.\r
1231 @retval EFI_DEVICE_ERROR The controller could not be\r
1232 disconnected because of a device\r
1233 error.\r
1234\r
1235**/\r
1236EFI_STATUS\r
1237EFIAPI\r
1238CoreDisconnectController (\r
1239 IN EFI_HANDLE ControllerHandle,\r
1240 IN EFI_HANDLE DriverImageHandle OPTIONAL,\r
1241 IN EFI_HANDLE ChildHandle OPTIONAL\r
1242 );\r
1243\r
1244\r
1245\r
1246/**\r
1247 Allocates pages from the memory map.\r
1248\r
1249 @param Type The type of allocation to perform\r
1250 @param MemoryType The type of memory to turn the allocated pages\r
1251 into\r
1252 @param NumberOfPages The number of pages to allocate\r
1253 @param Memory A pointer to receive the base allocated memory\r
1254 address\r
1255\r
1256 @return Status. On success, Memory is filled in with the base address allocated\r
1257 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in\r
1258 spec.\r
1259 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r
1260 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r
1261 @retval EFI_SUCCESS Pages successfully allocated.\r
1262\r
1263**/\r
1264EFI_STATUS\r
1265EFIAPI\r
1266CoreAllocatePages (\r
1267 IN EFI_ALLOCATE_TYPE Type,\r
1268 IN EFI_MEMORY_TYPE MemoryType,\r
1269 IN UINTN NumberOfPages,\r
1270 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
1271 );\r
1272\r
1273/**\r
1274 Frees previous allocated pages.\r
1275\r
1276 @param Memory Base address of memory being freed\r
1277 @param NumberOfPages The number of pages to free\r
1278\r
1279 @retval EFI_NOT_FOUND Could not find the entry that covers the range\r
1280 @retval EFI_INVALID_PARAMETER Address not aligned\r
1281 @return EFI_SUCCESS -Pages successfully freed.\r
1282\r
1283**/\r
1284EFI_STATUS\r
1285EFIAPI\r
1286CoreFreePages (\r
1287 IN EFI_PHYSICAL_ADDRESS Memory,\r
1288 IN UINTN NumberOfPages\r
1289 );\r
1290\r
1291/**\r
1292 This function returns a copy of the current memory map. The map is an array of\r
1293 memory descriptors, each of which describes a contiguous block of memory.\r
1294\r
1295 @param MemoryMapSize A pointer to the size, in bytes, of the\r
1296 MemoryMap buffer. On input, this is the size of\r
1297 the buffer allocated by the caller. On output,\r
1298 it is the size of the buffer returned by the\r
1299 firmware if the buffer was large enough, or the\r
1300 size of the buffer needed to contain the map if\r
1301 the buffer was too small.\r
1302 @param MemoryMap A pointer to the buffer in which firmware places\r
1303 the current memory map.\r
1304 @param MapKey A pointer to the location in which firmware\r
1305 returns the key for the current memory map.\r
1306 @param DescriptorSize A pointer to the location in which firmware\r
1307 returns the size, in bytes, of an individual\r
1308 EFI_MEMORY_DESCRIPTOR.\r
1309 @param DescriptorVersion A pointer to the location in which firmware\r
1310 returns the version number associated with the\r
1311 EFI_MEMORY_DESCRIPTOR.\r
1312\r
1313 @retval EFI_SUCCESS The memory map was returned in the MemoryMap\r
1314 buffer.\r
1315 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current\r
1316 buffer size needed to hold the memory map is\r
1317 returned in MemoryMapSize.\r
1318 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1319\r
1320**/\r
1321EFI_STATUS\r
1322EFIAPI\r
1323CoreGetMemoryMap (\r
1324 IN OUT UINTN *MemoryMapSize,\r
1325 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
1326 OUT UINTN *MapKey,\r
1327 OUT UINTN *DescriptorSize,\r
1328 OUT UINT32 *DescriptorVersion\r
1329 );\r
1330\r
1331\r
1332\r
1333/**\r
1334 Allocate pool of a particular type.\r
1335\r
1336 @param PoolType Type of pool to allocate\r
1337 @param Size The amount of pool to allocate\r
1338 @param Buffer The address to return a pointer to the allocated\r
1339 pool\r
1340\r
1341 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r
1342 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
1343 @retval EFI_SUCCESS Pool successfully allocated.\r
1344\r
1345**/\r
1346EFI_STATUS\r
1347EFIAPI\r
1348CoreAllocatePool (\r
1349 IN EFI_MEMORY_TYPE PoolType,\r
1350 IN UINTN Size,\r
1351 OUT VOID **Buffer\r
1352 );\r
1353\r
1354/**\r
1355 Allocate pool of a particular type.\r
1356\r
1357 @param PoolType Type of pool to allocate\r
1358 @param Size The amount of pool to allocate\r
1359 @param Buffer The address to return a pointer to the allocated\r
1360 pool\r
1361\r
1362 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r
1363 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
1364 @retval EFI_SUCCESS Pool successfully allocated.\r
1365\r
1366**/\r
1367EFI_STATUS\r
1368EFIAPI\r
1369CoreInternalAllocatePool (\r
1370 IN EFI_MEMORY_TYPE PoolType,\r
1371 IN UINTN Size,\r
1372 OUT VOID **Buffer\r
1373 );\r
1374\r
1375/**\r
1376 Frees pool.\r
1377\r
1378 @param Buffer The allocated pool entry to free\r
1379\r
1380 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
1381 @retval EFI_SUCCESS Pool successfully freed.\r
1382\r
1383**/\r
1384EFI_STATUS\r
1385EFIAPI\r
1386CoreFreePool (\r
1387 IN VOID *Buffer\r
1388 );\r
1389\r
1390/**\r
1391 Frees pool.\r
1392\r
1393 @param Buffer The allocated pool entry to free\r
1394 @param PoolType Pointer to pool type\r
1395\r
1396 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
1397 @retval EFI_SUCCESS Pool successfully freed.\r
1398\r
1399**/\r
1400EFI_STATUS\r
1401EFIAPI\r
1402CoreInternalFreePool (\r
1403 IN VOID *Buffer,\r
1404 OUT EFI_MEMORY_TYPE *PoolType OPTIONAL\r
1405 );\r
1406\r
1407/**\r
1408 Loads an EFI image into memory and returns a handle to the image.\r
1409\r
1410 @param BootPolicy If TRUE, indicates that the request originates\r
1411 from the boot manager, and that the boot\r
1412 manager is attempting to load FilePath as a\r
1413 boot selection.\r
1414 @param ParentImageHandle The caller's image handle.\r
1415 @param FilePath The specific file path from which the image is\r
1416 loaded.\r
1417 @param SourceBuffer If not NULL, a pointer to the memory location\r
1418 containing a copy of the image to be loaded.\r
1419 @param SourceSize The size in bytes of SourceBuffer.\r
1420 @param ImageHandle Pointer to the returned image handle that is\r
1421 created when the image is successfully loaded.\r
1422\r
1423 @retval EFI_SUCCESS The image was loaded into memory.\r
1424 @retval EFI_NOT_FOUND The FilePath was not found.\r
1425 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1426 @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
1427 path cannot be parsed to locate the proper\r
1428 protocol for loading the file.\r
1429 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
1430 resources.\r
1431 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
1432 understood.\r
1433 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
1434 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the \r
1435 image from being loaded. NULL is returned in *ImageHandle.\r
1436 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a \r
1437 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
1438 platform policy specifies that the image should not be started.\r
1439\r
1440**/\r
1441EFI_STATUS\r
1442EFIAPI\r
1443CoreLoadImage (\r
1444 IN BOOLEAN BootPolicy,\r
1445 IN EFI_HANDLE ParentImageHandle,\r
1446 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
1447 IN VOID *SourceBuffer OPTIONAL,\r
1448 IN UINTN SourceSize,\r
1449 OUT EFI_HANDLE *ImageHandle\r
1450 );\r
1451\r
1452\r
1453\r
1454/**\r
1455 Unloads an image.\r
1456\r
1457 @param ImageHandle Handle that identifies the image to be\r
1458 unloaded.\r
1459\r
1460 @retval EFI_SUCCESS The image has been unloaded.\r
1461 @retval EFI_UNSUPPORTED The image has been started, and does not support\r
1462 unload.\r
1463 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.\r
1464\r
1465**/\r
1466EFI_STATUS\r
1467EFIAPI\r
1468CoreUnloadImage (\r
1469 IN EFI_HANDLE ImageHandle\r
1470 );\r
1471\r
1472\r
1473\r
1474/**\r
1475 Transfer control to a loaded image's entry point.\r
1476\r
1477 @param ImageHandle Handle of image to be started.\r
1478 @param ExitDataSize Pointer of the size to ExitData\r
1479 @param ExitData Pointer to a pointer to a data buffer that\r
1480 includes a Null-terminated string,\r
1481 optionally followed by additional binary data.\r
1482 The string is a description that the caller may\r
1483 use to further indicate the reason for the\r
1484 image's exit.\r
1485\r
1486 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1487 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
1488 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.\r
1489 @retval EFI_SUCCESS Successfully transfer control to the image's\r
1490 entry point.\r
1491\r
1492**/\r
1493EFI_STATUS\r
1494EFIAPI\r
1495CoreStartImage (\r
1496 IN EFI_HANDLE ImageHandle,\r
1497 OUT UINTN *ExitDataSize,\r
1498 OUT CHAR16 **ExitData OPTIONAL\r
1499 );\r
1500\r
1501\r
1502\r
1503/**\r
1504 Terminates the currently loaded EFI image and returns control to boot services.\r
1505\r
1506 @param ImageHandle Handle that identifies the image. This\r
1507 parameter is passed to the image on entry.\r
1508 @param Status The image's exit code.\r
1509 @param ExitDataSize The size, in bytes, of ExitData. Ignored if\r
1510 ExitStatus is EFI_SUCCESS.\r
1511 @param ExitData Pointer to a data buffer that includes a\r
1512 Null-terminated Unicode string, optionally\r
1513 followed by additional binary data. The string\r
1514 is a description that the caller may use to\r
1515 further indicate the reason for the image's\r
1516 exit.\r
1517\r
1518 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current\r
1519 image.\r
1520 @retval EFI_SUCCESS Successfully terminates the currently loaded\r
1521 EFI image.\r
1522 @retval EFI_ACCESS_DENIED Should never reach there.\r
1523 @retval EFI_OUT_OF_RESOURCES Could not allocate pool\r
1524\r
1525**/\r
1526EFI_STATUS\r
1527EFIAPI\r
1528CoreExit (\r
1529 IN EFI_HANDLE ImageHandle,\r
1530 IN EFI_STATUS Status,\r
1531 IN UINTN ExitDataSize,\r
1532 IN CHAR16 *ExitData OPTIONAL\r
1533 );\r
1534\r
1535\r
1536\r
1537/**\r
1538 Creates an event.\r
1539\r
1540 @param Type The type of event to create and its mode and\r
1541 attributes\r
1542 @param NotifyTpl The task priority level of event notifications\r
1543 @param NotifyFunction Pointer to the events notification function\r
1544 @param NotifyContext Pointer to the notification functions context;\r
1545 corresponds to parameter "Context" in the\r
1546 notification function\r
1547 @param Event Pointer to the newly created event if the call\r
1548 succeeds; undefined otherwise\r
1549\r
1550 @retval EFI_SUCCESS The event structure was created\r
1551 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1552 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1553\r
1554**/\r
1555EFI_STATUS\r
1556EFIAPI\r
1557CoreCreateEvent (\r
1558 IN UINT32 Type,\r
1559 IN EFI_TPL NotifyTpl,\r
1560 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1561 IN VOID *NotifyContext, OPTIONAL\r
1562 OUT EFI_EVENT *Event\r
1563 );\r
1564\r
1565\r
1566\r
1567/**\r
1568 Creates an event in a group.\r
1569\r
1570 @param Type The type of event to create and its mode and\r
1571 attributes\r
1572 @param NotifyTpl The task priority level of event notifications\r
1573 @param NotifyFunction Pointer to the events notification function\r
1574 @param NotifyContext Pointer to the notification functions context;\r
1575 corresponds to parameter "Context" in the\r
1576 notification function\r
1577 @param EventGroup GUID for EventGroup if NULL act the same as\r
1578 gBS->CreateEvent().\r
1579 @param Event Pointer to the newly created event if the call\r
1580 succeeds; undefined otherwise\r
1581\r
1582 @retval EFI_SUCCESS The event structure was created\r
1583 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1584 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1585\r
1586**/\r
1587EFI_STATUS\r
1588EFIAPI\r
1589CoreCreateEventEx (\r
1590 IN UINT32 Type,\r
1591 IN EFI_TPL NotifyTpl,\r
1592 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1593 IN CONST VOID *NotifyContext, OPTIONAL\r
1594 IN CONST EFI_GUID *EventGroup, OPTIONAL\r
1595 OUT EFI_EVENT *Event\r
1596 );\r
1597\r
1598/**\r
1599 Creates a general-purpose event structure\r
1600\r
1601 @param Type The type of event to create and its mode and\r
1602 attributes\r
1603 @param NotifyTpl The task priority level of event notifications\r
1604 @param NotifyFunction Pointer to the events notification function\r
1605 @param NotifyContext Pointer to the notification functions context;\r
1606 corresponds to parameter "Context" in the\r
1607 notification function\r
1608 @param EventGroup GUID for EventGroup if NULL act the same as\r
1609 gBS->CreateEvent().\r
1610 @param Event Pointer to the newly created event if the call\r
1611 succeeds; undefined otherwise\r
1612\r
1613 @retval EFI_SUCCESS The event structure was created\r
1614 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1615 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1616\r
1617**/\r
1618EFI_STATUS\r
1619EFIAPI\r
1620CoreCreateEventInternal (\r
1621 IN UINT32 Type,\r
1622 IN EFI_TPL NotifyTpl,\r
1623 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1624 IN CONST VOID *NotifyContext, OPTIONAL\r
1625 IN CONST EFI_GUID *EventGroup, OPTIONAL\r
1626 OUT EFI_EVENT *Event\r
1627 );\r
1628\r
1629/**\r
1630 Sets the type of timer and the trigger time for a timer event.\r
1631\r
1632 @param UserEvent The timer event that is to be signaled at the\r
1633 specified time\r
1634 @param Type The type of time that is specified in\r
1635 TriggerTime\r
1636 @param TriggerTime The number of 100ns units until the timer\r
1637 expires\r
1638\r
1639 @retval EFI_SUCCESS The event has been set to be signaled at the\r
1640 requested time\r
1641 @retval EFI_INVALID_PARAMETER Event or Type is not valid\r
1642\r
1643**/\r
1644EFI_STATUS\r
1645EFIAPI\r
1646CoreSetTimer (\r
1647 IN EFI_EVENT UserEvent,\r
1648 IN EFI_TIMER_DELAY Type,\r
1649 IN UINT64 TriggerTime\r
1650 );\r
1651\r
1652\r
1653\r
1654/**\r
1655 Signals the event. Queues the event to be notified if needed.\r
1656\r
1657 @param UserEvent The event to signal .\r
1658\r
1659 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
1660 @retval EFI_SUCCESS The event was signaled.\r
1661\r
1662**/\r
1663EFI_STATUS\r
1664EFIAPI\r
1665CoreSignalEvent (\r
1666 IN EFI_EVENT UserEvent\r
1667 );\r
1668\r
1669\r
1670\r
1671/**\r
1672 Stops execution until an event is signaled.\r
1673\r
1674 @param NumberOfEvents The number of events in the UserEvents array\r
1675 @param UserEvents An array of EFI_EVENT\r
1676 @param UserIndex Pointer to the index of the event which\r
1677 satisfied the wait condition\r
1678\r
1679 @retval EFI_SUCCESS The event indicated by Index was signaled.\r
1680 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification\r
1681 function or Event was not a valid type\r
1682 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION\r
1683\r
1684**/\r
1685EFI_STATUS\r
1686EFIAPI\r
1687CoreWaitForEvent (\r
1688 IN UINTN NumberOfEvents,\r
1689 IN EFI_EVENT *UserEvents,\r
1690 OUT UINTN *UserIndex\r
1691 );\r
1692\r
1693\r
1694\r
1695/**\r
1696 Closes an event and frees the event structure.\r
1697\r
1698 @param UserEvent Event to close\r
1699\r
1700 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
1701 @retval EFI_SUCCESS The event has been closed\r
1702\r
1703**/\r
1704EFI_STATUS\r
1705EFIAPI\r
1706CoreCloseEvent (\r
1707 IN EFI_EVENT UserEvent\r
1708 );\r
1709\r
1710\r
1711\r
1712/**\r
1713 Check the status of an event.\r
1714\r
1715 @param UserEvent The event to check\r
1716\r
1717 @retval EFI_SUCCESS The event is in the signaled state\r
1718 @retval EFI_NOT_READY The event is not in the signaled state\r
1719 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL\r
1720\r
1721**/\r
1722EFI_STATUS\r
1723EFIAPI\r
1724CoreCheckEvent (\r
1725 IN EFI_EVENT UserEvent\r
1726 );\r
1727\r
1728\r
1729/**\r
1730 Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
1731 global coherency domain of the processor.\r
1732\r
1733 @param GcdMemoryType Memory type of the memory space.\r
1734 @param BaseAddress Base address of the memory space.\r
1735 @param Length Length of the memory space.\r
1736 @param Capabilities alterable attributes of the memory space.\r
1737\r
1738 @retval EFI_SUCCESS Merged this memory space into GCD map.\r
1739\r
1740**/\r
1741EFI_STATUS\r
1742EFIAPI\r
1743CoreAddMemorySpace (\r
1744 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1745 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1746 IN UINT64 Length,\r
1747 IN UINT64 Capabilities\r
1748 );\r
1749\r
1750\r
1751/**\r
1752 Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
1753 I/O resources from the global coherency domain of the processor.\r
1754\r
1755 @param GcdAllocateType The type of allocate operation\r
1756 @param GcdMemoryType The desired memory type\r
1757 @param Alignment Align with 2^Alignment\r
1758 @param Length Length to allocate\r
1759 @param BaseAddress Base address to allocate\r
1760 @param ImageHandle The image handle consume the allocated space.\r
1761 @param DeviceHandle The device handle consume the allocated space.\r
1762\r
1763 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1764 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
1765 @retval EFI_SUCCESS Memory space successfully allocated.\r
1766\r
1767**/\r
1768EFI_STATUS\r
1769EFIAPI\r
1770CoreAllocateMemorySpace (\r
1771 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1772 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1773 IN UINTN Alignment,\r
1774 IN UINT64 Length,\r
1775 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1776 IN EFI_HANDLE ImageHandle,\r
1777 IN EFI_HANDLE DeviceHandle OPTIONAL\r
1778 );\r
1779\r
1780\r
1781/**\r
1782 Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
1783 I/O resources from the global coherency domain of the processor.\r
1784\r
1785 @param BaseAddress Base address of the memory space.\r
1786 @param Length Length of the memory space.\r
1787\r
1788 @retval EFI_SUCCESS Space successfully freed.\r
1789\r
1790**/\r
1791EFI_STATUS\r
1792EFIAPI\r
1793CoreFreeMemorySpace (\r
1794 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1795 IN UINT64 Length\r
1796 );\r
1797\r
1798\r
1799/**\r
1800 Removes reserved memory, system memory, or memory-mapped I/O resources from\r
1801 the global coherency domain of the processor.\r
1802\r
1803 @param BaseAddress Base address of the memory space.\r
1804 @param Length Length of the memory space.\r
1805\r
1806 @retval EFI_SUCCESS Successfully remove a segment of memory space.\r
1807\r
1808**/\r
1809EFI_STATUS\r
1810EFIAPI\r
1811CoreRemoveMemorySpace (\r
1812 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1813 IN UINT64 Length\r
1814 );\r
1815\r
1816\r
1817/**\r
1818 Retrieves the descriptor for a memory region containing a specified address.\r
1819\r
1820 @param BaseAddress Specified start address\r
1821 @param Descriptor Specified length\r
1822\r
1823 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1824 @retval EFI_SUCCESS Successfully get memory space descriptor.\r
1825\r
1826**/\r
1827EFI_STATUS\r
1828EFIAPI\r
1829CoreGetMemorySpaceDescriptor (\r
1830 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1831 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
1832 );\r
1833\r
1834\r
1835/**\r
1836 Modifies the attributes for a memory region in the global coherency domain of the\r
1837 processor.\r
1838\r
1839 @param BaseAddress Specified start address\r
1840 @param Length Specified length\r
1841 @param Attributes Specified attributes\r
1842\r
1843 @retval EFI_SUCCESS The attributes were set for the memory region.\r
1844 @retval EFI_INVALID_PARAMETER Length is zero. \r
1845 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory\r
1846 resource range specified by BaseAddress and Length.\r
1847 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource\r
1848 range specified by BaseAddress and Length.\r
1849 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by\r
1850 BaseAddress and Length cannot be modified.\r
1851 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of\r
1852 the memory resource range.\r
1853 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
1854 not available yet.\r
1855\r
1856**/\r
1857EFI_STATUS\r
1858EFIAPI\r
1859CoreSetMemorySpaceAttributes (\r
1860 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1861 IN UINT64 Length,\r
1862 IN UINT64 Attributes\r
1863 );\r
1864\r
1865\r
1866/**\r
1867 Modifies the capabilities for a memory region in the global coherency domain of the\r
1868 processor.\r
1869\r
1870 @param BaseAddress The physical address that is the start address of a memory region.\r
1871 @param Length The size in bytes of the memory region.\r
1872 @param Capabilities The bit mask of capabilities that the memory region supports.\r
1873\r
1874 @retval EFI_SUCCESS The capabilities were set for the memory region.\r
1875 @retval EFI_INVALID_PARAMETER Length is zero.\r
1876 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the\r
1877 memory region attributes currently in use.\r
1878 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by\r
1879 BaseAddress and Length cannot be modified.\r
1880 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities\r
1881 of the memory resource range.\r
1882**/\r
1883EFI_STATUS\r
1884EFIAPI\r
1885CoreSetMemorySpaceCapabilities (\r
1886 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1887 IN UINT64 Length,\r
1888 IN UINT64 Capabilities\r
1889 );\r
1890\r
1891\r
1892/**\r
1893 Returns a map of the memory resources in the global coherency domain of the\r
1894 processor.\r
1895\r
1896 @param NumberOfDescriptors Number of descriptors.\r
1897 @param MemorySpaceMap Descriptor array\r
1898\r
1899 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1900 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
1901 @retval EFI_SUCCESS Successfully get memory space map.\r
1902\r
1903**/\r
1904EFI_STATUS\r
1905EFIAPI\r
1906CoreGetMemorySpaceMap (\r
1907 OUT UINTN *NumberOfDescriptors,\r
1908 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
1909 );\r
1910\r
1911\r
1912/**\r
1913 Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
1914\r
1915 @param GcdIoType IO type of the segment.\r
1916 @param BaseAddress Base address of the segment.\r
1917 @param Length Length of the segment.\r
1918\r
1919 @retval EFI_SUCCESS Merged this segment into GCD map.\r
1920 @retval EFI_INVALID_PARAMETER Parameter not valid\r
1921\r
1922**/\r
1923EFI_STATUS\r
1924EFIAPI\r
1925CoreAddIoSpace (\r
1926 IN EFI_GCD_IO_TYPE GcdIoType,\r
1927 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1928 IN UINT64 Length\r
1929 );\r
1930\r
1931\r
1932/**\r
1933 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1934 domain of the processor.\r
1935\r
1936 @param GcdAllocateType The type of allocate operation\r
1937 @param GcdIoType The desired IO type\r
1938 @param Alignment Align with 2^Alignment\r
1939 @param Length Length to allocate\r
1940 @param BaseAddress Base address to allocate\r
1941 @param ImageHandle The image handle consume the allocated space.\r
1942 @param DeviceHandle The device handle consume the allocated space.\r
1943\r
1944 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1945 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
1946 @retval EFI_SUCCESS IO space successfully allocated.\r
1947\r
1948**/\r
1949EFI_STATUS\r
1950EFIAPI\r
1951CoreAllocateIoSpace (\r
1952 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1953 IN EFI_GCD_IO_TYPE GcdIoType,\r
1954 IN UINTN Alignment,\r
1955 IN UINT64 Length,\r
1956 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1957 IN EFI_HANDLE ImageHandle,\r
1958 IN EFI_HANDLE DeviceHandle OPTIONAL\r
1959 );\r
1960\r
1961\r
1962/**\r
1963 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1964 domain of the processor.\r
1965\r
1966 @param BaseAddress Base address of the segment.\r
1967 @param Length Length of the segment.\r
1968\r
1969 @retval EFI_SUCCESS Space successfully freed.\r
1970\r
1971**/\r
1972EFI_STATUS\r
1973EFIAPI\r
1974CoreFreeIoSpace (\r
1975 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1976 IN UINT64 Length\r
1977 );\r
1978\r
1979\r
1980/**\r
1981 Removes reserved I/O or I/O resources from the global coherency domain of the\r
1982 processor.\r
1983\r
1984 @param BaseAddress Base address of the segment.\r
1985 @param Length Length of the segment.\r
1986\r
1987 @retval EFI_SUCCESS Successfully removed a segment of IO space.\r
1988\r
1989**/\r
1990EFI_STATUS\r
1991EFIAPI\r
1992CoreRemoveIoSpace (\r
1993 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1994 IN UINT64 Length\r
1995 );\r
1996\r
1997\r
1998/**\r
1999 Retrieves the descriptor for an I/O region containing a specified address.\r
2000\r
2001 @param BaseAddress Specified start address\r
2002 @param Descriptor Specified length\r
2003\r
2004 @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r
2005 @retval EFI_SUCCESS Successfully get the IO space descriptor.\r
2006\r
2007**/\r
2008EFI_STATUS\r
2009EFIAPI\r
2010CoreGetIoSpaceDescriptor (\r
2011 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
2012 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
2013 );\r
2014\r
2015\r
2016/**\r
2017 Returns a map of the I/O resources in the global coherency domain of the processor.\r
2018\r
2019 @param NumberOfDescriptors Number of descriptors.\r
2020 @param IoSpaceMap Descriptor array\r
2021\r
2022 @retval EFI_INVALID_PARAMETER Invalid parameter\r
2023 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
2024 @retval EFI_SUCCESS Successfully get IO space map.\r
2025\r
2026**/\r
2027EFI_STATUS\r
2028EFIAPI\r
2029CoreGetIoSpaceMap (\r
2030 OUT UINTN *NumberOfDescriptors,\r
2031 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
2032 );\r
2033\r
2034\r
2035/**\r
2036 This is the main Dispatcher for DXE and it exits when there are no more\r
2037 drivers to run. Drain the mScheduledQueue and load and start a PE\r
2038 image for each driver. Search the mDiscoveredList to see if any driver can\r
2039 be placed on the mScheduledQueue. If no drivers are placed on the\r
2040 mScheduledQueue exit the function. On exit it is assumed the Bds()\r
2041 will be called, and when the Bds() exits the Dispatcher will be called\r
2042 again.\r
2043\r
2044 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running\r
2045 @retval EFI_NOT_FOUND No DXE Drivers were dispatched\r
2046 @retval EFI_SUCCESS One or more DXE Drivers were dispatched\r
2047\r
2048**/\r
2049EFI_STATUS\r
2050EFIAPI\r
2051CoreDispatcher (\r
2052 VOID\r
2053 );\r
2054\r
2055/**\r
2056 Check every driver and locate a matching one. If the driver is found, the Unrequested\r
2057 state flag is cleared.\r
2058\r
2059 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
2060 the firmware file specified by DriverName.\r
2061 @param DriverName The Driver name to put in the Dependent state.\r
2062\r
2063 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was\r
2064 cleared\r
2065 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was\r
2066 not set.\r
2067\r
2068**/\r
2069EFI_STATUS\r
2070EFIAPI\r
2071CoreSchedule (\r
2072 IN EFI_HANDLE FirmwareVolumeHandle,\r
2073 IN EFI_GUID *DriverName\r
2074 );\r
2075\r
2076\r
2077/**\r
2078 Convert a driver from the Untrused back to the Scheduled state.\r
2079\r
2080 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
2081 the firmware file specified by DriverName.\r
2082 @param DriverName The Driver name to put in the Scheduled state\r
2083\r
2084 @retval EFI_SUCCESS The file was found in the untrusted state, and it\r
2085 was promoted to the trusted state.\r
2086 @retval EFI_NOT_FOUND The file was not found in the untrusted state.\r
2087\r
2088**/\r
2089EFI_STATUS\r
2090EFIAPI\r
2091CoreTrust (\r
2092 IN EFI_HANDLE FirmwareVolumeHandle,\r
2093 IN EFI_GUID *DriverName\r
2094 );\r
2095\r
2096\r
2097/**\r
2098 This routine is the driver initialization entry point. It initializes the\r
2099 libraries, and registers two notification functions. These notification\r
2100 functions are responsible for building the FV stack dynamically.\r
2101\r
2102 @param ImageHandle The image handle.\r
2103 @param SystemTable The system table.\r
2104\r
2105 @retval EFI_SUCCESS Function successfully returned.\r
2106\r
2107**/\r
2108EFI_STATUS\r
2109EFIAPI\r
2110FwVolDriverInit (\r
2111 IN EFI_HANDLE ImageHandle,\r
2112 IN EFI_SYSTEM_TABLE *SystemTable\r
2113 );\r
2114\r
2115\r
2116/**\r
2117 Entry point of the section extraction code. Initializes an instance of the\r
2118 section extraction interface and installs it on a new handle.\r
2119\r
2120 @param ImageHandle A handle for the image that is initializing this driver\r
2121 @param SystemTable A pointer to the EFI system table\r
2122\r
2123 @retval EFI_SUCCESS Driver initialized successfully\r
2124 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
2125\r
2126**/\r
2127EFI_STATUS\r
2128EFIAPI\r
2129InitializeSectionExtraction (\r
2130 IN EFI_HANDLE ImageHandle,\r
2131 IN EFI_SYSTEM_TABLE *SystemTable\r
2132 );\r
2133\r
2134\r
2135/**\r
2136 This DXE service routine is used to process a firmware volume. In\r
2137 particular, it can be called by BDS to process a single firmware\r
2138 volume found in a capsule.\r
2139\r
2140 @param FvHeader pointer to a firmware volume header\r
2141 @param Size the size of the buffer pointed to by FvHeader\r
2142 @param FVProtocolHandle the handle on which a firmware volume protocol\r
2143 was produced for the firmware volume passed in.\r
2144\r
2145 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of\r
2146 system resources\r
2147 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted\r
2148 @retval EFI_SUCCESS a firmware volume protocol was produced for the\r
2149 firmware volume\r
2150\r
2151**/\r
2152EFI_STATUS\r
2153EFIAPI\r
2154CoreProcessFirmwareVolume (\r
2155 IN VOID *FvHeader,\r
2156 IN UINTN Size,\r
2157 OUT EFI_HANDLE *FVProtocolHandle\r
2158 );\r
2159\r
2160//\r
2161//Functions used during debug buils\r
2162//\r
2163\r
2164/**\r
2165 Displays Architectural protocols that were not loaded and are required for DXE\r
2166 core to function. Only used in Debug Builds.\r
2167\r
2168**/\r
2169VOID\r
2170CoreDisplayMissingArchProtocols (\r
2171 VOID\r
2172 );\r
2173\r
2174\r
2175/**\r
2176 Traverse the discovered list for any drivers that were discovered but not loaded\r
2177 because the dependency experessions evaluated to false.\r
2178\r
2179**/\r
2180VOID\r
2181CoreDisplayDiscoveredNotDispatched (\r
2182 VOID\r
2183 );\r
2184\r
2185\r
2186/**\r
2187 Place holder function until all the Boot Services and Runtime Services are\r
2188 available.\r
2189\r
2190 @return EFI_NOT_AVAILABLE_YET\r
2191\r
2192**/\r
2193EFI_STATUS\r
2194EFIAPI\r
2195CoreEfiNotAvailableYetArg0 (\r
2196 VOID\r
2197 );\r
2198\r
2199\r
2200/**\r
2201 Place holder function until all the Boot Services and Runtime Services are\r
2202 available.\r
2203\r
2204 @param Arg1 Undefined\r
2205\r
2206 @return EFI_NOT_AVAILABLE_YET\r
2207\r
2208**/\r
2209EFI_STATUS\r
2210EFIAPI\r
2211CoreEfiNotAvailableYetArg1 (\r
2212 UINTN Arg1\r
2213 );\r
2214\r
2215\r
2216/**\r
2217 Place holder function until all the Boot Services and Runtime Services are available.\r
2218\r
2219 @param Arg1 Undefined\r
2220 @param Arg2 Undefined\r
2221\r
2222 @return EFI_NOT_AVAILABLE_YET\r
2223\r
2224**/\r
2225EFI_STATUS\r
2226EFIAPI\r
2227CoreEfiNotAvailableYetArg2 (\r
2228 UINTN Arg1,\r
2229 UINTN Arg2\r
2230 );\r
2231\r
2232\r
2233/**\r
2234 Place holder function until all the Boot Services and Runtime Services are available.\r
2235\r
2236 @param Arg1 Undefined\r
2237 @param Arg2 Undefined\r
2238 @param Arg3 Undefined\r
2239\r
2240 @return EFI_NOT_AVAILABLE_YET\r
2241\r
2242**/\r
2243EFI_STATUS\r
2244EFIAPI\r
2245CoreEfiNotAvailableYetArg3 (\r
2246 UINTN Arg1,\r
2247 UINTN Arg2,\r
2248 UINTN Arg3\r
2249 );\r
2250\r
2251\r
2252/**\r
2253 Place holder function until all the Boot Services and Runtime Services are available.\r
2254\r
2255 @param Arg1 Undefined\r
2256 @param Arg2 Undefined\r
2257 @param Arg3 Undefined\r
2258 @param Arg4 Undefined\r
2259\r
2260 @return EFI_NOT_AVAILABLE_YET\r
2261\r
2262**/\r
2263EFI_STATUS\r
2264EFIAPI\r
2265CoreEfiNotAvailableYetArg4 (\r
2266 UINTN Arg1,\r
2267 UINTN Arg2,\r
2268 UINTN Arg3,\r
2269 UINTN Arg4\r
2270 );\r
2271\r
2272\r
2273/**\r
2274 Place holder function until all the Boot Services and Runtime Services are available.\r
2275\r
2276 @param Arg1 Undefined\r
2277 @param Arg2 Undefined\r
2278 @param Arg3 Undefined\r
2279 @param Arg4 Undefined\r
2280 @param Arg5 Undefined\r
2281\r
2282 @return EFI_NOT_AVAILABLE_YET\r
2283\r
2284**/\r
2285EFI_STATUS\r
2286EFIAPI\r
2287CoreEfiNotAvailableYetArg5 (\r
2288 UINTN Arg1,\r
2289 UINTN Arg2,\r
2290 UINTN Arg3,\r
2291 UINTN Arg4,\r
2292 UINTN Arg5\r
2293 );\r
2294\r
2295\r
2296/**\r
2297 Given a compressed source buffer, this function retrieves the size of the\r
2298 uncompressed buffer and the size of the scratch buffer required to decompress\r
2299 the compressed source buffer.\r
2300\r
2301 The GetInfo() function retrieves the size of the uncompressed buffer and the\r
2302 temporary scratch buffer required to decompress the buffer specified by Source\r
2303 and SourceSize. If the size of the uncompressed buffer or the size of the\r
2304 scratch buffer cannot be determined from the compressed data specified by\r
2305 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the\r
2306 size of the uncompressed buffer is returned in DestinationSize, the size of\r
2307 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.\r
2308 The GetInfo() function does not have scratch buffer available to perform a\r
2309 thorough checking of the validity of the source data. It just retrieves the\r
2310 "Original Size" field from the beginning bytes of the source data and output\r
2311 it as DestinationSize. And ScratchSize is specific to the decompression\r
2312 implementation.\r
2313\r
2314 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2315 @param Source The source buffer containing the compressed data.\r
2316 @param SourceSize The size, in bytes, of the source buffer.\r
2317 @param DestinationSize A pointer to the size, in bytes, of the\r
2318 uncompressed buffer that will be generated when the\r
2319 compressed buffer specified by Source and\r
2320 SourceSize is decompressed.\r
2321 @param ScratchSize A pointer to the size, in bytes, of the scratch\r
2322 buffer that is required to decompress the\r
2323 compressed buffer specified by Source and\r
2324 SourceSize.\r
2325\r
2326 @retval EFI_SUCCESS The size of the uncompressed data was returned in\r
2327 DestinationSize and the size of the scratch buffer\r
2328 was returned in ScratchSize.\r
2329 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of\r
2330 the scratch buffer cannot be determined from the\r
2331 compressed data specified by Source and\r
2332 SourceSize.\r
2333\r
2334**/\r
2335EFI_STATUS\r
2336EFIAPI\r
2337DxeMainUefiDecompressGetInfo (\r
2338 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2339 IN VOID *Source,\r
2340 IN UINT32 SourceSize,\r
2341 OUT UINT32 *DestinationSize,\r
2342 OUT UINT32 *ScratchSize\r
2343 );\r
2344\r
2345\r
2346/**\r
2347 Decompresses a compressed source buffer.\r
2348\r
2349 The Decompress() function extracts decompressed data to its original form.\r
2350 This protocol is designed so that the decompression algorithm can be\r
2351 implemented without using any memory services. As a result, the Decompress()\r
2352 Function is not allowed to call AllocatePool() or AllocatePages() in its\r
2353 implementation. It is the caller's responsibility to allocate and free the\r
2354 Destination and Scratch buffers.\r
2355 If the compressed source data specified by Source and SourceSize is\r
2356 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If\r
2357 the compressed source data specified by Source and SourceSize is not in a\r
2358 valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
2359\r
2360 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2361 @param Source The source buffer containing the compressed data.\r
2362 @param SourceSize SourceSizeThe size of source data.\r
2363 @param Destination On output, the destination buffer that contains\r
2364 the uncompressed data.\r
2365 @param DestinationSize The size of the destination buffer. The size of\r
2366 the destination buffer needed is obtained from\r
2367 EFI_DECOMPRESS_PROTOCOL.GetInfo().\r
2368 @param Scratch A temporary scratch buffer that is used to perform\r
2369 the decompression.\r
2370 @param ScratchSize The size of scratch buffer. The size of the\r
2371 scratch buffer needed is obtained from GetInfo().\r
2372\r
2373 @retval EFI_SUCCESS Decompression completed successfully, and the\r
2374 uncompressed buffer is returned in Destination.\r
2375 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and\r
2376 SourceSize is corrupted (not in a valid\r
2377 compressed format).\r
2378\r
2379**/\r
2380EFI_STATUS\r
2381EFIAPI\r
2382DxeMainUefiDecompress (\r
2383 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2384 IN VOID *Source,\r
2385 IN UINT32 SourceSize,\r
2386 IN OUT VOID *Destination,\r
2387 IN UINT32 DestinationSize,\r
2388 IN OUT VOID *Scratch,\r
2389 IN UINT32 ScratchSize\r
2390 );\r
2391\r
2392/**\r
2393 SEP member function. This function creates and returns a new section stream\r
2394 handle to represent the new section stream.\r
2395\r
2396 @param SectionStreamLength Size in bytes of the section stream.\r
2397 @param SectionStream Buffer containing the new section stream.\r
2398 @param SectionStreamHandle A pointer to a caller allocated UINTN that on\r
2399 output contains the new section stream handle.\r
2400\r
2401 @retval EFI_SUCCESS The section stream is created successfully.\r
2402 @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r
2403 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
2404 of last section.\r
2405\r
2406**/\r
2407EFI_STATUS\r
2408EFIAPI\r
2409OpenSectionStream (\r
2410 IN UINTN SectionStreamLength,\r
2411 IN VOID *SectionStream,\r
2412 OUT UINTN *SectionStreamHandle\r
2413 );\r
2414\r
2415\r
2416\r
2417/**\r
2418 SEP member function. Retrieves requested section from section stream.\r
2419\r
2420 @param SectionStreamHandle The section stream from which to extract the\r
2421 requested section.\r
2422 @param SectionType A pointer to the type of section to search for.\r
2423 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,\r
2424 then SectionDefinitionGuid indicates which of\r
2425 these types of sections to search for.\r
2426 @param SectionInstance Indicates which instance of the requested\r
2427 section to return.\r
2428 @param Buffer Double indirection to buffer. If *Buffer is\r
2429 non-null on input, then the buffer is caller\r
2430 allocated. If Buffer is NULL, then the buffer\r
2431 is callee allocated. In either case, the\r
2432 required buffer size is returned in *BufferSize.\r
2433 @param BufferSize On input, indicates the size of *Buffer if\r
2434 *Buffer is non-null on input. On output,\r
2435 indicates the required size (allocated size if\r
2436 callee allocated) of *Buffer.\r
2437 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
2438 indicates the authentication status of the\r
2439 output buffer. If the input section's\r
2440 GuidedSectionHeader.Attributes field\r
2441 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
2442 bit as clear, AuthenticationStatus must return\r
2443 zero. Both local bits (19:16) and aggregate\r
2444 bits (3:0) in AuthenticationStatus are returned\r
2445 by ExtractSection(). These bits reflect the\r
2446 status of the extraction operation. The bit\r
2447 pattern in both regions must be the same, as\r
2448 the local and aggregate authentication statuses\r
2449 have equivalent meaning at this level. If the\r
2450 function returns anything other than\r
2451 EFI_SUCCESS, the value of *AuthenticationStatus\r
2452 is undefined.\r
2453 @param IsFfs3Fv Indicates the FV format.\r
2454\r
2455 @retval EFI_SUCCESS Section was retrieved successfully\r
2456 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r
2457 section stream with its\r
2458 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r
2459 but there was no corresponding GUIDed Section\r
2460 Extraction Protocol in the handle database.\r
2461 *Buffer is unmodified.\r
2462 @retval EFI_NOT_FOUND An error was encountered when parsing the\r
2463 SectionStream. This indicates the SectionStream\r
2464 is not correctly formatted.\r
2465 @retval EFI_NOT_FOUND The requested section does not exist.\r
2466 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process\r
2467 the request.\r
2468 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
2469 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is\r
2470 insufficient to contain the requested section.\r
2471 The input buffer is filled and section contents\r
2472 are truncated.\r
2473\r
2474**/\r
2475EFI_STATUS\r
2476EFIAPI\r
2477GetSection (\r
2478 IN UINTN SectionStreamHandle,\r
2479 IN EFI_SECTION_TYPE *SectionType,\r
2480 IN EFI_GUID *SectionDefinitionGuid,\r
2481 IN UINTN SectionInstance,\r
2482 IN VOID **Buffer,\r
2483 IN OUT UINTN *BufferSize,\r
2484 OUT UINT32 *AuthenticationStatus,\r
2485 IN BOOLEAN IsFfs3Fv\r
2486 );\r
2487\r
2488\r
2489/**\r
2490 SEP member function. Deletes an existing section stream\r
2491\r
2492 @param StreamHandleToClose Indicates the stream to close\r
2493 @param FreeStreamBuffer TRUE - Need to free stream buffer;\r
2494 FALSE - No need to free stream buffer.\r
2495\r
2496 @retval EFI_SUCCESS The section stream is closed sucessfully.\r
2497 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
2498 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
2499 of last section.\r
2500\r
2501**/\r
2502EFI_STATUS\r
2503EFIAPI\r
2504CloseSectionStream (\r
2505 IN UINTN StreamHandleToClose,\r
2506 IN BOOLEAN FreeStreamBuffer\r
2507 );\r
2508\r
2509/**\r
2510 Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
2511 table and registers it into the system table.\r
2512\r
2513 Note:\r
2514 This function allocates memory, frees it, and then allocates memory at an\r
2515 address within the initial allocation. Since this function is called early\r
2516 in DXE core initialization (before drivers are dispatched), this should not\r
2517 be a problem.\r
2518\r
2519**/\r
2520VOID\r
2521CoreInitializeDebugImageInfoTable (\r
2522 VOID\r
2523 );\r
2524\r
2525\r
2526/**\r
2527 Update the CRC32 in the Debug Table.\r
2528 Since the CRC32 service is made available by the Runtime driver, we have to\r
2529 wait for the Runtime Driver to be installed before the CRC32 can be computed.\r
2530 This function is called elsewhere by the core when the runtime architectural\r
2531 protocol is produced.\r
2532\r
2533**/\r
2534VOID\r
2535CoreUpdateDebugTableCrc32 (\r
2536 VOID\r
2537 );\r
2538\r
2539\r
2540/**\r
2541 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r
2542 the table if it's not large enough to accomidate another entry.\r
2543\r
2544 @param ImageInfoType type of debug image information\r
2545 @param LoadedImage pointer to the loaded image protocol for the image being\r
2546 loaded\r
2547 @param ImageHandle image handle for the image being loaded\r
2548\r
2549**/\r
2550VOID\r
2551CoreNewDebugImageInfoEntry (\r
2552 IN UINT32 ImageInfoType,\r
2553 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2554 IN EFI_HANDLE ImageHandle\r
2555 );\r
2556\r
2557\r
2558/**\r
2559 Removes and frees an entry from the DebugImageInfo Table.\r
2560\r
2561 @param ImageHandle image handle for the image being unloaded\r
2562\r
2563**/\r
2564VOID\r
2565CoreRemoveDebugImageInfoEntry (\r
2566 EFI_HANDLE ImageHandle\r
2567 );\r
2568\r
2569\r
2570/**\r
2571 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
2572\r
2573 @param ImageHandle The image handle.\r
2574 @param SystemTable The system table.\r
2575\r
2576 @retval EFI_SUCCESS Successfully initialized firmware volume block\r
2577 driver.\r
2578\r
2579**/\r
2580EFI_STATUS\r
2581EFIAPI\r
2582FwVolBlockDriverInit (\r
2583 IN EFI_HANDLE ImageHandle,\r
2584 IN EFI_SYSTEM_TABLE *SystemTable\r
2585 );\r
2586\r
2587/**\r
2588\r
2589 Get FVB authentication status\r
2590\r
2591 @param FvbProtocol FVB protocol.\r
2592\r
2593 @return Authentication status.\r
2594\r
2595**/\r
2596UINT32\r
2597GetFvbAuthenticationStatus (\r
2598 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol\r
2599 );\r
2600\r
2601/**\r
2602 This routine produces a firmware volume block protocol on a given\r
2603 buffer.\r
2604\r
2605 @param BaseAddress base address of the firmware volume image\r
2606 @param Length length of the firmware volume image\r
2607 @param ParentHandle handle of parent firmware volume, if this image\r
2608 came from an FV image file and section in another firmware\r
2609 volume (ala capsules)\r
2610 @param AuthenticationStatus Authentication status inherited, if this image\r
2611 came from an FV image file and section in another firmware volume.\r
2612 @param FvProtocol Firmware volume block protocol produced.\r
2613\r
2614 @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
2615 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r
2616 @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r
2617 buffer.\r
2618\r
2619**/\r
2620EFI_STATUS\r
2621ProduceFVBProtocolOnBuffer (\r
2622 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
2623 IN UINT64 Length,\r
2624 IN EFI_HANDLE ParentHandle,\r
2625 IN UINT32 AuthenticationStatus,\r
2626 OUT EFI_HANDLE *FvProtocol OPTIONAL\r
2627 );\r
2628\r
2629\r
2630/**\r
2631 Raising to the task priority level of the mutual exclusion\r
2632 lock, and then acquires ownership of the lock.\r
2633\r
2634 @param Lock The lock to acquire\r
2635\r
2636 @return Lock owned\r
2637\r
2638**/\r
2639VOID\r
2640CoreAcquireLock (\r
2641 IN EFI_LOCK *Lock\r
2642 );\r
2643\r
2644\r
2645/**\r
2646 Initialize a basic mutual exclusion lock. Each lock\r
2647 provides mutual exclusion access at it's task priority\r
2648 level. Since there is no-premption (at any TPL) or\r
2649 multiprocessor support, acquiring the lock only consists\r
2650 of raising to the locks TPL.\r
2651\r
2652 @param Lock The EFI_LOCK structure to initialize\r
2653\r
2654 @retval EFI_SUCCESS Lock Owned.\r
2655 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r
2656\r
2657**/\r
2658EFI_STATUS\r
2659CoreAcquireLockOrFail (\r
2660 IN EFI_LOCK *Lock\r
2661 );\r
2662\r
2663\r
2664/**\r
2665 Releases ownership of the mutual exclusion lock, and\r
2666 restores the previous task priority level.\r
2667\r
2668 @param Lock The lock to release\r
2669\r
2670 @return Lock unowned\r
2671\r
2672**/\r
2673VOID\r
2674CoreReleaseLock (\r
2675 IN EFI_LOCK *Lock\r
2676 );\r
2677\r
2678/**\r
2679 Read data from Firmware Block by FVB protocol Read. \r
2680 The data may cross the multi block ranges.\r
2681\r
2682 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r
2683 @param StartLba Pointer to StartLba.\r
2684 On input, the start logical block index from which to read.\r
2685 On output,the end logical block index after reading.\r
2686 @param Offset Pointer to Offset\r
2687 On input, offset into the block at which to begin reading.\r
2688 On output, offset into the end block after reading.\r
2689 @param DataSize Size of data to be read.\r
2690 @param Data Pointer to Buffer that the data will be read into.\r
2691\r
2692 @retval EFI_SUCCESS Successfully read data from firmware block.\r
2693 @retval others\r
2694**/\r
2695EFI_STATUS\r
2696ReadFvbData (\r
2697 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2698 IN OUT EFI_LBA *StartLba,\r
2699 IN OUT UINTN *Offset,\r
2700 IN UINTN DataSize,\r
2701 OUT UINT8 *Data\r
2702 );\r
2703\r
2704/**\r
2705 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
2706 copy the real length volume header into it.\r
2707\r
2708 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to\r
2709 read the volume header\r
2710 @param FwVolHeader Pointer to pointer to allocated buffer in which\r
2711 the volume header is returned.\r
2712\r
2713 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.\r
2714 @retval EFI_SUCCESS Successfully read volume header to the allocated\r
2715 buffer.\r
2716 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or\r
2717 the file system could not be understood.\r
2718\r
2719**/\r
2720EFI_STATUS\r
2721GetFwVolHeader (\r
2722 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2723 OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
2724 );\r
2725\r
2726/**\r
2727 Verify checksum of the firmware volume header.\r
2728\r
2729 @param FvHeader Points to the firmware volume header to be checked\r
2730\r
2731 @retval TRUE Checksum verification passed\r
2732 @retval FALSE Checksum verification failed\r
2733\r
2734**/\r
2735BOOLEAN\r
2736VerifyFvHeaderChecksum (\r
2737 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
2738 );\r
2739\r
2740/**\r
2741 Initialize memory profile.\r
2742\r
2743 @param HobStart The start address of the HOB.\r
2744\r
2745**/\r
2746VOID\r
2747MemoryProfileInit (\r
2748 IN VOID *HobStart\r
2749 );\r
2750\r
2751/**\r
2752 Install memory profile protocol.\r
2753\r
2754**/\r
2755VOID\r
2756MemoryProfileInstallProtocol (\r
2757 VOID\r
2758 );\r
2759\r
2760/**\r
2761 Register image to memory profile.\r
2762\r
2763 @param DriverEntry Image info.\r
2764 @param FileType Image file type.\r
2765\r
2766 @return EFI_SUCCESS Register successfully.\r
2767 @return EFI_UNSUPPORTED Memory profile unsupported,\r
2768 or memory profile for the image is not required.\r
2769 @return EFI_OUT_OF_RESOURCES No enough resource for this register.\r
2770\r
2771**/\r
2772EFI_STATUS\r
2773RegisterMemoryProfileImage (\r
2774 IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry,\r
2775 IN EFI_FV_FILETYPE FileType\r
2776 );\r
2777\r
2778/**\r
2779 Unregister image from memory profile.\r
2780\r
2781 @param DriverEntry Image info.\r
2782\r
2783 @return EFI_SUCCESS Unregister successfully.\r
2784 @return EFI_UNSUPPORTED Memory profile unsupported,\r
2785 or memory profile for the image is not required.\r
2786 @return EFI_NOT_FOUND The image is not found.\r
2787\r
2788**/\r
2789EFI_STATUS\r
2790UnregisterMemoryProfileImage (\r
2791 IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry\r
2792 );\r
2793\r
2794/**\r
2795 Update memory profile information.\r
2796\r
2797 @param CallerAddress Address of caller who call Allocate or Free.\r
2798 @param Action This Allocate or Free action.\r
2799 @param MemoryType Memory type.\r
2800 EfiMaxMemoryType means the MemoryType is unknown.\r
2801 @param Size Buffer size.\r
2802 @param Buffer Buffer address.\r
2803 @param ActionString String for memory profile action.\r
2804 Only needed for user defined allocate action.\r
2805\r
2806 @return EFI_SUCCESS Memory profile is updated.\r
2807 @return EFI_UNSUPPORTED Memory profile is unsupported,\r
2808 or memory profile for the image is not required,\r
2809 or memory profile for the memory type is not required.\r
2810 @return EFI_ACCESS_DENIED It is during memory profile data getting.\r
2811 @return EFI_ABORTED Memory profile recording is not enabled.\r
2812 @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.\r
2813 @return EFI_NOT_FOUND No matched allocate info found for free action.\r
2814\r
2815**/\r
2816EFI_STATUS\r
2817EFIAPI\r
2818CoreUpdateProfile (\r
2819 IN EFI_PHYSICAL_ADDRESS CallerAddress,\r
2820 IN MEMORY_PROFILE_ACTION Action,\r
2821 IN EFI_MEMORY_TYPE MemoryType,\r
2822 IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool\r
2823 IN VOID *Buffer,\r
2824 IN CHAR8 *ActionString OPTIONAL\r
2825 );\r
2826\r
2827/**\r
2828 Internal function. Converts a memory range to use new attributes.\r
2829\r
2830 @param Start The first address of the range Must be page\r
2831 aligned\r
2832 @param NumberOfPages The number of pages to convert\r
2833 @param NewAttributes The new attributes value for the range.\r
2834\r
2835**/\r
2836VOID\r
2837CoreUpdateMemoryAttributes (\r
2838 IN EFI_PHYSICAL_ADDRESS Start,\r
2839 IN UINT64 NumberOfPages,\r
2840 IN UINT64 NewAttributes\r
2841 );\r
2842\r
2843/**\r
2844 Initialize PropertiesTable support.\r
2845**/\r
2846VOID\r
2847EFIAPI\r
2848CoreInitializePropertiesTable (\r
2849 VOID\r
2850 );\r
2851\r
2852/**\r
2853 Initialize MemoryAttrubutesTable support.\r
2854**/\r
2855VOID\r
2856EFIAPI\r
2857CoreInitializeMemoryAttributesTable (\r
2858 VOID\r
2859 );\r
2860\r
2861/**\r
2862 Install MemoryAttributesTable on memory allocation.\r
2863\r
2864 @param[in] MemoryType EFI memory type.\r
2865**/\r
2866VOID\r
2867InstallMemoryAttributesTableOnMemoryAllocation (\r
2868 IN EFI_MEMORY_TYPE MemoryType\r
2869 );\r
2870\r
2871/**\r
2872 Insert image record.\r
2873\r
2874 @param RuntimeImage Runtime image information\r
2875**/\r
2876VOID\r
2877InsertImageRecord (\r
2878 IN EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage\r
2879 );\r
2880\r
2881/**\r
2882 Remove Image record.\r
2883\r
2884 @param RuntimeImage Runtime image information\r
2885**/\r
2886VOID\r
2887RemoveImageRecord (\r
2888 IN EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage\r
2889 );\r
2890\r
2891#endif\r