2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
6 All rights reserved. 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/DriverBinding.h>
29 #include <Protocol/VariableWrite.h>
30 #include <Protocol/PlatformDriverOverride.h>
31 #include <Protocol/Variable.h>
32 #include <Protocol/Timer.h>
33 #include <Protocol/SimpleFileSystem.h>
34 #include <Protocol/Bds.h>
35 #include <Protocol/RealTimeClock.h>
36 #include <Protocol/WatchdogTimer.h>
37 #include <Protocol/FirmwareVolume2.h>
38 #include <Protocol/MonotonicCounter.h>
39 #include <Protocol/StatusCode.h>
40 #include <Protocol/Decompress.h>
41 #include <Protocol/LoadPe32Image.h>
42 #include <Protocol/Security.h>
43 #include <Protocol/Ebc.h>
44 #include <Protocol/Reset.h>
45 #include <Protocol/Cpu.h>
46 #include <Protocol/Metronome.h>
47 #include <Protocol/FirmwareVolumeBlock.h>
48 #include <Protocol/Capsule.h>
49 #include <Protocol/BusSpecificDriverOverride.h>
50 #include <Protocol/TcgService.h>
51 #include <Protocol/TcgPlatform.h>
52 #include <Guid/MemoryTypeInformation.h>
53 #include <Guid/FirmwareFileSystem2.h>
54 #include <Guid/HobList.h>
55 #include <Guid/DebugImageInfoTable.h>
56 #include <Guid/FileInfo.h>
57 #include <Guid/Apriori.h>
58 #include <Guid/DxeServices.h>
59 #include <Guid/MemoryAllocationHob.h>
60 #include <Guid/EventLegacyBios.h>
61 #include <Guid/EventGroup.h>
64 #include <Library/DxeCoreEntryPoint.h>
65 #include <Library/DebugLib.h>
66 #include <Library/UefiLib.h>
67 #include <Library/BaseLib.h>
68 #include <Library/HobLib.h>
69 #include <Library/PerformanceLib.h>
70 #include <Library/UefiDecompressLib.h>
71 #include <Library/ExtractGuidedSectionLib.h>
72 #include <Library/CacheMaintenanceLib.h>
73 #include <Library/BaseMemoryLib.h>
74 #include <Library/PeCoffLib.h>
75 #include <Library/PcdLib.h>
76 #include <Library/MemoryAllocationLib.h>
77 #include <Library/DevicePathLib.h>
78 #include <Library/UefiBootServicesTableLib.h>
79 #include <Library/ReportStatusCodeLib.h>
80 #include <Library/TimerLib.h>
83 // attributes for reserved memory before it is promoted to system memory
85 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
86 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
87 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
90 // range for memory mapped port I/O on IPF
92 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
96 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
97 /// to save time. A EFI_DEP_PUSH is evauated one an
98 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
99 /// Driver Execution Environment Core Interface use 0xff
100 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
101 /// defined to a new value that is not conflicting with PI spec.
103 #define EFI_DEP_REPLACE_TRUE 0xff
106 /// Define the initial size of the dependency expression evaluation stack
108 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
111 EFI_GUID
*ProtocolGuid
;
116 } ARCHITECTURAL_PROTOCOL_ENTRY
;
119 // DXE Dispatcher Data structures
122 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
125 LIST_ENTRY Link
; // mFvHandleList
130 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
133 LIST_ENTRY Link
; // mDriverList
135 LIST_ENTRY ScheduledLink
; // mScheduledQueue
139 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
140 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
147 EFI_GUID BeforeAfterGuid
;
154 BOOLEAN DepexProtocolError
;
156 EFI_HANDLE ImageHandle
;
158 } EFI_CORE_DRIVER_ENTRY
;
161 //The data structure of GCD memory map entry
163 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
167 EFI_PHYSICAL_ADDRESS BaseAddress
;
171 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
172 EFI_GCD_IO_TYPE GcdIoType
;
173 EFI_HANDLE ImageHandle
;
174 EFI_HANDLE DeviceHandle
;
178 // DXE Core Global Variables
180 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
181 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
182 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
183 extern EFI_HANDLE gDxeCoreImageHandle
;
185 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
187 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
188 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
189 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
190 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
191 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
192 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
193 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
195 extern EFI_TPL gEfiCurrentTpl
;
197 extern EFI_GUID
*gDxeCoreFileName
;
198 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
200 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
202 extern BOOLEAN gDispatcherRunning
;
203 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
206 // Service Initialization Functions
212 Called to initialize the pool.
222 Called to initialize the memory map and add descriptors to
223 the current descriptor list.
224 The first descriptor that is added must be general usable
225 memory as the addition allocates heap.
227 @param Type The type of memory to add
228 @param Start The starting address in the memory range Must be
230 @param NumberOfPages The number of pages in the range
231 @param Attribute Attributes of the memory to add
233 @return None. The range is added to the memory map
237 CoreAddMemoryDescriptor (
238 IN EFI_MEMORY_TYPE Type
,
239 IN EFI_PHYSICAL_ADDRESS Start
,
240 IN UINT64 NumberOfPages
,
246 Release memory lock on mGcdMemorySpaceLock.
250 CoreReleaseGcdMemoryLock (
256 Acquire memory lock on mGcdMemorySpaceLock.
260 CoreAcquireGcdMemoryLock (
266 External function. Initializes memory services based on the memory
267 descriptor HOBs. This function is responsible for priming the memory
268 map, so memory allocations and resource allocations can be made.
269 The first part of this function can not depend on any memory services
270 until at least one memory descriptor is provided to the memory services.
272 @param HobStart The start address of the HOB.
273 @param MemoryBaseAddress Start address of memory region found to init DXE
275 @param MemoryLength Length of memory region found to init DXE core.
277 @retval EFI_SUCCESS Memory services successfully initialized.
281 CoreInitializeMemoryServices (
283 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
284 OUT UINT64
*MemoryLength
290 External function. Initializes the GCD and memory services based on the memory
291 descriptor HOBs. This function is responsible for priming the GCD map and the
292 memory map, so memory allocations and resource allocations can be made. The
293 HobStart will be relocated to a pool buffer.
295 @param HobStart The start address of the HOB
296 @param MemoryBaseAddress Start address of memory region found to init DXE
298 @param MemoryLength Length of memory region found to init DXE core.
300 @retval EFI_SUCCESS GCD services successfully initialized.
304 CoreInitializeGcdServices (
305 IN OUT VOID
**HobStart
,
306 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
307 IN UINT64 MemoryLength
312 Initializes "event" support.
314 @retval EFI_SUCCESS Always return success
318 CoreInitializeEventServices (
324 Add the Image Services to EFI Boot Services Table and install the protocol
325 interfaces for this image.
327 @param HobStart The HOB to initialize
333 CoreInitializeImageServices (
339 Creates an event that is fired everytime a Protocol of a specific type is installed.
343 CoreNotifyOnArchProtocolInstallation (
349 Return TRUE if all AP services are availible.
351 @retval EFI_SUCCESS All AP services are available
352 @retval EFI_NOT_FOUND At least one AP service is not available
356 CoreAllEfiServicesAvailable (
362 Calcualte the 32-bit CRC in a EFI table using the service provided by the
365 @param Hdr Pointer to an EFI standard header
370 IN OUT EFI_TABLE_HEADER
*Hdr
375 Called by the platform code to process a tick.
377 @param Duration The number of 100ns elasped since the last call
389 Initialize the dispatcher. Initialize the notification function that runs when
390 an FV2 protocol is added to the system.
394 CoreInitializeDispatcher (
400 This is the POSTFIX version of the dependency evaluator. This code does
401 not need to handle Before or After, as it is not valid to call this
402 routine in this case. The SOR is just ignored and is a nop in the grammer.
403 POSTFIX means all the math is done on top of the stack.
405 @param DriverEntry DriverEntry element to update.
407 @retval TRUE If driver is ready to run.
408 @retval FALSE If driver is not ready to run or some fatal error
414 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
419 Preprocess dependency expression and update DriverEntry to reflect the
420 state of Before, After, and SOR dependencies. If DriverEntry->Before
421 or DriverEntry->After is set it will never be cleared. If SOR is set
422 it will be cleared by CoreSchedule(), and then the driver can be
425 @param DriverEntry DriverEntry element to update .
427 @retval EFI_SUCCESS It always works.
431 CorePreProcessDepex (
432 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
438 Terminates all boot services.
440 @param ImageHandle Handle that identifies the exiting image.
441 @param MapKey Key to the latest memory map.
443 @retval EFI_SUCCESS Boot Services terminated
444 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
449 CoreExitBootServices (
450 IN EFI_HANDLE ImageHandle
,
456 Make sure the memory map is following all the construction rules,
457 it is the last time to check memory map error before exit boot services.
459 @param MapKey Memory map key
461 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
463 @retval EFI_SUCCESS Valid memory map.
467 CoreTerminateMemoryMap (
473 Signals all events in the EventGroup.
475 @param EventGroup The list to signal
479 CoreNotifySignalList (
480 IN EFI_GUID
*EventGroup
486 Boot Service called to add, modify, or remove a system configuration table from
487 the EFI System Table.
489 @param Guid Pointer to the GUID for the entry to add, update, or
491 @param Table Pointer to the configuration table for the entry to add,
492 update, or remove, may be NULL.
494 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
495 @return EFI_INVALID_PARAMETER Input GUID not valid.
496 @return EFI_NOT_FOUND Attempted to delete non-existant entry
497 @return EFI_OUT_OF_RESOURCES Not enough memory available
502 CoreInstallConfigurationTable (
510 Raise the task priority level to the new level.
511 High level is implemented by disabling processor interrupts.
513 @param NewTpl New task priority level
515 @return The previous task priority level
527 Lowers the task priority to the previous value. If the new
528 priority unmasks events at a higher priority, they are dispatched.
530 @param NewTpl New, lower, task priority
542 Introduces a fine-grained stall.
544 @param Microseconds The number of microseconds to stall execution.
546 @retval EFI_SUCCESS Execution was stalled for at least the requested
547 amount of microseconds.
548 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
554 IN UINTN Microseconds
560 Sets the system's watchdog timer.
562 @param Timeout The number of seconds to set the watchdog timer to.
563 A value of zero disables the timer.
564 @param WatchdogCode The numeric code to log on a watchdog timer timeout
565 event. The firmware reserves codes 0x0000 to 0xFFFF.
566 Loaders and operating systems may use other timeout
568 @param DataSize The size, in bytes, of WatchdogData.
569 @param WatchdogData A data buffer that includes a Null-terminated Unicode
570 string, optionally followed by additional binary data.
571 The string is a description that the call may use to
572 further indicate the reason to be logged with a
575 @return EFI_SUCCESS Timeout has been set
576 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
577 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
578 @return EFI_DEVICE_ERROR Could not complete due to hardware error
583 CoreSetWatchdogTimer (
585 IN UINT64 WatchdogCode
,
587 IN CHAR16
*WatchdogData OPTIONAL
593 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
594 Calls the private one which contains a BOOLEAN parameter for notifications
596 @param UserHandle The handle to install the protocol handler on,
597 or NULL if a new handle is to be allocated
598 @param Protocol The protocol to add to the handle
599 @param InterfaceType Indicates whether Interface is supplied in
601 @param Interface The interface for the protocol being added
608 CoreInstallProtocolInterface (
609 IN OUT EFI_HANDLE
*UserHandle
,
610 IN EFI_GUID
*Protocol
,
611 IN EFI_INTERFACE_TYPE InterfaceType
,
617 Installs a protocol interface into the boot services environment.
619 @param UserHandle The handle to install the protocol handler on,
620 or NULL if a new handle is to be allocated
621 @param Protocol The protocol to add to the handle
622 @param InterfaceType Indicates whether Interface is supplied in
624 @param Interface The interface for the protocol being added
625 @param Notify indicates whether notify the notification list
628 @retval EFI_INVALID_PARAMETER Invalid parameter
629 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
630 @retval EFI_SUCCESS Protocol interface successfully installed
634 CoreInstallProtocolInterfaceNotify (
635 IN OUT EFI_HANDLE
*UserHandle
,
636 IN EFI_GUID
*Protocol
,
637 IN EFI_INTERFACE_TYPE InterfaceType
,
645 Installs a list of protocol interface into the boot services environment.
646 This function calls InstallProtocolInterface() in a loop. If any error
647 occures all the protocols added by this function are removed. This is
648 basically a lib function to save space.
650 @param Handle The handle to install the protocol handlers on,
651 or NULL if a new handle is to be allocated
652 @param ... EFI_GUID followed by protocol instance. A NULL
653 terminates the list. The pairs are the
654 arguments to InstallProtocolInterface(). All the
655 protocols are added to Handle.
657 @retval EFI_INVALID_PARAMETER Handle is NULL.
658 @retval EFI_SUCCESS Protocol interfaces successfully installed.
663 CoreInstallMultipleProtocolInterfaces (
664 IN OUT EFI_HANDLE
*Handle
,
671 Uninstalls a list of protocol interface in the boot services environment.
672 This function calls UnisatllProtocolInterface() in a loop. This is
673 basically a lib function to save space.
675 @param Handle The handle to uninstall the protocol
676 @param ... EFI_GUID followed by protocol instance. A NULL
677 terminates the list. The pairs are the
678 arguments to UninstallProtocolInterface(). All
679 the protocols are added to Handle.
686 CoreUninstallMultipleProtocolInterfaces (
687 IN EFI_HANDLE Handle
,
694 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
696 @param UserHandle Handle on which the interface is to be
698 @param Protocol The numeric ID of the interface
699 @param OldInterface A pointer to the old interface
700 @param NewInterface A pointer to the new interface
702 @retval EFI_SUCCESS The protocol interface was installed
703 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
704 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
709 CoreReinstallProtocolInterface (
710 IN EFI_HANDLE UserHandle
,
711 IN EFI_GUID
*Protocol
,
712 IN VOID
*OldInterface
,
713 IN VOID
*NewInterface
719 Uninstalls all instances of a protocol:interfacer from a handle.
720 If the last protocol interface is remove from the handle, the
723 @param UserHandle The handle to remove the protocol handler from
724 @param Protocol The protocol, of protocol:interface, to remove
725 @param Interface The interface, of protocol:interface, to remove
727 @retval EFI_INVALID_PARAMETER Protocol is NULL.
728 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
733 CoreUninstallProtocolInterface (
734 IN EFI_HANDLE UserHandle
,
735 IN EFI_GUID
*Protocol
,
742 Queries a handle to determine if it supports a specified protocol.
744 @param UserHandle The handle being queried.
745 @param Protocol The published unique identifier of the protocol.
746 @param Interface Supplies the address where a pointer to the
747 corresponding Protocol Interface is returned.
749 @return The requested protocol interface for the handle
755 IN EFI_HANDLE UserHandle
,
756 IN EFI_GUID
*Protocol
,
763 Locates the installed protocol handler for the handle, and
764 invokes it to obtain the protocol interface. Usage information
765 is registered in the protocol data base.
767 @param UserHandle The handle to obtain the protocol interface on
768 @param Protocol The ID of the protocol
769 @param Interface The location to return the protocol interface
770 @param ImageHandle The handle of the Image that is opening the
771 protocol interface specified by Protocol and
773 @param ControllerHandle The controller handle that is requiring this
775 @param Attributes The open mode of the protocol interface
776 specified by Handle and Protocol.
778 @retval EFI_INVALID_PARAMETER Protocol is NULL.
779 @retval EFI_SUCCESS Get the protocol interface.
785 IN EFI_HANDLE UserHandle
,
786 IN EFI_GUID
*Protocol
,
787 OUT VOID
**Interface OPTIONAL
,
788 IN EFI_HANDLE ImageHandle
,
789 IN EFI_HANDLE ControllerHandle
,
796 Return information about Opened protocols in the system
798 @param UserHandle The handle to close the protocol interface on
799 @param Protocol The ID of the protocol
800 @param EntryBuffer A pointer to a buffer of open protocol
801 information in the form of
802 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
803 @param EntryCount Number of EntryBuffer entries
808 CoreOpenProtocolInformation (
809 IN EFI_HANDLE UserHandle
,
810 IN EFI_GUID
*Protocol
,
811 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
812 OUT UINTN
*EntryCount
818 Closes a protocol on a handle that was opened using OpenProtocol().
820 @param UserHandle The handle for the protocol interface that was
821 previously opened with OpenProtocol(), and is
823 @param Protocol The published unique identifier of the protocol.
824 It is the caller's responsibility to pass in a
826 @param AgentHandle The handle of the agent that is closing the
828 @param ControllerHandle If the agent that opened a protocol is a driver
829 that follows the EFI Driver Model, then this
830 parameter is the controller handle that required
831 the protocol interface. If the agent does not
832 follow the EFI Driver Model, then this parameter
833 is optional and may be NULL.
835 @retval EFI_SUCCESS The protocol instance was closed.
836 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
838 @retval EFI_NOT_FOUND Can not find the specified protocol or
845 IN EFI_HANDLE UserHandle
,
846 IN EFI_GUID
*Protocol
,
847 IN EFI_HANDLE AgentHandle
,
848 IN EFI_HANDLE ControllerHandle
854 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
857 @param UserHandle The handle from which to retrieve the list of
858 protocol interface GUIDs.
859 @param ProtocolBuffer A pointer to the list of protocol interface GUID
860 pointers that are installed on Handle.
861 @param ProtocolBufferCount A pointer to the number of GUID pointers present
864 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
865 on Handle was returned in ProtocolBuffer. The
866 number of protocol interface GUIDs was returned
867 in ProtocolBufferCount.
868 @retval EFI_INVALID_PARAMETER Handle is NULL.
869 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
870 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
871 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
872 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
878 CoreProtocolsPerHandle (
879 IN EFI_HANDLE UserHandle
,
880 OUT EFI_GUID
***ProtocolBuffer
,
881 OUT UINTN
*ProtocolBufferCount
887 Add a new protocol notification record for the request protocol.
889 @param Protocol The requested protocol to add the notify
891 @param Event The event to signal
892 @param Registration Returns the registration record
894 @retval EFI_INVALID_PARAMETER Invalid parameter
895 @retval EFI_SUCCESS Successfully returned the registration record
901 CoreRegisterProtocolNotify (
902 IN EFI_GUID
*Protocol
,
904 OUT VOID
**Registration
909 Removes all the events in the protocol database that match Event.
911 @param Event The event to search for in the protocol
914 @return EFI_SUCCESS when done searching the entire database.
918 CoreUnregisterProtocolNotify (
924 Locates the requested handle(s) and returns them in Buffer.
926 @param SearchType The type of search to perform to locate the
928 @param Protocol The protocol to search for
929 @param SearchKey Dependant on SearchType
930 @param BufferSize On input the size of Buffer. On output the
931 size of data returned.
932 @param Buffer The buffer to return the results in
934 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
935 returned in BufferSize.
936 @retval EFI_INVALID_PARAMETER Invalid parameter
937 @retval EFI_SUCCESS Successfully found the requested handle(s) and
938 returns them in Buffer.
944 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
945 IN EFI_GUID
*Protocol OPTIONAL
,
946 IN VOID
*SearchKey OPTIONAL
,
947 IN OUT UINTN
*BufferSize
,
948 OUT EFI_HANDLE
*Buffer
954 Locates the handle to a device on the device path that best matches the specified protocol.
956 @param Protocol The protocol to search for.
957 @param DevicePath On input, a pointer to a pointer to the device
958 path. On output, the device path pointer is
959 modified to point to the remaining part of the
961 @param Device A pointer to the returned device handle.
963 @retval EFI_SUCCESS The resulting handle was returned.
964 @retval EFI_NOT_FOUND No handles matched the search.
965 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
970 CoreLocateDevicePath (
971 IN EFI_GUID
*Protocol
,
972 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
973 OUT EFI_HANDLE
*Device
979 Function returns an array of handles that support the requested protocol
980 in a buffer allocated from pool. This is a version of CoreLocateHandle()
981 that allocates a buffer for the caller.
983 @param SearchType Specifies which handle(s) are to be returned.
984 @param Protocol Provides the protocol to search by. This
985 parameter is only valid for SearchType
987 @param SearchKey Supplies the search key depending on the
989 @param NumberHandles The number of handles returned in Buffer.
990 @param Buffer A pointer to the buffer to return the requested
991 array of handles that support Protocol.
993 @retval EFI_SUCCESS The result array of handles was returned.
994 @retval EFI_NOT_FOUND No handles match the search.
995 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
997 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1002 CoreLocateHandleBuffer (
1003 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1004 IN EFI_GUID
*Protocol OPTIONAL
,
1005 IN VOID
*SearchKey OPTIONAL
,
1006 IN OUT UINTN
*NumberHandles
,
1007 OUT EFI_HANDLE
**Buffer
1013 Return the first Protocol Interface that matches the Protocol GUID. If
1014 Registration is pasased in return a Protocol Instance that was just add
1015 to the system. If Retistration is NULL return the first Protocol Interface
1018 @param Protocol The protocol to search for
1019 @param Registration Optional Registration Key returned from
1020 RegisterProtocolNotify()
1021 @param Interface Return the Protocol interface (instance).
1023 @retval EFI_SUCCESS If a valid Interface is returned
1024 @retval EFI_INVALID_PARAMETER Invalid parameter
1025 @retval EFI_NOT_FOUND Protocol interface not found
1030 CoreLocateProtocol (
1031 IN EFI_GUID
*Protocol
,
1032 IN VOID
*Registration OPTIONAL
,
1033 OUT VOID
**Interface
1038 return handle database key.
1041 @return Handle database key.
1045 CoreGetHandleDatabaseKey (
1051 Go connect any handles that were created or modified while a image executed.
1053 @param Key The Key to show that the handle has been
1058 CoreConnectHandlesByKey (
1065 Connects one or more drivers to a controller.
1067 @param ControllerHandle Handle of the controller to be
1069 @param DriverImageHandle DriverImageHandle A pointer to an
1070 ordered list of driver image
1072 @param RemainingDevicePath RemainingDevicePath A pointer to
1073 the device path that specifies a
1074 child of the controller specified
1075 by ControllerHandle.
1076 @param Recursive Whether the function would be
1077 called recursively or not.
1079 @return Status code.
1084 CoreConnectController (
1085 IN EFI_HANDLE ControllerHandle
,
1086 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1087 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1088 IN BOOLEAN Recursive
1094 Disonnects a controller from a driver
1096 @param ControllerHandle ControllerHandle The handle of
1097 the controller from which
1100 @param DriverImageHandle DriverImageHandle The driver to
1101 disconnect from ControllerHandle.
1102 @param ChildHandle ChildHandle The handle of the
1105 @retval EFI_SUCCESS One or more drivers were
1106 disconnected from the controller.
1107 @retval EFI_SUCCESS On entry, no drivers are managing
1109 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1110 and on entry DriverImageHandle is
1111 not managing ControllerHandle.
1112 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1114 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1115 and it is not a valid EFI_HANDLE.
1116 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1117 is not a valid EFI_HANDLE.
1118 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1119 available to disconnect any
1120 drivers from ControllerHandle.
1121 @retval EFI_DEVICE_ERROR The controller could not be
1122 disconnected because of a device
1128 CoreDisconnectController (
1129 IN EFI_HANDLE ControllerHandle
,
1130 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1131 IN EFI_HANDLE ChildHandle OPTIONAL
1137 Allocates pages from the memory map.
1139 @param Type The type of allocation to perform
1140 @param MemoryType The type of memory to turn the allocated pages
1142 @param NumberOfPages The number of pages to allocate
1143 @param Memory A pointer to receive the base allocated memory
1146 @return Status. On success, Memory is filled in with the base address allocated
1147 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1149 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1150 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1151 @retval EFI_SUCCESS Pages successfully allocated.
1157 IN EFI_ALLOCATE_TYPE Type
,
1158 IN EFI_MEMORY_TYPE MemoryType
,
1159 IN UINTN NumberOfPages
,
1160 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1166 Frees previous allocated pages.
1168 @param Memory Base address of memory being freed
1169 @param NumberOfPages The number of pages to free
1171 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1172 @retval EFI_INVALID_PARAMETER Address not aligned
1173 @return EFI_SUCCESS -Pages successfully freed.
1179 IN EFI_PHYSICAL_ADDRESS Memory
,
1180 IN UINTN NumberOfPages
1186 This function returns a copy of the current memory map. The map is an array of
1187 memory descriptors, each of which describes a contiguous block of memory.
1189 @param MemoryMapSize A pointer to the size, in bytes, of the
1190 MemoryMap buffer. On input, this is the size of
1191 the buffer allocated by the caller. On output,
1192 it is the size of the buffer returned by the
1193 firmware if the buffer was large enough, or the
1194 size of the buffer needed to contain the map if
1195 the buffer was too small.
1196 @param MemoryMap A pointer to the buffer in which firmware places
1197 the current memory map.
1198 @param MapKey A pointer to the location in which firmware
1199 returns the key for the current memory map.
1200 @param DescriptorSize A pointer to the location in which firmware
1201 returns the size, in bytes, of an individual
1202 EFI_MEMORY_DESCRIPTOR.
1203 @param DescriptorVersion A pointer to the location in which firmware
1204 returns the version number associated with the
1205 EFI_MEMORY_DESCRIPTOR.
1207 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1209 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1210 buffer size needed to hold the memory map is
1211 returned in MemoryMapSize.
1212 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1218 IN OUT UINTN
*MemoryMapSize
,
1219 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1221 OUT UINTN
*DescriptorSize
,
1222 OUT UINT32
*DescriptorVersion
1228 Allocate pool of a particular type.
1230 @param PoolType Type of pool to allocate
1231 @param Size The amount of pool to allocate
1232 @param Buffer The address to return a pointer to the allocated
1235 @retval EFI_INVALID_PARAMETER PoolType not valid
1236 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1237 @retval EFI_SUCCESS Pool successfully allocated.
1243 IN EFI_MEMORY_TYPE PoolType
,
1253 @param Buffer The allocated pool entry to free
1255 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1256 @retval EFI_SUCCESS Pool successfully freed.
1268 Loads an EFI image into memory and returns a handle to the image.
1270 @param BootPolicy If TRUE, indicates that the request originates
1271 from the boot manager, and that the boot
1272 manager is attempting to load FilePath as a
1274 @param ParentImageHandle The caller's image handle.
1275 @param FilePath The specific file path from which the image is
1277 @param SourceBuffer If not NULL, a pointer to the memory location
1278 containing a copy of the image to be loaded.
1279 @param SourceSize The size in bytes of SourceBuffer.
1280 @param ImageHandle Pointer to the returned image handle that is
1281 created when the image is successfully loaded.
1283 @retval EFI_SUCCESS The image was loaded into memory.
1284 @retval EFI_NOT_FOUND The FilePath was not found.
1285 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1286 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1287 path cannot be parsed to locate the proper
1288 protocol for loading the file.
1289 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1296 IN BOOLEAN BootPolicy
,
1297 IN EFI_HANDLE ParentImageHandle
,
1298 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1299 IN VOID
*SourceBuffer OPTIONAL
,
1300 IN UINTN SourceSize
,
1301 OUT EFI_HANDLE
*ImageHandle
1309 @param ImageHandle Handle that identifies the image to be
1312 @retval EFI_SUCCESS The image has been unloaded.
1313 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1315 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1321 IN EFI_HANDLE ImageHandle
1327 Transfer control to a loaded image's entry point.
1329 @param ImageHandle Handle of image to be started.
1330 @param ExitDataSize Pointer of the size to ExitData
1331 @param ExitData Pointer to a pointer to a data buffer that
1332 includes a Null-terminated Unicode string,
1333 optionally followed by additional binary data.
1334 The string is a description that the caller may
1335 use to further indicate the reason for the
1338 @retval EFI_INVALID_PARAMETER Invalid parameter
1339 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1340 @retval EFI_SUCCESS Successfully transfer control to the image's
1347 IN EFI_HANDLE ImageHandle
,
1348 OUT UINTN
*ExitDataSize
,
1349 OUT CHAR16
**ExitData OPTIONAL
1355 Terminates the currently loaded EFI image and returns control to boot services.
1357 @param ImageHandle Handle that identifies the image. This
1358 parameter is passed to the image on entry.
1359 @param Status The image's exit code.
1360 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1361 ExitStatus is EFI_SUCCESS.
1362 @param ExitData Pointer to a data buffer that includes a
1363 Null-terminated Unicode string, optionally
1364 followed by additional binary data. The string
1365 is a description that the caller may use to
1366 further indicate the reason for the image's
1369 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1371 @retval EFI_SUCCESS Successfully terminates the currently loaded
1373 @retval EFI_ACCESS_DENIED Should never reach there.
1374 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1380 IN EFI_HANDLE ImageHandle
,
1381 IN EFI_STATUS Status
,
1382 IN UINTN ExitDataSize
,
1383 IN CHAR16
*ExitData OPTIONAL
1389 Creates a general-purpose event structure.
1391 @param Type The type of event to create and its mode and
1393 @param NotifyTpl The task priority level of event notifications
1394 @param NotifyFunction Pointer to the events notification function
1395 @param NotifyContext Pointer to the notification functions context;
1396 corresponds to parameter "Context" in the
1397 notification function
1398 @param Event Pointer to the newly created event if the call
1399 succeeds; undefined otherwise
1401 @retval EFI_SUCCESS The event structure was created
1402 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1403 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1410 IN EFI_TPL NotifyTpl
,
1411 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1412 IN VOID
*NotifyContext
, OPTIONAL
1413 OUT EFI_EVENT
*Event
1419 Creates a general-purpose event structure
1421 @param Type The type of event to create and its mode and
1423 @param NotifyTpl The task priority level of event notifications
1424 @param NotifyFunction Pointer to the events notification function
1425 @param NotifyContext Pointer to the notification functions context;
1426 corresponds to parameter "Context" in the
1427 notification function
1428 @param EventGroup GUID for EventGroup if NULL act the same as
1430 @param Event Pointer to the newly created event if the call
1431 succeeds; undefined otherwise
1433 @retval EFI_SUCCESS The event structure was created
1434 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1435 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1442 IN EFI_TPL NotifyTpl
,
1443 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1444 IN CONST VOID
*NotifyContext
, OPTIONAL
1445 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1446 OUT EFI_EVENT
*Event
1452 Sets the type of timer and the trigger time for a timer event.
1454 @param UserEvent The timer event that is to be signaled at the
1456 @param Type The type of time that is specified in
1458 @param TriggerTime The number of 100ns units until the timer
1461 @retval EFI_SUCCESS The event has been set to be signaled at the
1463 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1469 IN EFI_EVENT UserEvent
,
1470 IN EFI_TIMER_DELAY Type
,
1471 IN UINT64 TriggerTime
1477 Signals the event. Queues the event to be notified if needed.
1479 @param UserEvent The event to signal .
1481 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1482 @retval EFI_SUCCESS The event was signaled.
1488 IN EFI_EVENT UserEvent
1494 Stops execution until an event is signaled.
1496 @param NumberOfEvents The number of events in the UserEvents array
1497 @param UserEvents An array of EFI_EVENT
1498 @param UserIndex Pointer to the index of the event which
1499 satisfied the wait condition
1501 @retval EFI_SUCCESS The event indicated by Index was signaled.
1502 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1503 function or Event was not a valid type
1504 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1510 IN UINTN NumberOfEvents
,
1511 IN EFI_EVENT
*UserEvents
,
1512 OUT UINTN
*UserIndex
1518 Closes an event and frees the event structure.
1520 @param UserEvent Event to close
1522 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1523 @retval EFI_SUCCESS The event has been closed
1529 IN EFI_EVENT UserEvent
1535 Check the status of an event.
1537 @param UserEvent The event to check
1539 @retval EFI_SUCCESS The event is in the signaled state
1540 @retval EFI_NOT_READY The event is not in the signaled state
1541 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1547 IN EFI_EVENT UserEvent
1552 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1553 global coherency domain of the processor.
1555 @param GcdMemoryType Memory type of the memory space.
1556 @param BaseAddress Base address of the memory space.
1557 @param Length Length of the memory space.
1558 @param Capabilities alterable attributes of the memory space.
1560 @retval EFI_SUCCESS Merged this memory space into GCD map.
1565 CoreAddMemorySpace (
1566 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1567 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1569 IN UINT64 Capabilities
1574 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1575 I/O resources from the global coherency domain of the processor.
1577 @param GcdAllocateType The type of allocate operation
1578 @param GcdMemoryType The desired memory type
1579 @param Alignment Align with 2^Alignment
1580 @param Length Length to allocate
1581 @param BaseAddress Base address to allocate
1582 @param ImageHandle The image handle consume the allocated space.
1583 @param DeviceHandle The device handle consume the allocated space.
1585 @retval EFI_INVALID_PARAMETER Invalid parameter.
1586 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1587 @retval EFI_SUCCESS Memory space successfully allocated.
1592 CoreAllocateMemorySpace (
1593 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1594 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1597 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1598 IN EFI_HANDLE ImageHandle
,
1599 IN EFI_HANDLE DeviceHandle OPTIONAL
1604 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1605 I/O resources from the global coherency domain of the processor.
1607 @param BaseAddress Base address of the memory space.
1608 @param Length Length of the memory space.
1610 @retval EFI_SUCCESS Space successfully freed.
1615 CoreFreeMemorySpace (
1616 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1622 Removes reserved memory, system memory, or memory-mapped I/O resources from
1623 the global coherency domain of the processor.
1625 @param BaseAddress Base address of the memory space.
1626 @param Length Length of the memory space.
1628 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1633 CoreRemoveMemorySpace (
1634 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1640 Retrieves the descriptor for a memory region containing a specified address.
1642 @param BaseAddress Specified start address
1643 @param Descriptor Specified length
1645 @retval EFI_INVALID_PARAMETER Invalid parameter
1646 @retval EFI_SUCCESS Successfully get memory space descriptor.
1651 CoreGetMemorySpaceDescriptor (
1652 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1653 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1658 Modifies the attributes for a memory region in the global coherency domain of the
1661 @param BaseAddress Specified start address
1662 @param Length Specified length
1663 @param Attributes Specified attributes
1665 @retval EFI_SUCCESS Successfully set attribute of a segment of
1671 CoreSetMemorySpaceAttributes (
1672 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1674 IN UINT64 Attributes
1679 Returns a map of the memory resources in the global coherency domain of the
1682 @param NumberOfDescriptors Number of descriptors.
1683 @param MemorySpaceMap Descriptor array
1685 @retval EFI_INVALID_PARAMETER Invalid parameter
1686 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1687 @retval EFI_SUCCESS Successfully get memory space map.
1692 CoreGetMemorySpaceMap (
1693 OUT UINTN
*NumberOfDescriptors
,
1694 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1699 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1701 @param GcdIoType IO type of the segment.
1702 @param BaseAddress Base address of the segment.
1703 @param Length Length of the segment.
1705 @retval EFI_SUCCESS Merged this segment into GCD map.
1706 @retval EFI_INVALID_PARAMETER Parameter not valid
1712 IN EFI_GCD_IO_TYPE GcdIoType
,
1713 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1719 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1720 domain of the processor.
1722 @param GcdAllocateType The type of allocate operation
1723 @param GcdIoType The desired IO type
1724 @param Alignment Align with 2^Alignment
1725 @param Length Length to allocate
1726 @param BaseAddress Base address to allocate
1727 @param ImageHandle The image handle consume the allocated space.
1728 @param DeviceHandle The device handle consume the allocated space.
1730 @retval EFI_INVALID_PARAMETER Invalid parameter.
1731 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1732 @retval EFI_SUCCESS IO space successfully allocated.
1737 CoreAllocateIoSpace (
1738 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1739 IN EFI_GCD_IO_TYPE GcdIoType
,
1742 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1743 IN EFI_HANDLE ImageHandle
,
1744 IN EFI_HANDLE DeviceHandle OPTIONAL
1749 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1750 domain of the processor.
1752 @param BaseAddress Base address of the segment.
1753 @param Length Length of the segment.
1755 @retval EFI_SUCCESS Space successfully freed.
1761 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1767 Removes reserved I/O or I/O resources from the global coherency domain of the
1770 @param BaseAddress Base address of the segment.
1771 @param Length Length of the segment.
1773 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1779 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1785 Retrieves the descriptor for an I/O region containing a specified address.
1787 @param BaseAddress Specified start address
1788 @param Descriptor Specified length
1790 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1791 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1796 CoreGetIoSpaceDescriptor (
1797 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1798 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1803 Returns a map of the I/O resources in the global coherency domain of the processor.
1805 @param NumberOfDescriptors Number of descriptors.
1806 @param IoSpaceMap Descriptor array
1808 @retval EFI_INVALID_PARAMETER Invalid parameter
1809 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1810 @retval EFI_SUCCESS Successfully get IO space map.
1816 OUT UINTN
*NumberOfDescriptors
,
1817 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1822 This is the main Dispatcher for DXE and it exits when there are no more
1823 drivers to run. Drain the mScheduledQueue and load and start a PE
1824 image for each driver. Search the mDiscoveredList to see if any driver can
1825 be placed on the mScheduledQueue. If no drivers are placed on the
1826 mScheduledQueue exit the function. On exit it is assumed the Bds()
1827 will be called, and when the Bds() exits the Dispatcher will be called
1830 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1831 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1832 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1842 Check every driver and locate a matching one. If the driver is found, the Unrequested
1843 state flag is cleared.
1845 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1846 the firmware file specified by DriverName.
1847 @param DriverName The Driver name to put in the Dependent state.
1849 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1851 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1858 IN EFI_HANDLE FirmwareVolumeHandle
,
1859 IN EFI_GUID
*DriverName
1864 Convert a driver from the Untrused back to the Scheduled state.
1866 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1867 the firmware file specified by DriverName.
1868 @param DriverName The Driver name to put in the Scheduled state
1870 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1871 was promoted to the trusted state.
1872 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1878 IN EFI_HANDLE FirmwareVolumeHandle
,
1879 IN EFI_GUID
*DriverName
1884 This routine is the driver initialization entry point. It initializes the
1885 libraries, and registers two notification functions. These notification
1886 functions are responsible for building the FV stack dynamically.
1888 @param ImageHandle The image handle.
1889 @param SystemTable The system table.
1891 @retval EFI_SUCCESS Function successfully returned.
1897 IN EFI_HANDLE ImageHandle
,
1898 IN EFI_SYSTEM_TABLE
*SystemTable
1903 Entry point of the section extraction code. Initializes an instance of the
1904 section extraction interface and installs it on a new handle.
1906 @param ImageHandle A handle for the image that is initializing this driver
1907 @param SystemTable A pointer to the EFI system table
1909 @retval EFI_SUCCESS Driver initialized successfully
1910 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1915 InitializeSectionExtraction (
1916 IN EFI_HANDLE ImageHandle
,
1917 IN EFI_SYSTEM_TABLE
*SystemTable
1922 This DXE service routine is used to process a firmware volume. In
1923 particular, it can be called by BDS to process a single firmware
1924 volume found in a capsule.
1926 @param FvHeader pointer to a firmware volume header
1927 @param Size the size of the buffer pointed to by FvHeader
1928 @param FVProtocolHandle the handle on which a firmware volume protocol
1929 was produced for the firmware volume passed in.
1931 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1933 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1934 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1940 CoreProcessFirmwareVolume (
1943 OUT EFI_HANDLE
*FVProtocolHandle
1947 //Functions used during debug buils
1951 Displays Architectural protocols that were not loaded and are required for DXE
1952 core to function. Only used in Debug Builds.
1956 CoreDisplayMissingArchProtocols (
1962 Traverse the discovered list for any drivers that were discovered but not loaded
1963 because the dependency experessions evaluated to false.
1967 CoreDisplayDiscoveredNotDispatched (
1973 Place holder function until all the Boot Services and Runtime Services are
1976 @return EFI_NOT_AVAILABLE_YET
1981 CoreEfiNotAvailableYetArg0 (
1987 Place holder function until all the Boot Services and Runtime Services are
1990 @param Arg1 Undefined
1992 @return EFI_NOT_AVAILABLE_YET
1997 CoreEfiNotAvailableYetArg1 (
2003 Place holder function until all the Boot Services and Runtime Services are available.
2005 @param Arg1 Undefined
2006 @param Arg2 Undefined
2008 @return EFI_NOT_AVAILABLE_YET
2013 CoreEfiNotAvailableYetArg2 (
2020 Place holder function until all the Boot Services and Runtime Services are available.
2022 @param Arg1 Undefined
2023 @param Arg2 Undefined
2024 @param Arg3 Undefined
2026 @return EFI_NOT_AVAILABLE_YET
2031 CoreEfiNotAvailableYetArg3 (
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
2044 @param Arg4 Undefined
2046 @return EFI_NOT_AVAILABLE_YET
2051 CoreEfiNotAvailableYetArg4 (
2060 Place holder function until all the Boot Services and Runtime Services are available.
2062 @param Arg1 Undefined
2063 @param Arg2 Undefined
2064 @param Arg3 Undefined
2065 @param Arg4 Undefined
2066 @param Arg5 Undefined
2068 @return EFI_NOT_AVAILABLE_YET
2073 CoreEfiNotAvailableYetArg5 (
2083 Given a compressed source buffer, this function retrieves the size of the
2084 uncompressed buffer and the size of the scratch buffer required to decompress
2085 the compressed source buffer.
2087 The GetInfo() function retrieves the size of the uncompressed buffer and the
2088 temporary scratch buffer required to decompress the buffer specified by Source
2089 and SourceSize. If the size of the uncompressed buffer or the size of the
2090 scratch buffer cannot be determined from the compressed data specified by
2091 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2092 size of the uncompressed buffer is returned in DestinationSize, the size of
2093 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2094 The GetInfo() function does not have scratch buffer available to perform a
2095 thorough checking of the validity of the source data. It just retrieves the
2096 "Original Size" field from the beginning bytes of the source data and output
2097 it as DestinationSize. And ScratchSize is specific to the decompression
2100 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2101 @param Source The source buffer containing the compressed data.
2102 @param SourceSize The size, in bytes, of the source buffer.
2103 @param DestinationSize A pointer to the size, in bytes, of the
2104 uncompressed buffer that will be generated when the
2105 compressed buffer specified by Source and
2106 SourceSize is decompressed.
2107 @param ScratchSize A pointer to the size, in bytes, of the scratch
2108 buffer that is required to decompress the
2109 compressed buffer specified by Source and
2112 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2113 DestinationSize and the size of the scratch buffer
2114 was returned in ScratchSize.
2115 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2116 the scratch buffer cannot be determined from the
2117 compressed data specified by Source and
2123 DxeMainUefiDecompressGetInfo (
2124 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2126 IN UINT32 SourceSize
,
2127 OUT UINT32
*DestinationSize
,
2128 OUT UINT32
*ScratchSize
2133 Decompresses a compressed source buffer.
2135 The Decompress() function extracts decompressed data to its original form.
2136 This protocol is designed so that the decompression algorithm can be
2137 implemented without using any memory services. As a result, the Decompress()
2138 Function is not allowed to call AllocatePool() or AllocatePages() in its
2139 implementation. It is the caller's responsibility to allocate and free the
2140 Destination and Scratch buffers.
2141 If the compressed source data specified by Source and SourceSize is
2142 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2143 the compressed source data specified by Source and SourceSize is not in a
2144 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2146 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2147 @param Source The source buffer containing the compressed data.
2148 @param SourceSize SourceSizeThe size of source data.
2149 @param Destination On output, the destination buffer that contains
2150 the uncompressed data.
2151 @param DestinationSize The size of the destination buffer. The size of
2152 the destination buffer needed is obtained from
2153 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2154 @param Scratch A temporary scratch buffer that is used to perform
2156 @param ScratchSize The size of scratch buffer. The size of the
2157 scratch buffer needed is obtained from GetInfo().
2159 @retval EFI_SUCCESS Decompression completed successfully, and the
2160 uncompressed buffer is returned in Destination.
2161 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2162 SourceSize is corrupted (not in a valid
2168 DxeMainUefiDecompress (
2169 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2171 IN UINT32 SourceSize
,
2172 IN OUT VOID
*Destination
,
2173 IN UINT32 DestinationSize
,
2174 IN OUT VOID
*Scratch
,
2175 IN UINT32 ScratchSize
2179 SEP member function. This function creates and returns a new section stream
2180 handle to represent the new section stream.
2182 @param SectionStreamLength Size in bytes of the section stream.
2183 @param SectionStream Buffer containing the new section stream.
2184 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2185 output contains the new section stream handle.
2187 @retval EFI_SUCCESS The section stream is created successfully.
2188 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2189 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2196 IN UINTN SectionStreamLength
,
2197 IN VOID
*SectionStream
,
2198 OUT UINTN
*SectionStreamHandle
2204 SEP member function. Retrieves requested section from section stream.
2206 @param SectionStreamHandle The section stream from which to extract the
2208 @param SectionType A pointer to the type of section to search for.
2209 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2210 then SectionDefinitionGuid indicates which of
2211 these types of sections to search for.
2212 @param SectionInstance Indicates which instance of the requested
2214 @param Buffer Double indirection to buffer. If *Buffer is
2215 non-null on input, then the buffer is caller
2216 allocated. If Buffer is NULL, then the buffer
2217 is callee allocated. In either case, the
2218 requried buffer size is returned in *BufferSize.
2219 @param BufferSize On input, indicates the size of *Buffer if
2220 *Buffer is non-null on input. On output,
2221 indicates the required size (allocated size if
2222 callee allocated) of *Buffer.
2223 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2224 indicates the authentication status of the
2225 output buffer. If the input section's
2226 GuidedSectionHeader.Attributes field
2227 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2228 bit as clear, AuthenticationStatus must return
2229 zero. Both local bits (19:16) and aggregate
2230 bits (3:0) in AuthenticationStatus are returned
2231 by ExtractSection(). These bits reflect the
2232 status of the extraction operation. The bit
2233 pattern in both regions must be the same, as
2234 the local and aggregate authentication statuses
2235 have equivalent meaning at this level. If the
2236 function returns anything other than
2237 EFI_SUCCESS, the value of *AuthenticationStatus
2240 @retval EFI_SUCCESS Section was retrieved successfully
2241 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2242 section stream with its
2243 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2244 but there was no corresponding GUIDed Section
2245 Extraction Protocol in the handle database.
2246 *Buffer is unmodified.
2247 @retval EFI_NOT_FOUND An error was encountered when parsing the
2248 SectionStream. This indicates the SectionStream
2249 is not correctly formatted.
2250 @retval EFI_NOT_FOUND The requested section does not exist.
2251 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2253 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2254 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2255 insufficient to contain the requested section.
2256 The input buffer is filled and section contents
2263 IN UINTN SectionStreamHandle
,
2264 IN EFI_SECTION_TYPE
*SectionType
,
2265 IN EFI_GUID
*SectionDefinitionGuid
,
2266 IN UINTN SectionInstance
,
2268 IN OUT UINTN
*BufferSize
,
2269 OUT UINT32
*AuthenticationStatus
2274 SEP member function. Deletes an existing section stream
2276 @param StreamHandleToClose Indicates the stream to close
2278 @retval EFI_SUCCESS The section stream is closed sucessfully.
2279 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2280 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2286 CloseSectionStream (
2287 IN UINTN StreamHandleToClose
2291 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2292 table and registers it into the system table.
2295 This function allocates memory, frees it, and then allocates memory at an
2296 address within the initial allocation. Since this function is called early
2297 in DXE core initialization (before drivers are dispatched), this should not
2302 CoreInitializeDebugImageInfoTable (
2308 Update the CRC32 in the Debug Table.
2309 Since the CRC32 service is made available by the Runtime driver, we have to
2310 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2311 This function is called elsewhere by the core when the runtime architectural
2312 protocol is produced.
2316 CoreUpdateDebugTableCrc32 (
2322 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2323 the table if it's not large enough to accomidate another entry.
2325 @param ImageInfoType type of debug image information
2326 @param LoadedImage pointer to the loaded image protocol for the image being
2328 @param ImageHandle image handle for the image being loaded
2332 CoreNewDebugImageInfoEntry (
2333 IN UINT32 ImageInfoType
,
2334 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2335 IN EFI_HANDLE ImageHandle
2340 Removes and frees an entry from the DebugImageInfo Table.
2342 @param ImageHandle image handle for the image being unloaded
2346 CoreRemoveDebugImageInfoEntry (
2347 EFI_HANDLE ImageHandle
2352 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2354 @param ImageHandle The image handle.
2355 @param SystemTable The system table.
2357 @retval EFI_SUCCESS Successfully initialized firmware volume block
2363 FwVolBlockDriverInit (
2364 IN EFI_HANDLE ImageHandle
,
2365 IN EFI_SYSTEM_TABLE
*SystemTable
2370 This routine produces a firmware volume block protocol on a given
2373 @param BaseAddress base address of the firmware volume image
2374 @param Length length of the firmware volume image
2375 @param ParentHandle handle of parent firmware volume, if this image
2376 came from an FV image file in another firmware
2377 volume (ala capsules)
2378 @param FvProtocol Firmware volume block protocol produced.
2380 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2381 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2382 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2387 ProduceFVBProtocolOnBuffer (
2388 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2390 IN EFI_HANDLE ParentHandle
,
2391 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2396 Raising to the task priority level of the mutual exclusion
2397 lock, and then acquires ownership of the lock.
2399 @param Lock The lock to acquire
2411 Initialize a basic mutual exclusion lock. Each lock
2412 provides mutual exclusion access at it's task priority
2413 level. Since there is no-premption (at any TPL) or
2414 multiprocessor support, acquiring the lock only consists
2415 of raising to the locks TPL.
2417 @param Lock The EFI_LOCK structure to initialize
2419 @retval EFI_SUCCESS Lock Owned.
2420 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2424 CoreAcquireLockOrFail (
2430 Releases ownership of the mutual exclusion lock, and
2431 restores the previous task priority level.
2433 @param Lock The lock to release
2435 @return Lock unowned