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