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