2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include <Protocol/LoadedImage.h>
24 #include <Protocol/GuidedSectionExtraction.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/Runtime.h>
27 #include <Protocol/LoadFile.h>
28 #include <Protocol/LoadFile2.h>
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/VariableWrite.h>
31 #include <Protocol/PlatformDriverOverride.h>
32 #include <Protocol/Variable.h>
33 #include <Protocol/Timer.h>
34 #include <Protocol/SimpleFileSystem.h>
35 #include <Protocol/Bds.h>
36 #include <Protocol/RealTimeClock.h>
37 #include <Protocol/WatchdogTimer.h>
38 #include <Protocol/FirmwareVolume2.h>
39 #include <Protocol/MonotonicCounter.h>
40 #include <Protocol/StatusCode.h>
41 #include <Protocol/Decompress.h>
42 #include <Protocol/LoadPe32Image.h>
43 #include <Protocol/Security.h>
44 #include <Protocol/Ebc.h>
45 #include <Protocol/Reset.h>
46 #include <Protocol/Cpu.h>
47 #include <Protocol/Metronome.h>
48 #include <Protocol/FirmwareVolumeBlock.h>
49 #include <Protocol/Capsule.h>
50 #include <Protocol/BusSpecificDriverOverride.h>
51 #include <Protocol/DriverFamilyOverride.h>
52 #include <Protocol/TcgService.h>
53 #include <Protocol/HiiPackageList.h>
54 #include <Protocol/SmmBase2.h>
55 #include <Guid/MemoryTypeInformation.h>
56 #include <Guid/FirmwareFileSystem2.h>
57 #include <Guid/FirmwareFileSystem3.h>
58 #include <Guid/HobList.h>
59 #include <Guid/DebugImageInfoTable.h>
60 #include <Guid/FileInfo.h>
61 #include <Guid/Apriori.h>
62 #include <Guid/DxeServices.h>
63 #include <Guid/MemoryAllocationHob.h>
64 #include <Guid/EventLegacyBios.h>
65 #include <Guid/EventGroup.h>
66 #include <Guid/LoadModuleAtFixedAddress.h>
67 #include <Guid/IdleLoopEvent.h>
69 #include <Library/DxeCoreEntryPoint.h>
70 #include <Library/DebugLib.h>
71 #include <Library/UefiLib.h>
72 #include <Library/BaseLib.h>
73 #include <Library/HobLib.h>
74 #include <Library/PerformanceLib.h>
75 #include <Library/UefiDecompressLib.h>
76 #include <Library/ExtractGuidedSectionLib.h>
77 #include <Library/CacheMaintenanceLib.h>
78 #include <Library/BaseMemoryLib.h>
79 #include <Library/PeCoffLib.h>
80 #include <Library/PeCoffGetEntryPointLib.h>
81 #include <Library/PeCoffExtraActionLib.h>
82 #include <Library/PcdLib.h>
83 #include <Library/MemoryAllocationLib.h>
84 #include <Library/DevicePathLib.h>
85 #include <Library/UefiBootServicesTableLib.h>
86 #include <Library/ReportStatusCodeLib.h>
87 #include <Library/TimerLib.h>
88 #include <Library/DxeServicesLib.h>
89 #include <Library/DebugAgentLib.h>
93 // attributes for reserved memory before it is promoted to system memory
95 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
96 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
97 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
100 // range for memory mapped port I/O on IPF
102 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
106 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
107 /// to save time. A EFI_DEP_PUSH is evauated one an
108 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
109 /// Driver Execution Environment Core Interface use 0xff
110 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
111 /// defined to a new value that is not conflicting with PI spec.
113 #define EFI_DEP_REPLACE_TRUE 0xff
116 /// Define the initial size of the dependency expression evaluation stack
118 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
121 EFI_GUID
*ProtocolGuid
;
126 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
129 // DXE Dispatcher Data structures
132 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
135 LIST_ENTRY Link
; // mFvHandleList
140 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
143 LIST_ENTRY Link
; // mDriverList
145 LIST_ENTRY ScheduledLink
; // mScheduledQueue
149 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
150 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
157 EFI_GUID BeforeAfterGuid
;
164 BOOLEAN DepexProtocolError
;
166 EFI_HANDLE ImageHandle
;
169 } EFI_CORE_DRIVER_ENTRY
;
172 //The data structure of GCD memory map entry
174 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
178 EFI_PHYSICAL_ADDRESS BaseAddress
;
182 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
183 EFI_GCD_IO_TYPE GcdIoType
;
184 EFI_HANDLE ImageHandle
;
185 EFI_HANDLE DeviceHandle
;
189 // DXE Core Global Variables
191 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
192 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
193 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
194 extern EFI_HANDLE gDxeCoreImageHandle
;
196 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
198 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
199 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
200 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
201 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
202 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
203 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
204 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
205 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
207 extern EFI_TPL gEfiCurrentTpl
;
209 extern EFI_GUID
*gDxeCoreFileName
;
210 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
212 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
214 extern BOOLEAN gDispatcherRunning
;
215 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
217 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
218 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
220 // Service Initialization Functions
226 Called to initialize the pool.
236 Called to initialize the memory map and add descriptors to
237 the current descriptor list.
238 The first descriptor that is added must be general usable
239 memory as the addition allocates heap.
241 @param Type The type of memory to add
242 @param Start The starting address in the memory range Must be
244 @param NumberOfPages The number of pages in the range
245 @param Attribute Attributes of the memory to add
247 @return None. The range is added to the memory map
251 CoreAddMemoryDescriptor (
252 IN EFI_MEMORY_TYPE Type
,
253 IN EFI_PHYSICAL_ADDRESS Start
,
254 IN UINT64 NumberOfPages
,
260 Release memory lock on mGcdMemorySpaceLock.
264 CoreReleaseGcdMemoryLock (
270 Acquire memory lock on mGcdMemorySpaceLock.
274 CoreAcquireGcdMemoryLock (
280 External function. Initializes memory services based on the memory
281 descriptor HOBs. This function is responsible for priming the memory
282 map, so memory allocations and resource allocations can be made.
283 The first part of this function can not depend on any memory services
284 until at least one memory descriptor is provided to the memory services.
286 @param HobStart The start address of the HOB.
287 @param MemoryBaseAddress Start address of memory region found to init DXE
289 @param MemoryLength Length of memory region found to init DXE core.
291 @retval EFI_SUCCESS Memory services successfully initialized.
295 CoreInitializeMemoryServices (
297 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
298 OUT UINT64
*MemoryLength
304 External function. Initializes the GCD and memory services based on the memory
305 descriptor HOBs. This function is responsible for priming the GCD map and the
306 memory map, so memory allocations and resource allocations can be made. The
307 HobStart will be relocated to a pool buffer.
309 @param HobStart The start address of the HOB
310 @param MemoryBaseAddress Start address of memory region found to init DXE
312 @param MemoryLength Length of memory region found to init DXE core.
314 @retval EFI_SUCCESS GCD services successfully initialized.
318 CoreInitializeGcdServices (
319 IN OUT VOID
**HobStart
,
320 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
321 IN UINT64 MemoryLength
326 Initializes "event" support.
328 @retval EFI_SUCCESS Always return success
332 CoreInitializeEventServices (
338 Add the Image Services to EFI Boot Services Table and install the protocol
339 interfaces for this image.
341 @param HobStart The HOB to initialize
347 CoreInitializeImageServices (
353 Creates an event that is fired everytime a Protocol of a specific type is installed.
357 CoreNotifyOnProtocolInstallation (
363 Return TRUE if all AP services are availible.
365 @retval EFI_SUCCESS All AP services are available
366 @retval EFI_NOT_FOUND At least one AP service is not available
370 CoreAllEfiServicesAvailable (
376 Calcualte the 32-bit CRC in a EFI table using the service provided by the
379 @param Hdr Pointer to an EFI standard header
384 IN OUT EFI_TABLE_HEADER
*Hdr
389 Called by the platform code to process a tick.
391 @param Duration The number of 100ns elasped since the last call
403 Initialize the dispatcher. Initialize the notification function that runs when
404 an FV2 protocol is added to the system.
408 CoreInitializeDispatcher (
414 This is the POSTFIX version of the dependency evaluator. This code does
415 not need to handle Before or After, as it is not valid to call this
416 routine in this case. The SOR is just ignored and is a nop in the grammer.
417 POSTFIX means all the math is done on top of the stack.
419 @param DriverEntry DriverEntry element to update.
421 @retval TRUE If driver is ready to run.
422 @retval FALSE If driver is not ready to run or some fatal error
428 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
433 Preprocess dependency expression and update DriverEntry to reflect the
434 state of Before, After, and SOR dependencies. If DriverEntry->Before
435 or DriverEntry->After is set it will never be cleared. If SOR is set
436 it will be cleared by CoreSchedule(), and then the driver can be
439 @param DriverEntry DriverEntry element to update .
441 @retval EFI_SUCCESS It always works.
445 CorePreProcessDepex (
446 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
452 Terminates all boot services.
454 @param ImageHandle Handle that identifies the exiting image.
455 @param MapKey Key to the latest memory map.
457 @retval EFI_SUCCESS Boot Services terminated
458 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
463 CoreExitBootServices (
464 IN EFI_HANDLE ImageHandle
,
470 Make sure the memory map is following all the construction rules,
471 it is the last time to check memory map error before exit boot services.
473 @param MapKey Memory map key
475 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
477 @retval EFI_SUCCESS Valid memory map.
481 CoreTerminateMemoryMap (
487 Signals all events in the EventGroup.
489 @param EventGroup The list to signal
493 CoreNotifySignalList (
494 IN EFI_GUID
*EventGroup
500 Boot Service called to add, modify, or remove a system configuration table from
501 the EFI System Table.
503 @param Guid Pointer to the GUID for the entry to add, update, or
505 @param Table Pointer to the configuration table for the entry to add,
506 update, or remove, may be NULL.
508 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
509 @return EFI_INVALID_PARAMETER Input GUID not valid.
510 @return EFI_NOT_FOUND Attempted to delete non-existant entry
511 @return EFI_OUT_OF_RESOURCES Not enough memory available
516 CoreInstallConfigurationTable (
524 Raise the task priority level to the new level.
525 High level is implemented by disabling processor interrupts.
527 @param NewTpl New task priority level
529 @return The previous task priority level
541 Lowers the task priority to the previous value. If the new
542 priority unmasks events at a higher priority, they are dispatched.
544 @param NewTpl New, lower, task priority
556 Introduces a fine-grained stall.
558 @param Microseconds The number of microseconds to stall execution.
560 @retval EFI_SUCCESS Execution was stalled for at least the requested
561 amount of microseconds.
562 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
568 IN UINTN Microseconds
574 Sets the system's watchdog timer.
576 @param Timeout The number of seconds to set the watchdog timer to.
577 A value of zero disables the timer.
578 @param WatchdogCode The numeric code to log on a watchdog timer timeout
579 event. The firmware reserves codes 0x0000 to 0xFFFF.
580 Loaders and operating systems may use other timeout
582 @param DataSize The size, in bytes, of WatchdogData.
583 @param WatchdogData A data buffer that includes a Null-terminated Unicode
584 string, optionally followed by additional binary data.
585 The string is a description that the call may use to
586 further indicate the reason to be logged with a
589 @return EFI_SUCCESS Timeout has been set
590 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
591 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
592 @return EFI_DEVICE_ERROR Could not complete due to hardware error
597 CoreSetWatchdogTimer (
599 IN UINT64 WatchdogCode
,
601 IN CHAR16
*WatchdogData OPTIONAL
607 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
608 Calls the private one which contains a BOOLEAN parameter for notifications
610 @param UserHandle The handle to install the protocol handler on,
611 or NULL if a new handle is to be allocated
612 @param Protocol The protocol to add to the handle
613 @param InterfaceType Indicates whether Interface is supplied in
615 @param Interface The interface for the protocol being added
622 CoreInstallProtocolInterface (
623 IN OUT EFI_HANDLE
*UserHandle
,
624 IN EFI_GUID
*Protocol
,
625 IN EFI_INTERFACE_TYPE InterfaceType
,
631 Installs a protocol interface into the boot services environment.
633 @param UserHandle The handle to install the protocol handler on,
634 or NULL if a new handle is to be allocated
635 @param Protocol The protocol to add to the handle
636 @param InterfaceType Indicates whether Interface is supplied in
638 @param Interface The interface for the protocol being added
639 @param Notify indicates whether notify the notification list
642 @retval EFI_INVALID_PARAMETER Invalid parameter
643 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
644 @retval EFI_SUCCESS Protocol interface successfully installed
648 CoreInstallProtocolInterfaceNotify (
649 IN OUT EFI_HANDLE
*UserHandle
,
650 IN EFI_GUID
*Protocol
,
651 IN EFI_INTERFACE_TYPE InterfaceType
,
659 Installs a list of protocol interface into the boot services environment.
660 This function calls InstallProtocolInterface() in a loop. If any error
661 occures all the protocols added by this function are removed. This is
662 basically a lib function to save space.
664 @param Handle The handle to install the protocol handlers on,
665 or NULL if a new handle is to be allocated
666 @param ... EFI_GUID followed by protocol instance. A NULL
667 terminates the list. The pairs are the
668 arguments to InstallProtocolInterface(). All the
669 protocols are added to Handle.
671 @retval EFI_INVALID_PARAMETER Handle is NULL.
672 @retval EFI_SUCCESS Protocol interfaces successfully installed.
677 CoreInstallMultipleProtocolInterfaces (
678 IN OUT EFI_HANDLE
*Handle
,
685 Uninstalls a list of protocol interface in the boot services environment.
686 This function calls UnisatllProtocolInterface() in a loop. This is
687 basically a lib function to save space.
689 @param Handle The handle to uninstall the protocol
690 @param ... EFI_GUID followed by protocol instance. A NULL
691 terminates the list. The pairs are the
692 arguments to UninstallProtocolInterface(). All
693 the protocols are added to Handle.
700 CoreUninstallMultipleProtocolInterfaces (
701 IN EFI_HANDLE Handle
,
708 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
710 @param UserHandle Handle on which the interface is to be
712 @param Protocol The numeric ID of the interface
713 @param OldInterface A pointer to the old interface
714 @param NewInterface A pointer to the new interface
716 @retval EFI_SUCCESS The protocol interface was installed
717 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
718 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
723 CoreReinstallProtocolInterface (
724 IN EFI_HANDLE UserHandle
,
725 IN EFI_GUID
*Protocol
,
726 IN VOID
*OldInterface
,
727 IN VOID
*NewInterface
733 Uninstalls all instances of a protocol:interfacer from a handle.
734 If the last protocol interface is remove from the handle, the
737 @param UserHandle The handle to remove the protocol handler from
738 @param Protocol The protocol, of protocol:interface, to remove
739 @param Interface The interface, of protocol:interface, to remove
741 @retval EFI_INVALID_PARAMETER Protocol is NULL.
742 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
747 CoreUninstallProtocolInterface (
748 IN EFI_HANDLE UserHandle
,
749 IN EFI_GUID
*Protocol
,
756 Queries a handle to determine if it supports a specified protocol.
758 @param UserHandle The handle being queried.
759 @param Protocol The published unique identifier of the protocol.
760 @param Interface Supplies the address where a pointer to the
761 corresponding Protocol Interface is returned.
763 @return The requested protocol interface for the handle
769 IN EFI_HANDLE UserHandle
,
770 IN EFI_GUID
*Protocol
,
777 Locates the installed protocol handler for the handle, and
778 invokes it to obtain the protocol interface. Usage information
779 is registered in the protocol data base.
781 @param UserHandle The handle to obtain the protocol interface on
782 @param Protocol The ID of the protocol
783 @param Interface The location to return the protocol interface
784 @param ImageHandle The handle of the Image that is opening the
785 protocol interface specified by Protocol and
787 @param ControllerHandle The controller handle that is requiring this
789 @param Attributes The open mode of the protocol interface
790 specified by Handle and Protocol.
792 @retval EFI_INVALID_PARAMETER Protocol is NULL.
793 @retval EFI_SUCCESS Get the protocol interface.
799 IN EFI_HANDLE UserHandle
,
800 IN EFI_GUID
*Protocol
,
801 OUT VOID
**Interface OPTIONAL
,
802 IN EFI_HANDLE ImageHandle
,
803 IN EFI_HANDLE ControllerHandle
,
810 Return information about Opened protocols in the system
812 @param UserHandle The handle to close the protocol interface on
813 @param Protocol The ID of the protocol
814 @param EntryBuffer A pointer to a buffer of open protocol
815 information in the form of
816 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
817 @param EntryCount Number of EntryBuffer entries
822 CoreOpenProtocolInformation (
823 IN EFI_HANDLE UserHandle
,
824 IN EFI_GUID
*Protocol
,
825 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
826 OUT UINTN
*EntryCount
832 Closes a protocol on a handle that was opened using OpenProtocol().
834 @param UserHandle The handle for the protocol interface that was
835 previously opened with OpenProtocol(), and is
837 @param Protocol The published unique identifier of the protocol.
838 It is the caller's responsibility to pass in a
840 @param AgentHandle The handle of the agent that is closing the
842 @param ControllerHandle If the agent that opened a protocol is a driver
843 that follows the EFI Driver Model, then this
844 parameter is the controller handle that required
845 the protocol interface. If the agent does not
846 follow the EFI Driver Model, then this parameter
847 is optional and may be NULL.
849 @retval EFI_SUCCESS The protocol instance was closed.
850 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
852 @retval EFI_NOT_FOUND Can not find the specified protocol or
859 IN EFI_HANDLE UserHandle
,
860 IN EFI_GUID
*Protocol
,
861 IN EFI_HANDLE AgentHandle
,
862 IN EFI_HANDLE ControllerHandle
868 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
871 @param UserHandle The handle from which to retrieve the list of
872 protocol interface GUIDs.
873 @param ProtocolBuffer A pointer to the list of protocol interface GUID
874 pointers that are installed on Handle.
875 @param ProtocolBufferCount A pointer to the number of GUID pointers present
878 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
879 on Handle was returned in ProtocolBuffer. The
880 number of protocol interface GUIDs was returned
881 in ProtocolBufferCount.
882 @retval EFI_INVALID_PARAMETER Handle is NULL.
883 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
884 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
885 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
886 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
892 CoreProtocolsPerHandle (
893 IN EFI_HANDLE UserHandle
,
894 OUT EFI_GUID
***ProtocolBuffer
,
895 OUT UINTN
*ProtocolBufferCount
901 Add a new protocol notification record for the request protocol.
903 @param Protocol The requested protocol to add the notify
905 @param Event The event to signal
906 @param Registration Returns the registration record
908 @retval EFI_INVALID_PARAMETER Invalid parameter
909 @retval EFI_SUCCESS Successfully returned the registration record
915 CoreRegisterProtocolNotify (
916 IN EFI_GUID
*Protocol
,
918 OUT VOID
**Registration
923 Removes all the events in the protocol database that match Event.
925 @param Event The event to search for in the protocol
928 @return EFI_SUCCESS when done searching the entire database.
932 CoreUnregisterProtocolNotify (
938 Locates the requested handle(s) and returns them in Buffer.
940 @param SearchType The type of search to perform to locate the
942 @param Protocol The protocol to search for
943 @param SearchKey Dependant on SearchType
944 @param BufferSize On input the size of Buffer. On output the
945 size of data returned.
946 @param Buffer The buffer to return the results in
948 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
949 returned in BufferSize.
950 @retval EFI_INVALID_PARAMETER Invalid parameter
951 @retval EFI_SUCCESS Successfully found the requested handle(s) and
952 returns them in Buffer.
958 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
959 IN EFI_GUID
*Protocol OPTIONAL
,
960 IN VOID
*SearchKey OPTIONAL
,
961 IN OUT UINTN
*BufferSize
,
962 OUT EFI_HANDLE
*Buffer
968 Locates the handle to a device on the device path that best matches the specified protocol.
970 @param Protocol The protocol to search for.
971 @param DevicePath On input, a pointer to a pointer to the device
972 path. On output, the device path pointer is
973 modified to point to the remaining part of the
975 @param Device A pointer to the returned device handle.
977 @retval EFI_SUCCESS The resulting handle was returned.
978 @retval EFI_NOT_FOUND No handles matched the search.
979 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
984 CoreLocateDevicePath (
985 IN EFI_GUID
*Protocol
,
986 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
987 OUT EFI_HANDLE
*Device
993 Function returns an array of handles that support the requested protocol
994 in a buffer allocated from pool. This is a version of CoreLocateHandle()
995 that allocates a buffer for the caller.
997 @param SearchType Specifies which handle(s) are to be returned.
998 @param Protocol Provides the protocol to search by. This
999 parameter is only valid for SearchType
1001 @param SearchKey Supplies the search key depending on the
1003 @param NumberHandles The number of handles returned in Buffer.
1004 @param Buffer A pointer to the buffer to return the requested
1005 array of handles that support Protocol.
1007 @retval EFI_SUCCESS The result array of handles was returned.
1008 @retval EFI_NOT_FOUND No handles match the search.
1009 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1011 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1016 CoreLocateHandleBuffer (
1017 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1018 IN EFI_GUID
*Protocol OPTIONAL
,
1019 IN VOID
*SearchKey OPTIONAL
,
1020 IN OUT UINTN
*NumberHandles
,
1021 OUT EFI_HANDLE
**Buffer
1027 Return the first Protocol Interface that matches the Protocol GUID. If
1028 Registration is passed in, return a Protocol Instance that was just add
1029 to the system. If Registration is NULL return the first Protocol Interface
1032 @param Protocol The protocol to search for
1033 @param Registration Optional Registration Key returned from
1034 RegisterProtocolNotify()
1035 @param Interface Return the Protocol interface (instance).
1037 @retval EFI_SUCCESS If a valid Interface is returned
1038 @retval EFI_INVALID_PARAMETER Invalid parameter
1039 @retval EFI_NOT_FOUND Protocol interface not found
1044 CoreLocateProtocol (
1045 IN EFI_GUID
*Protocol
,
1046 IN VOID
*Registration OPTIONAL
,
1047 OUT VOID
**Interface
1052 return handle database key.
1055 @return Handle database key.
1059 CoreGetHandleDatabaseKey (
1065 Go connect any handles that were created or modified while a image executed.
1067 @param Key The Key to show that the handle has been
1072 CoreConnectHandlesByKey (
1079 Connects one or more drivers to a controller.
1081 @param ControllerHandle Handle of the controller to be
1083 @param DriverImageHandle DriverImageHandle A pointer to an
1084 ordered list of driver image
1086 @param RemainingDevicePath RemainingDevicePath A pointer to
1087 the device path that specifies a
1088 child of the controller specified
1089 by ControllerHandle.
1090 @param Recursive Whether the function would be
1091 called recursively or not.
1093 @return Status code.
1098 CoreConnectController (
1099 IN EFI_HANDLE ControllerHandle
,
1100 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1101 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1102 IN BOOLEAN Recursive
1108 Disonnects a controller from a driver
1110 @param ControllerHandle ControllerHandle The handle of
1111 the controller from which
1114 @param DriverImageHandle DriverImageHandle The driver to
1115 disconnect from ControllerHandle.
1116 @param ChildHandle ChildHandle The handle of the
1119 @retval EFI_SUCCESS One or more drivers were
1120 disconnected from the controller.
1121 @retval EFI_SUCCESS On entry, no drivers are managing
1123 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1124 and on entry DriverImageHandle is
1125 not managing ControllerHandle.
1126 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1127 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1128 and it is not a valid EFI_HANDLE.
1129 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1130 is not a valid EFI_HANDLE.
1131 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1132 available to disconnect any
1133 drivers from ControllerHandle.
1134 @retval EFI_DEVICE_ERROR The controller could not be
1135 disconnected because of a device
1141 CoreDisconnectController (
1142 IN EFI_HANDLE ControllerHandle
,
1143 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1144 IN EFI_HANDLE ChildHandle OPTIONAL
1150 Allocates pages from the memory map.
1152 @param Type The type of allocation to perform
1153 @param MemoryType The type of memory to turn the allocated pages
1155 @param NumberOfPages The number of pages to allocate
1156 @param Memory A pointer to receive the base allocated memory
1159 @return Status. On success, Memory is filled in with the base address allocated
1160 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1162 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1163 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1164 @retval EFI_SUCCESS Pages successfully allocated.
1170 IN EFI_ALLOCATE_TYPE Type
,
1171 IN EFI_MEMORY_TYPE MemoryType
,
1172 IN UINTN NumberOfPages
,
1173 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1179 Frees previous allocated pages.
1181 @param Memory Base address of memory being freed
1182 @param NumberOfPages The number of pages to free
1184 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1185 @retval EFI_INVALID_PARAMETER Address not aligned
1186 @return EFI_SUCCESS -Pages successfully freed.
1192 IN EFI_PHYSICAL_ADDRESS Memory
,
1193 IN UINTN NumberOfPages
1199 This function returns a copy of the current memory map. The map is an array of
1200 memory descriptors, each of which describes a contiguous block of memory.
1202 @param MemoryMapSize A pointer to the size, in bytes, of the
1203 MemoryMap buffer. On input, this is the size of
1204 the buffer allocated by the caller. On output,
1205 it is the size of the buffer returned by the
1206 firmware if the buffer was large enough, or the
1207 size of the buffer needed to contain the map if
1208 the buffer was too small.
1209 @param MemoryMap A pointer to the buffer in which firmware places
1210 the current memory map.
1211 @param MapKey A pointer to the location in which firmware
1212 returns the key for the current memory map.
1213 @param DescriptorSize A pointer to the location in which firmware
1214 returns the size, in bytes, of an individual
1215 EFI_MEMORY_DESCRIPTOR.
1216 @param DescriptorVersion A pointer to the location in which firmware
1217 returns the version number associated with the
1218 EFI_MEMORY_DESCRIPTOR.
1220 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1222 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1223 buffer size needed to hold the memory map is
1224 returned in MemoryMapSize.
1225 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1231 IN OUT UINTN
*MemoryMapSize
,
1232 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1234 OUT UINTN
*DescriptorSize
,
1235 OUT UINT32
*DescriptorVersion
1241 Allocate pool of a particular type.
1243 @param PoolType Type of pool to allocate
1244 @param Size The amount of pool to allocate
1245 @param Buffer The address to return a pointer to the allocated
1248 @retval EFI_INVALID_PARAMETER PoolType not valid
1249 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1250 @retval EFI_SUCCESS Pool successfully allocated.
1256 IN EFI_MEMORY_TYPE PoolType
,
1266 @param Buffer The allocated pool entry to free
1268 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1269 @retval EFI_SUCCESS Pool successfully freed.
1281 Loads an EFI image into memory and returns a handle to the image.
1283 @param BootPolicy If TRUE, indicates that the request originates
1284 from the boot manager, and that the boot
1285 manager is attempting to load FilePath as a
1287 @param ParentImageHandle The caller's image handle.
1288 @param FilePath The specific file path from which the image is
1290 @param SourceBuffer If not NULL, a pointer to the memory location
1291 containing a copy of the image to be loaded.
1292 @param SourceSize The size in bytes of SourceBuffer.
1293 @param ImageHandle Pointer to the returned image handle that is
1294 created when the image is successfully loaded.
1296 @retval EFI_SUCCESS The image was loaded into memory.
1297 @retval EFI_NOT_FOUND The FilePath was not found.
1298 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1299 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1300 path cannot be parsed to locate the proper
1301 protocol for loading the file.
1302 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1304 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1306 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1307 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1308 image from being loaded. NULL is returned in *ImageHandle.
1309 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1310 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1311 platform policy specifies that the image should not be started.
1317 IN BOOLEAN BootPolicy
,
1318 IN EFI_HANDLE ParentImageHandle
,
1319 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1320 IN VOID
*SourceBuffer OPTIONAL
,
1321 IN UINTN SourceSize
,
1322 OUT EFI_HANDLE
*ImageHandle
1330 @param ImageHandle Handle that identifies the image to be
1333 @retval EFI_SUCCESS The image has been unloaded.
1334 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1336 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1342 IN EFI_HANDLE ImageHandle
1348 Transfer control to a loaded image's entry point.
1350 @param ImageHandle Handle of image to be started.
1351 @param ExitDataSize Pointer of the size to ExitData
1352 @param ExitData Pointer to a pointer to a data buffer that
1353 includes a Null-terminated string,
1354 optionally followed by additional binary data.
1355 The string is a description that the caller may
1356 use to further indicate the reason for the
1359 @retval EFI_INVALID_PARAMETER Invalid parameter
1360 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1361 @retval EFI_SUCCESS Successfully transfer control to the image's
1368 IN EFI_HANDLE ImageHandle
,
1369 OUT UINTN
*ExitDataSize
,
1370 OUT CHAR16
**ExitData OPTIONAL
1376 Terminates the currently loaded EFI image and returns control to boot services.
1378 @param ImageHandle Handle that identifies the image. This
1379 parameter is passed to the image on entry.
1380 @param Status The image's exit code.
1381 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1382 ExitStatus is EFI_SUCCESS.
1383 @param ExitData Pointer to a data buffer that includes a
1384 Null-terminated Unicode string, optionally
1385 followed by additional binary data. The string
1386 is a description that the caller may use to
1387 further indicate the reason for the image's
1390 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1392 @retval EFI_SUCCESS Successfully terminates the currently loaded
1394 @retval EFI_ACCESS_DENIED Should never reach there.
1395 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1401 IN EFI_HANDLE ImageHandle
,
1402 IN EFI_STATUS Status
,
1403 IN UINTN ExitDataSize
,
1404 IN CHAR16
*ExitData OPTIONAL
1410 Creates a general-purpose event structure.
1412 @param Type The type of event to create and its mode and
1414 @param NotifyTpl The task priority level of event notifications
1415 @param NotifyFunction Pointer to the events notification function
1416 @param NotifyContext Pointer to the notification functions context;
1417 corresponds to parameter "Context" in the
1418 notification function
1419 @param Event Pointer to the newly created event if the call
1420 succeeds; undefined otherwise
1422 @retval EFI_SUCCESS The event structure was created
1423 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1424 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1431 IN EFI_TPL NotifyTpl
,
1432 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1433 IN VOID
*NotifyContext
, OPTIONAL
1434 OUT EFI_EVENT
*Event
1440 Creates a general-purpose event structure
1442 @param Type The type of event to create and its mode and
1444 @param NotifyTpl The task priority level of event notifications
1445 @param NotifyFunction Pointer to the events notification function
1446 @param NotifyContext Pointer to the notification functions context;
1447 corresponds to parameter "Context" in the
1448 notification function
1449 @param EventGroup GUID for EventGroup if NULL act the same as
1451 @param Event Pointer to the newly created event if the call
1452 succeeds; undefined otherwise
1454 @retval EFI_SUCCESS The event structure was created
1455 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1456 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1463 IN EFI_TPL NotifyTpl
,
1464 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1465 IN CONST VOID
*NotifyContext
, OPTIONAL
1466 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1467 OUT EFI_EVENT
*Event
1473 Sets the type of timer and the trigger time for a timer event.
1475 @param UserEvent The timer event that is to be signaled at the
1477 @param Type The type of time that is specified in
1479 @param TriggerTime The number of 100ns units until the timer
1482 @retval EFI_SUCCESS The event has been set to be signaled at the
1484 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1490 IN EFI_EVENT UserEvent
,
1491 IN EFI_TIMER_DELAY Type
,
1492 IN UINT64 TriggerTime
1498 Signals the event. Queues the event to be notified if needed.
1500 @param UserEvent The event to signal .
1502 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1503 @retval EFI_SUCCESS The event was signaled.
1509 IN EFI_EVENT UserEvent
1515 Stops execution until an event is signaled.
1517 @param NumberOfEvents The number of events in the UserEvents array
1518 @param UserEvents An array of EFI_EVENT
1519 @param UserIndex Pointer to the index of the event which
1520 satisfied the wait condition
1522 @retval EFI_SUCCESS The event indicated by Index was signaled.
1523 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1524 function or Event was not a valid type
1525 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1531 IN UINTN NumberOfEvents
,
1532 IN EFI_EVENT
*UserEvents
,
1533 OUT UINTN
*UserIndex
1539 Closes an event and frees the event structure.
1541 @param UserEvent Event to close
1543 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1544 @retval EFI_SUCCESS The event has been closed
1550 IN EFI_EVENT UserEvent
1556 Check the status of an event.
1558 @param UserEvent The event to check
1560 @retval EFI_SUCCESS The event is in the signaled state
1561 @retval EFI_NOT_READY The event is not in the signaled state
1562 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1568 IN EFI_EVENT UserEvent
1573 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1574 global coherency domain of the processor.
1576 @param GcdMemoryType Memory type of the memory space.
1577 @param BaseAddress Base address of the memory space.
1578 @param Length Length of the memory space.
1579 @param Capabilities alterable attributes of the memory space.
1581 @retval EFI_SUCCESS Merged this memory space into GCD map.
1586 CoreAddMemorySpace (
1587 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1588 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1590 IN UINT64 Capabilities
1595 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1596 I/O resources from the global coherency domain of the processor.
1598 @param GcdAllocateType The type of allocate operation
1599 @param GcdMemoryType The desired memory type
1600 @param Alignment Align with 2^Alignment
1601 @param Length Length to allocate
1602 @param BaseAddress Base address to allocate
1603 @param ImageHandle The image handle consume the allocated space.
1604 @param DeviceHandle The device handle consume the allocated space.
1606 @retval EFI_INVALID_PARAMETER Invalid parameter.
1607 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1608 @retval EFI_SUCCESS Memory space successfully allocated.
1613 CoreAllocateMemorySpace (
1614 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1615 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1618 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1619 IN EFI_HANDLE ImageHandle
,
1620 IN EFI_HANDLE DeviceHandle OPTIONAL
1625 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1626 I/O resources from the global coherency domain of the processor.
1628 @param BaseAddress Base address of the memory space.
1629 @param Length Length of the memory space.
1631 @retval EFI_SUCCESS Space successfully freed.
1636 CoreFreeMemorySpace (
1637 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1643 Removes reserved memory, system memory, or memory-mapped I/O resources from
1644 the global coherency domain of the processor.
1646 @param BaseAddress Base address of the memory space.
1647 @param Length Length of the memory space.
1649 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1654 CoreRemoveMemorySpace (
1655 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1661 Retrieves the descriptor for a memory region containing a specified address.
1663 @param BaseAddress Specified start address
1664 @param Descriptor Specified length
1666 @retval EFI_INVALID_PARAMETER Invalid parameter
1667 @retval EFI_SUCCESS Successfully get memory space descriptor.
1672 CoreGetMemorySpaceDescriptor (
1673 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1674 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1679 Modifies the attributes for a memory region in the global coherency domain of the
1682 @param BaseAddress Specified start address
1683 @param Length Specified length
1684 @param Attributes Specified attributes
1686 @retval EFI_SUCCESS The attributes were set for the memory region.
1687 @retval EFI_INVALID_PARAMETER Length is zero.
1688 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1689 resource range specified by BaseAddress and Length.
1690 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1691 range specified by BaseAddress and Length.
1692 @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by
1693 BaseAddress and Length cannot be modified.
1694 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1695 the memory resource range.
1696 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1702 CoreSetMemorySpaceAttributes (
1703 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1705 IN UINT64 Attributes
1710 Returns a map of the memory resources in the global coherency domain of the
1713 @param NumberOfDescriptors Number of descriptors.
1714 @param MemorySpaceMap Descriptor array
1716 @retval EFI_INVALID_PARAMETER Invalid parameter
1717 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1718 @retval EFI_SUCCESS Successfully get memory space map.
1723 CoreGetMemorySpaceMap (
1724 OUT UINTN
*NumberOfDescriptors
,
1725 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1730 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1732 @param GcdIoType IO type of the segment.
1733 @param BaseAddress Base address of the segment.
1734 @param Length Length of the segment.
1736 @retval EFI_SUCCESS Merged this segment into GCD map.
1737 @retval EFI_INVALID_PARAMETER Parameter not valid
1743 IN EFI_GCD_IO_TYPE GcdIoType
,
1744 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1750 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1751 domain of the processor.
1753 @param GcdAllocateType The type of allocate operation
1754 @param GcdIoType The desired IO type
1755 @param Alignment Align with 2^Alignment
1756 @param Length Length to allocate
1757 @param BaseAddress Base address to allocate
1758 @param ImageHandle The image handle consume the allocated space.
1759 @param DeviceHandle The device handle consume the allocated space.
1761 @retval EFI_INVALID_PARAMETER Invalid parameter.
1762 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1763 @retval EFI_SUCCESS IO space successfully allocated.
1768 CoreAllocateIoSpace (
1769 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1770 IN EFI_GCD_IO_TYPE GcdIoType
,
1773 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1774 IN EFI_HANDLE ImageHandle
,
1775 IN EFI_HANDLE DeviceHandle OPTIONAL
1780 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1781 domain of the processor.
1783 @param BaseAddress Base address of the segment.
1784 @param Length Length of the segment.
1786 @retval EFI_SUCCESS Space successfully freed.
1792 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1798 Removes reserved I/O or I/O resources from the global coherency domain of the
1801 @param BaseAddress Base address of the segment.
1802 @param Length Length of the segment.
1804 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1810 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1816 Retrieves the descriptor for an I/O region containing a specified address.
1818 @param BaseAddress Specified start address
1819 @param Descriptor Specified length
1821 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1822 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1827 CoreGetIoSpaceDescriptor (
1828 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1829 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1834 Returns a map of the I/O resources in the global coherency domain of the processor.
1836 @param NumberOfDescriptors Number of descriptors.
1837 @param IoSpaceMap Descriptor array
1839 @retval EFI_INVALID_PARAMETER Invalid parameter
1840 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1841 @retval EFI_SUCCESS Successfully get IO space map.
1847 OUT UINTN
*NumberOfDescriptors
,
1848 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1853 This is the main Dispatcher for DXE and it exits when there are no more
1854 drivers to run. Drain the mScheduledQueue and load and start a PE
1855 image for each driver. Search the mDiscoveredList to see if any driver can
1856 be placed on the mScheduledQueue. If no drivers are placed on the
1857 mScheduledQueue exit the function. On exit it is assumed the Bds()
1858 will be called, and when the Bds() exits the Dispatcher will be called
1861 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1862 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1863 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1873 Check every driver and locate a matching one. If the driver is found, the Unrequested
1874 state flag is cleared.
1876 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1877 the firmware file specified by DriverName.
1878 @param DriverName The Driver name to put in the Dependent state.
1880 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1882 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1889 IN EFI_HANDLE FirmwareVolumeHandle
,
1890 IN EFI_GUID
*DriverName
1895 Convert a driver from the Untrused back to the Scheduled state.
1897 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1898 the firmware file specified by DriverName.
1899 @param DriverName The Driver name to put in the Scheduled state
1901 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1902 was promoted to the trusted state.
1903 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1909 IN EFI_HANDLE FirmwareVolumeHandle
,
1910 IN EFI_GUID
*DriverName
1915 This routine is the driver initialization entry point. It initializes the
1916 libraries, and registers two notification functions. These notification
1917 functions are responsible for building the FV stack dynamically.
1919 @param ImageHandle The image handle.
1920 @param SystemTable The system table.
1922 @retval EFI_SUCCESS Function successfully returned.
1928 IN EFI_HANDLE ImageHandle
,
1929 IN EFI_SYSTEM_TABLE
*SystemTable
1934 Entry point of the section extraction code. Initializes an instance of the
1935 section extraction interface and installs it on a new handle.
1937 @param ImageHandle A handle for the image that is initializing this driver
1938 @param SystemTable A pointer to the EFI system table
1940 @retval EFI_SUCCESS Driver initialized successfully
1941 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1946 InitializeSectionExtraction (
1947 IN EFI_HANDLE ImageHandle
,
1948 IN EFI_SYSTEM_TABLE
*SystemTable
1953 This DXE service routine is used to process a firmware volume. In
1954 particular, it can be called by BDS to process a single firmware
1955 volume found in a capsule.
1957 @param FvHeader pointer to a firmware volume header
1958 @param Size the size of the buffer pointed to by FvHeader
1959 @param FVProtocolHandle the handle on which a firmware volume protocol
1960 was produced for the firmware volume passed in.
1962 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1964 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1965 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1971 CoreProcessFirmwareVolume (
1974 OUT EFI_HANDLE
*FVProtocolHandle
1978 //Functions used during debug buils
1982 Displays Architectural protocols that were not loaded and are required for DXE
1983 core to function. Only used in Debug Builds.
1987 CoreDisplayMissingArchProtocols (
1993 Traverse the discovered list for any drivers that were discovered but not loaded
1994 because the dependency experessions evaluated to false.
1998 CoreDisplayDiscoveredNotDispatched (
2004 Place holder function until all the Boot Services and Runtime Services are
2007 @return EFI_NOT_AVAILABLE_YET
2012 CoreEfiNotAvailableYetArg0 (
2018 Place holder function until all the Boot Services and Runtime Services are
2021 @param Arg1 Undefined
2023 @return EFI_NOT_AVAILABLE_YET
2028 CoreEfiNotAvailableYetArg1 (
2034 Place holder function until all the Boot Services and Runtime Services are available.
2036 @param Arg1 Undefined
2037 @param Arg2 Undefined
2039 @return EFI_NOT_AVAILABLE_YET
2044 CoreEfiNotAvailableYetArg2 (
2051 Place holder function until all the Boot Services and Runtime Services are available.
2053 @param Arg1 Undefined
2054 @param Arg2 Undefined
2055 @param Arg3 Undefined
2057 @return EFI_NOT_AVAILABLE_YET
2062 CoreEfiNotAvailableYetArg3 (
2070 Place holder function until all the Boot Services and Runtime Services are available.
2072 @param Arg1 Undefined
2073 @param Arg2 Undefined
2074 @param Arg3 Undefined
2075 @param Arg4 Undefined
2077 @return EFI_NOT_AVAILABLE_YET
2082 CoreEfiNotAvailableYetArg4 (
2091 Place holder function until all the Boot Services and Runtime Services are available.
2093 @param Arg1 Undefined
2094 @param Arg2 Undefined
2095 @param Arg3 Undefined
2096 @param Arg4 Undefined
2097 @param Arg5 Undefined
2099 @return EFI_NOT_AVAILABLE_YET
2104 CoreEfiNotAvailableYetArg5 (
2114 Given a compressed source buffer, this function retrieves the size of the
2115 uncompressed buffer and the size of the scratch buffer required to decompress
2116 the compressed source buffer.
2118 The GetInfo() function retrieves the size of the uncompressed buffer and the
2119 temporary scratch buffer required to decompress the buffer specified by Source
2120 and SourceSize. If the size of the uncompressed buffer or the size of the
2121 scratch buffer cannot be determined from the compressed data specified by
2122 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2123 size of the uncompressed buffer is returned in DestinationSize, the size of
2124 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2125 The GetInfo() function does not have scratch buffer available to perform a
2126 thorough checking of the validity of the source data. It just retrieves the
2127 "Original Size" field from the beginning bytes of the source data and output
2128 it as DestinationSize. And ScratchSize is specific to the decompression
2131 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2132 @param Source The source buffer containing the compressed data.
2133 @param SourceSize The size, in bytes, of the source buffer.
2134 @param DestinationSize A pointer to the size, in bytes, of the
2135 uncompressed buffer that will be generated when the
2136 compressed buffer specified by Source and
2137 SourceSize is decompressed.
2138 @param ScratchSize A pointer to the size, in bytes, of the scratch
2139 buffer that is required to decompress the
2140 compressed buffer specified by Source and
2143 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2144 DestinationSize and the size of the scratch buffer
2145 was returned in ScratchSize.
2146 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2147 the scratch buffer cannot be determined from the
2148 compressed data specified by Source and
2154 DxeMainUefiDecompressGetInfo (
2155 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2157 IN UINT32 SourceSize
,
2158 OUT UINT32
*DestinationSize
,
2159 OUT UINT32
*ScratchSize
2164 Decompresses a compressed source buffer.
2166 The Decompress() function extracts decompressed data to its original form.
2167 This protocol is designed so that the decompression algorithm can be
2168 implemented without using any memory services. As a result, the Decompress()
2169 Function is not allowed to call AllocatePool() or AllocatePages() in its
2170 implementation. It is the caller's responsibility to allocate and free the
2171 Destination and Scratch buffers.
2172 If the compressed source data specified by Source and SourceSize is
2173 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2174 the compressed source data specified by Source and SourceSize is not in a
2175 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2177 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2178 @param Source The source buffer containing the compressed data.
2179 @param SourceSize SourceSizeThe size of source data.
2180 @param Destination On output, the destination buffer that contains
2181 the uncompressed data.
2182 @param DestinationSize The size of the destination buffer. The size of
2183 the destination buffer needed is obtained from
2184 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2185 @param Scratch A temporary scratch buffer that is used to perform
2187 @param ScratchSize The size of scratch buffer. The size of the
2188 scratch buffer needed is obtained from GetInfo().
2190 @retval EFI_SUCCESS Decompression completed successfully, and the
2191 uncompressed buffer is returned in Destination.
2192 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2193 SourceSize is corrupted (not in a valid
2199 DxeMainUefiDecompress (
2200 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2202 IN UINT32 SourceSize
,
2203 IN OUT VOID
*Destination
,
2204 IN UINT32 DestinationSize
,
2205 IN OUT VOID
*Scratch
,
2206 IN UINT32 ScratchSize
2210 SEP member function. This function creates and returns a new section stream
2211 handle to represent the new section stream.
2213 @param SectionStreamLength Size in bytes of the section stream.
2214 @param SectionStream Buffer containing the new section stream.
2215 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2216 output contains the new section stream handle.
2218 @retval EFI_SUCCESS The section stream is created successfully.
2219 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2220 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2227 IN UINTN SectionStreamLength
,
2228 IN VOID
*SectionStream
,
2229 OUT UINTN
*SectionStreamHandle
2235 SEP member function. Retrieves requested section from section stream.
2237 @param SectionStreamHandle The section stream from which to extract the
2239 @param SectionType A pointer to the type of section to search for.
2240 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2241 then SectionDefinitionGuid indicates which of
2242 these types of sections to search for.
2243 @param SectionInstance Indicates which instance of the requested
2245 @param Buffer Double indirection to buffer. If *Buffer is
2246 non-null on input, then the buffer is caller
2247 allocated. If Buffer is NULL, then the buffer
2248 is callee allocated. In either case, the
2249 requried buffer size is returned in *BufferSize.
2250 @param BufferSize On input, indicates the size of *Buffer if
2251 *Buffer is non-null on input. On output,
2252 indicates the required size (allocated size if
2253 callee allocated) of *Buffer.
2254 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2255 indicates the authentication status of the
2256 output buffer. If the input section's
2257 GuidedSectionHeader.Attributes field
2258 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2259 bit as clear, AuthenticationStatus must return
2260 zero. Both local bits (19:16) and aggregate
2261 bits (3:0) in AuthenticationStatus are returned
2262 by ExtractSection(). These bits reflect the
2263 status of the extraction operation. The bit
2264 pattern in both regions must be the same, as
2265 the local and aggregate authentication statuses
2266 have equivalent meaning at this level. If the
2267 function returns anything other than
2268 EFI_SUCCESS, the value of *AuthenticationStatus
2270 @param IsFfs3Fv Indicates the FV format.
2272 @retval EFI_SUCCESS Section was retrieved successfully
2273 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2274 section stream with its
2275 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2276 but there was no corresponding GUIDed Section
2277 Extraction Protocol in the handle database.
2278 *Buffer is unmodified.
2279 @retval EFI_NOT_FOUND An error was encountered when parsing the
2280 SectionStream. This indicates the SectionStream
2281 is not correctly formatted.
2282 @retval EFI_NOT_FOUND The requested section does not exist.
2283 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2285 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2286 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2287 insufficient to contain the requested section.
2288 The input buffer is filled and section contents
2295 IN UINTN SectionStreamHandle
,
2296 IN EFI_SECTION_TYPE
*SectionType
,
2297 IN EFI_GUID
*SectionDefinitionGuid
,
2298 IN UINTN SectionInstance
,
2300 IN OUT UINTN
*BufferSize
,
2301 OUT UINT32
*AuthenticationStatus
,
2307 SEP member function. Deletes an existing section stream
2309 @param StreamHandleToClose Indicates the stream to close
2311 @retval EFI_SUCCESS The section stream is closed sucessfully.
2312 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2313 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2319 CloseSectionStream (
2320 IN UINTN StreamHandleToClose
2324 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2325 table and registers it into the system table.
2328 This function allocates memory, frees it, and then allocates memory at an
2329 address within the initial allocation. Since this function is called early
2330 in DXE core initialization (before drivers are dispatched), this should not
2335 CoreInitializeDebugImageInfoTable (
2341 Update the CRC32 in the Debug Table.
2342 Since the CRC32 service is made available by the Runtime driver, we have to
2343 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2344 This function is called elsewhere by the core when the runtime architectural
2345 protocol is produced.
2349 CoreUpdateDebugTableCrc32 (
2355 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2356 the table if it's not large enough to accomidate another entry.
2358 @param ImageInfoType type of debug image information
2359 @param LoadedImage pointer to the loaded image protocol for the image being
2361 @param ImageHandle image handle for the image being loaded
2365 CoreNewDebugImageInfoEntry (
2366 IN UINT32 ImageInfoType
,
2367 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2368 IN EFI_HANDLE ImageHandle
2373 Removes and frees an entry from the DebugImageInfo Table.
2375 @param ImageHandle image handle for the image being unloaded
2379 CoreRemoveDebugImageInfoEntry (
2380 EFI_HANDLE ImageHandle
2385 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2387 @param ImageHandle The image handle.
2388 @param SystemTable The system table.
2390 @retval EFI_SUCCESS Successfully initialized firmware volume block
2396 FwVolBlockDriverInit (
2397 IN EFI_HANDLE ImageHandle
,
2398 IN EFI_SYSTEM_TABLE
*SystemTable
2403 This routine produces a firmware volume block protocol on a given
2406 @param BaseAddress base address of the firmware volume image
2407 @param Length length of the firmware volume image
2408 @param ParentHandle handle of parent firmware volume, if this image
2409 came from an FV image file in another firmware
2410 volume (ala capsules)
2411 @param FvProtocol Firmware volume block protocol produced.
2413 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2414 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2415 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2420 ProduceFVBProtocolOnBuffer (
2421 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2423 IN EFI_HANDLE ParentHandle
,
2424 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2429 Raising to the task priority level of the mutual exclusion
2430 lock, and then acquires ownership of the lock.
2432 @param Lock The lock to acquire
2444 Initialize a basic mutual exclusion lock. Each lock
2445 provides mutual exclusion access at it's task priority
2446 level. Since there is no-premption (at any TPL) or
2447 multiprocessor support, acquiring the lock only consists
2448 of raising to the locks TPL.
2450 @param Lock The EFI_LOCK structure to initialize
2452 @retval EFI_SUCCESS Lock Owned.
2453 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2457 CoreAcquireLockOrFail (
2463 Releases ownership of the mutual exclusion lock, and
2464 restores the previous task priority level.
2466 @param Lock The lock to release
2468 @return Lock unowned
2478 An empty function to pass error checking of CreateEventEx ().
2480 @param Event Event whose notification function is being invoked.
2481 @param Context Pointer to the notification function's context,
2482 which is implementation-dependent.
2487 CoreEmptyCallbackFunction (