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 <Guid/DebugImageInfoTable.h>
26 #include <Protocol/DevicePath.h>
27 #include <Protocol/Runtime.h>
28 #include <Protocol/LoadFile.h>
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/VariableWrite.h>
31 #include <Protocol/PlatformDriverOverride.h>
32 #include <Protocol/Variable.h>
33 #include <Guid/MemoryTypeInformation.h>
34 #include <Guid/FirmwareFileSystem2.h>
35 #include <Guid/HobList.h>
36 #include <Protocol/Timer.h>
37 #include <Protocol/SimpleFileSystem.h>
38 #include <Protocol/Bds.h>
39 #include <Guid/FileInfo.h>
40 #include <Protocol/RealTimeClock.h>
41 #include <Guid/Apriori.h>
42 #include <Protocol/WatchdogTimer.h>
43 #include <Protocol/FirmwareVolume2.h>
44 #include <Protocol/MonotonicCounter.h>
45 #include <Guid/DxeServices.h>
46 #include <Guid/MemoryAllocationHob.h>
47 #include <Protocol/StatusCode.h>
48 #include <Protocol/CustomizedDecompress.h>
49 #include <Protocol/Decompress.h>
50 #include <Protocol/LoadPe32Image.h>
51 #include <Protocol/FirmwareVolumeDispatch.h>
52 #include <Protocol/Security.h>
53 #include <Protocol/Ebc.h>
54 #include <Guid/EventLegacyBios.h>
55 #include <Protocol/Reset.h>
56 #include <Protocol/EdkDecompress.h>
57 #include <Protocol/Cpu.h>
58 #include <Guid/EventGroup.h>
59 #include <Protocol/Metronome.h>
60 #include <Protocol/FirmwareVolumeBlock.h>
61 #include <Protocol/Capsule.h>
62 #include <Protocol/BusSpecificDriverOverride.h>
63 #include <Protocol/Performance.h>
64 #include <Uefi/UefiTcgPlatform.h>
65 #include <Protocol/TcgPlatform.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/PcdLib.h>
79 #include <Library/MemoryAllocationLib.h>
81 #include "DebugImageInfo.h"
83 #include "FwVolBlock.h"
84 #include "FwVolDriver.h"
93 // Modifier for EFI DXE Services
95 #define EFI_DXESERVICE
98 // attributes for reserved memory before it is promoted to system memory
100 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
101 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
102 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
105 // range for memory mapped port I/O on IPF
107 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
111 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
112 /// to save time. A EFI_DEP_PUSH is evauated one an
113 /// replaced with EFI_DEP_REPLACE_TRUE
115 #define EFI_DEP_REPLACE_TRUE 0xff
118 /// Define the initial size of the dependency expression evaluation stack
120 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
123 EFI_GUID
*ProtocolGuid
;
128 } ARCHITECTURAL_PROTOCOL_ENTRY
;
131 EFI_STATUS_CODE_DATA DataHeader
;
133 } EFI_DXE_DEVICE_HANDLE_EXTENDED_DATA
;
135 #define EFI_STATUS_CODE_DXE_CORE_GUID \
136 { 0x335984bd, 0xe805, 0x409a, { 0xb8, 0xf8, 0xd2, 0x7e, 0xce, 0x5f, 0xf7, 0xa6 } }
139 // DXE Dispatcher Data structures
142 #define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w')
145 LIST_ENTRY Link
; // mFvHandleList
150 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r')
153 LIST_ENTRY Link
; // mDriverList
155 LIST_ENTRY ScheduledLink
; // mScheduledQueue
159 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
160 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
167 EFI_GUID BeforeAfterGuid
;
174 BOOLEAN DepexProtocolError
;
176 EFI_HANDLE ImageHandle
;
178 } EFI_CORE_DRIVER_ENTRY
;
181 //The data structure of GCD memory map entry
183 #define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m')
187 EFI_PHYSICAL_ADDRESS BaseAddress
;
191 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
192 EFI_GCD_IO_TYPE GcdIoType
;
193 EFI_HANDLE ImageHandle
;
194 EFI_HANDLE DeviceHandle
;
198 // DXE Core Global Variables
200 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
201 extern EFI_BOOT_SERVICES
*gDxeCoreBS
;
202 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
203 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
204 extern EFI_HANDLE gDxeCoreImageHandle
;
206 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
208 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
209 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
210 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
211 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
212 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
213 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
214 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
215 extern EFI_STATUS_CODE_PROTOCOL
*gStatusCode
;
217 extern EFI_TPL gEfiCurrentTpl
;
219 extern EFI_GUID
*gDxeCoreFileName
;
220 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
222 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
224 extern BOOLEAN gDispatcherRunning
;
225 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
228 // Service Initialization Functions
234 Called to initialize the pool.
244 Called to initialize the memory map and add descriptors to
245 the current descriptor list.
246 The first descriptor that is added must be general usable
247 memory as the addition allocates heap.
249 @param Type The type of memory to add
250 @param Start The starting address in the memory range Must be
252 @param NumberOfPages The number of pages in the range
253 @param Attribute Attributes of the memory to add
255 @return None. The range is added to the memory map
259 CoreAddMemoryDescriptor (
260 IN EFI_MEMORY_TYPE Type
,
261 IN EFI_PHYSICAL_ADDRESS Start
,
262 IN UINT64 NumberOfPages
,
268 Release memory lock on mGcdMemorySpaceLock.
272 CoreReleaseGcdMemoryLock (
278 Acquire memory lock on mGcdMemorySpaceLock.
282 CoreAcquireGcdMemoryLock (
288 External function. Initializes the GCD and memory services based on the memory
289 descriptor HOBs. This function is responsible for priming the GCD map and the
290 memory map, so memory allocations and resource allocations can be made. The first
291 part of this function can not depend on any memory services until at least one
292 memory descriptor is provided to the memory services. Then the memory services
293 can be used to intialize the GCD map.
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 Memory services successfully initialized.
304 CoreInitializeMemoryServices (
306 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
307 OUT UINT64
*MemoryLength
313 External function. Initializes the GCD and memory services based on the memory
314 descriptor HOBs. This function is responsible for priming the GCD map and the
315 memory map, so memory allocations and resource allocations can be made. The first
316 part of this function can not depend on any memory services until at least one
317 memory descriptor is provided to the memory services. Then the memory services
318 can be used to intialize the GCD map. The HobStart will be relocated to a pool
321 @param HobStart The start address of the HOB
322 @param MemoryBaseAddress Start address of memory region found to init DXE
324 @param MemoryLength Length of memory region found to init DXE core.
326 @retval EFI_SUCCESS GCD services successfully initialized.
330 CoreInitializeGcdServices (
331 IN OUT VOID
**HobStart
,
332 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
333 IN UINT64 MemoryLength
338 Initializes "event" support and populates parts of the System and Runtime Table.
341 @retval EFI_SUCCESS Always return success
345 CoreInitializeEventServices (
351 Add the Image Services to EFI Boot Services Table and install the protocol
352 interfaces for this image.
354 @param HobStart The HOB to initialize
360 CoreInitializeImageServices (
366 Creates an event that is fired everytime a Protocol of a specific type is installed.
370 CoreNotifyOnArchProtocolInstallation (
376 Return TRUE if all AP services are availible.
379 @retval EFI_SUCCESS All AP services are available
380 @retval EFI_NOT_FOUND At least one AP service is not available
384 CoreAllEfiServicesAvailable (
390 Calcualte the 32-bit CRC in a EFI table using the service provided by the
393 @param Hdr Pointer to an EFI standard header
398 IN OUT EFI_TABLE_HEADER
*Hdr
403 Called by the platform code to process a tick.
405 @param Duration The number of 100ns elasped since the last call
417 Initialize the dispatcher. Initialize the notification function that runs when
418 a FV protocol is added to the system.
422 CoreInitializeDispatcher (
428 This is the POSTFIX version of the dependency evaluator. This code does
429 not need to handle Before or After, as it is not valid to call this
430 routine in this case. The SOR is just ignored and is a nop in the grammer.
431 POSTFIX means all the math is done on top of the stack.
433 @param DriverEntry DriverEntry element to update
435 @retval TRUE If driver is ready to run.
436 @retval FALSE If driver is not ready to run or some fatal error
442 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
447 Preprocess dependency expression and update DriverEntry to reflect the
448 state of Before, After, and SOR dependencies. If DriverEntry->Before
449 or DriverEntry->After is set it will never be cleared. If SOR is set
450 it will be cleared by CoreSchedule(), and then the driver can be
453 @param DriverEntry DriverEntry element to update
455 @retval EFI_SUCCESS It always works.
459 CorePreProcessDepex (
460 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
466 Terminates all boot services.
468 @param ImageHandle Handle that identifies the exiting image.
469 @param MapKey Key to the latest memory map.
471 @retval EFI_SUCCESS Boot Services terminated
472 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
477 CoreExitBootServices (
478 IN EFI_HANDLE ImageHandle
,
484 Make sure the memory map is following all the construction rules,
485 it is the last time to check memory map error before exit boot services.
487 @param MapKey Memory map key
489 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
491 @retval EFI_SUCCESS Valid memory map.
495 CoreTerminateMemoryMap (
501 Signals all events in the EventGroup.
503 @param EventGroup The list to signal
507 CoreNotifySignalList (
508 IN EFI_GUID
*EventGroup
514 Boot Service called to add, modify, or remove a system configuration table from
515 the EFI System Table.
517 @param Guid Pointer to the GUID for the entry to add, update, or
519 @param Table Pointer to the configuration table for the entry to add,
520 update, or remove, may be NULL.
522 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
523 @return EFI_INVALID_PARAMETER Input GUID not valid.
524 @return EFI_NOT_FOUND Attempted to delete non-existant entry
525 @return EFI_OUT_OF_RESOURCES Not enough memory available
530 CoreInstallConfigurationTable (
538 Raise the task priority level to the new level.
539 High level is implemented by disabling processor interrupts.
541 @param NewTpl New task priority level
543 @return The previous task priority level
555 Lowers the task priority to the previous value. If the new
556 priority unmasks events at a higher priority, they are dispatched.
558 @param NewTpl New, lower, task priority
570 Introduces a fine-grained stall.
572 @param Microseconds The number of microseconds to stall execution.
574 @retval EFI_SUCCESS Execution was stalled for at least the requested
575 amount of microseconds.
576 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
582 IN UINTN Microseconds
588 Sets the system's watchdog timer.
590 @param Timeout The number of seconds to set the watchdog timer to.
591 A value of zero disables the timer.
592 @param WatchdogCode The numeric code to log on a watchdog timer timeout
593 event. The firmware reserves codes 0x0000 to 0xFFFF.
594 Loaders and operating systems may use other timeout
596 @param DataSize The size, in bytes, of WatchdogData.
597 @param WatchdogData A data buffer that includes a Null-terminated Unicode
598 string, optionally followed by additional binary data.
599 The string is a description that the call may use to
600 further indicate the reason to be logged with a
603 @return EFI_SUCCESS Timeout has been set
604 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
605 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
606 @return EFI_DEVICE_ERROR Could not complete due to hardware error
611 CoreSetWatchdogTimer (
613 IN UINT64 WatchdogCode
,
615 IN CHAR16
*WatchdogData OPTIONAL
621 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
622 Calls the private one which contains a BOOLEAN parameter for notifications
624 @param UserHandle The handle to install the protocol handler on,
625 or NULL if a new handle is to be allocated
626 @param Protocol The protocol to add to the handle
627 @param InterfaceType Indicates whether Interface is supplied in
629 @param Interface The interface for the protocol being added
636 CoreInstallProtocolInterface (
637 IN OUT EFI_HANDLE
*UserHandle
,
638 IN EFI_GUID
*Protocol
,
639 IN EFI_INTERFACE_TYPE InterfaceType
,
645 Installs a protocol interface into the boot services environment.
647 @param UserHandle The handle to install the protocol handler on,
648 or NULL if a new handle is to be allocated
649 @param Protocol The protocol to add to the handle
650 @param InterfaceType Indicates whether Interface is supplied in
652 @param Interface The interface for the protocol being added
653 @param Notify indicates whether notify the notification list
656 @retval EFI_INVALID_PARAMETER Invalid parameter
657 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
658 @retval EFI_SUCCESS Protocol interface successfully installed
662 CoreInstallProtocolInterfaceNotify (
663 IN OUT EFI_HANDLE
*UserHandle
,
664 IN EFI_GUID
*Protocol
,
665 IN EFI_INTERFACE_TYPE InterfaceType
,
673 Installs a list of protocol interface into the boot services environment.
674 This function calls InstallProtocolInterface() in a loop. If any error
675 occures all the protocols added by this function are removed. This is
676 basically a lib function to save space.
678 @param Handle The handle to install the protocol handlers on,
679 or NULL if a new handle is to be allocated
680 @param ... EFI_GUID followed by protocol instance. A NULL
681 terminates the list. The pairs are the
682 arguments to InstallProtocolInterface(). All the
683 protocols are added to Handle.
685 @retval EFI_INVALID_PARAMETER Handle is NULL.
686 @retval EFI_SUCCESS Protocol interfaces successfully installed.
691 CoreInstallMultipleProtocolInterfaces (
692 IN OUT EFI_HANDLE
*Handle
,
699 Uninstalls a list of protocol interface in the boot services environment.
700 This function calls UnisatllProtocolInterface() in a loop. This is
701 basically a lib function to save space.
703 @param Handle The handle to uninstall the protocol
704 @param ... EFI_GUID followed by protocol instance. A NULL
705 terminates the list. The pairs are the
706 arguments to UninstallProtocolInterface(). All
707 the protocols are added to Handle.
714 CoreUninstallMultipleProtocolInterfaces (
715 IN EFI_HANDLE Handle
,
722 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
724 @param UserHandle Handle on which the interface is to be
726 @param Protocol The numeric ID of the interface
727 @param OldInterface A pointer to the old interface
728 @param NewInterface A pointer to the new interface
730 @retval EFI_SUCCESS The protocol interface was installed
731 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
732 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
737 CoreReinstallProtocolInterface (
738 IN EFI_HANDLE UserHandle
,
739 IN EFI_GUID
*Protocol
,
740 IN VOID
*OldInterface
,
741 IN VOID
*NewInterface
747 Uninstalls all instances of a protocol:interfacer from a handle.
748 If the last protocol interface is remove from the handle, the
751 @param UserHandle The handle to remove the protocol handler from
752 @param Protocol The protocol, of protocol:interface, to remove
753 @param Interface The interface, of protocol:interface, to remove
755 @retval EFI_INVALID_PARAMETER Protocol is NULL.
756 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
761 CoreUninstallProtocolInterface (
762 IN EFI_HANDLE UserHandle
,
763 IN EFI_GUID
*Protocol
,
770 Queries a handle to determine if it supports a specified protocol.
772 @param UserHandle The handle being queried.
773 @param Protocol The published unique identifier of the protocol.
774 @param Interface Supplies the address where a pointer to the
775 corresponding Protocol Interface is returned.
777 @return The requested protocol interface for the handle
783 IN EFI_HANDLE UserHandle
,
784 IN EFI_GUID
*Protocol
,
791 Locates the installed protocol handler for the handle, and
792 invokes it to obtain the protocol interface. Usage information
793 is registered in the protocol data base.
795 @param UserHandle The handle to obtain the protocol interface on
796 @param Protocol The ID of the protocol
797 @param Interface The location to return the protocol interface
798 @param ImageHandle The handle of the Image that is opening the
799 protocol interface specified by Protocol and
801 @param ControllerHandle The controller handle that is requiring this
803 @param Attributes The open mode of the protocol interface
804 specified by Handle and Protocol.
806 @retval EFI_INVALID_PARAMETER Protocol is NULL.
807 @retval EFI_SUCCESS Get the protocol interface.
813 IN EFI_HANDLE UserHandle
,
814 IN EFI_GUID
*Protocol
,
815 OUT VOID
**Interface OPTIONAL
,
816 IN EFI_HANDLE ImageHandle
,
817 IN EFI_HANDLE ControllerHandle
,
824 Return information about Opened protocols in the system
826 @param UserHandle The handle to close the protocol interface on
827 @param Protocol The ID of the protocol
828 @param EntryBuffer A pointer to a buffer of open protocol
829 information in the form of
830 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
831 @param EntryCount Number of EntryBuffer entries
836 CoreOpenProtocolInformation (
837 IN EFI_HANDLE UserHandle
,
838 IN EFI_GUID
*Protocol
,
839 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
840 OUT UINTN
*EntryCount
846 Closes a protocol on a handle that was opened using OpenProtocol().
848 @param UserHandle The handle for the protocol interface that was
849 previously opened with OpenProtocol(), and is
851 @param Protocol The published unique identifier of the protocol.
852 It is the caller's responsibility to pass in a
854 @param AgentHandle The handle of the agent that is closing the
856 @param ControllerHandle If the agent that opened a protocol is a driver
857 that follows the EFI Driver Model, then this
858 parameter is the controller handle that required
859 the protocol interface. If the agent does not
860 follow the EFI Driver Model, then this parameter
861 is optional and may be NULL.
863 @retval EFI_SUCCESS The protocol instance was closed.
864 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
866 @retval EFI_NOT_FOUND Can not find the specified protocol or
873 IN EFI_HANDLE UserHandle
,
874 IN EFI_GUID
*Protocol
,
875 IN EFI_HANDLE AgentHandle
,
876 IN EFI_HANDLE ControllerHandle
882 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
885 @param UserHandle The handle from which to retrieve the list of
886 protocol interface GUIDs.
887 @param ProtocolBuffer A pointer to the list of protocol interface GUID
888 pointers that are installed on Handle.
889 @param ProtocolBufferCount A pointer to the number of GUID pointers present
892 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
893 on Handle was returned in ProtocolBuffer. The
894 number of protocol interface GUIDs was returned
895 in ProtocolBufferCount.
896 @retval EFI_INVALID_PARAMETER Handle is NULL.
897 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
898 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
899 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
900 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
906 CoreProtocolsPerHandle (
907 IN EFI_HANDLE UserHandle
,
908 OUT EFI_GUID
***ProtocolBuffer
,
909 OUT UINTN
*ProtocolBufferCount
915 Add a new protocol notification record for the request protocol.
917 @param Protocol The requested protocol to add the notify
919 @param Event The event to signal
920 @param Registration Returns the registration record
922 @retval EFI_INVALID_PARAMETER Invalid parameter
923 @retval EFI_SUCCESS Successfully returned the registration record
929 CoreRegisterProtocolNotify (
930 IN EFI_GUID
*Protocol
,
932 OUT VOID
**Registration
938 Locates the requested handle(s) and returns them in Buffer.
940 @param SearchType The type of search to perform to locate the
942 @param Protocol The protocol to search for
943 @param SearchKey Dependant on SearchType
944 @param BufferSize On input the size of Buffer. On output the
945 size of data returned.
946 @param Buffer The buffer to return the results in
948 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
949 returned in BufferSize.
950 @retval EFI_INVALID_PARAMETER Invalid parameter
951 @retval EFI_SUCCESS Successfully found the requested handle(s) and
952 returns them in Buffer.
958 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
959 IN EFI_GUID
*Protocol OPTIONAL
,
960 IN VOID
*SearchKey OPTIONAL
,
961 IN OUT UINTN
*BufferSize
,
962 OUT EFI_HANDLE
*Buffer
968 Locates the handle to a device on the device path that best matches the specified protocol.
970 @param Protocol The protocol to search for.
971 @param DevicePath On input, a pointer to a pointer to the device
972 path. On output, the device path pointer is
973 modified to point to the remaining part of the
975 @param Device A pointer to the returned device handle.
977 @retval EFI_SUCCESS The resulting handle was returned.
978 @retval EFI_NOT_FOUND No handles matched the search.
979 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
984 CoreLocateDevicePath (
985 IN EFI_GUID
*Protocol
,
986 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
987 OUT EFI_HANDLE
*Device
993 Function returns an array of handles that support the requested protocol
994 in a buffer allocated from pool. This is a version of CoreLocateHandle()
995 that allocates a buffer for the caller.
997 @param SearchType Specifies which handle(s) are to be returned.
998 @param Protocol Provides the protocol to search by. This
999 parameter is only valid for SearchType
1001 @param SearchKey Supplies the search key depending on the
1003 @param NumberHandles The number of handles returned in Buffer.
1004 @param Buffer A pointer to the buffer to return the requested
1005 array of handles that support Protocol.
1007 @retval EFI_SUCCESS The result array of handles was returned.
1008 @retval EFI_NOT_FOUND No handles match the search.
1009 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1011 @retval EFI_INVALID_PARAMETER Invalid parameter
1016 CoreLocateHandleBuffer (
1017 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1018 IN EFI_GUID
*Protocol OPTIONAL
,
1019 IN VOID
*SearchKey OPTIONAL
,
1020 IN OUT UINTN
*NumberHandles
,
1021 OUT EFI_HANDLE
**Buffer
1027 Return the first Protocol Interface that matches the Protocol GUID. If
1028 Registration is pasased in return a Protocol Instance that was just add
1029 to the system. If Retistration is NULL return the first Protocol Interface
1032 @param Protocol The protocol to search for
1033 @param Registration Optional Registration Key returned from
1034 RegisterProtocolNotify()
1035 @param Interface Return the Protocol interface (instance).
1037 @retval EFI_SUCCESS If a valid Interface is returned
1038 @retval EFI_INVALID_PARAMETER Invalid parameter
1039 @retval EFI_NOT_FOUND Protocol interface not found
1044 CoreLocateProtocol (
1045 IN EFI_GUID
*Protocol
,
1046 IN VOID
*Registration OPTIONAL
,
1047 OUT VOID
**Interface
1052 return handle database key.
1055 @return Handle database key.
1059 CoreGetHandleDatabaseKey (
1065 Go connect any handles that were created or modified while a image executed.
1067 @param Key The Key to show that the handle has been
1072 CoreConnectHandlesByKey (
1079 Connects one or more drivers to a controller.
1081 @param ControllerHandle Handle of the controller to be
1083 @param DriverImageHandle DriverImageHandle A pointer to an
1084 ordered list of driver image
1086 @param RemainingDevicePath RemainingDevicePath A pointer to
1087 the device path that specifies a
1088 child of the controller specified
1089 by ControllerHandle.
1090 @param Recursive Whether the function would be
1091 called recursively or not.
1093 @return Status code.
1098 CoreConnectController (
1099 IN EFI_HANDLE ControllerHandle
,
1100 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1101 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1102 IN BOOLEAN Recursive
1108 Disonnects a controller from a driver
1110 @param ControllerHandle ControllerHandle The handle of
1111 the controller from which
1114 @param DriverImageHandle DriverImageHandle The driver to
1115 disconnect from ControllerHandle.
1116 @param ChildHandle ChildHandle The handle of the
1119 @retval EFI_SUCCESS One or more drivers were
1120 disconnected from the controller.
1121 @retval EFI_SUCCESS On entry, no drivers are managing
1123 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1124 and on entry DriverImageHandle is
1125 not managing ControllerHandle.
1126 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1128 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1129 and it is not a valid EFI_HANDLE.
1130 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1131 is not a valid EFI_HANDLE.
1132 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1133 available to disconnect any
1134 drivers from ControllerHandle.
1135 @retval EFI_DEVICE_ERROR The controller could not be
1136 disconnected because of a device
1142 CoreDisconnectController (
1143 IN EFI_HANDLE ControllerHandle
,
1144 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1145 IN EFI_HANDLE ChildHandle OPTIONAL
1151 Allocates pages from the memory map.
1153 @param Type The type of allocation to perform
1154 @param MemoryType The type of memory to turn the allocated pages
1156 @param NumberOfPages The number of pages to allocate
1157 @param Memory A pointer to receive the base allocated memory
1160 @return Status. On success, Memory is filled in with the base address allocated
1161 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1163 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1164 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1165 @retval EFI_SUCCESS Pages successfully allocated.
1171 IN EFI_ALLOCATE_TYPE Type
,
1172 IN EFI_MEMORY_TYPE MemoryType
,
1173 IN UINTN NumberOfPages
,
1174 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1180 Frees previous allocated pages.
1182 @param Memory Base address of memory being freed
1183 @param NumberOfPages The number of pages to free
1185 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1186 @retval EFI_INVALID_PARAMETER Address not aligned
1187 @return EFI_SUCCESS -Pages successfully freed.
1193 IN EFI_PHYSICAL_ADDRESS Memory
,
1194 IN UINTN NumberOfPages
1200 This function returns a copy of the current memory map. The map is an array of
1201 memory descriptors, each of which describes a contiguous block of memory.
1203 @param MemoryMapSize A pointer to the size, in bytes, of the
1204 MemoryMap buffer. On input, this is the size of
1205 the buffer allocated by the caller. On output,
1206 it is the size of the buffer returned by the
1207 firmware if the buffer was large enough, or the
1208 size of the buffer needed to contain the map if
1209 the buffer was too small.
1210 @param MemoryMap A pointer to the buffer in which firmware places
1211 the current memory map.
1212 @param MapKey A pointer to the location in which firmware
1213 returns the key for the current memory map.
1214 @param DescriptorSize A pointer to the location in which firmware
1215 returns the size, in bytes, of an individual
1216 EFI_MEMORY_DESCRIPTOR.
1217 @param DescriptorVersion A pointer to the location in which firmware
1218 returns the version number associated with the
1219 EFI_MEMORY_DESCRIPTOR.
1221 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1223 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1224 buffer size needed to hold the memory map is
1225 returned in MemoryMapSize.
1226 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1232 IN OUT UINTN
*MemoryMapSize
,
1233 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1235 OUT UINTN
*DescriptorSize
,
1236 OUT UINT32
*DescriptorVersion
1242 Allocate pool of a particular type.
1244 @param PoolType Type of pool to allocate
1245 @param Size The amount of pool to allocate
1246 @param Buffer The address to return a pointer to the allocated
1249 @retval EFI_INVALID_PARAMETER PoolType not valid
1250 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1251 @retval EFI_SUCCESS Pool successfully allocated.
1257 IN EFI_MEMORY_TYPE PoolType
,
1267 @param Buffer The allocated pool entry to free
1269 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1270 @retval EFI_SUCCESS Pool successfully freed.
1282 Loads an EFI image into memory and returns a handle to the image.
1284 @param BootPolicy If TRUE, indicates that the request originates
1285 from the boot manager, and that the boot
1286 manager is attempting to load FilePath as a
1288 @param ParentImageHandle The caller's image handle.
1289 @param FilePath The specific file path from which the image is
1291 @param SourceBuffer If not NULL, a pointer to the memory location
1292 containing a copy of the image to be loaded.
1293 @param SourceSize The size in bytes of SourceBuffer.
1294 @param ImageHandle Pointer to the returned image handle that is
1295 created when the image is successfully loaded.
1297 @retval EFI_SUCCESS The image was loaded into memory.
1298 @retval EFI_NOT_FOUND The FilePath was not found.
1299 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1300 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1301 path cannot be parsed to locate the proper
1302 protocol for loading the file.
1303 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1310 IN BOOLEAN BootPolicy
,
1311 IN EFI_HANDLE ParentImageHandle
,
1312 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1313 IN VOID
*SourceBuffer OPTIONAL
,
1314 IN UINTN SourceSize
,
1315 OUT EFI_HANDLE
*ImageHandle
1323 @param ImageHandle Handle that identifies the image to be
1326 @retval EFI_SUCCESS The image has been unloaded.
1327 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1329 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1335 IN EFI_HANDLE ImageHandle
1341 Transfer control to a loaded image's entry point.
1343 @param ImageHandle Handle of image to be started.
1344 @param ExitDataSize Pointer of the size to ExitData
1345 @param ExitData Pointer to a pointer to a data buffer that
1346 includes a Null-terminated Unicode string,
1347 optionally followed by additional binary data.
1348 The string is a description that the caller may
1349 use to further indicate the reason for the
1352 @retval EFI_INVALID_PARAMETER Invalid parameter
1353 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1354 @retval EFI_SUCCESS Successfully transfer control to the image's
1361 IN EFI_HANDLE ImageHandle
,
1362 OUT UINTN
*ExitDataSize
,
1363 OUT CHAR16
**ExitData OPTIONAL
1369 Terminates the currently loaded EFI image and returns control to boot services.
1371 @param ImageHandle Handle that identifies the image. This
1372 parameter is passed to the image on entry.
1373 @param Status The image's exit code.
1374 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1375 ExitStatus is EFI_SUCCESS.
1376 @param ExitData Pointer to a data buffer that includes a
1377 Null-terminated Unicode string, optionally
1378 followed by additional binary data. The string
1379 is a description that the caller may use to
1380 further indicate the reason for the image's
1383 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1385 @retval EFI_SUCCESS Successfully terminates the currently loaded
1387 @retval EFI_ACCESS_DENIED Should never reach there.
1388 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1394 IN EFI_HANDLE ImageHandle
,
1395 IN EFI_STATUS Status
,
1396 IN UINTN ExitDataSize
,
1397 IN CHAR16
*ExitData OPTIONAL
1403 Creates a general-purpose event structure.
1405 @param Type The type of event to create and its mode and
1407 @param NotifyTpl The task priority level of event notifications
1408 @param NotifyFunction Pointer to the events notification function
1409 @param NotifyContext Pointer to the notification functions context;
1410 corresponds to parameter "Context" in the
1411 notification function
1412 @param Event Pointer to the newly created event if the call
1413 succeeds; undefined otherwise
1415 @retval EFI_SUCCESS The event structure was created
1416 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1417 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1424 IN EFI_TPL NotifyTpl
,
1425 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1426 IN VOID
*NotifyContext
, OPTIONAL
1427 OUT EFI_EVENT
*Event
1433 Creates a general-purpose event structure
1435 @param Type The type of event to create and its mode and
1437 @param NotifyTpl The task priority level of event notifications
1438 @param NotifyFunction Pointer to the events notification function
1439 @param NotifyContext Pointer to the notification functions context;
1440 corresponds to parameter "Context" in the
1441 notification function
1442 @param EventGroup GUID for EventGroup if NULL act the same as
1444 @param Event Pointer to the newly created event if the call
1445 succeeds; undefined otherwise
1447 @retval EFI_SUCCESS The event structure was created
1448 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1449 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1456 IN EFI_TPL NotifyTpl
,
1457 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1458 IN CONST VOID
*NotifyContext
, OPTIONAL
1459 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1460 OUT EFI_EVENT
*Event
1466 Sets the type of timer and the trigger time for a timer event.
1468 @param UserEvent The timer event that is to be signaled at the
1470 @param Type The type of time that is specified in
1472 @param TriggerTime The number of 100ns units until the timer
1475 @retval EFI_SUCCESS The event has been set to be signaled at the
1477 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1483 IN EFI_EVENT UserEvent
,
1484 IN EFI_TIMER_DELAY Type
,
1485 IN UINT64 TriggerTime
1491 Signals the event. Queues the event to be notified if needed
1493 @param UserEvent The event to signal
1495 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1496 @retval EFI_SUCCESS The event was signaled.
1502 IN EFI_EVENT UserEvent
1508 Stops execution until an event is signaled.
1510 @param NumberOfEvents The number of events in the UserEvents array
1511 @param UserEvents An array of EFI_EVENT
1512 @param UserIndex Pointer to the index of the event which
1513 satisfied the wait condition
1515 @retval EFI_SUCCESS The event indicated by Index was signaled.
1516 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1517 function or Event was not a valid type
1518 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1524 IN UINTN NumberOfEvents
,
1525 IN EFI_EVENT
*UserEvents
,
1526 OUT UINTN
*UserIndex
1532 Closes an event and frees the event structure.
1534 @param UserEvent Event to close
1536 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1537 @retval EFI_SUCCESS The event has been closed
1543 IN EFI_EVENT UserEvent
1549 Check the status of an event.
1551 @param UserEvent The event to check
1553 @retval EFI_SUCCESS The event is in the signaled state
1554 @retval EFI_NOT_READY The event is not in the signaled state
1555 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1561 IN EFI_EVENT UserEvent
1566 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1567 global coherency domain of the processor.
1569 @param GcdMemoryType Memory type of the memory space.
1570 @param BaseAddress Base address of the memory space.
1571 @param Length Length of the memory space.
1572 @param Capabilities alterable attributes of the memory space.
1574 @retval EFI_SUCCESS Merged this memory space into GCD map.
1578 CoreAddMemorySpace (
1579 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1580 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1582 IN UINT64 Capabilities
1587 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1588 I/O resources from the global coherency domain of the processor.
1590 @param GcdAllocateType The type of allocate operation
1591 @param GcdMemoryType The desired memory type
1592 @param Alignment Align with 2^Alignment
1593 @param Length Length to allocate
1594 @param BaseAddress Base address to allocate
1595 @param ImageHandle The image handle consume the allocated space.
1596 @param DeviceHandle The device handle consume the allocated space.
1598 @retval EFI_INVALID_PARAMETER Invalid parameter.
1599 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1600 @retval EFI_SUCCESS Memory space successfully allocated.
1604 CoreAllocateMemorySpace (
1605 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1606 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1609 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1610 IN EFI_HANDLE ImageHandle
,
1611 IN EFI_HANDLE DeviceHandle OPTIONAL
1616 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1617 I/O resources from the global coherency domain of the processor.
1619 @param BaseAddress Base address of the memory space.
1620 @param Length Length of the memory space.
1622 @retval EFI_SUCCESS Space successfully freed.
1626 CoreFreeMemorySpace (
1627 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1633 Removes reserved memory, system memory, or memory-mapped I/O resources from
1634 the global coherency domain of the processor.
1636 @param BaseAddress Base address of the memory space.
1637 @param Length Length of the memory space.
1639 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1643 CoreRemoveMemorySpace (
1644 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1650 Retrieves the descriptor for a memory region containing a specified address.
1652 @param BaseAddress Specified start address
1653 @param Descriptor Specified length
1655 @retval EFI_INVALID_PARAMETER Invalid parameter
1656 @retval EFI_SUCCESS Successfully get memory space descriptor.
1660 CoreGetMemorySpaceDescriptor (
1661 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1662 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1667 Modifies the attributes for a memory region in the global coherency domain of the
1670 @param BaseAddress Specified start address
1671 @param Length Specified length
1672 @param Attributes Specified attributes
1674 @retval EFI_SUCCESS Successfully set attribute of a segment of
1679 CoreSetMemorySpaceAttributes (
1680 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1682 IN UINT64 Attributes
1687 Returns a map of the memory resources in the global coherency domain of the
1690 @param NumberOfDescriptors Number of descriptors.
1691 @param MemorySpaceMap Descriptor array
1693 @retval EFI_INVALID_PARAMETER Invalid parameter
1694 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1695 @retval EFI_SUCCESS Successfully get memory space map.
1699 CoreGetMemorySpaceMap (
1700 OUT UINTN
*NumberOfDescriptors
,
1701 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1706 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1708 @param GcdIoType IO type of the segment.
1709 @param BaseAddress Base address of the segment.
1710 @param Length Length of the segment.
1712 @retval EFI_SUCCESS Merged this segment into GCD map.
1713 @retval EFI_INVALID_PARAMETER Parameter not valid
1718 IN EFI_GCD_IO_TYPE GcdIoType
,
1719 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1725 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1726 domain of the processor.
1728 @param GcdAllocateType The type of allocate operation
1729 @param GcdIoType The desired IO type
1730 @param Alignment Align with 2^Alignment
1731 @param Length Length to allocate
1732 @param BaseAddress Base address to allocate
1733 @param ImageHandle The image handle consume the allocated space.
1734 @param DeviceHandle The device handle consume the allocated space.
1736 @retval EFI_INVALID_PARAMETER Invalid parameter.
1737 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1738 @retval EFI_SUCCESS IO space successfully allocated.
1742 CoreAllocateIoSpace (
1743 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1744 IN EFI_GCD_IO_TYPE GcdIoType
,
1747 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1748 IN EFI_HANDLE ImageHandle
,
1749 IN EFI_HANDLE DeviceHandle OPTIONAL
1754 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1755 domain of the processor.
1757 @param BaseAddress Base address of the segment.
1758 @param Length Length of the segment.
1760 @retval EFI_SUCCESS Space successfully freed.
1765 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1771 Removes reserved I/O or I/O resources from the global coherency domain of the
1774 @param BaseAddress Base address of the segment.
1775 @param Length Length of the segment.
1777 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1782 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1788 Retrieves the descriptor for an I/O region containing a specified address.
1790 @param BaseAddress Specified start address
1791 @param Descriptor Specified length
1793 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1794 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1798 CoreGetIoSpaceDescriptor (
1799 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1800 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1805 Returns a map of the I/O resources in the global coherency domain of the processor.
1807 @param NumberOfDescriptors Number of descriptors.
1808 @param IoSpaceMap Descriptor array
1810 @retval EFI_INVALID_PARAMETER Invalid parameter
1811 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1812 @retval EFI_SUCCESS Successfully get IO space map.
1817 OUT UINTN
*NumberOfDescriptors
,
1818 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1823 This is the main Dispatcher for DXE and it exits when there are no more
1824 drivers to run. Drain the mScheduledQueue and load and start a PE
1825 image for each driver. Search the mDiscoveredList to see if any driver can
1826 be placed on the mScheduledQueue. If no drivers are placed on the
1827 mScheduledQueue exit the function. On exit it is assumed the Bds()
1828 will be called, and when the Bds() exits the Dispatcher will be called
1833 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1834 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1835 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1849 Check every driver and locate a matching one. If the driver is found, the Unrequested
1850 state flag is cleared.
1852 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1853 the firmware file specified by DriverName.
1854 @param DriverName The Driver name to put in the Dependent state.
1856 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1858 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit
1869 IN EFI_HANDLE FirmwareVolumeHandle
,
1870 IN EFI_GUID
*DriverName
1875 Convert a driver from the Untrused back to the Scheduled state
1877 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1878 the firmware file specified by DriverName.
1879 @param DriverName The Driver name to put in the Scheduled state
1881 @retval EFI_SUCCESS The file was found in the untrusted state, and
1882 it was promoted to the trusted state.
1883 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1893 IN EFI_HANDLE FirmwareVolumeHandle
,
1894 IN EFI_GUID
*DriverName
1899 Helper function called as part of the code needed
1900 to allocate the proper sized buffer for various
1903 @param Status Current status
1904 @param Buffer Current allocated buffer, or NULL
1905 @param BufferSize Current buffer size needed
1907 @retval TRUE if the buffer was reallocated and the caller
1908 should try the API again.
1909 @retval FALSE buffer could not be allocated and the caller
1910 should not try the API again.
1915 IN OUT EFI_STATUS
*Status
,
1916 IN OUT VOID
**Buffer
,
1922 This routine is the driver initialization entry point. It initializes the
1923 libraries, and registers two notification functions. These notification
1924 functions are responsible for building the FV stack dynamically.
1926 @param ImageHandle The image handle.
1927 @param SystemTable The system table.
1929 @retval EFI_SUCCESS Function successfully returned.
1935 IN EFI_HANDLE ImageHandle
,
1936 IN EFI_SYSTEM_TABLE
*SystemTable
1941 Entry point of the section extraction code. Initializes an instance of the
1942 section extraction interface and installs it on a new handle.
1944 @param ImageHandle A handle for the image that is initializing this driver
1945 @param SystemTable A pointer to the EFI system table
1947 @retval EFI_SUCCESS Driver initialized successfully
1948 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1953 InitializeSectionExtraction (
1954 IN EFI_HANDLE ImageHandle
,
1955 IN EFI_SYSTEM_TABLE
*SystemTable
1960 This DXE service routine is used to process a firmware volume. In
1961 particular, it can be called by BDS to process a single firmware
1962 volume found in a capsule.
1964 @param FvHeader pointer to a firmware volume header
1965 @param Size the size of the buffer pointed to by FvHeader
1966 @param FVProtocolHandle the handle on which a firmware volume protocol
1967 was produced for the firmware volume passed in.
1969 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1971 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1972 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1977 CoreProcessFirmwareVolume (
1980 OUT EFI_HANDLE
*FVProtocolHandle
1984 //Functions used during debug buils
1988 Displays Architectural protocols that were not loaded and are required for DXE
1989 core to function. Only used in Debug Builds.
1993 CoreDisplayMissingArchProtocols (
1999 Traverse the discovered list for any drivers that were discovered but not loaded
2000 because the dependency experessions evaluated to false.
2004 CoreDisplayDiscoveredNotDispatched (
2010 Place holder function until all the Boot Services and Runtime Services are
2013 @return EFI_NOT_AVAILABLE_YET
2018 CoreEfiNotAvailableYetArg0 (
2024 Place holder function until all the Boot Services and Runtime Services are
2027 @param Arg1 Undefined
2029 @return EFI_NOT_AVAILABLE_YET
2034 CoreEfiNotAvailableYetArg1 (
2040 Place holder function until all the Boot Services and Runtime Services are available.
2042 @param Arg1 Undefined
2043 @param Arg2 Undefined
2045 @return EFI_NOT_AVAILABLE_YET
2050 CoreEfiNotAvailableYetArg2 (
2057 Place holder function until all the Boot Services and Runtime Services are available.
2059 @param Arg1 Undefined
2060 @param Arg2 Undefined
2061 @param Arg3 Undefined
2063 @return EFI_NOT_AVAILABLE_YET
2068 CoreEfiNotAvailableYetArg3 (
2076 Place holder function until all the Boot Services and Runtime Services are available.
2078 @param Arg1 Undefined
2079 @param Arg2 Undefined
2080 @param Arg3 Undefined
2081 @param Arg4 Undefined
2083 @return EFI_NOT_AVAILABLE_YET
2088 CoreEfiNotAvailableYetArg4 (
2097 Place holder function until all the Boot Services and Runtime Services are available.
2099 @param Arg1 Undefined
2100 @param Arg2 Undefined
2101 @param Arg3 Undefined
2102 @param Arg4 Undefined
2103 @param Arg5 Undefined
2105 @return EFI_NOT_AVAILABLE_YET
2110 CoreEfiNotAvailableYetArg5 (
2120 Searches for a Protocol Interface passed from PEI through a HOB.
2122 @param ProtocolGuid The Protocol GUID to search for in the HOB List
2123 @param Interface A pointer to the interface for the Protocol GUID
2125 @retval EFI_SUCCESS The Protocol GUID was found and its interface is
2126 returned in Interface
2127 @retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List
2131 CoreGetPeiProtocol (
2132 IN EFI_GUID
*ProtocolGuid
,
2138 Given a compressed source buffer, this function retrieves the size of the
2139 uncompressed buffer and the size of the scratch buffer required to decompress
2140 the compressed source buffer.
2142 The GetInfo() function retrieves the size of the uncompressed buffer and the
2143 temporary scratch buffer required to decompress the buffer specified by Source
2144 and SourceSize. If the size of the uncompressed buffer or the size of the
2145 scratch buffer cannot be determined from the compressed data specified by
2146 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2147 size of the uncompressed buffer is returned in DestinationSize, the size of
2148 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2149 The GetInfo() function does not have scratch buffer available to perform a
2150 thorough checking of the validity of the source data. It just retrieves the
2151 "Original Size" field from the beginning bytes of the source data and output
2152 it as DestinationSize. And ScratchSize is specific to the decompression
2155 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2156 @param Source The source buffer containing the compressed data.
2157 @param SourceSize The size, in bytes, of the source buffer.
2158 @param DestinationSize A pointer to the size, in bytes, of the
2159 uncompressed buffer that will be generated when the
2160 compressed buffer specified by Source and
2161 SourceSize is decompressed.
2162 @param ScratchSize A pointer to the size, in bytes, of the scratch
2163 buffer that is required to decompress the
2164 compressed buffer specified by Source and
2167 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2168 DestinationSize and the size of the scratch buffer
2169 was returned in ScratchSize.
2170 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2171 the scratch buffer cannot be determined from the
2172 compressed data specified by Source and
2178 DxeMainUefiDecompressGetInfo (
2179 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2181 IN UINT32 SourceSize
,
2182 OUT UINT32
*DestinationSize
,
2183 OUT UINT32
*ScratchSize
2188 Decompresses a compressed source buffer.
2190 The Decompress() function extracts decompressed data to its original form.
2191 This protocol is designed so that the decompression algorithm can be
2192 implemented without using any memory services. As a result, the Decompress()
2193 Function is not allowed to call AllocatePool() or AllocatePages() in its
2194 implementation. It is the caller's responsibility to allocate and free the
2195 Destination and Scratch buffers.
2196 If the compressed source data specified by Source and SourceSize is
2197 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2198 the compressed source data specified by Source and SourceSize is not in a
2199 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2201 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2202 @param Source The source buffer containing the compressed data.
2203 @param SourceSize SourceSizeThe size of source data.
2204 @param Destination On output, the destination buffer that contains
2205 the uncompressed data.
2206 @param DestinationSize The size of the destination buffer. The size of
2207 the destination buffer needed is obtained from
2208 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2209 @param Scratch A temporary scratch buffer that is used to perform
2211 @param ScratchSize The size of scratch buffer. The size of the
2212 scratch buffer needed is obtained from GetInfo().
2214 @retval EFI_SUCCESS Decompression completed successfully, and the
2215 uncompressed buffer is returned in Destination.
2216 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2217 SourceSize is corrupted (not in a valid
2223 DxeMainUefiDecompress (
2224 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2226 IN UINT32 SourceSize
,
2227 IN OUT VOID
*Destination
,
2228 IN UINT32 DestinationSize
,
2229 IN OUT VOID
*Scratch
,
2230 IN UINT32 ScratchSize
2234 SEP member function. This function creates and returns a new section stream
2235 handle to represent the new section stream.
2237 @param SectionStreamLength Size in bytes of the section stream.
2238 @param SectionStream Buffer containing the new section stream.
2239 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2240 output contains the new section stream handle.
2242 @retval EFI_SUCCESS The section stream is created successfully.
2243 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2244 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2251 IN UINTN SectionStreamLength
,
2252 IN VOID
*SectionStream
,
2253 OUT UINTN
*SectionStreamHandle
2259 SEP member function. Retrieves requested section from section stream.
2261 @param SectionStreamHandle The section stream from which to extract the
2263 @param SectionType A pointer to the type of section to search for.
2264 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2265 then SectionDefinitionGuid indicates which of
2266 these types of sections to search for.
2267 @param SectionInstance Indicates which instance of the requested
2269 @param Buffer Double indirection to buffer. If *Buffer is
2270 non-null on input, then the buffer is caller
2271 allocated. If Buffer is NULL, then the buffer
2272 is callee allocated. In either case, the
2273 requried buffer size is returned in *BufferSize.
2274 @param BufferSize On input, indicates the size of *Buffer if
2275 *Buffer is non-null on input. On output,
2276 indicates the required size (allocated size if
2277 callee allocated) of *Buffer.
2278 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2279 indicates the authentication status of the
2280 output buffer. If the input section's
2281 GuidedSectionHeader.Attributes field
2282 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2283 bit as clear, AuthenticationStatus must return
2284 zero. Both local bits (19:16) and aggregate
2285 bits (3:0) in AuthenticationStatus are returned
2286 by ExtractSection(). These bits reflect the
2287 status of the extraction operation. The bit
2288 pattern in both regions must be the same, as
2289 the local and aggregate authentication statuses
2290 have equivalent meaning at this level. If the
2291 function returns anything other than
2292 EFI_SUCCESS, the value of *AuthenticationStatus
2295 @retval EFI_SUCCESS Section was retrieved successfully
2296 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2297 section stream with its
2298 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2299 but there was no corresponding GUIDed Section
2300 Extraction Protocol in the handle database.
2301 *Buffer is unmodified.
2302 @retval EFI_NOT_FOUND An error was encountered when parsing the
2303 SectionStream. This indicates the SectionStream
2304 is not correctly formatted.
2305 @retval EFI_NOT_FOUND The requested section does not exist.
2306 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2308 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2309 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2310 insufficient to contain the requested section.
2311 The input buffer is filled and section contents
2318 IN UINTN SectionStreamHandle
,
2319 IN EFI_SECTION_TYPE
*SectionType
,
2320 IN EFI_GUID
*SectionDefinitionGuid
,
2321 IN UINTN SectionInstance
,
2323 IN OUT UINTN
*BufferSize
,
2324 OUT UINT32
*AuthenticationStatus
2329 SEP member function. Deletes an existing section stream
2331 @param StreamHandleToClose Indicates the stream to close
2333 @retval EFI_SUCCESS The section stream is closed sucessfully.
2334 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2335 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2341 CloseSectionStream (
2342 IN UINTN StreamHandleToClose