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/FirmwareVolumeDispatch.h>
43 #include <Protocol/Security.h>
44 #include <Protocol/Ebc.h>
45 #include <Protocol/Reset.h>
46 #include <Protocol/Cpu.h>
47 #include <Protocol/Metronome.h>
48 #include <Protocol/FirmwareVolumeBlock.h>
49 #include <Protocol/Capsule.h>
50 #include <Protocol/BusSpecificDriverOverride.h>
51 #include <Protocol/Performance.h>
52 #include <Protocol/TcgService.h>
53 #include <Protocol/TcgPlatform.h>
54 #include <Guid/MemoryTypeInformation.h>
55 #include <Guid/FirmwareFileSystem2.h>
56 #include <Guid/HobList.h>
57 #include <Guid/DebugImageInfoTable.h>
58 #include <Guid/FileInfo.h>
59 #include <Guid/Apriori.h>
60 #include <Guid/DxeServices.h>
61 #include <Guid/MemoryAllocationHob.h>
62 #include <Guid/EventLegacyBios.h>
63 #include <Guid/EventGroup.h>
66 #include <Library/DxeCoreEntryPoint.h>
67 #include <Library/DebugLib.h>
68 #include <Library/UefiLib.h>
69 #include <Library/BaseLib.h>
70 #include <Library/HobLib.h>
71 #include <Library/PerformanceLib.h>
72 #include <Library/UefiDecompressLib.h>
73 #include <Library/ExtractGuidedSectionLib.h>
74 #include <Library/CacheMaintenanceLib.h>
75 #include <Library/BaseMemoryLib.h>
76 #include <Library/PeCoffLib.h>
77 #include <Library/PcdLib.h>
78 #include <Library/MemoryAllocationLib.h>
79 #include <Library/DevicePathLib.h>
80 #include <Library/UefiBootServicesTableLib.h>
81 #include <Library/ReportStatusCodeLib.h>
83 #include "DebugImageInfo.h"
85 #include "FwVolBlock.h"
86 #include "FwVolDriver.h"
95 // Modifier for EFI DXE Services
97 #define EFI_DXESERVICE
100 // attributes for reserved memory before it is promoted to system memory
102 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
103 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
104 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
107 // range for memory mapped port I/O on IPF
109 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
113 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
114 /// to save time. A EFI_DEP_PUSH is evauated one an
115 /// replaced with EFI_DEP_REPLACE_TRUE
117 #define EFI_DEP_REPLACE_TRUE 0xff
120 /// Define the initial size of the dependency expression evaluation stack
122 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
125 EFI_GUID
*ProtocolGuid
;
130 } ARCHITECTURAL_PROTOCOL_ENTRY
;
133 EFI_STATUS_CODE_DATA DataHeader
;
135 } EFI_DXE_DEVICE_HANDLE_EXTENDED_DATA
;
137 #define EFI_STATUS_CODE_DXE_CORE_GUID \
138 { 0x335984bd, 0xe805, 0x409a, { 0xb8, 0xf8, 0xd2, 0x7e, 0xce, 0x5f, 0xf7, 0xa6 } }
141 // DXE Dispatcher Data structures
144 #define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w')
147 LIST_ENTRY Link
; // mFvHandleList
152 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r')
155 LIST_ENTRY Link
; // mDriverList
157 LIST_ENTRY ScheduledLink
; // mScheduledQueue
161 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
162 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
169 EFI_GUID BeforeAfterGuid
;
176 BOOLEAN DepexProtocolError
;
178 EFI_HANDLE ImageHandle
;
180 } EFI_CORE_DRIVER_ENTRY
;
183 //The data structure of GCD memory map entry
185 #define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m')
189 EFI_PHYSICAL_ADDRESS BaseAddress
;
193 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
194 EFI_GCD_IO_TYPE GcdIoType
;
195 EFI_HANDLE ImageHandle
;
196 EFI_HANDLE DeviceHandle
;
200 // DXE Core Global Variables
202 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
203 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
204 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
205 extern EFI_HANDLE gDxeCoreImageHandle
;
207 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
209 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
210 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
211 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
212 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
213 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
214 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
215 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
216 extern EFI_STATUS_CODE_PROTOCOL
*gStatusCode
;
218 extern EFI_TPL gEfiCurrentTpl
;
220 extern EFI_GUID
*gDxeCoreFileName
;
221 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
223 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
225 extern BOOLEAN gDispatcherRunning
;
226 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
229 // Service Initialization Functions
235 Called to initialize the pool.
245 Called to initialize the memory map and add descriptors to
246 the current descriptor list.
247 The first descriptor that is added must be general usable
248 memory as the addition allocates heap.
250 @param Type The type of memory to add
251 @param Start The starting address in the memory range Must be
253 @param NumberOfPages The number of pages in the range
254 @param Attribute Attributes of the memory to add
256 @return None. The range is added to the memory map
260 CoreAddMemoryDescriptor (
261 IN EFI_MEMORY_TYPE Type
,
262 IN EFI_PHYSICAL_ADDRESS Start
,
263 IN UINT64 NumberOfPages
,
269 Release memory lock on mGcdMemorySpaceLock.
273 CoreReleaseGcdMemoryLock (
279 Acquire memory lock on mGcdMemorySpaceLock.
283 CoreAcquireGcdMemoryLock (
289 External function. Initializes the GCD and memory services based on the memory
290 descriptor HOBs. This function is responsible for priming the GCD map and the
291 memory map, so memory allocations and resource allocations can be made. The first
292 part of this function can not depend on any memory services until at least one
293 memory descriptor is provided to the memory services. Then the memory services
294 can be used to intialize the GCD map.
296 @param HobStart The start address of the HOB.
297 @param MemoryBaseAddress Start address of memory region found to init DXE
299 @param MemoryLength Length of memory region found to init DXE core.
301 @retval EFI_SUCCESS Memory services successfully initialized.
305 CoreInitializeMemoryServices (
307 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
308 OUT UINT64
*MemoryLength
314 External function. Initializes the GCD and memory services based on the memory
315 descriptor HOBs. This function is responsible for priming the GCD map and the
316 memory map, so memory allocations and resource allocations can be made. The first
317 part of this function can not depend on any memory services until at least one
318 memory descriptor is provided to the memory services. Then the memory services
319 can be used to intialize the GCD map. The HobStart will be relocated to a pool
322 @param HobStart The start address of the HOB
323 @param MemoryBaseAddress Start address of memory region found to init DXE
325 @param MemoryLength Length of memory region found to init DXE core.
327 @retval EFI_SUCCESS GCD services successfully initialized.
331 CoreInitializeGcdServices (
332 IN OUT VOID
**HobStart
,
333 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
334 IN UINT64 MemoryLength
339 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.
378 @retval EFI_SUCCESS All AP services are available
379 @retval EFI_NOT_FOUND At least one AP service is not available
383 CoreAllEfiServicesAvailable (
389 Calcualte the 32-bit CRC in a EFI table using the service provided by the
392 @param Hdr Pointer to an EFI standard header
397 IN OUT EFI_TABLE_HEADER
*Hdr
402 Called by the platform code to process a tick.
404 @param Duration The number of 100ns elasped since the last call
416 Initialize the dispatcher. Initialize the notification function that runs when
417 an FV2 protocol is added to the system.
421 CoreInitializeDispatcher (
427 This is the POSTFIX version of the dependency evaluator. This code does
428 not need to handle Before or After, as it is not valid to call this
429 routine in this case. The SOR is just ignored and is a nop in the grammer.
430 POSTFIX means all the math is done on top of the stack.
432 @param DriverEntry DriverEntry element to update.
434 @retval TRUE If driver is ready to run.
435 @retval FALSE If driver is not ready to run or some fatal error
441 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
446 Preprocess dependency expression and update DriverEntry to reflect the
447 state of Before, After, and SOR dependencies. If DriverEntry->Before
448 or DriverEntry->After is set it will never be cleared. If SOR is set
449 it will be cleared by CoreSchedule(), and then the driver can be
452 @param DriverEntry DriverEntry element to update .
454 @retval EFI_SUCCESS It always works.
458 CorePreProcessDepex (
459 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
465 Terminates all boot services.
467 @param ImageHandle Handle that identifies the exiting image.
468 @param MapKey Key to the latest memory map.
470 @retval EFI_SUCCESS Boot Services terminated
471 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
476 CoreExitBootServices (
477 IN EFI_HANDLE ImageHandle
,
483 Make sure the memory map is following all the construction rules,
484 it is the last time to check memory map error before exit boot services.
486 @param MapKey Memory map key
488 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
490 @retval EFI_SUCCESS Valid memory map.
494 CoreTerminateMemoryMap (
500 Signals all events in the EventGroup.
502 @param EventGroup The list to signal
506 CoreNotifySignalList (
507 IN EFI_GUID
*EventGroup
513 Boot Service called to add, modify, or remove a system configuration table from
514 the EFI System Table.
516 @param Guid Pointer to the GUID for the entry to add, update, or
518 @param Table Pointer to the configuration table for the entry to add,
519 update, or remove, may be NULL.
521 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
522 @return EFI_INVALID_PARAMETER Input GUID not valid.
523 @return EFI_NOT_FOUND Attempted to delete non-existant entry
524 @return EFI_OUT_OF_RESOURCES Not enough memory available
529 CoreInstallConfigurationTable (
537 Raise the task priority level to the new level.
538 High level is implemented by disabling processor interrupts.
540 @param NewTpl New task priority level
542 @return The previous task priority level
554 Lowers the task priority to the previous value. If the new
555 priority unmasks events at a higher priority, they are dispatched.
557 @param NewTpl New, lower, task priority
569 Introduces a fine-grained stall.
571 @param Microseconds The number of microseconds to stall execution.
573 @retval EFI_SUCCESS Execution was stalled for at least the requested
574 amount of microseconds.
575 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
581 IN UINTN Microseconds
587 Sets the system's watchdog timer.
589 @param Timeout The number of seconds to set the watchdog timer to.
590 A value of zero disables the timer.
591 @param WatchdogCode The numeric code to log on a watchdog timer timeout
592 event. The firmware reserves codes 0x0000 to 0xFFFF.
593 Loaders and operating systems may use other timeout
595 @param DataSize The size, in bytes, of WatchdogData.
596 @param WatchdogData A data buffer that includes a Null-terminated Unicode
597 string, optionally followed by additional binary data.
598 The string is a description that the call may use to
599 further indicate the reason to be logged with a
602 @return EFI_SUCCESS Timeout has been set
603 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
604 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
605 @return EFI_DEVICE_ERROR Could not complete due to hardware error
610 CoreSetWatchdogTimer (
612 IN UINT64 WatchdogCode
,
614 IN CHAR16
*WatchdogData OPTIONAL
620 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
621 Calls the private one which contains a BOOLEAN parameter for notifications
623 @param UserHandle The handle to install the protocol handler on,
624 or NULL if a new handle is to be allocated
625 @param Protocol The protocol to add to the handle
626 @param InterfaceType Indicates whether Interface is supplied in
628 @param Interface The interface for the protocol being added
635 CoreInstallProtocolInterface (
636 IN OUT EFI_HANDLE
*UserHandle
,
637 IN EFI_GUID
*Protocol
,
638 IN EFI_INTERFACE_TYPE InterfaceType
,
644 Installs a protocol interface into the boot services environment.
646 @param UserHandle The handle to install the protocol handler on,
647 or NULL if a new handle is to be allocated
648 @param Protocol The protocol to add to the handle
649 @param InterfaceType Indicates whether Interface is supplied in
651 @param Interface The interface for the protocol being added
652 @param Notify indicates whether notify the notification list
655 @retval EFI_INVALID_PARAMETER Invalid parameter
656 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
657 @retval EFI_SUCCESS Protocol interface successfully installed
661 CoreInstallProtocolInterfaceNotify (
662 IN OUT EFI_HANDLE
*UserHandle
,
663 IN EFI_GUID
*Protocol
,
664 IN EFI_INTERFACE_TYPE InterfaceType
,
672 Installs a list of protocol interface into the boot services environment.
673 This function calls InstallProtocolInterface() in a loop. If any error
674 occures all the protocols added by this function are removed. This is
675 basically a lib function to save space.
677 @param Handle The handle to install the protocol handlers on,
678 or NULL if a new handle is to be allocated
679 @param ... EFI_GUID followed by protocol instance. A NULL
680 terminates the list. The pairs are the
681 arguments to InstallProtocolInterface(). All the
682 protocols are added to Handle.
684 @retval EFI_INVALID_PARAMETER Handle is NULL.
685 @retval EFI_SUCCESS Protocol interfaces successfully installed.
690 CoreInstallMultipleProtocolInterfaces (
691 IN OUT EFI_HANDLE
*Handle
,
698 Uninstalls a list of protocol interface in the boot services environment.
699 This function calls UnisatllProtocolInterface() in a loop. This is
700 basically a lib function to save space.
702 @param Handle The handle to uninstall the protocol
703 @param ... EFI_GUID followed by protocol instance. A NULL
704 terminates the list. The pairs are the
705 arguments to UninstallProtocolInterface(). All
706 the protocols are added to Handle.
713 CoreUninstallMultipleProtocolInterfaces (
714 IN EFI_HANDLE Handle
,
721 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
723 @param UserHandle Handle on which the interface is to be
725 @param Protocol The numeric ID of the interface
726 @param OldInterface A pointer to the old interface
727 @param NewInterface A pointer to the new interface
729 @retval EFI_SUCCESS The protocol interface was installed
730 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
731 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
736 CoreReinstallProtocolInterface (
737 IN EFI_HANDLE UserHandle
,
738 IN EFI_GUID
*Protocol
,
739 IN VOID
*OldInterface
,
740 IN VOID
*NewInterface
746 Uninstalls all instances of a protocol:interfacer from a handle.
747 If the last protocol interface is remove from the handle, the
750 @param UserHandle The handle to remove the protocol handler from
751 @param Protocol The protocol, of protocol:interface, to remove
752 @param Interface The interface, of protocol:interface, to remove
754 @retval EFI_INVALID_PARAMETER Protocol is NULL.
755 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
760 CoreUninstallProtocolInterface (
761 IN EFI_HANDLE UserHandle
,
762 IN EFI_GUID
*Protocol
,
769 Queries a handle to determine if it supports a specified protocol.
771 @param UserHandle The handle being queried.
772 @param Protocol The published unique identifier of the protocol.
773 @param Interface Supplies the address where a pointer to the
774 corresponding Protocol Interface is returned.
776 @return The requested protocol interface for the handle
782 IN EFI_HANDLE UserHandle
,
783 IN EFI_GUID
*Protocol
,
790 Locates the installed protocol handler for the handle, and
791 invokes it to obtain the protocol interface. Usage information
792 is registered in the protocol data base.
794 @param UserHandle The handle to obtain the protocol interface on
795 @param Protocol The ID of the protocol
796 @param Interface The location to return the protocol interface
797 @param ImageHandle The handle of the Image that is opening the
798 protocol interface specified by Protocol and
800 @param ControllerHandle The controller handle that is requiring this
802 @param Attributes The open mode of the protocol interface
803 specified by Handle and Protocol.
805 @retval EFI_INVALID_PARAMETER Protocol is NULL.
806 @retval EFI_SUCCESS Get the protocol interface.
812 IN EFI_HANDLE UserHandle
,
813 IN EFI_GUID
*Protocol
,
814 OUT VOID
**Interface OPTIONAL
,
815 IN EFI_HANDLE ImageHandle
,
816 IN EFI_HANDLE ControllerHandle
,
823 Return information about Opened protocols in the system
825 @param UserHandle The handle to close the protocol interface on
826 @param Protocol The ID of the protocol
827 @param EntryBuffer A pointer to a buffer of open protocol
828 information in the form of
829 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
830 @param EntryCount Number of EntryBuffer entries
835 CoreOpenProtocolInformation (
836 IN EFI_HANDLE UserHandle
,
837 IN EFI_GUID
*Protocol
,
838 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
839 OUT UINTN
*EntryCount
845 Closes a protocol on a handle that was opened using OpenProtocol().
847 @param UserHandle The handle for the protocol interface that was
848 previously opened with OpenProtocol(), and is
850 @param Protocol The published unique identifier of the protocol.
851 It is the caller's responsibility to pass in a
853 @param AgentHandle The handle of the agent that is closing the
855 @param ControllerHandle If the agent that opened a protocol is a driver
856 that follows the EFI Driver Model, then this
857 parameter is the controller handle that required
858 the protocol interface. If the agent does not
859 follow the EFI Driver Model, then this parameter
860 is optional and may be NULL.
862 @retval EFI_SUCCESS The protocol instance was closed.
863 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
865 @retval EFI_NOT_FOUND Can not find the specified protocol or
872 IN EFI_HANDLE UserHandle
,
873 IN EFI_GUID
*Protocol
,
874 IN EFI_HANDLE AgentHandle
,
875 IN EFI_HANDLE ControllerHandle
881 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
884 @param UserHandle The handle from which to retrieve the list of
885 protocol interface GUIDs.
886 @param ProtocolBuffer A pointer to the list of protocol interface GUID
887 pointers that are installed on Handle.
888 @param ProtocolBufferCount A pointer to the number of GUID pointers present
891 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
892 on Handle was returned in ProtocolBuffer. The
893 number of protocol interface GUIDs was returned
894 in ProtocolBufferCount.
895 @retval EFI_INVALID_PARAMETER Handle is NULL.
896 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
897 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
898 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
899 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
905 CoreProtocolsPerHandle (
906 IN EFI_HANDLE UserHandle
,
907 OUT EFI_GUID
***ProtocolBuffer
,
908 OUT UINTN
*ProtocolBufferCount
914 Add a new protocol notification record for the request protocol.
916 @param Protocol The requested protocol to add the notify
918 @param Event The event to signal
919 @param Registration Returns the registration record
921 @retval EFI_INVALID_PARAMETER Invalid parameter
922 @retval EFI_SUCCESS Successfully returned the registration record
928 CoreRegisterProtocolNotify (
929 IN EFI_GUID
*Protocol
,
931 OUT VOID
**Registration
937 Locates the requested handle(s) and returns them in Buffer.
939 @param SearchType The type of search to perform to locate the
941 @param Protocol The protocol to search for
942 @param SearchKey Dependant on SearchType
943 @param BufferSize On input the size of Buffer. On output the
944 size of data returned.
945 @param Buffer The buffer to return the results in
947 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
948 returned in BufferSize.
949 @retval EFI_INVALID_PARAMETER Invalid parameter
950 @retval EFI_SUCCESS Successfully found the requested handle(s) and
951 returns them in Buffer.
957 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
958 IN EFI_GUID
*Protocol OPTIONAL
,
959 IN VOID
*SearchKey OPTIONAL
,
960 IN OUT UINTN
*BufferSize
,
961 OUT EFI_HANDLE
*Buffer
967 Locates the handle to a device on the device path that best matches the specified protocol.
969 @param Protocol The protocol to search for.
970 @param DevicePath On input, a pointer to a pointer to the device
971 path. On output, the device path pointer is
972 modified to point to the remaining part of the
974 @param Device A pointer to the returned device handle.
976 @retval EFI_SUCCESS The resulting handle was returned.
977 @retval EFI_NOT_FOUND No handles matched the search.
978 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
983 CoreLocateDevicePath (
984 IN EFI_GUID
*Protocol
,
985 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
986 OUT EFI_HANDLE
*Device
992 Function returns an array of handles that support the requested protocol
993 in a buffer allocated from pool. This is a version of CoreLocateHandle()
994 that allocates a buffer for the caller.
996 @param SearchType Specifies which handle(s) are to be returned.
997 @param Protocol Provides the protocol to search by. This
998 parameter is only valid for SearchType
1000 @param SearchKey Supplies the search key depending on the
1002 @param NumberHandles The number of handles returned in Buffer.
1003 @param Buffer A pointer to the buffer to return the requested
1004 array of handles that support Protocol.
1006 @retval EFI_SUCCESS The result array of handles was returned.
1007 @retval EFI_NOT_FOUND No handles match the search.
1008 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1010 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1015 CoreLocateHandleBuffer (
1016 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1017 IN EFI_GUID
*Protocol OPTIONAL
,
1018 IN VOID
*SearchKey OPTIONAL
,
1019 IN OUT UINTN
*NumberHandles
,
1020 OUT EFI_HANDLE
**Buffer
1026 Return the first Protocol Interface that matches the Protocol GUID. If
1027 Registration is pasased in return a Protocol Instance that was just add
1028 to the system. If Retistration is NULL return the first Protocol Interface
1031 @param Protocol The protocol to search for
1032 @param Registration Optional Registration Key returned from
1033 RegisterProtocolNotify()
1034 @param Interface Return the Protocol interface (instance).
1036 @retval EFI_SUCCESS If a valid Interface is returned
1037 @retval EFI_INVALID_PARAMETER Invalid parameter
1038 @retval EFI_NOT_FOUND Protocol interface not found
1043 CoreLocateProtocol (
1044 IN EFI_GUID
*Protocol
,
1045 IN VOID
*Registration OPTIONAL
,
1046 OUT VOID
**Interface
1051 return handle database key.
1054 @return Handle database key.
1058 CoreGetHandleDatabaseKey (
1064 Go connect any handles that were created or modified while a image executed.
1066 @param Key The Key to show that the handle has been
1071 CoreConnectHandlesByKey (
1078 Connects one or more drivers to a controller.
1080 @param ControllerHandle Handle of the controller to be
1082 @param DriverImageHandle DriverImageHandle A pointer to an
1083 ordered list of driver image
1085 @param RemainingDevicePath RemainingDevicePath A pointer to
1086 the device path that specifies a
1087 child of the controller specified
1088 by ControllerHandle.
1089 @param Recursive Whether the function would be
1090 called recursively or not.
1092 @return Status code.
1097 CoreConnectController (
1098 IN EFI_HANDLE ControllerHandle
,
1099 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1100 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1101 IN BOOLEAN Recursive
1107 Disonnects a controller from a driver
1109 @param ControllerHandle ControllerHandle The handle of
1110 the controller from which
1113 @param DriverImageHandle DriverImageHandle The driver to
1114 disconnect from ControllerHandle.
1115 @param ChildHandle ChildHandle The handle of the
1118 @retval EFI_SUCCESS One or more drivers were
1119 disconnected from the controller.
1120 @retval EFI_SUCCESS On entry, no drivers are managing
1122 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1123 and on entry DriverImageHandle is
1124 not managing ControllerHandle.
1125 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1127 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1128 and it is not a valid EFI_HANDLE.
1129 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1130 is not a valid EFI_HANDLE.
1131 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1132 available to disconnect any
1133 drivers from ControllerHandle.
1134 @retval EFI_DEVICE_ERROR The controller could not be
1135 disconnected because of a device
1141 CoreDisconnectController (
1142 IN EFI_HANDLE ControllerHandle
,
1143 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1144 IN EFI_HANDLE ChildHandle OPTIONAL
1150 Allocates pages from the memory map.
1152 @param Type The type of allocation to perform
1153 @param MemoryType The type of memory to turn the allocated pages
1155 @param NumberOfPages The number of pages to allocate
1156 @param Memory A pointer to receive the base allocated memory
1159 @return Status. On success, Memory is filled in with the base address allocated
1160 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1162 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1163 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1164 @retval EFI_SUCCESS Pages successfully allocated.
1170 IN EFI_ALLOCATE_TYPE Type
,
1171 IN EFI_MEMORY_TYPE MemoryType
,
1172 IN UINTN NumberOfPages
,
1173 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1179 Frees previous allocated pages.
1181 @param Memory Base address of memory being freed
1182 @param NumberOfPages The number of pages to free
1184 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1185 @retval EFI_INVALID_PARAMETER Address not aligned
1186 @return EFI_SUCCESS -Pages successfully freed.
1192 IN EFI_PHYSICAL_ADDRESS Memory
,
1193 IN UINTN NumberOfPages
1199 This function returns a copy of the current memory map. The map is an array of
1200 memory descriptors, each of which describes a contiguous block of memory.
1202 @param MemoryMapSize A pointer to the size, in bytes, of the
1203 MemoryMap buffer. On input, this is the size of
1204 the buffer allocated by the caller. On output,
1205 it is the size of the buffer returned by the
1206 firmware if the buffer was large enough, or the
1207 size of the buffer needed to contain the map if
1208 the buffer was too small.
1209 @param MemoryMap A pointer to the buffer in which firmware places
1210 the current memory map.
1211 @param MapKey A pointer to the location in which firmware
1212 returns the key for the current memory map.
1213 @param DescriptorSize A pointer to the location in which firmware
1214 returns the size, in bytes, of an individual
1215 EFI_MEMORY_DESCRIPTOR.
1216 @param DescriptorVersion A pointer to the location in which firmware
1217 returns the version number associated with the
1218 EFI_MEMORY_DESCRIPTOR.
1220 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1222 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1223 buffer size needed to hold the memory map is
1224 returned in MemoryMapSize.
1225 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1231 IN OUT UINTN
*MemoryMapSize
,
1232 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1234 OUT UINTN
*DescriptorSize
,
1235 OUT UINT32
*DescriptorVersion
1241 Allocate pool of a particular type.
1243 @param PoolType Type of pool to allocate
1244 @param Size The amount of pool to allocate
1245 @param Buffer The address to return a pointer to the allocated
1248 @retval EFI_INVALID_PARAMETER PoolType not valid
1249 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1250 @retval EFI_SUCCESS Pool successfully allocated.
1256 IN EFI_MEMORY_TYPE PoolType
,
1266 @param Buffer The allocated pool entry to free
1268 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1269 @retval EFI_SUCCESS Pool successfully freed.
1281 Loads an EFI image into memory and returns a handle to the image.
1283 @param BootPolicy If TRUE, indicates that the request originates
1284 from the boot manager, and that the boot
1285 manager is attempting to load FilePath as a
1287 @param ParentImageHandle The caller's image handle.
1288 @param FilePath The specific file path from which the image is
1290 @param SourceBuffer If not NULL, a pointer to the memory location
1291 containing a copy of the image to be loaded.
1292 @param SourceSize The size in bytes of SourceBuffer.
1293 @param ImageHandle Pointer to the returned image handle that is
1294 created when the image is successfully loaded.
1296 @retval EFI_SUCCESS The image was loaded into memory.
1297 @retval EFI_NOT_FOUND The FilePath was not found.
1298 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1299 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1300 path cannot be parsed to locate the proper
1301 protocol for loading the file.
1302 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1309 IN BOOLEAN BootPolicy
,
1310 IN EFI_HANDLE ParentImageHandle
,
1311 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1312 IN VOID
*SourceBuffer OPTIONAL
,
1313 IN UINTN SourceSize
,
1314 OUT EFI_HANDLE
*ImageHandle
1322 @param ImageHandle Handle that identifies the image to be
1325 @retval EFI_SUCCESS The image has been unloaded.
1326 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1328 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1334 IN EFI_HANDLE ImageHandle
1340 Transfer control to a loaded image's entry point.
1342 @param ImageHandle Handle of image to be started.
1343 @param ExitDataSize Pointer of the size to ExitData
1344 @param ExitData Pointer to a pointer to a data buffer that
1345 includes a Null-terminated Unicode string,
1346 optionally followed by additional binary data.
1347 The string is a description that the caller may
1348 use to further indicate the reason for the
1351 @retval EFI_INVALID_PARAMETER Invalid parameter
1352 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1353 @retval EFI_SUCCESS Successfully transfer control to the image's
1360 IN EFI_HANDLE ImageHandle
,
1361 OUT UINTN
*ExitDataSize
,
1362 OUT CHAR16
**ExitData OPTIONAL
1368 Terminates the currently loaded EFI image and returns control to boot services.
1370 @param ImageHandle Handle that identifies the image. This
1371 parameter is passed to the image on entry.
1372 @param Status The image's exit code.
1373 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1374 ExitStatus is EFI_SUCCESS.
1375 @param ExitData Pointer to a data buffer that includes a
1376 Null-terminated Unicode string, optionally
1377 followed by additional binary data. The string
1378 is a description that the caller may use to
1379 further indicate the reason for the image's
1382 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1384 @retval EFI_SUCCESS Successfully terminates the currently loaded
1386 @retval EFI_ACCESS_DENIED Should never reach there.
1387 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1393 IN EFI_HANDLE ImageHandle
,
1394 IN EFI_STATUS Status
,
1395 IN UINTN ExitDataSize
,
1396 IN CHAR16
*ExitData OPTIONAL
1402 Creates a general-purpose event structure.
1404 @param Type The type of event to create and its mode and
1406 @param NotifyTpl The task priority level of event notifications
1407 @param NotifyFunction Pointer to the events notification function
1408 @param NotifyContext Pointer to the notification functions context;
1409 corresponds to parameter "Context" in the
1410 notification function
1411 @param Event Pointer to the newly created event if the call
1412 succeeds; undefined otherwise
1414 @retval EFI_SUCCESS The event structure was created
1415 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1416 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1423 IN EFI_TPL NotifyTpl
,
1424 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1425 IN VOID
*NotifyContext
, OPTIONAL
1426 OUT EFI_EVENT
*Event
1432 Creates a general-purpose event structure
1434 @param Type The type of event to create and its mode and
1436 @param NotifyTpl The task priority level of event notifications
1437 @param NotifyFunction Pointer to the events notification function
1438 @param NotifyContext Pointer to the notification functions context;
1439 corresponds to parameter "Context" in the
1440 notification function
1441 @param EventGroup GUID for EventGroup if NULL act the same as
1443 @param Event Pointer to the newly created event if the call
1444 succeeds; undefined otherwise
1446 @retval EFI_SUCCESS The event structure was created
1447 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1448 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1455 IN EFI_TPL NotifyTpl
,
1456 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1457 IN CONST VOID
*NotifyContext
, OPTIONAL
1458 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1459 OUT EFI_EVENT
*Event
1465 Sets the type of timer and the trigger time for a timer event.
1467 @param UserEvent The timer event that is to be signaled at the
1469 @param Type The type of time that is specified in
1471 @param TriggerTime The number of 100ns units until the timer
1474 @retval EFI_SUCCESS The event has been set to be signaled at the
1476 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1482 IN EFI_EVENT UserEvent
,
1483 IN EFI_TIMER_DELAY Type
,
1484 IN UINT64 TriggerTime
1490 Signals the event. Queues the event to be notified if needed.
1492 @param UserEvent The event to signal .
1494 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1495 @retval EFI_SUCCESS The event was signaled.
1501 IN EFI_EVENT UserEvent
1507 Stops execution until an event is signaled.
1509 @param NumberOfEvents The number of events in the UserEvents array
1510 @param UserEvents An array of EFI_EVENT
1511 @param UserIndex Pointer to the index of the event which
1512 satisfied the wait condition
1514 @retval EFI_SUCCESS The event indicated by Index was signaled.
1515 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1516 function or Event was not a valid type
1517 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1523 IN UINTN NumberOfEvents
,
1524 IN EFI_EVENT
*UserEvents
,
1525 OUT UINTN
*UserIndex
1531 Closes an event and frees the event structure.
1533 @param UserEvent Event to close
1535 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1536 @retval EFI_SUCCESS The event has been closed
1542 IN EFI_EVENT UserEvent
1548 Check the status of an event.
1550 @param UserEvent The event to check
1552 @retval EFI_SUCCESS The event is in the signaled state
1553 @retval EFI_NOT_READY The event is not in the signaled state
1554 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1560 IN EFI_EVENT UserEvent
1565 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1566 global coherency domain of the processor.
1568 @param GcdMemoryType Memory type of the memory space.
1569 @param BaseAddress Base address of the memory space.
1570 @param Length Length of the memory space.
1571 @param Capabilities alterable attributes of the memory space.
1573 @retval EFI_SUCCESS Merged this memory space into GCD map.
1577 CoreAddMemorySpace (
1578 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1579 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1581 IN UINT64 Capabilities
1586 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1587 I/O resources from the global coherency domain of the processor.
1589 @param GcdAllocateType The type of allocate operation
1590 @param GcdMemoryType The desired memory type
1591 @param Alignment Align with 2^Alignment
1592 @param Length Length to allocate
1593 @param BaseAddress Base address to allocate
1594 @param ImageHandle The image handle consume the allocated space.
1595 @param DeviceHandle The device handle consume the allocated space.
1597 @retval EFI_INVALID_PARAMETER Invalid parameter.
1598 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1599 @retval EFI_SUCCESS Memory space successfully allocated.
1603 CoreAllocateMemorySpace (
1604 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1605 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1608 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1609 IN EFI_HANDLE ImageHandle
,
1610 IN EFI_HANDLE DeviceHandle OPTIONAL
1615 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1616 I/O resources from the global coherency domain of the processor.
1618 @param BaseAddress Base address of the memory space.
1619 @param Length Length of the memory space.
1621 @retval EFI_SUCCESS Space successfully freed.
1625 CoreFreeMemorySpace (
1626 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1632 Removes reserved memory, system memory, or memory-mapped I/O resources from
1633 the global coherency domain of the processor.
1635 @param BaseAddress Base address of the memory space.
1636 @param Length Length of the memory space.
1638 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1642 CoreRemoveMemorySpace (
1643 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1649 Retrieves the descriptor for a memory region containing a specified address.
1651 @param BaseAddress Specified start address
1652 @param Descriptor Specified length
1654 @retval EFI_INVALID_PARAMETER Invalid parameter
1655 @retval EFI_SUCCESS Successfully get memory space descriptor.
1659 CoreGetMemorySpaceDescriptor (
1660 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1661 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1666 Modifies the attributes for a memory region in the global coherency domain of the
1669 @param BaseAddress Specified start address
1670 @param Length Specified length
1671 @param Attributes Specified attributes
1673 @retval EFI_SUCCESS Successfully set attribute of a segment of
1678 CoreSetMemorySpaceAttributes (
1679 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1681 IN UINT64 Attributes
1686 Returns a map of the memory resources in the global coherency domain of the
1689 @param NumberOfDescriptors Number of descriptors.
1690 @param MemorySpaceMap Descriptor array
1692 @retval EFI_INVALID_PARAMETER Invalid parameter
1693 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1694 @retval EFI_SUCCESS Successfully get memory space map.
1698 CoreGetMemorySpaceMap (
1699 OUT UINTN
*NumberOfDescriptors
,
1700 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1705 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1707 @param GcdIoType IO type of the segment.
1708 @param BaseAddress Base address of the segment.
1709 @param Length Length of the segment.
1711 @retval EFI_SUCCESS Merged this segment into GCD map.
1712 @retval EFI_INVALID_PARAMETER Parameter not valid
1717 IN EFI_GCD_IO_TYPE GcdIoType
,
1718 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1724 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1725 domain of the processor.
1727 @param GcdAllocateType The type of allocate operation
1728 @param GcdIoType The desired IO type
1729 @param Alignment Align with 2^Alignment
1730 @param Length Length to allocate
1731 @param BaseAddress Base address to allocate
1732 @param ImageHandle The image handle consume the allocated space.
1733 @param DeviceHandle The device handle consume the allocated space.
1735 @retval EFI_INVALID_PARAMETER Invalid parameter.
1736 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1737 @retval EFI_SUCCESS IO space successfully allocated.
1741 CoreAllocateIoSpace (
1742 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1743 IN EFI_GCD_IO_TYPE GcdIoType
,
1746 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1747 IN EFI_HANDLE ImageHandle
,
1748 IN EFI_HANDLE DeviceHandle OPTIONAL
1753 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1754 domain of the processor.
1756 @param BaseAddress Base address of the segment.
1757 @param Length Length of the segment.
1759 @retval EFI_SUCCESS Space successfully freed.
1764 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1770 Removes reserved I/O or I/O resources from the global coherency domain of the
1773 @param BaseAddress Base address of the segment.
1774 @param Length Length of the segment.
1776 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1781 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1787 Retrieves the descriptor for an I/O region containing a specified address.
1789 @param BaseAddress Specified start address
1790 @param Descriptor Specified length
1792 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1793 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1797 CoreGetIoSpaceDescriptor (
1798 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1799 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1804 Returns a map of the I/O resources in the global coherency domain of the processor.
1806 @param NumberOfDescriptors Number of descriptors.
1807 @param IoSpaceMap Descriptor array
1809 @retval EFI_INVALID_PARAMETER Invalid parameter
1810 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1811 @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 Helper function called as part of the code needed
1885 to allocate the proper sized buffer for various
1888 @param Status Current status
1889 @param Buffer Current allocated buffer, or NULL
1890 @param BufferSize Current buffer size needed
1892 @retval TRUE if the buffer was reallocated and the caller
1893 should try the API again.
1894 @retval FALSE buffer could not be allocated and the caller
1895 should not try the API again.
1900 IN OUT EFI_STATUS
*Status
,
1901 IN OUT VOID
**Buffer
,
1907 This routine is the driver initialization entry point. It initializes the
1908 libraries, and registers two notification functions. These notification
1909 functions are responsible for building the FV stack dynamically.
1911 @param ImageHandle The image handle.
1912 @param SystemTable The system table.
1914 @retval EFI_SUCCESS Function successfully returned.
1920 IN EFI_HANDLE ImageHandle
,
1921 IN EFI_SYSTEM_TABLE
*SystemTable
1926 Entry point of the section extraction code. Initializes an instance of the
1927 section extraction interface and installs it on a new handle.
1929 @param ImageHandle A handle for the image that is initializing this driver
1930 @param SystemTable A pointer to the EFI system table
1932 @retval EFI_SUCCESS Driver initialized successfully
1933 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1938 InitializeSectionExtraction (
1939 IN EFI_HANDLE ImageHandle
,
1940 IN EFI_SYSTEM_TABLE
*SystemTable
1945 This DXE service routine is used to process a firmware volume. In
1946 particular, it can be called by BDS to process a single firmware
1947 volume found in a capsule.
1949 @param FvHeader pointer to a firmware volume header
1950 @param Size the size of the buffer pointed to by FvHeader
1951 @param FVProtocolHandle the handle on which a firmware volume protocol
1952 was produced for the firmware volume passed in.
1954 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1956 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1957 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1962 CoreProcessFirmwareVolume (
1965 OUT EFI_HANDLE
*FVProtocolHandle
1969 //Functions used during debug buils
1973 Displays Architectural protocols that were not loaded and are required for DXE
1974 core to function. Only used in Debug Builds.
1978 CoreDisplayMissingArchProtocols (
1984 Traverse the discovered list for any drivers that were discovered but not loaded
1985 because the dependency experessions evaluated to false.
1989 CoreDisplayDiscoveredNotDispatched (
1995 Place holder function until all the Boot Services and Runtime Services are
1998 @return EFI_NOT_AVAILABLE_YET
2003 CoreEfiNotAvailableYetArg0 (
2009 Place holder function until all the Boot Services and Runtime Services are
2012 @param Arg1 Undefined
2014 @return EFI_NOT_AVAILABLE_YET
2019 CoreEfiNotAvailableYetArg1 (
2025 Place holder function until all the Boot Services and Runtime Services are available.
2027 @param Arg1 Undefined
2028 @param Arg2 Undefined
2030 @return EFI_NOT_AVAILABLE_YET
2035 CoreEfiNotAvailableYetArg2 (
2042 Place holder function until all the Boot Services and Runtime Services are available.
2044 @param Arg1 Undefined
2045 @param Arg2 Undefined
2046 @param Arg3 Undefined
2048 @return EFI_NOT_AVAILABLE_YET
2053 CoreEfiNotAvailableYetArg3 (
2061 Place holder function until all the Boot Services and Runtime Services are available.
2063 @param Arg1 Undefined
2064 @param Arg2 Undefined
2065 @param Arg3 Undefined
2066 @param Arg4 Undefined
2068 @return EFI_NOT_AVAILABLE_YET
2073 CoreEfiNotAvailableYetArg4 (
2082 Place holder function until all the Boot Services and Runtime Services are available.
2084 @param Arg1 Undefined
2085 @param Arg2 Undefined
2086 @param Arg3 Undefined
2087 @param Arg4 Undefined
2088 @param Arg5 Undefined
2090 @return EFI_NOT_AVAILABLE_YET
2095 CoreEfiNotAvailableYetArg5 (
2105 Searches for a Protocol Interface passed from PEI through a HOB.
2107 @param ProtocolGuid The Protocol GUID to search for in the HOB List
2108 @param Interface A pointer to the interface for the Protocol GUID
2110 @retval EFI_SUCCESS The Protocol GUID was found and its interface is
2111 returned in Interface
2112 @retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List
2116 CoreGetPeiProtocol (
2117 IN EFI_GUID
*ProtocolGuid
,
2123 Given a compressed source buffer, this function retrieves the size of the
2124 uncompressed buffer and the size of the scratch buffer required to decompress
2125 the compressed source buffer.
2127 The GetInfo() function retrieves the size of the uncompressed buffer and the
2128 temporary scratch buffer required to decompress the buffer specified by Source
2129 and SourceSize. If the size of the uncompressed buffer or the size of the
2130 scratch buffer cannot be determined from the compressed data specified by
2131 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2132 size of the uncompressed buffer is returned in DestinationSize, the size of
2133 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2134 The GetInfo() function does not have scratch buffer available to perform a
2135 thorough checking of the validity of the source data. It just retrieves the
2136 "Original Size" field from the beginning bytes of the source data and output
2137 it as DestinationSize. And ScratchSize is specific to the decompression
2140 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2141 @param Source The source buffer containing the compressed data.
2142 @param SourceSize The size, in bytes, of the source buffer.
2143 @param DestinationSize A pointer to the size, in bytes, of the
2144 uncompressed buffer that will be generated when the
2145 compressed buffer specified by Source and
2146 SourceSize is decompressed.
2147 @param ScratchSize A pointer to the size, in bytes, of the scratch
2148 buffer that is required to decompress the
2149 compressed buffer specified by Source and
2152 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2153 DestinationSize and the size of the scratch buffer
2154 was returned in ScratchSize.
2155 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2156 the scratch buffer cannot be determined from the
2157 compressed data specified by Source and
2163 DxeMainUefiDecompressGetInfo (
2164 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2166 IN UINT32 SourceSize
,
2167 OUT UINT32
*DestinationSize
,
2168 OUT UINT32
*ScratchSize
2173 Decompresses a compressed source buffer.
2175 The Decompress() function extracts decompressed data to its original form.
2176 This protocol is designed so that the decompression algorithm can be
2177 implemented without using any memory services. As a result, the Decompress()
2178 Function is not allowed to call AllocatePool() or AllocatePages() in its
2179 implementation. It is the caller's responsibility to allocate and free the
2180 Destination and Scratch buffers.
2181 If the compressed source data specified by Source and SourceSize is
2182 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2183 the compressed source data specified by Source and SourceSize is not in a
2184 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2186 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2187 @param Source The source buffer containing the compressed data.
2188 @param SourceSize SourceSizeThe size of source data.
2189 @param Destination On output, the destination buffer that contains
2190 the uncompressed data.
2191 @param DestinationSize The size of the destination buffer. The size of
2192 the destination buffer needed is obtained from
2193 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2194 @param Scratch A temporary scratch buffer that is used to perform
2196 @param ScratchSize The size of scratch buffer. The size of the
2197 scratch buffer needed is obtained from GetInfo().
2199 @retval EFI_SUCCESS Decompression completed successfully, and the
2200 uncompressed buffer is returned in Destination.
2201 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2202 SourceSize is corrupted (not in a valid
2208 DxeMainUefiDecompress (
2209 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2211 IN UINT32 SourceSize
,
2212 IN OUT VOID
*Destination
,
2213 IN UINT32 DestinationSize
,
2214 IN OUT VOID
*Scratch
,
2215 IN UINT32 ScratchSize
2219 SEP member function. This function creates and returns a new section stream
2220 handle to represent the new section stream.
2222 @param SectionStreamLength Size in bytes of the section stream.
2223 @param SectionStream Buffer containing the new section stream.
2224 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2225 output contains the new section stream handle.
2227 @retval EFI_SUCCESS The section stream is created successfully.
2228 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2229 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2236 IN UINTN SectionStreamLength
,
2237 IN VOID
*SectionStream
,
2238 OUT UINTN
*SectionStreamHandle
2244 SEP member function. Retrieves requested section from section stream.
2246 @param SectionStreamHandle The section stream from which to extract the
2248 @param SectionType A pointer to the type of section to search for.
2249 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2250 then SectionDefinitionGuid indicates which of
2251 these types of sections to search for.
2252 @param SectionInstance Indicates which instance of the requested
2254 @param Buffer Double indirection to buffer. If *Buffer is
2255 non-null on input, then the buffer is caller
2256 allocated. If Buffer is NULL, then the buffer
2257 is callee allocated. In either case, the
2258 requried buffer size is returned in *BufferSize.
2259 @param BufferSize On input, indicates the size of *Buffer if
2260 *Buffer is non-null on input. On output,
2261 indicates the required size (allocated size if
2262 callee allocated) of *Buffer.
2263 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2264 indicates the authentication status of the
2265 output buffer. If the input section's
2266 GuidedSectionHeader.Attributes field
2267 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2268 bit as clear, AuthenticationStatus must return
2269 zero. Both local bits (19:16) and aggregate
2270 bits (3:0) in AuthenticationStatus are returned
2271 by ExtractSection(). These bits reflect the
2272 status of the extraction operation. The bit
2273 pattern in both regions must be the same, as
2274 the local and aggregate authentication statuses
2275 have equivalent meaning at this level. If the
2276 function returns anything other than
2277 EFI_SUCCESS, the value of *AuthenticationStatus
2280 @retval EFI_SUCCESS Section was retrieved successfully
2281 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2282 section stream with its
2283 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2284 but there was no corresponding GUIDed Section
2285 Extraction Protocol in the handle database.
2286 *Buffer is unmodified.
2287 @retval EFI_NOT_FOUND An error was encountered when parsing the
2288 SectionStream. This indicates the SectionStream
2289 is not correctly formatted.
2290 @retval EFI_NOT_FOUND The requested section does not exist.
2291 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2293 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2294 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2295 insufficient to contain the requested section.
2296 The input buffer is filled and section contents
2303 IN UINTN SectionStreamHandle
,
2304 IN EFI_SECTION_TYPE
*SectionType
,
2305 IN EFI_GUID
*SectionDefinitionGuid
,
2306 IN UINTN SectionInstance
,
2308 IN OUT UINTN
*BufferSize
,
2309 OUT UINT32
*AuthenticationStatus
2314 SEP member function. Deletes an existing section stream
2316 @param StreamHandleToClose Indicates the stream to close
2318 @retval EFI_SUCCESS The section stream is closed sucessfully.
2319 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2320 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2326 CloseSectionStream (
2327 IN UINTN StreamHandleToClose