2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include <Protocol/LoadedImage.h>
24 #include <Protocol/GuidedSectionExtraction.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/Runtime.h>
27 #include <Protocol/LoadFile.h>
28 #include <Protocol/LoadFile2.h>
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/VariableWrite.h>
31 #include <Protocol/PlatformDriverOverride.h>
32 #include <Protocol/Variable.h>
33 #include <Protocol/Timer.h>
34 #include <Protocol/SimpleFileSystem.h>
35 #include <Protocol/Bds.h>
36 #include <Protocol/RealTimeClock.h>
37 #include <Protocol/WatchdogTimer.h>
38 #include <Protocol/FirmwareVolume2.h>
39 #include <Protocol/MonotonicCounter.h>
40 #include <Protocol/StatusCode.h>
41 #include <Protocol/Decompress.h>
42 #include <Protocol/LoadPe32Image.h>
43 #include <Protocol/Security.h>
44 #include <Protocol/Ebc.h>
45 #include <Protocol/Reset.h>
46 #include <Protocol/Cpu.h>
47 #include <Protocol/Metronome.h>
48 #include <Protocol/FirmwareVolumeBlock.h>
49 #include <Protocol/Capsule.h>
50 #include <Protocol/BusSpecificDriverOverride.h>
51 #include <Protocol/TcgService.h>
52 #include <Protocol/HiiPackageList.h>
53 #include <Protocol/SmmBase2.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>
64 #include <Guid/LoadModuleAtFixedAddress.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/PeCoffGetEntryPointLib.h>
78 #include <Library/PeCoffExtraActionLib.h>
79 #include <Library/PcdLib.h>
80 #include <Library/MemoryAllocationLib.h>
81 #include <Library/DevicePathLib.h>
82 #include <Library/UefiBootServicesTableLib.h>
83 #include <Library/ReportStatusCodeLib.h>
84 #include <Library/TimerLib.h>
85 #include <Library/DxeServicesLib.h>
86 #include <Library/DebugAgentLib.h>
90 // attributes for reserved memory before it is promoted to system memory
92 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
93 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
94 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
97 // range for memory mapped port I/O on IPF
99 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
103 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
104 /// to save time. A EFI_DEP_PUSH is evauated one an
105 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
106 /// Driver Execution Environment Core Interface use 0xff
107 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
108 /// defined to a new value that is not conflicting with PI spec.
110 #define EFI_DEP_REPLACE_TRUE 0xff
113 /// Define the initial size of the dependency expression evaluation stack
115 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
118 EFI_GUID
*ProtocolGuid
;
123 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
126 // DXE Dispatcher Data structures
129 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
132 LIST_ENTRY Link
; // mFvHandleList
137 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
140 LIST_ENTRY Link
; // mDriverList
142 LIST_ENTRY ScheduledLink
; // mScheduledQueue
146 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
147 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
154 EFI_GUID BeforeAfterGuid
;
161 BOOLEAN DepexProtocolError
;
163 EFI_HANDLE ImageHandle
;
165 } EFI_CORE_DRIVER_ENTRY
;
168 //The data structure of GCD memory map entry
170 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
174 EFI_PHYSICAL_ADDRESS BaseAddress
;
178 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
179 EFI_GCD_IO_TYPE GcdIoType
;
180 EFI_HANDLE ImageHandle
;
181 EFI_HANDLE DeviceHandle
;
185 // DXE Core Global Variables
187 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
188 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
189 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
190 extern EFI_HANDLE gDxeCoreImageHandle
;
192 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
194 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
195 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
196 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
197 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
198 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
199 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
200 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
201 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
203 extern EFI_TPL gEfiCurrentTpl
;
205 extern EFI_GUID
*gDxeCoreFileName
;
206 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
208 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
210 extern BOOLEAN gDispatcherRunning
;
211 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
213 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
214 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
216 // Service Initialization Functions
222 Called to initialize the pool.
232 Called to initialize the memory map and add descriptors to
233 the current descriptor list.
234 The first descriptor that is added must be general usable
235 memory as the addition allocates heap.
237 @param Type The type of memory to add
238 @param Start The starting address in the memory range Must be
240 @param NumberOfPages The number of pages in the range
241 @param Attribute Attributes of the memory to add
243 @return None. The range is added to the memory map
247 CoreAddMemoryDescriptor (
248 IN EFI_MEMORY_TYPE Type
,
249 IN EFI_PHYSICAL_ADDRESS Start
,
250 IN UINT64 NumberOfPages
,
256 Release memory lock on mGcdMemorySpaceLock.
260 CoreReleaseGcdMemoryLock (
266 Acquire memory lock on mGcdMemorySpaceLock.
270 CoreAcquireGcdMemoryLock (
276 External function. Initializes memory services based on the memory
277 descriptor HOBs. This function is responsible for priming the memory
278 map, so memory allocations and resource allocations can be made.
279 The first part of this function can not depend on any memory services
280 until at least one memory descriptor is provided to the memory services.
282 @param HobStart The start address of the HOB.
283 @param MemoryBaseAddress Start address of memory region found to init DXE
285 @param MemoryLength Length of memory region found to init DXE core.
287 @retval EFI_SUCCESS Memory services successfully initialized.
291 CoreInitializeMemoryServices (
293 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
294 OUT UINT64
*MemoryLength
300 External function. Initializes the GCD and memory services based on the memory
301 descriptor HOBs. This function is responsible for priming the GCD map and the
302 memory map, so memory allocations and resource allocations can be made. The
303 HobStart will be relocated to a pool buffer.
305 @param HobStart The start address of the HOB
306 @param MemoryBaseAddress Start address of memory region found to init DXE
308 @param MemoryLength Length of memory region found to init DXE core.
310 @retval EFI_SUCCESS GCD services successfully initialized.
314 CoreInitializeGcdServices (
315 IN OUT VOID
**HobStart
,
316 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
317 IN UINT64 MemoryLength
322 Initializes "event" support.
324 @retval EFI_SUCCESS Always return success
328 CoreInitializeEventServices (
334 Add the Image Services to EFI Boot Services Table and install the protocol
335 interfaces for this image.
337 @param HobStart The HOB to initialize
343 CoreInitializeImageServices (
349 Creates an event that is fired everytime a Protocol of a specific type is installed.
353 CoreNotifyOnProtocolInstallation (
359 Return TRUE if all AP services are availible.
361 @retval EFI_SUCCESS All AP services are available
362 @retval EFI_NOT_FOUND At least one AP service is not available
366 CoreAllEfiServicesAvailable (
372 Calcualte the 32-bit CRC in a EFI table using the service provided by the
375 @param Hdr Pointer to an EFI standard header
380 IN OUT EFI_TABLE_HEADER
*Hdr
385 Called by the platform code to process a tick.
387 @param Duration The number of 100ns elasped since the last call
399 Initialize the dispatcher. Initialize the notification function that runs when
400 an FV2 protocol is added to the system.
404 CoreInitializeDispatcher (
410 This is the POSTFIX version of the dependency evaluator. This code does
411 not need to handle Before or After, as it is not valid to call this
412 routine in this case. The SOR is just ignored and is a nop in the grammer.
413 POSTFIX means all the math is done on top of the stack.
415 @param DriverEntry DriverEntry element to update.
417 @retval TRUE If driver is ready to run.
418 @retval FALSE If driver is not ready to run or some fatal error
424 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
429 Preprocess dependency expression and update DriverEntry to reflect the
430 state of Before, After, and SOR dependencies. If DriverEntry->Before
431 or DriverEntry->After is set it will never be cleared. If SOR is set
432 it will be cleared by CoreSchedule(), and then the driver can be
435 @param DriverEntry DriverEntry element to update .
437 @retval EFI_SUCCESS It always works.
441 CorePreProcessDepex (
442 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
448 Terminates all boot services.
450 @param ImageHandle Handle that identifies the exiting image.
451 @param MapKey Key to the latest memory map.
453 @retval EFI_SUCCESS Boot Services terminated
454 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
459 CoreExitBootServices (
460 IN EFI_HANDLE ImageHandle
,
466 Make sure the memory map is following all the construction rules,
467 it is the last time to check memory map error before exit boot services.
469 @param MapKey Memory map key
471 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
473 @retval EFI_SUCCESS Valid memory map.
477 CoreTerminateMemoryMap (
483 Signals all events in the EventGroup.
485 @param EventGroup The list to signal
489 CoreNotifySignalList (
490 IN EFI_GUID
*EventGroup
496 Boot Service called to add, modify, or remove a system configuration table from
497 the EFI System Table.
499 @param Guid Pointer to the GUID for the entry to add, update, or
501 @param Table Pointer to the configuration table for the entry to add,
502 update, or remove, may be NULL.
504 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
505 @return EFI_INVALID_PARAMETER Input GUID not valid.
506 @return EFI_NOT_FOUND Attempted to delete non-existant entry
507 @return EFI_OUT_OF_RESOURCES Not enough memory available
512 CoreInstallConfigurationTable (
520 Raise the task priority level to the new level.
521 High level is implemented by disabling processor interrupts.
523 @param NewTpl New task priority level
525 @return The previous task priority level
537 Lowers the task priority to the previous value. If the new
538 priority unmasks events at a higher priority, they are dispatched.
540 @param NewTpl New, lower, task priority
552 Introduces a fine-grained stall.
554 @param Microseconds The number of microseconds to stall execution.
556 @retval EFI_SUCCESS Execution was stalled for at least the requested
557 amount of microseconds.
558 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
564 IN UINTN Microseconds
570 Sets the system's watchdog timer.
572 @param Timeout The number of seconds to set the watchdog timer to.
573 A value of zero disables the timer.
574 @param WatchdogCode The numeric code to log on a watchdog timer timeout
575 event. The firmware reserves codes 0x0000 to 0xFFFF.
576 Loaders and operating systems may use other timeout
578 @param DataSize The size, in bytes, of WatchdogData.
579 @param WatchdogData A data buffer that includes a Null-terminated Unicode
580 string, optionally followed by additional binary data.
581 The string is a description that the call may use to
582 further indicate the reason to be logged with a
585 @return EFI_SUCCESS Timeout has been set
586 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
587 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
588 @return EFI_DEVICE_ERROR Could not complete due to hardware error
593 CoreSetWatchdogTimer (
595 IN UINT64 WatchdogCode
,
597 IN CHAR16
*WatchdogData OPTIONAL
603 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
604 Calls the private one which contains a BOOLEAN parameter for notifications
606 @param UserHandle The handle to install the protocol handler on,
607 or NULL if a new handle is to be allocated
608 @param Protocol The protocol to add to the handle
609 @param InterfaceType Indicates whether Interface is supplied in
611 @param Interface The interface for the protocol being added
618 CoreInstallProtocolInterface (
619 IN OUT EFI_HANDLE
*UserHandle
,
620 IN EFI_GUID
*Protocol
,
621 IN EFI_INTERFACE_TYPE InterfaceType
,
627 Installs a protocol interface into the boot services environment.
629 @param UserHandle The handle to install the protocol handler on,
630 or NULL if a new handle is to be allocated
631 @param Protocol The protocol to add to the handle
632 @param InterfaceType Indicates whether Interface is supplied in
634 @param Interface The interface for the protocol being added
635 @param Notify indicates whether notify the notification list
638 @retval EFI_INVALID_PARAMETER Invalid parameter
639 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
640 @retval EFI_SUCCESS Protocol interface successfully installed
644 CoreInstallProtocolInterfaceNotify (
645 IN OUT EFI_HANDLE
*UserHandle
,
646 IN EFI_GUID
*Protocol
,
647 IN EFI_INTERFACE_TYPE InterfaceType
,
655 Installs a list of protocol interface into the boot services environment.
656 This function calls InstallProtocolInterface() in a loop. If any error
657 occures all the protocols added by this function are removed. This is
658 basically a lib function to save space.
660 @param Handle The handle to install the protocol handlers on,
661 or NULL if a new handle is to be allocated
662 @param ... EFI_GUID followed by protocol instance. A NULL
663 terminates the list. The pairs are the
664 arguments to InstallProtocolInterface(). All the
665 protocols are added to Handle.
667 @retval EFI_INVALID_PARAMETER Handle is NULL.
668 @retval EFI_SUCCESS Protocol interfaces successfully installed.
673 CoreInstallMultipleProtocolInterfaces (
674 IN OUT EFI_HANDLE
*Handle
,
681 Uninstalls a list of protocol interface in the boot services environment.
682 This function calls UnisatllProtocolInterface() in a loop. This is
683 basically a lib function to save space.
685 @param Handle The handle to uninstall the protocol
686 @param ... EFI_GUID followed by protocol instance. A NULL
687 terminates the list. The pairs are the
688 arguments to UninstallProtocolInterface(). All
689 the protocols are added to Handle.
696 CoreUninstallMultipleProtocolInterfaces (
697 IN EFI_HANDLE Handle
,
704 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
706 @param UserHandle Handle on which the interface is to be
708 @param Protocol The numeric ID of the interface
709 @param OldInterface A pointer to the old interface
710 @param NewInterface A pointer to the new interface
712 @retval EFI_SUCCESS The protocol interface was installed
713 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
714 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
719 CoreReinstallProtocolInterface (
720 IN EFI_HANDLE UserHandle
,
721 IN EFI_GUID
*Protocol
,
722 IN VOID
*OldInterface
,
723 IN VOID
*NewInterface
729 Uninstalls all instances of a protocol:interfacer from a handle.
730 If the last protocol interface is remove from the handle, the
733 @param UserHandle The handle to remove the protocol handler from
734 @param Protocol The protocol, of protocol:interface, to remove
735 @param Interface The interface, of protocol:interface, to remove
737 @retval EFI_INVALID_PARAMETER Protocol is NULL.
738 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
743 CoreUninstallProtocolInterface (
744 IN EFI_HANDLE UserHandle
,
745 IN EFI_GUID
*Protocol
,
752 Queries a handle to determine if it supports a specified protocol.
754 @param UserHandle The handle being queried.
755 @param Protocol The published unique identifier of the protocol.
756 @param Interface Supplies the address where a pointer to the
757 corresponding Protocol Interface is returned.
759 @return The requested protocol interface for the handle
765 IN EFI_HANDLE UserHandle
,
766 IN EFI_GUID
*Protocol
,
773 Locates the installed protocol handler for the handle, and
774 invokes it to obtain the protocol interface. Usage information
775 is registered in the protocol data base.
777 @param UserHandle The handle to obtain the protocol interface on
778 @param Protocol The ID of the protocol
779 @param Interface The location to return the protocol interface
780 @param ImageHandle The handle of the Image that is opening the
781 protocol interface specified by Protocol and
783 @param ControllerHandle The controller handle that is requiring this
785 @param Attributes The open mode of the protocol interface
786 specified by Handle and Protocol.
788 @retval EFI_INVALID_PARAMETER Protocol is NULL.
789 @retval EFI_SUCCESS Get the protocol interface.
795 IN EFI_HANDLE UserHandle
,
796 IN EFI_GUID
*Protocol
,
797 OUT VOID
**Interface OPTIONAL
,
798 IN EFI_HANDLE ImageHandle
,
799 IN EFI_HANDLE ControllerHandle
,
806 Return information about Opened protocols in the system
808 @param UserHandle The handle to close the protocol interface on
809 @param Protocol The ID of the protocol
810 @param EntryBuffer A pointer to a buffer of open protocol
811 information in the form of
812 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
813 @param EntryCount Number of EntryBuffer entries
818 CoreOpenProtocolInformation (
819 IN EFI_HANDLE UserHandle
,
820 IN EFI_GUID
*Protocol
,
821 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
822 OUT UINTN
*EntryCount
828 Closes a protocol on a handle that was opened using OpenProtocol().
830 @param UserHandle The handle for the protocol interface that was
831 previously opened with OpenProtocol(), and is
833 @param Protocol The published unique identifier of the protocol.
834 It is the caller's responsibility to pass in a
836 @param AgentHandle The handle of the agent that is closing the
838 @param ControllerHandle If the agent that opened a protocol is a driver
839 that follows the EFI Driver Model, then this
840 parameter is the controller handle that required
841 the protocol interface. If the agent does not
842 follow the EFI Driver Model, then this parameter
843 is optional and may be NULL.
845 @retval EFI_SUCCESS The protocol instance was closed.
846 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
848 @retval EFI_NOT_FOUND Can not find the specified protocol or
855 IN EFI_HANDLE UserHandle
,
856 IN EFI_GUID
*Protocol
,
857 IN EFI_HANDLE AgentHandle
,
858 IN EFI_HANDLE ControllerHandle
864 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
867 @param UserHandle The handle from which to retrieve the list of
868 protocol interface GUIDs.
869 @param ProtocolBuffer A pointer to the list of protocol interface GUID
870 pointers that are installed on Handle.
871 @param ProtocolBufferCount A pointer to the number of GUID pointers present
874 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
875 on Handle was returned in ProtocolBuffer. The
876 number of protocol interface GUIDs was returned
877 in ProtocolBufferCount.
878 @retval EFI_INVALID_PARAMETER Handle is NULL.
879 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
880 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
881 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
882 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
888 CoreProtocolsPerHandle (
889 IN EFI_HANDLE UserHandle
,
890 OUT EFI_GUID
***ProtocolBuffer
,
891 OUT UINTN
*ProtocolBufferCount
897 Add a new protocol notification record for the request protocol.
899 @param Protocol The requested protocol to add the notify
901 @param Event The event to signal
902 @param Registration Returns the registration record
904 @retval EFI_INVALID_PARAMETER Invalid parameter
905 @retval EFI_SUCCESS Successfully returned the registration record
911 CoreRegisterProtocolNotify (
912 IN EFI_GUID
*Protocol
,
914 OUT VOID
**Registration
919 Removes all the events in the protocol database that match Event.
921 @param Event The event to search for in the protocol
924 @return EFI_SUCCESS when done searching the entire database.
928 CoreUnregisterProtocolNotify (
934 Locates the requested handle(s) and returns them in Buffer.
936 @param SearchType The type of search to perform to locate the
938 @param Protocol The protocol to search for
939 @param SearchKey Dependant on SearchType
940 @param BufferSize On input the size of Buffer. On output the
941 size of data returned.
942 @param Buffer The buffer to return the results in
944 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
945 returned in BufferSize.
946 @retval EFI_INVALID_PARAMETER Invalid parameter
947 @retval EFI_SUCCESS Successfully found the requested handle(s) and
948 returns them in Buffer.
954 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
955 IN EFI_GUID
*Protocol OPTIONAL
,
956 IN VOID
*SearchKey OPTIONAL
,
957 IN OUT UINTN
*BufferSize
,
958 OUT EFI_HANDLE
*Buffer
964 Locates the handle to a device on the device path that best matches the specified protocol.
966 @param Protocol The protocol to search for.
967 @param DevicePath On input, a pointer to a pointer to the device
968 path. On output, the device path pointer is
969 modified to point to the remaining part of the
971 @param Device A pointer to the returned device handle.
973 @retval EFI_SUCCESS The resulting handle was returned.
974 @retval EFI_NOT_FOUND No handles matched the search.
975 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
980 CoreLocateDevicePath (
981 IN EFI_GUID
*Protocol
,
982 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
983 OUT EFI_HANDLE
*Device
989 Function returns an array of handles that support the requested protocol
990 in a buffer allocated from pool. This is a version of CoreLocateHandle()
991 that allocates a buffer for the caller.
993 @param SearchType Specifies which handle(s) are to be returned.
994 @param Protocol Provides the protocol to search by. This
995 parameter is only valid for SearchType
997 @param SearchKey Supplies the search key depending on the
999 @param NumberHandles The number of handles returned in Buffer.
1000 @param Buffer A pointer to the buffer to return the requested
1001 array of handles that support Protocol.
1003 @retval EFI_SUCCESS The result array of handles was returned.
1004 @retval EFI_NOT_FOUND No handles match the search.
1005 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1007 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1012 CoreLocateHandleBuffer (
1013 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1014 IN EFI_GUID
*Protocol OPTIONAL
,
1015 IN VOID
*SearchKey OPTIONAL
,
1016 IN OUT UINTN
*NumberHandles
,
1017 OUT EFI_HANDLE
**Buffer
1023 Return the first Protocol Interface that matches the Protocol GUID. If
1024 Registration is passed in, return a Protocol Instance that was just add
1025 to the system. If Registration is NULL return the first Protocol Interface
1028 @param Protocol The protocol to search for
1029 @param Registration Optional Registration Key returned from
1030 RegisterProtocolNotify()
1031 @param Interface Return the Protocol interface (instance).
1033 @retval EFI_SUCCESS If a valid Interface is returned
1034 @retval EFI_INVALID_PARAMETER Invalid parameter
1035 @retval EFI_NOT_FOUND Protocol interface not found
1040 CoreLocateProtocol (
1041 IN EFI_GUID
*Protocol
,
1042 IN VOID
*Registration OPTIONAL
,
1043 OUT VOID
**Interface
1048 return handle database key.
1051 @return Handle database key.
1055 CoreGetHandleDatabaseKey (
1061 Go connect any handles that were created or modified while a image executed.
1063 @param Key The Key to show that the handle has been
1068 CoreConnectHandlesByKey (
1075 Connects one or more drivers to a controller.
1077 @param ControllerHandle Handle of the controller to be
1079 @param DriverImageHandle DriverImageHandle A pointer to an
1080 ordered list of driver image
1082 @param RemainingDevicePath RemainingDevicePath A pointer to
1083 the device path that specifies a
1084 child of the controller specified
1085 by ControllerHandle.
1086 @param Recursive Whether the function would be
1087 called recursively or not.
1089 @return Status code.
1094 CoreConnectController (
1095 IN EFI_HANDLE ControllerHandle
,
1096 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1097 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1098 IN BOOLEAN Recursive
1104 Disonnects a controller from a driver
1106 @param ControllerHandle ControllerHandle The handle of
1107 the controller from which
1110 @param DriverImageHandle DriverImageHandle The driver to
1111 disconnect from ControllerHandle.
1112 @param ChildHandle ChildHandle The handle of the
1115 @retval EFI_SUCCESS One or more drivers were
1116 disconnected from the controller.
1117 @retval EFI_SUCCESS On entry, no drivers are managing
1119 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1120 and on entry DriverImageHandle is
1121 not managing ControllerHandle.
1122 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1124 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1125 and it is not a valid EFI_HANDLE.
1126 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1127 is not a valid EFI_HANDLE.
1128 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1129 available to disconnect any
1130 drivers from ControllerHandle.
1131 @retval EFI_DEVICE_ERROR The controller could not be
1132 disconnected because of a device
1138 CoreDisconnectController (
1139 IN EFI_HANDLE ControllerHandle
,
1140 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1141 IN EFI_HANDLE ChildHandle OPTIONAL
1147 Allocates pages from the memory map.
1149 @param Type The type of allocation to perform
1150 @param MemoryType The type of memory to turn the allocated pages
1152 @param NumberOfPages The number of pages to allocate
1153 @param Memory A pointer to receive the base allocated memory
1156 @return Status. On success, Memory is filled in with the base address allocated
1157 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1159 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1160 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1161 @retval EFI_SUCCESS Pages successfully allocated.
1167 IN EFI_ALLOCATE_TYPE Type
,
1168 IN EFI_MEMORY_TYPE MemoryType
,
1169 IN UINTN NumberOfPages
,
1170 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1176 Frees previous allocated pages.
1178 @param Memory Base address of memory being freed
1179 @param NumberOfPages The number of pages to free
1181 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1182 @retval EFI_INVALID_PARAMETER Address not aligned
1183 @return EFI_SUCCESS -Pages successfully freed.
1189 IN EFI_PHYSICAL_ADDRESS Memory
,
1190 IN UINTN NumberOfPages
1196 This function returns a copy of the current memory map. The map is an array of
1197 memory descriptors, each of which describes a contiguous block of memory.
1199 @param MemoryMapSize A pointer to the size, in bytes, of the
1200 MemoryMap buffer. On input, this is the size of
1201 the buffer allocated by the caller. On output,
1202 it is the size of the buffer returned by the
1203 firmware if the buffer was large enough, or the
1204 size of the buffer needed to contain the map if
1205 the buffer was too small.
1206 @param MemoryMap A pointer to the buffer in which firmware places
1207 the current memory map.
1208 @param MapKey A pointer to the location in which firmware
1209 returns the key for the current memory map.
1210 @param DescriptorSize A pointer to the location in which firmware
1211 returns the size, in bytes, of an individual
1212 EFI_MEMORY_DESCRIPTOR.
1213 @param DescriptorVersion A pointer to the location in which firmware
1214 returns the version number associated with the
1215 EFI_MEMORY_DESCRIPTOR.
1217 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1219 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1220 buffer size needed to hold the memory map is
1221 returned in MemoryMapSize.
1222 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1228 IN OUT UINTN
*MemoryMapSize
,
1229 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1231 OUT UINTN
*DescriptorSize
,
1232 OUT UINT32
*DescriptorVersion
1238 Allocate pool of a particular type.
1240 @param PoolType Type of pool to allocate
1241 @param Size The amount of pool to allocate
1242 @param Buffer The address to return a pointer to the allocated
1245 @retval EFI_INVALID_PARAMETER PoolType not valid
1246 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1247 @retval EFI_SUCCESS Pool successfully allocated.
1253 IN EFI_MEMORY_TYPE PoolType
,
1263 @param Buffer The allocated pool entry to free
1265 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1266 @retval EFI_SUCCESS Pool successfully freed.
1278 Loads an EFI image into memory and returns a handle to the image.
1280 @param BootPolicy If TRUE, indicates that the request originates
1281 from the boot manager, and that the boot
1282 manager is attempting to load FilePath as a
1284 @param ParentImageHandle The caller's image handle.
1285 @param FilePath The specific file path from which the image is
1287 @param SourceBuffer If not NULL, a pointer to the memory location
1288 containing a copy of the image to be loaded.
1289 @param SourceSize The size in bytes of SourceBuffer.
1290 @param ImageHandle Pointer to the returned image handle that is
1291 created when the image is successfully loaded.
1293 @retval EFI_SUCCESS The image was loaded into memory.
1294 @retval EFI_NOT_FOUND The FilePath was not found.
1295 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1296 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1297 path cannot be parsed to locate the proper
1298 protocol for loading the file.
1299 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1301 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1303 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1304 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1305 image from being loaded. NULL is returned in *ImageHandle.
1306 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1307 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1308 platform policy specifies that the image should not be started.
1314 IN BOOLEAN BootPolicy
,
1315 IN EFI_HANDLE ParentImageHandle
,
1316 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1317 IN VOID
*SourceBuffer OPTIONAL
,
1318 IN UINTN SourceSize
,
1319 OUT EFI_HANDLE
*ImageHandle
1327 @param ImageHandle Handle that identifies the image to be
1330 @retval EFI_SUCCESS The image has been unloaded.
1331 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1333 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1339 IN EFI_HANDLE ImageHandle
1345 Transfer control to a loaded image's entry point.
1347 @param ImageHandle Handle of image to be started.
1348 @param ExitDataSize Pointer of the size to ExitData
1349 @param ExitData Pointer to a pointer to a data buffer that
1350 includes a Null-terminated string,
1351 optionally followed by additional binary data.
1352 The string is a description that the caller may
1353 use to further indicate the reason for the
1356 @retval EFI_INVALID_PARAMETER Invalid parameter
1357 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1358 @retval EFI_SUCCESS Successfully transfer control to the image's
1365 IN EFI_HANDLE ImageHandle
,
1366 OUT UINTN
*ExitDataSize
,
1367 OUT CHAR16
**ExitData OPTIONAL
1373 Terminates the currently loaded EFI image and returns control to boot services.
1375 @param ImageHandle Handle that identifies the image. This
1376 parameter is passed to the image on entry.
1377 @param Status The image's exit code.
1378 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1379 ExitStatus is EFI_SUCCESS.
1380 @param ExitData Pointer to a data buffer that includes a
1381 Null-terminated Unicode string, optionally
1382 followed by additional binary data. The string
1383 is a description that the caller may use to
1384 further indicate the reason for the image's
1387 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1389 @retval EFI_SUCCESS Successfully terminates the currently loaded
1391 @retval EFI_ACCESS_DENIED Should never reach there.
1392 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1398 IN EFI_HANDLE ImageHandle
,
1399 IN EFI_STATUS Status
,
1400 IN UINTN ExitDataSize
,
1401 IN CHAR16
*ExitData OPTIONAL
1407 Creates a general-purpose event structure.
1409 @param Type The type of event to create and its mode and
1411 @param NotifyTpl The task priority level of event notifications
1412 @param NotifyFunction Pointer to the events notification function
1413 @param NotifyContext Pointer to the notification functions context;
1414 corresponds to parameter "Context" in the
1415 notification function
1416 @param Event Pointer to the newly created event if the call
1417 succeeds; undefined otherwise
1419 @retval EFI_SUCCESS The event structure was created
1420 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1421 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1428 IN EFI_TPL NotifyTpl
,
1429 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1430 IN VOID
*NotifyContext
, OPTIONAL
1431 OUT EFI_EVENT
*Event
1437 Creates a general-purpose event structure
1439 @param Type The type of event to create and its mode and
1441 @param NotifyTpl The task priority level of event notifications
1442 @param NotifyFunction Pointer to the events notification function
1443 @param NotifyContext Pointer to the notification functions context;
1444 corresponds to parameter "Context" in the
1445 notification function
1446 @param EventGroup GUID for EventGroup if NULL act the same as
1448 @param Event Pointer to the newly created event if the call
1449 succeeds; undefined otherwise
1451 @retval EFI_SUCCESS The event structure was created
1452 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1453 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1460 IN EFI_TPL NotifyTpl
,
1461 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1462 IN CONST VOID
*NotifyContext
, OPTIONAL
1463 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1464 OUT EFI_EVENT
*Event
1470 Sets the type of timer and the trigger time for a timer event.
1472 @param UserEvent The timer event that is to be signaled at the
1474 @param Type The type of time that is specified in
1476 @param TriggerTime The number of 100ns units until the timer
1479 @retval EFI_SUCCESS The event has been set to be signaled at the
1481 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1487 IN EFI_EVENT UserEvent
,
1488 IN EFI_TIMER_DELAY Type
,
1489 IN UINT64 TriggerTime
1495 Signals the event. Queues the event to be notified if needed.
1497 @param UserEvent The event to signal .
1499 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1500 @retval EFI_SUCCESS The event was signaled.
1506 IN EFI_EVENT UserEvent
1512 Stops execution until an event is signaled.
1514 @param NumberOfEvents The number of events in the UserEvents array
1515 @param UserEvents An array of EFI_EVENT
1516 @param UserIndex Pointer to the index of the event which
1517 satisfied the wait condition
1519 @retval EFI_SUCCESS The event indicated by Index was signaled.
1520 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1521 function or Event was not a valid type
1522 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1528 IN UINTN NumberOfEvents
,
1529 IN EFI_EVENT
*UserEvents
,
1530 OUT UINTN
*UserIndex
1536 Closes an event and frees the event structure.
1538 @param UserEvent Event to close
1540 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1541 @retval EFI_SUCCESS The event has been closed
1547 IN EFI_EVENT UserEvent
1553 Check the status of an event.
1555 @param UserEvent The event to check
1557 @retval EFI_SUCCESS The event is in the signaled state
1558 @retval EFI_NOT_READY The event is not in the signaled state
1559 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1565 IN EFI_EVENT UserEvent
1570 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1571 global coherency domain of the processor.
1573 @param GcdMemoryType Memory type of the memory space.
1574 @param BaseAddress Base address of the memory space.
1575 @param Length Length of the memory space.
1576 @param Capabilities alterable attributes of the memory space.
1578 @retval EFI_SUCCESS Merged this memory space into GCD map.
1583 CoreAddMemorySpace (
1584 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1585 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1587 IN UINT64 Capabilities
1592 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1593 I/O resources from the global coherency domain of the processor.
1595 @param GcdAllocateType The type of allocate operation
1596 @param GcdMemoryType The desired memory type
1597 @param Alignment Align with 2^Alignment
1598 @param Length Length to allocate
1599 @param BaseAddress Base address to allocate
1600 @param ImageHandle The image handle consume the allocated space.
1601 @param DeviceHandle The device handle consume the allocated space.
1603 @retval EFI_INVALID_PARAMETER Invalid parameter.
1604 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1605 @retval EFI_SUCCESS Memory space successfully allocated.
1610 CoreAllocateMemorySpace (
1611 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1612 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1615 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1616 IN EFI_HANDLE ImageHandle
,
1617 IN EFI_HANDLE DeviceHandle OPTIONAL
1622 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1623 I/O resources from the global coherency domain of the processor.
1625 @param BaseAddress Base address of the memory space.
1626 @param Length Length of the memory space.
1628 @retval EFI_SUCCESS Space successfully freed.
1633 CoreFreeMemorySpace (
1634 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1640 Removes reserved memory, system memory, or memory-mapped I/O resources from
1641 the global coherency domain of the processor.
1643 @param BaseAddress Base address of the memory space.
1644 @param Length Length of the memory space.
1646 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1651 CoreRemoveMemorySpace (
1652 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1658 Retrieves the descriptor for a memory region containing a specified address.
1660 @param BaseAddress Specified start address
1661 @param Descriptor Specified length
1663 @retval EFI_INVALID_PARAMETER Invalid parameter
1664 @retval EFI_SUCCESS Successfully get memory space descriptor.
1669 CoreGetMemorySpaceDescriptor (
1670 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1671 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1676 Modifies the attributes for a memory region in the global coherency domain of the
1679 @param BaseAddress Specified start address
1680 @param Length Specified length
1681 @param Attributes Specified attributes
1683 @retval EFI_SUCCESS Successfully set attribute of a segment of
1689 CoreSetMemorySpaceAttributes (
1690 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1692 IN UINT64 Attributes
1697 Returns a map of the memory resources in the global coherency domain of the
1700 @param NumberOfDescriptors Number of descriptors.
1701 @param MemorySpaceMap Descriptor array
1703 @retval EFI_INVALID_PARAMETER Invalid parameter
1704 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1705 @retval EFI_SUCCESS Successfully get memory space map.
1710 CoreGetMemorySpaceMap (
1711 OUT UINTN
*NumberOfDescriptors
,
1712 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1717 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1719 @param GcdIoType IO type of the segment.
1720 @param BaseAddress Base address of the segment.
1721 @param Length Length of the segment.
1723 @retval EFI_SUCCESS Merged this segment into GCD map.
1724 @retval EFI_INVALID_PARAMETER Parameter not valid
1730 IN EFI_GCD_IO_TYPE GcdIoType
,
1731 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1737 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1738 domain of the processor.
1740 @param GcdAllocateType The type of allocate operation
1741 @param GcdIoType The desired IO type
1742 @param Alignment Align with 2^Alignment
1743 @param Length Length to allocate
1744 @param BaseAddress Base address to allocate
1745 @param ImageHandle The image handle consume the allocated space.
1746 @param DeviceHandle The device handle consume the allocated space.
1748 @retval EFI_INVALID_PARAMETER Invalid parameter.
1749 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1750 @retval EFI_SUCCESS IO space successfully allocated.
1755 CoreAllocateIoSpace (
1756 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1757 IN EFI_GCD_IO_TYPE GcdIoType
,
1760 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1761 IN EFI_HANDLE ImageHandle
,
1762 IN EFI_HANDLE DeviceHandle OPTIONAL
1767 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1768 domain of the processor.
1770 @param BaseAddress Base address of the segment.
1771 @param Length Length of the segment.
1773 @retval EFI_SUCCESS Space successfully freed.
1779 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1785 Removes reserved I/O or I/O resources from the global coherency domain of the
1788 @param BaseAddress Base address of the segment.
1789 @param Length Length of the segment.
1791 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1797 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1803 Retrieves the descriptor for an I/O region containing a specified address.
1805 @param BaseAddress Specified start address
1806 @param Descriptor Specified length
1808 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1809 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1814 CoreGetIoSpaceDescriptor (
1815 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1816 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1821 Returns a map of the I/O resources in the global coherency domain of the processor.
1823 @param NumberOfDescriptors Number of descriptors.
1824 @param IoSpaceMap Descriptor array
1826 @retval EFI_INVALID_PARAMETER Invalid parameter
1827 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1828 @retval EFI_SUCCESS Successfully get IO space map.
1834 OUT UINTN
*NumberOfDescriptors
,
1835 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1840 This is the main Dispatcher for DXE and it exits when there are no more
1841 drivers to run. Drain the mScheduledQueue and load and start a PE
1842 image for each driver. Search the mDiscoveredList to see if any driver can
1843 be placed on the mScheduledQueue. If no drivers are placed on the
1844 mScheduledQueue exit the function. On exit it is assumed the Bds()
1845 will be called, and when the Bds() exits the Dispatcher will be called
1848 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1849 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1850 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1860 Check every driver and locate a matching one. If the driver is found, the Unrequested
1861 state flag is cleared.
1863 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1864 the firmware file specified by DriverName.
1865 @param DriverName The Driver name to put in the Dependent state.
1867 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1869 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1876 IN EFI_HANDLE FirmwareVolumeHandle
,
1877 IN EFI_GUID
*DriverName
1882 Convert a driver from the Untrused back to the Scheduled state.
1884 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1885 the firmware file specified by DriverName.
1886 @param DriverName The Driver name to put in the Scheduled state
1888 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1889 was promoted to the trusted state.
1890 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1896 IN EFI_HANDLE FirmwareVolumeHandle
,
1897 IN EFI_GUID
*DriverName
1902 This routine is the driver initialization entry point. It initializes the
1903 libraries, and registers two notification functions. These notification
1904 functions are responsible for building the FV stack dynamically.
1906 @param ImageHandle The image handle.
1907 @param SystemTable The system table.
1909 @retval EFI_SUCCESS Function successfully returned.
1915 IN EFI_HANDLE ImageHandle
,
1916 IN EFI_SYSTEM_TABLE
*SystemTable
1921 Entry point of the section extraction code. Initializes an instance of the
1922 section extraction interface and installs it on a new handle.
1924 @param ImageHandle A handle for the image that is initializing this driver
1925 @param SystemTable A pointer to the EFI system table
1927 @retval EFI_SUCCESS Driver initialized successfully
1928 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1933 InitializeSectionExtraction (
1934 IN EFI_HANDLE ImageHandle
,
1935 IN EFI_SYSTEM_TABLE
*SystemTable
1940 This DXE service routine is used to process a firmware volume. In
1941 particular, it can be called by BDS to process a single firmware
1942 volume found in a capsule.
1944 @param FvHeader pointer to a firmware volume header
1945 @param Size the size of the buffer pointed to by FvHeader
1946 @param FVProtocolHandle the handle on which a firmware volume protocol
1947 was produced for the firmware volume passed in.
1949 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1951 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1952 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1958 CoreProcessFirmwareVolume (
1961 OUT EFI_HANDLE
*FVProtocolHandle
1965 //Functions used during debug buils
1969 Displays Architectural protocols that were not loaded and are required for DXE
1970 core to function. Only used in Debug Builds.
1974 CoreDisplayMissingArchProtocols (
1980 Traverse the discovered list for any drivers that were discovered but not loaded
1981 because the dependency experessions evaluated to false.
1985 CoreDisplayDiscoveredNotDispatched (
1991 Place holder function until all the Boot Services and Runtime Services are
1994 @return EFI_NOT_AVAILABLE_YET
1999 CoreEfiNotAvailableYetArg0 (
2005 Place holder function until all the Boot Services and Runtime Services are
2008 @param Arg1 Undefined
2010 @return EFI_NOT_AVAILABLE_YET
2015 CoreEfiNotAvailableYetArg1 (
2021 Place holder function until all the Boot Services and Runtime Services are available.
2023 @param Arg1 Undefined
2024 @param Arg2 Undefined
2026 @return EFI_NOT_AVAILABLE_YET
2031 CoreEfiNotAvailableYetArg2 (
2038 Place holder function until all the Boot Services and Runtime Services are available.
2040 @param Arg1 Undefined
2041 @param Arg2 Undefined
2042 @param Arg3 Undefined
2044 @return EFI_NOT_AVAILABLE_YET
2049 CoreEfiNotAvailableYetArg3 (
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
2062 @param Arg4 Undefined
2064 @return EFI_NOT_AVAILABLE_YET
2069 CoreEfiNotAvailableYetArg4 (
2078 Place holder function until all the Boot Services and Runtime Services are available.
2080 @param Arg1 Undefined
2081 @param Arg2 Undefined
2082 @param Arg3 Undefined
2083 @param Arg4 Undefined
2084 @param Arg5 Undefined
2086 @return EFI_NOT_AVAILABLE_YET
2091 CoreEfiNotAvailableYetArg5 (
2101 Given a compressed source buffer, this function retrieves the size of the
2102 uncompressed buffer and the size of the scratch buffer required to decompress
2103 the compressed source buffer.
2105 The GetInfo() function retrieves the size of the uncompressed buffer and the
2106 temporary scratch buffer required to decompress the buffer specified by Source
2107 and SourceSize. If the size of the uncompressed buffer or the size of the
2108 scratch buffer cannot be determined from the compressed data specified by
2109 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2110 size of the uncompressed buffer is returned in DestinationSize, the size of
2111 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2112 The GetInfo() function does not have scratch buffer available to perform a
2113 thorough checking of the validity of the source data. It just retrieves the
2114 "Original Size" field from the beginning bytes of the source data and output
2115 it as DestinationSize. And ScratchSize is specific to the decompression
2118 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2119 @param Source The source buffer containing the compressed data.
2120 @param SourceSize The size, in bytes, of the source buffer.
2121 @param DestinationSize A pointer to the size, in bytes, of the
2122 uncompressed buffer that will be generated when the
2123 compressed buffer specified by Source and
2124 SourceSize is decompressed.
2125 @param ScratchSize A pointer to the size, in bytes, of the scratch
2126 buffer that is required to decompress the
2127 compressed buffer specified by Source and
2130 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2131 DestinationSize and the size of the scratch buffer
2132 was returned in ScratchSize.
2133 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2134 the scratch buffer cannot be determined from the
2135 compressed data specified by Source and
2141 DxeMainUefiDecompressGetInfo (
2142 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2144 IN UINT32 SourceSize
,
2145 OUT UINT32
*DestinationSize
,
2146 OUT UINT32
*ScratchSize
2151 Decompresses a compressed source buffer.
2153 The Decompress() function extracts decompressed data to its original form.
2154 This protocol is designed so that the decompression algorithm can be
2155 implemented without using any memory services. As a result, the Decompress()
2156 Function is not allowed to call AllocatePool() or AllocatePages() in its
2157 implementation. It is the caller's responsibility to allocate and free the
2158 Destination and Scratch buffers.
2159 If the compressed source data specified by Source and SourceSize is
2160 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2161 the compressed source data specified by Source and SourceSize is not in a
2162 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2164 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2165 @param Source The source buffer containing the compressed data.
2166 @param SourceSize SourceSizeThe size of source data.
2167 @param Destination On output, the destination buffer that contains
2168 the uncompressed data.
2169 @param DestinationSize The size of the destination buffer. The size of
2170 the destination buffer needed is obtained from
2171 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2172 @param Scratch A temporary scratch buffer that is used to perform
2174 @param ScratchSize The size of scratch buffer. The size of the
2175 scratch buffer needed is obtained from GetInfo().
2177 @retval EFI_SUCCESS Decompression completed successfully, and the
2178 uncompressed buffer is returned in Destination.
2179 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2180 SourceSize is corrupted (not in a valid
2186 DxeMainUefiDecompress (
2187 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2189 IN UINT32 SourceSize
,
2190 IN OUT VOID
*Destination
,
2191 IN UINT32 DestinationSize
,
2192 IN OUT VOID
*Scratch
,
2193 IN UINT32 ScratchSize
2197 SEP member function. This function creates and returns a new section stream
2198 handle to represent the new section stream.
2200 @param SectionStreamLength Size in bytes of the section stream.
2201 @param SectionStream Buffer containing the new section stream.
2202 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2203 output contains the new section stream handle.
2205 @retval EFI_SUCCESS The section stream is created successfully.
2206 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2207 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2214 IN UINTN SectionStreamLength
,
2215 IN VOID
*SectionStream
,
2216 OUT UINTN
*SectionStreamHandle
2222 SEP member function. Retrieves requested section from section stream.
2224 @param SectionStreamHandle The section stream from which to extract the
2226 @param SectionType A pointer to the type of section to search for.
2227 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2228 then SectionDefinitionGuid indicates which of
2229 these types of sections to search for.
2230 @param SectionInstance Indicates which instance of the requested
2232 @param Buffer Double indirection to buffer. If *Buffer is
2233 non-null on input, then the buffer is caller
2234 allocated. If Buffer is NULL, then the buffer
2235 is callee allocated. In either case, the
2236 requried buffer size is returned in *BufferSize.
2237 @param BufferSize On input, indicates the size of *Buffer if
2238 *Buffer is non-null on input. On output,
2239 indicates the required size (allocated size if
2240 callee allocated) of *Buffer.
2241 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2242 indicates the authentication status of the
2243 output buffer. If the input section's
2244 GuidedSectionHeader.Attributes field
2245 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2246 bit as clear, AuthenticationStatus must return
2247 zero. Both local bits (19:16) and aggregate
2248 bits (3:0) in AuthenticationStatus are returned
2249 by ExtractSection(). These bits reflect the
2250 status of the extraction operation. The bit
2251 pattern in both regions must be the same, as
2252 the local and aggregate authentication statuses
2253 have equivalent meaning at this level. If the
2254 function returns anything other than
2255 EFI_SUCCESS, the value of *AuthenticationStatus
2258 @retval EFI_SUCCESS Section was retrieved successfully
2259 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2260 section stream with its
2261 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2262 but there was no corresponding GUIDed Section
2263 Extraction Protocol in the handle database.
2264 *Buffer is unmodified.
2265 @retval EFI_NOT_FOUND An error was encountered when parsing the
2266 SectionStream. This indicates the SectionStream
2267 is not correctly formatted.
2268 @retval EFI_NOT_FOUND The requested section does not exist.
2269 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2271 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2272 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2273 insufficient to contain the requested section.
2274 The input buffer is filled and section contents
2281 IN UINTN SectionStreamHandle
,
2282 IN EFI_SECTION_TYPE
*SectionType
,
2283 IN EFI_GUID
*SectionDefinitionGuid
,
2284 IN UINTN SectionInstance
,
2286 IN OUT UINTN
*BufferSize
,
2287 OUT UINT32
*AuthenticationStatus
2292 SEP member function. Deletes an existing section stream
2294 @param StreamHandleToClose Indicates the stream to close
2296 @retval EFI_SUCCESS The section stream is closed sucessfully.
2297 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2298 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2304 CloseSectionStream (
2305 IN UINTN StreamHandleToClose
2309 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2310 table and registers it into the system table.
2313 This function allocates memory, frees it, and then allocates memory at an
2314 address within the initial allocation. Since this function is called early
2315 in DXE core initialization (before drivers are dispatched), this should not
2320 CoreInitializeDebugImageInfoTable (
2326 Update the CRC32 in the Debug Table.
2327 Since the CRC32 service is made available by the Runtime driver, we have to
2328 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2329 This function is called elsewhere by the core when the runtime architectural
2330 protocol is produced.
2334 CoreUpdateDebugTableCrc32 (
2340 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2341 the table if it's not large enough to accomidate another entry.
2343 @param ImageInfoType type of debug image information
2344 @param LoadedImage pointer to the loaded image protocol for the image being
2346 @param ImageHandle image handle for the image being loaded
2350 CoreNewDebugImageInfoEntry (
2351 IN UINT32 ImageInfoType
,
2352 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2353 IN EFI_HANDLE ImageHandle
2358 Removes and frees an entry from the DebugImageInfo Table.
2360 @param ImageHandle image handle for the image being unloaded
2364 CoreRemoveDebugImageInfoEntry (
2365 EFI_HANDLE ImageHandle
2370 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2372 @param ImageHandle The image handle.
2373 @param SystemTable The system table.
2375 @retval EFI_SUCCESS Successfully initialized firmware volume block
2381 FwVolBlockDriverInit (
2382 IN EFI_HANDLE ImageHandle
,
2383 IN EFI_SYSTEM_TABLE
*SystemTable
2388 This routine produces a firmware volume block protocol on a given
2391 @param BaseAddress base address of the firmware volume image
2392 @param Length length of the firmware volume image
2393 @param ParentHandle handle of parent firmware volume, if this image
2394 came from an FV image file in another firmware
2395 volume (ala capsules)
2396 @param FvProtocol Firmware volume block protocol produced.
2398 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2399 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2400 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2405 ProduceFVBProtocolOnBuffer (
2406 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2408 IN EFI_HANDLE ParentHandle
,
2409 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2414 Raising to the task priority level of the mutual exclusion
2415 lock, and then acquires ownership of the lock.
2417 @param Lock The lock to acquire
2429 Initialize a basic mutual exclusion lock. Each lock
2430 provides mutual exclusion access at it's task priority
2431 level. Since there is no-premption (at any TPL) or
2432 multiprocessor support, acquiring the lock only consists
2433 of raising to the locks TPL.
2435 @param Lock The EFI_LOCK structure to initialize
2437 @retval EFI_SUCCESS Lock Owned.
2438 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2442 CoreAcquireLockOrFail (
2448 Releases ownership of the mutual exclusion lock, and
2449 restores the previous task priority level.
2451 @param Lock The lock to release
2453 @return Lock unowned