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