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/HobList.h>
58 #include <Guid/DebugImageInfoTable.h>
59 #include <Guid/FileInfo.h>
60 #include <Guid/Apriori.h>
61 #include <Guid/DxeServices.h>
62 #include <Guid/MemoryAllocationHob.h>
63 #include <Guid/EventLegacyBios.h>
64 #include <Guid/EventGroup.h>
65 #include <Guid/LoadModuleAtFixedAddress.h>
67 #include <Library/DxeCoreEntryPoint.h>
68 #include <Library/DebugLib.h>
69 #include <Library/UefiLib.h>
70 #include <Library/BaseLib.h>
71 #include <Library/HobLib.h>
72 #include <Library/PerformanceLib.h>
73 #include <Library/UefiDecompressLib.h>
74 #include <Library/ExtractGuidedSectionLib.h>
75 #include <Library/CacheMaintenanceLib.h>
76 #include <Library/BaseMemoryLib.h>
77 #include <Library/PeCoffLib.h>
78 #include <Library/PeCoffGetEntryPointLib.h>
79 #include <Library/PeCoffExtraActionLib.h>
80 #include <Library/PcdLib.h>
81 #include <Library/MemoryAllocationLib.h>
82 #include <Library/DevicePathLib.h>
83 #include <Library/UefiBootServicesTableLib.h>
84 #include <Library/ReportStatusCodeLib.h>
85 #include <Library/TimerLib.h>
86 #include <Library/DxeServicesLib.h>
87 #include <Library/DebugAgentLib.h>
91 // attributes for reserved memory before it is promoted to system memory
93 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
94 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
95 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
98 // range for memory mapped port I/O on IPF
100 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
104 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
105 /// to save time. A EFI_DEP_PUSH is evauated one an
106 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
107 /// Driver Execution Environment Core Interface use 0xff
108 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
109 /// defined to a new value that is not conflicting with PI spec.
111 #define EFI_DEP_REPLACE_TRUE 0xff
114 /// Define the initial size of the dependency expression evaluation stack
116 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
119 EFI_GUID
*ProtocolGuid
;
124 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
127 // DXE Dispatcher Data structures
130 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
133 LIST_ENTRY Link
; // mFvHandleList
138 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
141 LIST_ENTRY Link
; // mDriverList
143 LIST_ENTRY ScheduledLink
; // mScheduledQueue
147 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
148 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
155 EFI_GUID BeforeAfterGuid
;
162 BOOLEAN DepexProtocolError
;
164 EFI_HANDLE ImageHandle
;
166 } EFI_CORE_DRIVER_ENTRY
;
169 //The data structure of GCD memory map entry
171 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
175 EFI_PHYSICAL_ADDRESS BaseAddress
;
179 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
180 EFI_GCD_IO_TYPE GcdIoType
;
181 EFI_HANDLE ImageHandle
;
182 EFI_HANDLE DeviceHandle
;
186 // DXE Core Global Variables
188 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
189 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
190 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
191 extern EFI_HANDLE gDxeCoreImageHandle
;
193 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
195 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
196 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
197 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
198 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
199 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
200 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
201 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
202 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
204 extern EFI_TPL gEfiCurrentTpl
;
206 extern EFI_GUID
*gDxeCoreFileName
;
207 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
209 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
211 extern BOOLEAN gDispatcherRunning
;
212 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
214 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
215 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
217 // Service Initialization Functions
223 Called to initialize the pool.
233 Called to initialize the memory map and add descriptors to
234 the current descriptor list.
235 The first descriptor that is added must be general usable
236 memory as the addition allocates heap.
238 @param Type The type of memory to add
239 @param Start The starting address in the memory range Must be
241 @param NumberOfPages The number of pages in the range
242 @param Attribute Attributes of the memory to add
244 @return None. The range is added to the memory map
248 CoreAddMemoryDescriptor (
249 IN EFI_MEMORY_TYPE Type
,
250 IN EFI_PHYSICAL_ADDRESS Start
,
251 IN UINT64 NumberOfPages
,
257 Release memory lock on mGcdMemorySpaceLock.
261 CoreReleaseGcdMemoryLock (
267 Acquire memory lock on mGcdMemorySpaceLock.
271 CoreAcquireGcdMemoryLock (
277 External function. Initializes memory services based on the memory
278 descriptor HOBs. This function is responsible for priming the memory
279 map, so memory allocations and resource allocations can be made.
280 The first part of this function can not depend on any memory services
281 until at least one memory descriptor is provided to the memory services.
283 @param HobStart The start address of the HOB.
284 @param MemoryBaseAddress Start address of memory region found to init DXE
286 @param MemoryLength Length of memory region found to init DXE core.
288 @retval EFI_SUCCESS Memory services successfully initialized.
292 CoreInitializeMemoryServices (
294 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
295 OUT UINT64
*MemoryLength
301 External function. Initializes the GCD and memory services based on the memory
302 descriptor HOBs. This function is responsible for priming the GCD map and the
303 memory map, so memory allocations and resource allocations can be made. The
304 HobStart will be relocated to a pool buffer.
306 @param HobStart The start address of the HOB
307 @param MemoryBaseAddress Start address of memory region found to init DXE
309 @param MemoryLength Length of memory region found to init DXE core.
311 @retval EFI_SUCCESS GCD services successfully initialized.
315 CoreInitializeGcdServices (
316 IN OUT VOID
**HobStart
,
317 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
318 IN UINT64 MemoryLength
323 Initializes "event" support.
325 @retval EFI_SUCCESS Always return success
329 CoreInitializeEventServices (
335 Add the Image Services to EFI Boot Services Table and install the protocol
336 interfaces for this image.
338 @param HobStart The HOB to initialize
344 CoreInitializeImageServices (
350 Creates an event that is fired everytime a Protocol of a specific type is installed.
354 CoreNotifyOnProtocolInstallation (
360 Return TRUE if all AP services are availible.
362 @retval EFI_SUCCESS All AP services are available
363 @retval EFI_NOT_FOUND At least one AP service is not available
367 CoreAllEfiServicesAvailable (
373 Calcualte the 32-bit CRC in a EFI table using the service provided by the
376 @param Hdr Pointer to an EFI standard header
381 IN OUT EFI_TABLE_HEADER
*Hdr
386 Called by the platform code to process a tick.
388 @param Duration The number of 100ns elasped since the last call
400 Initialize the dispatcher. Initialize the notification function that runs when
401 an FV2 protocol is added to the system.
405 CoreInitializeDispatcher (
411 This is the POSTFIX version of the dependency evaluator. This code does
412 not need to handle Before or After, as it is not valid to call this
413 routine in this case. The SOR is just ignored and is a nop in the grammer.
414 POSTFIX means all the math is done on top of the stack.
416 @param DriverEntry DriverEntry element to update.
418 @retval TRUE If driver is ready to run.
419 @retval FALSE If driver is not ready to run or some fatal error
425 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
430 Preprocess dependency expression and update DriverEntry to reflect the
431 state of Before, After, and SOR dependencies. If DriverEntry->Before
432 or DriverEntry->After is set it will never be cleared. If SOR is set
433 it will be cleared by CoreSchedule(), and then the driver can be
436 @param DriverEntry DriverEntry element to update .
438 @retval EFI_SUCCESS It always works.
442 CorePreProcessDepex (
443 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
449 Terminates all boot services.
451 @param ImageHandle Handle that identifies the exiting image.
452 @param MapKey Key to the latest memory map.
454 @retval EFI_SUCCESS Boot Services terminated
455 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
460 CoreExitBootServices (
461 IN EFI_HANDLE ImageHandle
,
467 Make sure the memory map is following all the construction rules,
468 it is the last time to check memory map error before exit boot services.
470 @param MapKey Memory map key
472 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
474 @retval EFI_SUCCESS Valid memory map.
478 CoreTerminateMemoryMap (
484 Signals all events in the EventGroup.
486 @param EventGroup The list to signal
490 CoreNotifySignalList (
491 IN EFI_GUID
*EventGroup
497 Boot Service called to add, modify, or remove a system configuration table from
498 the EFI System Table.
500 @param Guid Pointer to the GUID for the entry to add, update, or
502 @param Table Pointer to the configuration table for the entry to add,
503 update, or remove, may be NULL.
505 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
506 @return EFI_INVALID_PARAMETER Input GUID not valid.
507 @return EFI_NOT_FOUND Attempted to delete non-existant entry
508 @return EFI_OUT_OF_RESOURCES Not enough memory available
513 CoreInstallConfigurationTable (
521 Raise the task priority level to the new level.
522 High level is implemented by disabling processor interrupts.
524 @param NewTpl New task priority level
526 @return The previous task priority level
538 Lowers the task priority to the previous value. If the new
539 priority unmasks events at a higher priority, they are dispatched.
541 @param NewTpl New, lower, task priority
553 Introduces a fine-grained stall.
555 @param Microseconds The number of microseconds to stall execution.
557 @retval EFI_SUCCESS Execution was stalled for at least the requested
558 amount of microseconds.
559 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
565 IN UINTN Microseconds
571 Sets the system's watchdog timer.
573 @param Timeout The number of seconds to set the watchdog timer to.
574 A value of zero disables the timer.
575 @param WatchdogCode The numeric code to log on a watchdog timer timeout
576 event. The firmware reserves codes 0x0000 to 0xFFFF.
577 Loaders and operating systems may use other timeout
579 @param DataSize The size, in bytes, of WatchdogData.
580 @param WatchdogData A data buffer that includes a Null-terminated Unicode
581 string, optionally followed by additional binary data.
582 The string is a description that the call may use to
583 further indicate the reason to be logged with a
586 @return EFI_SUCCESS Timeout has been set
587 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
588 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
589 @return EFI_DEVICE_ERROR Could not complete due to hardware error
594 CoreSetWatchdogTimer (
596 IN UINT64 WatchdogCode
,
598 IN CHAR16
*WatchdogData OPTIONAL
604 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
605 Calls the private one which contains a BOOLEAN parameter for notifications
607 @param UserHandle The handle to install the protocol handler on,
608 or NULL if a new handle is to be allocated
609 @param Protocol The protocol to add to the handle
610 @param InterfaceType Indicates whether Interface is supplied in
612 @param Interface The interface for the protocol being added
619 CoreInstallProtocolInterface (
620 IN OUT EFI_HANDLE
*UserHandle
,
621 IN EFI_GUID
*Protocol
,
622 IN EFI_INTERFACE_TYPE InterfaceType
,
628 Installs a protocol interface into the boot services environment.
630 @param UserHandle The handle to install the protocol handler on,
631 or NULL if a new handle is to be allocated
632 @param Protocol The protocol to add to the handle
633 @param InterfaceType Indicates whether Interface is supplied in
635 @param Interface The interface for the protocol being added
636 @param Notify indicates whether notify the notification list
639 @retval EFI_INVALID_PARAMETER Invalid parameter
640 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
641 @retval EFI_SUCCESS Protocol interface successfully installed
645 CoreInstallProtocolInterfaceNotify (
646 IN OUT EFI_HANDLE
*UserHandle
,
647 IN EFI_GUID
*Protocol
,
648 IN EFI_INTERFACE_TYPE InterfaceType
,
656 Installs a list of protocol interface into the boot services environment.
657 This function calls InstallProtocolInterface() in a loop. If any error
658 occures all the protocols added by this function are removed. This is
659 basically a lib function to save space.
661 @param Handle The handle to install the protocol handlers on,
662 or NULL if a new handle is to be allocated
663 @param ... EFI_GUID followed by protocol instance. A NULL
664 terminates the list. The pairs are the
665 arguments to InstallProtocolInterface(). All the
666 protocols are added to Handle.
668 @retval EFI_INVALID_PARAMETER Handle is NULL.
669 @retval EFI_SUCCESS Protocol interfaces successfully installed.
674 CoreInstallMultipleProtocolInterfaces (
675 IN OUT EFI_HANDLE
*Handle
,
682 Uninstalls a list of protocol interface in the boot services environment.
683 This function calls UnisatllProtocolInterface() in a loop. This is
684 basically a lib function to save space.
686 @param Handle The handle to uninstall the protocol
687 @param ... EFI_GUID followed by protocol instance. A NULL
688 terminates the list. The pairs are the
689 arguments to UninstallProtocolInterface(). All
690 the protocols are added to Handle.
697 CoreUninstallMultipleProtocolInterfaces (
698 IN EFI_HANDLE Handle
,
705 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
707 @param UserHandle Handle on which the interface is to be
709 @param Protocol The numeric ID of the interface
710 @param OldInterface A pointer to the old interface
711 @param NewInterface A pointer to the new interface
713 @retval EFI_SUCCESS The protocol interface was installed
714 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
715 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
720 CoreReinstallProtocolInterface (
721 IN EFI_HANDLE UserHandle
,
722 IN EFI_GUID
*Protocol
,
723 IN VOID
*OldInterface
,
724 IN VOID
*NewInterface
730 Uninstalls all instances of a protocol:interfacer from a handle.
731 If the last protocol interface is remove from the handle, the
734 @param UserHandle The handle to remove the protocol handler from
735 @param Protocol The protocol, of protocol:interface, to remove
736 @param Interface The interface, of protocol:interface, to remove
738 @retval EFI_INVALID_PARAMETER Protocol is NULL.
739 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
744 CoreUninstallProtocolInterface (
745 IN EFI_HANDLE UserHandle
,
746 IN EFI_GUID
*Protocol
,
753 Queries a handle to determine if it supports a specified protocol.
755 @param UserHandle The handle being queried.
756 @param Protocol The published unique identifier of the protocol.
757 @param Interface Supplies the address where a pointer to the
758 corresponding Protocol Interface is returned.
760 @return The requested protocol interface for the handle
766 IN EFI_HANDLE UserHandle
,
767 IN EFI_GUID
*Protocol
,
774 Locates the installed protocol handler for the handle, and
775 invokes it to obtain the protocol interface. Usage information
776 is registered in the protocol data base.
778 @param UserHandle The handle to obtain the protocol interface on
779 @param Protocol The ID of the protocol
780 @param Interface The location to return the protocol interface
781 @param ImageHandle The handle of the Image that is opening the
782 protocol interface specified by Protocol and
784 @param ControllerHandle The controller handle that is requiring this
786 @param Attributes The open mode of the protocol interface
787 specified by Handle and Protocol.
789 @retval EFI_INVALID_PARAMETER Protocol is NULL.
790 @retval EFI_SUCCESS Get the protocol interface.
796 IN EFI_HANDLE UserHandle
,
797 IN EFI_GUID
*Protocol
,
798 OUT VOID
**Interface OPTIONAL
,
799 IN EFI_HANDLE ImageHandle
,
800 IN EFI_HANDLE ControllerHandle
,
807 Return information about Opened protocols in the system
809 @param UserHandle The handle to close the protocol interface on
810 @param Protocol The ID of the protocol
811 @param EntryBuffer A pointer to a buffer of open protocol
812 information in the form of
813 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
814 @param EntryCount Number of EntryBuffer entries
819 CoreOpenProtocolInformation (
820 IN EFI_HANDLE UserHandle
,
821 IN EFI_GUID
*Protocol
,
822 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
823 OUT UINTN
*EntryCount
829 Closes a protocol on a handle that was opened using OpenProtocol().
831 @param UserHandle The handle for the protocol interface that was
832 previously opened with OpenProtocol(), and is
834 @param Protocol The published unique identifier of the protocol.
835 It is the caller's responsibility to pass in a
837 @param AgentHandle The handle of the agent that is closing the
839 @param ControllerHandle If the agent that opened a protocol is a driver
840 that follows the EFI Driver Model, then this
841 parameter is the controller handle that required
842 the protocol interface. If the agent does not
843 follow the EFI Driver Model, then this parameter
844 is optional and may be NULL.
846 @retval EFI_SUCCESS The protocol instance was closed.
847 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
849 @retval EFI_NOT_FOUND Can not find the specified protocol or
856 IN EFI_HANDLE UserHandle
,
857 IN EFI_GUID
*Protocol
,
858 IN EFI_HANDLE AgentHandle
,
859 IN EFI_HANDLE ControllerHandle
865 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
868 @param UserHandle The handle from which to retrieve the list of
869 protocol interface GUIDs.
870 @param ProtocolBuffer A pointer to the list of protocol interface GUID
871 pointers that are installed on Handle.
872 @param ProtocolBufferCount A pointer to the number of GUID pointers present
875 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
876 on Handle was returned in ProtocolBuffer. The
877 number of protocol interface GUIDs was returned
878 in ProtocolBufferCount.
879 @retval EFI_INVALID_PARAMETER Handle is NULL.
880 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
881 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
882 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
883 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
889 CoreProtocolsPerHandle (
890 IN EFI_HANDLE UserHandle
,
891 OUT EFI_GUID
***ProtocolBuffer
,
892 OUT UINTN
*ProtocolBufferCount
898 Add a new protocol notification record for the request protocol.
900 @param Protocol The requested protocol to add the notify
902 @param Event The event to signal
903 @param Registration Returns the registration record
905 @retval EFI_INVALID_PARAMETER Invalid parameter
906 @retval EFI_SUCCESS Successfully returned the registration record
912 CoreRegisterProtocolNotify (
913 IN EFI_GUID
*Protocol
,
915 OUT VOID
**Registration
920 Removes all the events in the protocol database that match Event.
922 @param Event The event to search for in the protocol
925 @return EFI_SUCCESS when done searching the entire database.
929 CoreUnregisterProtocolNotify (
935 Locates the requested handle(s) and returns them in Buffer.
937 @param SearchType The type of search to perform to locate the
939 @param Protocol The protocol to search for
940 @param SearchKey Dependant on SearchType
941 @param BufferSize On input the size of Buffer. On output the
942 size of data returned.
943 @param Buffer The buffer to return the results in
945 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
946 returned in BufferSize.
947 @retval EFI_INVALID_PARAMETER Invalid parameter
948 @retval EFI_SUCCESS Successfully found the requested handle(s) and
949 returns them in Buffer.
955 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
956 IN EFI_GUID
*Protocol OPTIONAL
,
957 IN VOID
*SearchKey OPTIONAL
,
958 IN OUT UINTN
*BufferSize
,
959 OUT EFI_HANDLE
*Buffer
965 Locates the handle to a device on the device path that best matches the specified protocol.
967 @param Protocol The protocol to search for.
968 @param DevicePath On input, a pointer to a pointer to the device
969 path. On output, the device path pointer is
970 modified to point to the remaining part of the
972 @param Device A pointer to the returned device handle.
974 @retval EFI_SUCCESS The resulting handle was returned.
975 @retval EFI_NOT_FOUND No handles matched the search.
976 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
981 CoreLocateDevicePath (
982 IN EFI_GUID
*Protocol
,
983 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
984 OUT EFI_HANDLE
*Device
990 Function returns an array of handles that support the requested protocol
991 in a buffer allocated from pool. This is a version of CoreLocateHandle()
992 that allocates a buffer for the caller.
994 @param SearchType Specifies which handle(s) are to be returned.
995 @param Protocol Provides the protocol to search by. This
996 parameter is only valid for SearchType
998 @param SearchKey Supplies the search key depending on the
1000 @param NumberHandles The number of handles returned in Buffer.
1001 @param Buffer A pointer to the buffer to return the requested
1002 array of handles that support Protocol.
1004 @retval EFI_SUCCESS The result array of handles was returned.
1005 @retval EFI_NOT_FOUND No handles match the search.
1006 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1008 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1013 CoreLocateHandleBuffer (
1014 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1015 IN EFI_GUID
*Protocol OPTIONAL
,
1016 IN VOID
*SearchKey OPTIONAL
,
1017 IN OUT UINTN
*NumberHandles
,
1018 OUT EFI_HANDLE
**Buffer
1024 Return the first Protocol Interface that matches the Protocol GUID. If
1025 Registration is passed in, return a Protocol Instance that was just add
1026 to the system. If Registration is NULL return the first Protocol Interface
1029 @param Protocol The protocol to search for
1030 @param Registration Optional Registration Key returned from
1031 RegisterProtocolNotify()
1032 @param Interface Return the Protocol interface (instance).
1034 @retval EFI_SUCCESS If a valid Interface is returned
1035 @retval EFI_INVALID_PARAMETER Invalid parameter
1036 @retval EFI_NOT_FOUND Protocol interface not found
1041 CoreLocateProtocol (
1042 IN EFI_GUID
*Protocol
,
1043 IN VOID
*Registration OPTIONAL
,
1044 OUT VOID
**Interface
1049 return handle database key.
1052 @return Handle database key.
1056 CoreGetHandleDatabaseKey (
1062 Go connect any handles that were created or modified while a image executed.
1064 @param Key The Key to show that the handle has been
1069 CoreConnectHandlesByKey (
1076 Connects one or more drivers to a controller.
1078 @param ControllerHandle Handle of the controller to be
1080 @param DriverImageHandle DriverImageHandle A pointer to an
1081 ordered list of driver image
1083 @param RemainingDevicePath RemainingDevicePath A pointer to
1084 the device path that specifies a
1085 child of the controller specified
1086 by ControllerHandle.
1087 @param Recursive Whether the function would be
1088 called recursively or not.
1090 @return Status code.
1095 CoreConnectController (
1096 IN EFI_HANDLE ControllerHandle
,
1097 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1098 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1099 IN BOOLEAN Recursive
1105 Disonnects a controller from a driver
1107 @param ControllerHandle ControllerHandle The handle of
1108 the controller from which
1111 @param DriverImageHandle DriverImageHandle The driver to
1112 disconnect from ControllerHandle.
1113 @param ChildHandle ChildHandle The handle of the
1116 @retval EFI_SUCCESS One or more drivers were
1117 disconnected from the controller.
1118 @retval EFI_SUCCESS On entry, no drivers are managing
1120 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1121 and on entry DriverImageHandle is
1122 not managing ControllerHandle.
1123 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1125 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1126 and it is not a valid EFI_HANDLE.
1127 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1128 is not a valid EFI_HANDLE.
1129 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1130 available to disconnect any
1131 drivers from ControllerHandle.
1132 @retval EFI_DEVICE_ERROR The controller could not be
1133 disconnected because of a device
1139 CoreDisconnectController (
1140 IN EFI_HANDLE ControllerHandle
,
1141 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1142 IN EFI_HANDLE ChildHandle OPTIONAL
1148 Allocates pages from the memory map.
1150 @param Type The type of allocation to perform
1151 @param MemoryType The type of memory to turn the allocated pages
1153 @param NumberOfPages The number of pages to allocate
1154 @param Memory A pointer to receive the base allocated memory
1157 @return Status. On success, Memory is filled in with the base address allocated
1158 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1160 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1161 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1162 @retval EFI_SUCCESS Pages successfully allocated.
1168 IN EFI_ALLOCATE_TYPE Type
,
1169 IN EFI_MEMORY_TYPE MemoryType
,
1170 IN UINTN NumberOfPages
,
1171 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1177 Frees previous allocated pages.
1179 @param Memory Base address of memory being freed
1180 @param NumberOfPages The number of pages to free
1182 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1183 @retval EFI_INVALID_PARAMETER Address not aligned
1184 @return EFI_SUCCESS -Pages successfully freed.
1190 IN EFI_PHYSICAL_ADDRESS Memory
,
1191 IN UINTN NumberOfPages
1197 This function returns a copy of the current memory map. The map is an array of
1198 memory descriptors, each of which describes a contiguous block of memory.
1200 @param MemoryMapSize A pointer to the size, in bytes, of the
1201 MemoryMap buffer. On input, this is the size of
1202 the buffer allocated by the caller. On output,
1203 it is the size of the buffer returned by the
1204 firmware if the buffer was large enough, or the
1205 size of the buffer needed to contain the map if
1206 the buffer was too small.
1207 @param MemoryMap A pointer to the buffer in which firmware places
1208 the current memory map.
1209 @param MapKey A pointer to the location in which firmware
1210 returns the key for the current memory map.
1211 @param DescriptorSize A pointer to the location in which firmware
1212 returns the size, in bytes, of an individual
1213 EFI_MEMORY_DESCRIPTOR.
1214 @param DescriptorVersion A pointer to the location in which firmware
1215 returns the version number associated with the
1216 EFI_MEMORY_DESCRIPTOR.
1218 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1220 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1221 buffer size needed to hold the memory map is
1222 returned in MemoryMapSize.
1223 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1229 IN OUT UINTN
*MemoryMapSize
,
1230 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1232 OUT UINTN
*DescriptorSize
,
1233 OUT UINT32
*DescriptorVersion
1239 Allocate pool of a particular type.
1241 @param PoolType Type of pool to allocate
1242 @param Size The amount of pool to allocate
1243 @param Buffer The address to return a pointer to the allocated
1246 @retval EFI_INVALID_PARAMETER PoolType not valid
1247 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1248 @retval EFI_SUCCESS Pool successfully allocated.
1254 IN EFI_MEMORY_TYPE PoolType
,
1264 @param Buffer The allocated pool entry to free
1266 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1267 @retval EFI_SUCCESS Pool successfully freed.
1279 Loads an EFI image into memory and returns a handle to the image.
1281 @param BootPolicy If TRUE, indicates that the request originates
1282 from the boot manager, and that the boot
1283 manager is attempting to load FilePath as a
1285 @param ParentImageHandle The caller's image handle.
1286 @param FilePath The specific file path from which the image is
1288 @param SourceBuffer If not NULL, a pointer to the memory location
1289 containing a copy of the image to be loaded.
1290 @param SourceSize The size in bytes of SourceBuffer.
1291 @param ImageHandle Pointer to the returned image handle that is
1292 created when the image is successfully loaded.
1294 @retval EFI_SUCCESS The image was loaded into memory.
1295 @retval EFI_NOT_FOUND The FilePath was not found.
1296 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1297 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1298 path cannot be parsed to locate the proper
1299 protocol for loading the file.
1300 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1302 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1304 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1305 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1306 image from being loaded. NULL is returned in *ImageHandle.
1307 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1308 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1309 platform policy specifies that the image should not be started.
1315 IN BOOLEAN BootPolicy
,
1316 IN EFI_HANDLE ParentImageHandle
,
1317 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1318 IN VOID
*SourceBuffer OPTIONAL
,
1319 IN UINTN SourceSize
,
1320 OUT EFI_HANDLE
*ImageHandle
1328 @param ImageHandle Handle that identifies the image to be
1331 @retval EFI_SUCCESS The image has been unloaded.
1332 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1334 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1340 IN EFI_HANDLE ImageHandle
1346 Transfer control to a loaded image's entry point.
1348 @param ImageHandle Handle of image to be started.
1349 @param ExitDataSize Pointer of the size to ExitData
1350 @param ExitData Pointer to a pointer to a data buffer that
1351 includes a Null-terminated string,
1352 optionally followed by additional binary data.
1353 The string is a description that the caller may
1354 use to further indicate the reason for the
1357 @retval EFI_INVALID_PARAMETER Invalid parameter
1358 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1359 @retval EFI_SUCCESS Successfully transfer control to the image's
1366 IN EFI_HANDLE ImageHandle
,
1367 OUT UINTN
*ExitDataSize
,
1368 OUT CHAR16
**ExitData OPTIONAL
1374 Terminates the currently loaded EFI image and returns control to boot services.
1376 @param ImageHandle Handle that identifies the image. This
1377 parameter is passed to the image on entry.
1378 @param Status The image's exit code.
1379 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1380 ExitStatus is EFI_SUCCESS.
1381 @param ExitData Pointer to a data buffer that includes a
1382 Null-terminated Unicode string, optionally
1383 followed by additional binary data. The string
1384 is a description that the caller may use to
1385 further indicate the reason for the image's
1388 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1390 @retval EFI_SUCCESS Successfully terminates the currently loaded
1392 @retval EFI_ACCESS_DENIED Should never reach there.
1393 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1399 IN EFI_HANDLE ImageHandle
,
1400 IN EFI_STATUS Status
,
1401 IN UINTN ExitDataSize
,
1402 IN CHAR16
*ExitData OPTIONAL
1408 Creates a general-purpose event structure.
1410 @param Type The type of event to create and its mode and
1412 @param NotifyTpl The task priority level of event notifications
1413 @param NotifyFunction Pointer to the events notification function
1414 @param NotifyContext Pointer to the notification functions context;
1415 corresponds to parameter "Context" in the
1416 notification function
1417 @param Event Pointer to the newly created event if the call
1418 succeeds; undefined otherwise
1420 @retval EFI_SUCCESS The event structure was created
1421 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1422 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1429 IN EFI_TPL NotifyTpl
,
1430 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1431 IN VOID
*NotifyContext
, OPTIONAL
1432 OUT EFI_EVENT
*Event
1438 Creates a general-purpose event structure
1440 @param Type The type of event to create and its mode and
1442 @param NotifyTpl The task priority level of event notifications
1443 @param NotifyFunction Pointer to the events notification function
1444 @param NotifyContext Pointer to the notification functions context;
1445 corresponds to parameter "Context" in the
1446 notification function
1447 @param EventGroup GUID for EventGroup if NULL act the same as
1449 @param Event Pointer to the newly created event if the call
1450 succeeds; undefined otherwise
1452 @retval EFI_SUCCESS The event structure was created
1453 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1454 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1461 IN EFI_TPL NotifyTpl
,
1462 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1463 IN CONST VOID
*NotifyContext
, OPTIONAL
1464 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1465 OUT EFI_EVENT
*Event
1471 Sets the type of timer and the trigger time for a timer event.
1473 @param UserEvent The timer event that is to be signaled at the
1475 @param Type The type of time that is specified in
1477 @param TriggerTime The number of 100ns units until the timer
1480 @retval EFI_SUCCESS The event has been set to be signaled at the
1482 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1488 IN EFI_EVENT UserEvent
,
1489 IN EFI_TIMER_DELAY Type
,
1490 IN UINT64 TriggerTime
1496 Signals the event. Queues the event to be notified if needed.
1498 @param UserEvent The event to signal .
1500 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1501 @retval EFI_SUCCESS The event was signaled.
1507 IN EFI_EVENT UserEvent
1513 Stops execution until an event is signaled.
1515 @param NumberOfEvents The number of events in the UserEvents array
1516 @param UserEvents An array of EFI_EVENT
1517 @param UserIndex Pointer to the index of the event which
1518 satisfied the wait condition
1520 @retval EFI_SUCCESS The event indicated by Index was signaled.
1521 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1522 function or Event was not a valid type
1523 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1529 IN UINTN NumberOfEvents
,
1530 IN EFI_EVENT
*UserEvents
,
1531 OUT UINTN
*UserIndex
1537 Closes an event and frees the event structure.
1539 @param UserEvent Event to close
1541 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1542 @retval EFI_SUCCESS The event has been closed
1548 IN EFI_EVENT UserEvent
1554 Check the status of an event.
1556 @param UserEvent The event to check
1558 @retval EFI_SUCCESS The event is in the signaled state
1559 @retval EFI_NOT_READY The event is not in the signaled state
1560 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1566 IN EFI_EVENT UserEvent
1571 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1572 global coherency domain of the processor.
1574 @param GcdMemoryType Memory type of the memory space.
1575 @param BaseAddress Base address of the memory space.
1576 @param Length Length of the memory space.
1577 @param Capabilities alterable attributes of the memory space.
1579 @retval EFI_SUCCESS Merged this memory space into GCD map.
1584 CoreAddMemorySpace (
1585 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1586 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1588 IN UINT64 Capabilities
1593 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1594 I/O resources from the global coherency domain of the processor.
1596 @param GcdAllocateType The type of allocate operation
1597 @param GcdMemoryType The desired memory type
1598 @param Alignment Align with 2^Alignment
1599 @param Length Length to allocate
1600 @param BaseAddress Base address to allocate
1601 @param ImageHandle The image handle consume the allocated space.
1602 @param DeviceHandle The device handle consume the allocated space.
1604 @retval EFI_INVALID_PARAMETER Invalid parameter.
1605 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1606 @retval EFI_SUCCESS Memory space successfully allocated.
1611 CoreAllocateMemorySpace (
1612 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1613 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1616 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1617 IN EFI_HANDLE ImageHandle
,
1618 IN EFI_HANDLE DeviceHandle OPTIONAL
1623 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1624 I/O resources from the global coherency domain of the processor.
1626 @param BaseAddress Base address of the memory space.
1627 @param Length Length of the memory space.
1629 @retval EFI_SUCCESS Space successfully freed.
1634 CoreFreeMemorySpace (
1635 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1641 Removes reserved memory, system memory, or memory-mapped I/O resources from
1642 the global coherency domain of the processor.
1644 @param BaseAddress Base address of the memory space.
1645 @param Length Length of the memory space.
1647 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1652 CoreRemoveMemorySpace (
1653 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1659 Retrieves the descriptor for a memory region containing a specified address.
1661 @param BaseAddress Specified start address
1662 @param Descriptor Specified length
1664 @retval EFI_INVALID_PARAMETER Invalid parameter
1665 @retval EFI_SUCCESS Successfully get memory space descriptor.
1670 CoreGetMemorySpaceDescriptor (
1671 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1672 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1677 Modifies the attributes for a memory region in the global coherency domain of the
1680 @param BaseAddress Specified start address
1681 @param Length Specified length
1682 @param Attributes Specified attributes
1684 @retval EFI_SUCCESS Successfully set attribute of a segment of
1690 CoreSetMemorySpaceAttributes (
1691 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1693 IN UINT64 Attributes
1698 Returns a map of the memory resources in the global coherency domain of the
1701 @param NumberOfDescriptors Number of descriptors.
1702 @param MemorySpaceMap Descriptor array
1704 @retval EFI_INVALID_PARAMETER Invalid parameter
1705 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1706 @retval EFI_SUCCESS Successfully get memory space map.
1711 CoreGetMemorySpaceMap (
1712 OUT UINTN
*NumberOfDescriptors
,
1713 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1718 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1720 @param GcdIoType IO type of the segment.
1721 @param BaseAddress Base address of the segment.
1722 @param Length Length of the segment.
1724 @retval EFI_SUCCESS Merged this segment into GCD map.
1725 @retval EFI_INVALID_PARAMETER Parameter not valid
1731 IN EFI_GCD_IO_TYPE GcdIoType
,
1732 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1738 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1739 domain of the processor.
1741 @param GcdAllocateType The type of allocate operation
1742 @param GcdIoType The desired IO type
1743 @param Alignment Align with 2^Alignment
1744 @param Length Length to allocate
1745 @param BaseAddress Base address to allocate
1746 @param ImageHandle The image handle consume the allocated space.
1747 @param DeviceHandle The device handle consume the allocated space.
1749 @retval EFI_INVALID_PARAMETER Invalid parameter.
1750 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1751 @retval EFI_SUCCESS IO space successfully allocated.
1756 CoreAllocateIoSpace (
1757 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1758 IN EFI_GCD_IO_TYPE GcdIoType
,
1761 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1762 IN EFI_HANDLE ImageHandle
,
1763 IN EFI_HANDLE DeviceHandle OPTIONAL
1768 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1769 domain of the processor.
1771 @param BaseAddress Base address of the segment.
1772 @param Length Length of the segment.
1774 @retval EFI_SUCCESS Space successfully freed.
1780 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1786 Removes reserved I/O or I/O resources from the global coherency domain of the
1789 @param BaseAddress Base address of the segment.
1790 @param Length Length of the segment.
1792 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1798 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1804 Retrieves the descriptor for an I/O region containing a specified address.
1806 @param BaseAddress Specified start address
1807 @param Descriptor Specified length
1809 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1810 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1815 CoreGetIoSpaceDescriptor (
1816 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1817 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1822 Returns a map of the I/O resources in the global coherency domain of the processor.
1824 @param NumberOfDescriptors Number of descriptors.
1825 @param IoSpaceMap Descriptor array
1827 @retval EFI_INVALID_PARAMETER Invalid parameter
1828 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1829 @retval EFI_SUCCESS Successfully get IO space map.
1835 OUT UINTN
*NumberOfDescriptors
,
1836 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1841 This is the main Dispatcher for DXE and it exits when there are no more
1842 drivers to run. Drain the mScheduledQueue and load and start a PE
1843 image for each driver. Search the mDiscoveredList to see if any driver can
1844 be placed on the mScheduledQueue. If no drivers are placed on the
1845 mScheduledQueue exit the function. On exit it is assumed the Bds()
1846 will be called, and when the Bds() exits the Dispatcher will be called
1849 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1850 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1851 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1861 Check every driver and locate a matching one. If the driver is found, the Unrequested
1862 state flag is cleared.
1864 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1865 the firmware file specified by DriverName.
1866 @param DriverName The Driver name to put in the Dependent state.
1868 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1870 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1877 IN EFI_HANDLE FirmwareVolumeHandle
,
1878 IN EFI_GUID
*DriverName
1883 Convert a driver from the Untrused back to the Scheduled state.
1885 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1886 the firmware file specified by DriverName.
1887 @param DriverName The Driver name to put in the Scheduled state
1889 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1890 was promoted to the trusted state.
1891 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1897 IN EFI_HANDLE FirmwareVolumeHandle
,
1898 IN EFI_GUID
*DriverName
1903 This routine is the driver initialization entry point. It initializes the
1904 libraries, and registers two notification functions. These notification
1905 functions are responsible for building the FV stack dynamically.
1907 @param ImageHandle The image handle.
1908 @param SystemTable The system table.
1910 @retval EFI_SUCCESS Function successfully returned.
1916 IN EFI_HANDLE ImageHandle
,
1917 IN EFI_SYSTEM_TABLE
*SystemTable
1922 Entry point of the section extraction code. Initializes an instance of the
1923 section extraction interface and installs it on a new handle.
1925 @param ImageHandle A handle for the image that is initializing this driver
1926 @param SystemTable A pointer to the EFI system table
1928 @retval EFI_SUCCESS Driver initialized successfully
1929 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1934 InitializeSectionExtraction (
1935 IN EFI_HANDLE ImageHandle
,
1936 IN EFI_SYSTEM_TABLE
*SystemTable
1941 This DXE service routine is used to process a firmware volume. In
1942 particular, it can be called by BDS to process a single firmware
1943 volume found in a capsule.
1945 @param FvHeader pointer to a firmware volume header
1946 @param Size the size of the buffer pointed to by FvHeader
1947 @param FVProtocolHandle the handle on which a firmware volume protocol
1948 was produced for the firmware volume passed in.
1950 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1952 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1953 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1959 CoreProcessFirmwareVolume (
1962 OUT EFI_HANDLE
*FVProtocolHandle
1966 //Functions used during debug buils
1970 Displays Architectural protocols that were not loaded and are required for DXE
1971 core to function. Only used in Debug Builds.
1975 CoreDisplayMissingArchProtocols (
1981 Traverse the discovered list for any drivers that were discovered but not loaded
1982 because the dependency experessions evaluated to false.
1986 CoreDisplayDiscoveredNotDispatched (
1992 Place holder function until all the Boot Services and Runtime Services are
1995 @return EFI_NOT_AVAILABLE_YET
2000 CoreEfiNotAvailableYetArg0 (
2006 Place holder function until all the Boot Services and Runtime Services are
2009 @param Arg1 Undefined
2011 @return EFI_NOT_AVAILABLE_YET
2016 CoreEfiNotAvailableYetArg1 (
2022 Place holder function until all the Boot Services and Runtime Services are available.
2024 @param Arg1 Undefined
2025 @param Arg2 Undefined
2027 @return EFI_NOT_AVAILABLE_YET
2032 CoreEfiNotAvailableYetArg2 (
2039 Place holder function until all the Boot Services and Runtime Services are available.
2041 @param Arg1 Undefined
2042 @param Arg2 Undefined
2043 @param Arg3 Undefined
2045 @return EFI_NOT_AVAILABLE_YET
2050 CoreEfiNotAvailableYetArg3 (
2058 Place holder function until all the Boot Services and Runtime Services are available.
2060 @param Arg1 Undefined
2061 @param Arg2 Undefined
2062 @param Arg3 Undefined
2063 @param Arg4 Undefined
2065 @return EFI_NOT_AVAILABLE_YET
2070 CoreEfiNotAvailableYetArg4 (
2079 Place holder function until all the Boot Services and Runtime Services are available.
2081 @param Arg1 Undefined
2082 @param Arg2 Undefined
2083 @param Arg3 Undefined
2084 @param Arg4 Undefined
2085 @param Arg5 Undefined
2087 @return EFI_NOT_AVAILABLE_YET
2092 CoreEfiNotAvailableYetArg5 (
2102 Given a compressed source buffer, this function retrieves the size of the
2103 uncompressed buffer and the size of the scratch buffer required to decompress
2104 the compressed source buffer.
2106 The GetInfo() function retrieves the size of the uncompressed buffer and the
2107 temporary scratch buffer required to decompress the buffer specified by Source
2108 and SourceSize. If the size of the uncompressed buffer or the size of the
2109 scratch buffer cannot be determined from the compressed data specified by
2110 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2111 size of the uncompressed buffer is returned in DestinationSize, the size of
2112 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2113 The GetInfo() function does not have scratch buffer available to perform a
2114 thorough checking of the validity of the source data. It just retrieves the
2115 "Original Size" field from the beginning bytes of the source data and output
2116 it as DestinationSize. And ScratchSize is specific to the decompression
2119 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2120 @param Source The source buffer containing the compressed data.
2121 @param SourceSize The size, in bytes, of the source buffer.
2122 @param DestinationSize A pointer to the size, in bytes, of the
2123 uncompressed buffer that will be generated when the
2124 compressed buffer specified by Source and
2125 SourceSize is decompressed.
2126 @param ScratchSize A pointer to the size, in bytes, of the scratch
2127 buffer that is required to decompress the
2128 compressed buffer specified by Source and
2131 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2132 DestinationSize and the size of the scratch buffer
2133 was returned in ScratchSize.
2134 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2135 the scratch buffer cannot be determined from the
2136 compressed data specified by Source and
2142 DxeMainUefiDecompressGetInfo (
2143 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2145 IN UINT32 SourceSize
,
2146 OUT UINT32
*DestinationSize
,
2147 OUT UINT32
*ScratchSize
2152 Decompresses a compressed source buffer.
2154 The Decompress() function extracts decompressed data to its original form.
2155 This protocol is designed so that the decompression algorithm can be
2156 implemented without using any memory services. As a result, the Decompress()
2157 Function is not allowed to call AllocatePool() or AllocatePages() in its
2158 implementation. It is the caller's responsibility to allocate and free the
2159 Destination and Scratch buffers.
2160 If the compressed source data specified by Source and SourceSize is
2161 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2162 the compressed source data specified by Source and SourceSize is not in a
2163 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2165 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2166 @param Source The source buffer containing the compressed data.
2167 @param SourceSize SourceSizeThe size of source data.
2168 @param Destination On output, the destination buffer that contains
2169 the uncompressed data.
2170 @param DestinationSize The size of the destination buffer. The size of
2171 the destination buffer needed is obtained from
2172 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2173 @param Scratch A temporary scratch buffer that is used to perform
2175 @param ScratchSize The size of scratch buffer. The size of the
2176 scratch buffer needed is obtained from GetInfo().
2178 @retval EFI_SUCCESS Decompression completed successfully, and the
2179 uncompressed buffer is returned in Destination.
2180 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2181 SourceSize is corrupted (not in a valid
2187 DxeMainUefiDecompress (
2188 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2190 IN UINT32 SourceSize
,
2191 IN OUT VOID
*Destination
,
2192 IN UINT32 DestinationSize
,
2193 IN OUT VOID
*Scratch
,
2194 IN UINT32 ScratchSize
2198 SEP member function. This function creates and returns a new section stream
2199 handle to represent the new section stream.
2201 @param SectionStreamLength Size in bytes of the section stream.
2202 @param SectionStream Buffer containing the new section stream.
2203 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2204 output contains the new section stream handle.
2206 @retval EFI_SUCCESS The section stream is created successfully.
2207 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2208 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2215 IN UINTN SectionStreamLength
,
2216 IN VOID
*SectionStream
,
2217 OUT UINTN
*SectionStreamHandle
2223 SEP member function. Retrieves requested section from section stream.
2225 @param SectionStreamHandle The section stream from which to extract the
2227 @param SectionType A pointer to the type of section to search for.
2228 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2229 then SectionDefinitionGuid indicates which of
2230 these types of sections to search for.
2231 @param SectionInstance Indicates which instance of the requested
2233 @param Buffer Double indirection to buffer. If *Buffer is
2234 non-null on input, then the buffer is caller
2235 allocated. If Buffer is NULL, then the buffer
2236 is callee allocated. In either case, the
2237 requried buffer size is returned in *BufferSize.
2238 @param BufferSize On input, indicates the size of *Buffer if
2239 *Buffer is non-null on input. On output,
2240 indicates the required size (allocated size if
2241 callee allocated) of *Buffer.
2242 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2243 indicates the authentication status of the
2244 output buffer. If the input section's
2245 GuidedSectionHeader.Attributes field
2246 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2247 bit as clear, AuthenticationStatus must return
2248 zero. Both local bits (19:16) and aggregate
2249 bits (3:0) in AuthenticationStatus are returned
2250 by ExtractSection(). These bits reflect the
2251 status of the extraction operation. The bit
2252 pattern in both regions must be the same, as
2253 the local and aggregate authentication statuses
2254 have equivalent meaning at this level. If the
2255 function returns anything other than
2256 EFI_SUCCESS, the value of *AuthenticationStatus
2259 @retval EFI_SUCCESS Section was retrieved successfully
2260 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2261 section stream with its
2262 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2263 but there was no corresponding GUIDed Section
2264 Extraction Protocol in the handle database.
2265 *Buffer is unmodified.
2266 @retval EFI_NOT_FOUND An error was encountered when parsing the
2267 SectionStream. This indicates the SectionStream
2268 is not correctly formatted.
2269 @retval EFI_NOT_FOUND The requested section does not exist.
2270 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2272 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2273 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2274 insufficient to contain the requested section.
2275 The input buffer is filled and section contents
2282 IN UINTN SectionStreamHandle
,
2283 IN EFI_SECTION_TYPE
*SectionType
,
2284 IN EFI_GUID
*SectionDefinitionGuid
,
2285 IN UINTN SectionInstance
,
2287 IN OUT UINTN
*BufferSize
,
2288 OUT UINT32
*AuthenticationStatus
2293 SEP member function. Deletes an existing section stream
2295 @param StreamHandleToClose Indicates the stream to close
2297 @retval EFI_SUCCESS The section stream is closed sucessfully.
2298 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2299 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2305 CloseSectionStream (
2306 IN UINTN StreamHandleToClose
2310 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2311 table and registers it into the system table.
2314 This function allocates memory, frees it, and then allocates memory at an
2315 address within the initial allocation. Since this function is called early
2316 in DXE core initialization (before drivers are dispatched), this should not
2321 CoreInitializeDebugImageInfoTable (
2327 Update the CRC32 in the Debug Table.
2328 Since the CRC32 service is made available by the Runtime driver, we have to
2329 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2330 This function is called elsewhere by the core when the runtime architectural
2331 protocol is produced.
2335 CoreUpdateDebugTableCrc32 (
2341 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2342 the table if it's not large enough to accomidate another entry.
2344 @param ImageInfoType type of debug image information
2345 @param LoadedImage pointer to the loaded image protocol for the image being
2347 @param ImageHandle image handle for the image being loaded
2351 CoreNewDebugImageInfoEntry (
2352 IN UINT32 ImageInfoType
,
2353 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2354 IN EFI_HANDLE ImageHandle
2359 Removes and frees an entry from the DebugImageInfo Table.
2361 @param ImageHandle image handle for the image being unloaded
2365 CoreRemoveDebugImageInfoEntry (
2366 EFI_HANDLE ImageHandle
2371 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2373 @param ImageHandle The image handle.
2374 @param SystemTable The system table.
2376 @retval EFI_SUCCESS Successfully initialized firmware volume block
2382 FwVolBlockDriverInit (
2383 IN EFI_HANDLE ImageHandle
,
2384 IN EFI_SYSTEM_TABLE
*SystemTable
2389 This routine produces a firmware volume block protocol on a given
2392 @param BaseAddress base address of the firmware volume image
2393 @param Length length of the firmware volume image
2394 @param ParentHandle handle of parent firmware volume, if this image
2395 came from an FV image file in another firmware
2396 volume (ala capsules)
2397 @param FvProtocol Firmware volume block protocol produced.
2399 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2400 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2401 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2406 ProduceFVBProtocolOnBuffer (
2407 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2409 IN EFI_HANDLE ParentHandle
,
2410 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2415 Raising to the task priority level of the mutual exclusion
2416 lock, and then acquires ownership of the lock.
2418 @param Lock The lock to acquire
2430 Initialize a basic mutual exclusion lock. Each lock
2431 provides mutual exclusion access at it's task priority
2432 level. Since there is no-premption (at any TPL) or
2433 multiprocessor support, acquiring the lock only consists
2434 of raising to the locks TPL.
2436 @param Lock The EFI_LOCK structure to initialize
2438 @retval EFI_SUCCESS Lock Owned.
2439 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2443 CoreAcquireLockOrFail (
2449 Releases ownership of the mutual exclusion lock, and
2450 restores the previous task priority level.
2452 @param Lock The lock to release
2454 @return Lock unowned