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