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