2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include <Protocol/LoadedImage.h>
24 #include <Protocol/GuidedSectionExtraction.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/Runtime.h>
27 #include <Protocol/LoadFile.h>
28 #include <Protocol/LoadFile2.h>
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/VariableWrite.h>
31 #include <Protocol/PlatformDriverOverride.h>
32 #include <Protocol/Variable.h>
33 #include <Protocol/Timer.h>
34 #include <Protocol/SimpleFileSystem.h>
35 #include <Protocol/Bds.h>
36 #include <Protocol/RealTimeClock.h>
37 #include <Protocol/WatchdogTimer.h>
38 #include <Protocol/FirmwareVolume2.h>
39 #include <Protocol/MonotonicCounter.h>
40 #include <Protocol/StatusCode.h>
41 #include <Protocol/Decompress.h>
42 #include <Protocol/LoadPe32Image.h>
43 #include <Protocol/Security.h>
44 #include <Protocol/Ebc.h>
45 #include <Protocol/Reset.h>
46 #include <Protocol/Cpu.h>
47 #include <Protocol/Metronome.h>
48 #include <Protocol/FirmwareVolumeBlock.h>
49 #include <Protocol/Capsule.h>
50 #include <Protocol/BusSpecificDriverOverride.h>
51 #include <Protocol/DriverFamilyOverride.h>
52 #include <Protocol/TcgService.h>
53 #include <Protocol/HiiPackageList.h>
54 #include <Protocol/SmmBase2.h>
55 #include <Guid/MemoryTypeInformation.h>
56 #include <Guid/FirmwareFileSystem2.h>
57 #include <Guid/FirmwareFileSystem3.h>
58 #include <Guid/HobList.h>
59 #include <Guid/DebugImageInfoTable.h>
60 #include <Guid/FileInfo.h>
61 #include <Guid/Apriori.h>
62 #include <Guid/DxeServices.h>
63 #include <Guid/MemoryAllocationHob.h>
64 #include <Guid/EventLegacyBios.h>
65 #include <Guid/EventGroup.h>
66 #include <Guid/EventExitBootServiceFailed.h>
67 #include <Guid/LoadModuleAtFixedAddress.h>
68 #include <Guid/IdleLoopEvent.h>
70 #include <Library/DxeCoreEntryPoint.h>
71 #include <Library/DebugLib.h>
72 #include <Library/UefiLib.h>
73 #include <Library/BaseLib.h>
74 #include <Library/HobLib.h>
75 #include <Library/PerformanceLib.h>
76 #include <Library/UefiDecompressLib.h>
77 #include <Library/ExtractGuidedSectionLib.h>
78 #include <Library/CacheMaintenanceLib.h>
79 #include <Library/BaseMemoryLib.h>
80 #include <Library/PeCoffLib.h>
81 #include <Library/PeCoffGetEntryPointLib.h>
82 #include <Library/PeCoffExtraActionLib.h>
83 #include <Library/PcdLib.h>
84 #include <Library/MemoryAllocationLib.h>
85 #include <Library/DevicePathLib.h>
86 #include <Library/UefiBootServicesTableLib.h>
87 #include <Library/ReportStatusCodeLib.h>
88 #include <Library/TimerLib.h>
89 #include <Library/DxeServicesLib.h>
90 #include <Library/DebugAgentLib.h>
91 #include <Library/CpuExceptionHandlerLib.h>
95 // attributes for reserved memory before it is promoted to system memory
97 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
98 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
99 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
102 // range for memory mapped port I/O on IPF
104 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
108 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
109 /// to save time. A EFI_DEP_PUSH is evauated one an
110 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
111 /// Driver Execution Environment Core Interface use 0xff
112 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
113 /// defined to a new value that is not conflicting with PI spec.
115 #define EFI_DEP_REPLACE_TRUE 0xff
118 /// Define the initial size of the dependency expression evaluation stack
120 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
123 EFI_GUID
*ProtocolGuid
;
128 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
131 // DXE Dispatcher Data structures
134 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
137 LIST_ENTRY Link
; // mFvHandleList
143 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
146 LIST_ENTRY Link
; // mDriverList
148 LIST_ENTRY ScheduledLink
; // mScheduledQueue
152 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
153 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
160 EFI_GUID BeforeAfterGuid
;
167 BOOLEAN DepexProtocolError
;
169 EFI_HANDLE ImageHandle
;
172 } EFI_CORE_DRIVER_ENTRY
;
175 //The data structure of GCD memory map entry
177 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
181 EFI_PHYSICAL_ADDRESS BaseAddress
;
185 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
186 EFI_GCD_IO_TYPE GcdIoType
;
187 EFI_HANDLE ImageHandle
;
188 EFI_HANDLE DeviceHandle
;
192 // DXE Core Global Variables
194 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
195 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
196 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
197 extern EFI_HANDLE gDxeCoreImageHandle
;
199 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
201 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
202 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
203 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
204 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
205 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
206 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
207 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
208 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
210 extern EFI_TPL gEfiCurrentTpl
;
212 extern EFI_GUID
*gDxeCoreFileName
;
213 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
215 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
217 extern BOOLEAN gDispatcherRunning
;
218 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
220 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
221 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
223 // Service Initialization Functions
229 Called to initialize the pool.
239 Called to initialize the memory map and add descriptors to
240 the current descriptor list.
241 The first descriptor that is added must be general usable
242 memory as the addition allocates heap.
244 @param Type The type of memory to add
245 @param Start The starting address in the memory range Must be
247 @param NumberOfPages The number of pages in the range
248 @param Attribute Attributes of the memory to add
250 @return None. The range is added to the memory map
254 CoreAddMemoryDescriptor (
255 IN EFI_MEMORY_TYPE Type
,
256 IN EFI_PHYSICAL_ADDRESS Start
,
257 IN UINT64 NumberOfPages
,
263 Release memory lock on mGcdMemorySpaceLock.
267 CoreReleaseGcdMemoryLock (
273 Acquire memory lock on mGcdMemorySpaceLock.
277 CoreAcquireGcdMemoryLock (
283 External function. Initializes memory services based on the memory
284 descriptor HOBs. This function is responsible for priming the memory
285 map, so memory allocations and resource allocations can be made.
286 The first part of this function can not depend on any memory services
287 until at least one memory descriptor is provided to the memory services.
289 @param HobStart The start address of the HOB.
290 @param MemoryBaseAddress Start address of memory region found to init DXE
292 @param MemoryLength Length of memory region found to init DXE core.
294 @retval EFI_SUCCESS Memory services successfully initialized.
298 CoreInitializeMemoryServices (
300 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
301 OUT UINT64
*MemoryLength
307 External function. Initializes the GCD and memory services based on the memory
308 descriptor HOBs. This function is responsible for priming the GCD map and the
309 memory map, so memory allocations and resource allocations can be made. The
310 HobStart will be relocated to a pool buffer.
312 @param HobStart The start address of the HOB
313 @param MemoryBaseAddress Start address of memory region found to init DXE
315 @param MemoryLength Length of memory region found to init DXE core.
317 @retval EFI_SUCCESS GCD services successfully initialized.
321 CoreInitializeGcdServices (
322 IN OUT VOID
**HobStart
,
323 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
324 IN UINT64 MemoryLength
329 Initializes "event" support.
331 @retval EFI_SUCCESS Always return success
335 CoreInitializeEventServices (
341 Add the Image Services to EFI Boot Services Table and install the protocol
342 interfaces for this image.
344 @param HobStart The HOB to initialize
350 CoreInitializeImageServices (
356 Creates an event that is fired everytime a Protocol of a specific type is installed.
360 CoreNotifyOnProtocolInstallation (
366 Return TRUE if all AP services are availible.
368 @retval EFI_SUCCESS All AP services are available
369 @retval EFI_NOT_FOUND At least one AP service is not available
373 CoreAllEfiServicesAvailable (
379 Calcualte the 32-bit CRC in a EFI table using the service provided by the
382 @param Hdr Pointer to an EFI standard header
387 IN OUT EFI_TABLE_HEADER
*Hdr
392 Called by the platform code to process a tick.
394 @param Duration The number of 100ns elasped since the last call
406 Initialize the dispatcher. Initialize the notification function that runs when
407 an FV2 protocol is added to the system.
411 CoreInitializeDispatcher (
417 This is the POSTFIX version of the dependency evaluator. This code does
418 not need to handle Before or After, as it is not valid to call this
419 routine in this case. The SOR is just ignored and is a nop in the grammer.
420 POSTFIX means all the math is done on top of the stack.
422 @param DriverEntry DriverEntry element to update.
424 @retval TRUE If driver is ready to run.
425 @retval FALSE If driver is not ready to run or some fatal error
431 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
436 Preprocess dependency expression and update DriverEntry to reflect the
437 state of Before, After, and SOR dependencies. If DriverEntry->Before
438 or DriverEntry->After is set it will never be cleared. If SOR is set
439 it will be cleared by CoreSchedule(), and then the driver can be
442 @param DriverEntry DriverEntry element to update .
444 @retval EFI_SUCCESS It always works.
448 CorePreProcessDepex (
449 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
455 Terminates all boot services.
457 @param ImageHandle Handle that identifies the exiting image.
458 @param MapKey Key to the latest memory map.
460 @retval EFI_SUCCESS Boot Services terminated
461 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
466 CoreExitBootServices (
467 IN EFI_HANDLE ImageHandle
,
473 Make sure the memory map is following all the construction rules,
474 it is the last time to check memory map error before exit boot services.
476 @param MapKey Memory map key
478 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
480 @retval EFI_SUCCESS Valid memory map.
484 CoreTerminateMemoryMap (
490 Signals all events in the EventGroup.
492 @param EventGroup The list to signal
496 CoreNotifySignalList (
497 IN EFI_GUID
*EventGroup
503 Boot Service called to add, modify, or remove a system configuration table from
504 the EFI System Table.
506 @param Guid Pointer to the GUID for the entry to add, update, or
508 @param Table Pointer to the configuration table for the entry to add,
509 update, or remove, may be NULL.
511 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
512 @return EFI_INVALID_PARAMETER Input GUID not valid.
513 @return EFI_NOT_FOUND Attempted to delete non-existant entry
514 @return EFI_OUT_OF_RESOURCES Not enough memory available
519 CoreInstallConfigurationTable (
527 Raise the task priority level to the new level.
528 High level is implemented by disabling processor interrupts.
530 @param NewTpl New task priority level
532 @return The previous task priority level
544 Lowers the task priority to the previous value. If the new
545 priority unmasks events at a higher priority, they are dispatched.
547 @param NewTpl New, lower, task priority
559 Introduces a fine-grained stall.
561 @param Microseconds The number of microseconds to stall execution.
563 @retval EFI_SUCCESS Execution was stalled for at least the requested
564 amount of microseconds.
565 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
571 IN UINTN Microseconds
577 Sets the system's watchdog timer.
579 @param Timeout The number of seconds to set the watchdog timer to.
580 A value of zero disables the timer.
581 @param WatchdogCode The numeric code to log on a watchdog timer timeout
582 event. The firmware reserves codes 0x0000 to 0xFFFF.
583 Loaders and operating systems may use other timeout
585 @param DataSize The size, in bytes, of WatchdogData.
586 @param WatchdogData A data buffer that includes a Null-terminated Unicode
587 string, optionally followed by additional binary data.
588 The string is a description that the call may use to
589 further indicate the reason to be logged with a
592 @return EFI_SUCCESS Timeout has been set
593 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
594 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
595 @return EFI_DEVICE_ERROR Could not complete due to hardware error
600 CoreSetWatchdogTimer (
602 IN UINT64 WatchdogCode
,
604 IN CHAR16
*WatchdogData OPTIONAL
610 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
611 Calls the private one which contains a BOOLEAN parameter for notifications
613 @param UserHandle The handle to install the protocol handler on,
614 or NULL if a new handle is to be allocated
615 @param Protocol The protocol to add to the handle
616 @param InterfaceType Indicates whether Interface is supplied in
618 @param Interface The interface for the protocol being added
625 CoreInstallProtocolInterface (
626 IN OUT EFI_HANDLE
*UserHandle
,
627 IN EFI_GUID
*Protocol
,
628 IN EFI_INTERFACE_TYPE InterfaceType
,
634 Installs a protocol interface into the boot services environment.
636 @param UserHandle The handle to install the protocol handler on,
637 or NULL if a new handle is to be allocated
638 @param Protocol The protocol to add to the handle
639 @param InterfaceType Indicates whether Interface is supplied in
641 @param Interface The interface for the protocol being added
642 @param Notify indicates whether notify the notification list
645 @retval EFI_INVALID_PARAMETER Invalid parameter
646 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
647 @retval EFI_SUCCESS Protocol interface successfully installed
651 CoreInstallProtocolInterfaceNotify (
652 IN OUT EFI_HANDLE
*UserHandle
,
653 IN EFI_GUID
*Protocol
,
654 IN EFI_INTERFACE_TYPE InterfaceType
,
662 Installs a list of protocol interface into the boot services environment.
663 This function calls InstallProtocolInterface() in a loop. If any error
664 occures all the protocols added by this function are removed. This is
665 basically a lib function to save space.
667 @param Handle The handle to install the protocol handlers on,
668 or NULL if a new handle is to be allocated
669 @param ... EFI_GUID followed by protocol instance. A NULL
670 terminates the list. The pairs are the
671 arguments to InstallProtocolInterface(). All the
672 protocols are added to Handle.
674 @retval EFI_INVALID_PARAMETER Handle is NULL.
675 @retval EFI_SUCCESS Protocol interfaces successfully installed.
680 CoreInstallMultipleProtocolInterfaces (
681 IN OUT EFI_HANDLE
*Handle
,
688 Uninstalls a list of protocol interface in the boot services environment.
689 This function calls UnisatllProtocolInterface() in a loop. This is
690 basically a lib function to save space.
692 @param Handle The handle to uninstall the protocol
693 @param ... EFI_GUID followed by protocol instance. A NULL
694 terminates the list. The pairs are the
695 arguments to UninstallProtocolInterface(). All
696 the protocols are added to Handle.
703 CoreUninstallMultipleProtocolInterfaces (
704 IN EFI_HANDLE Handle
,
711 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
713 @param UserHandle Handle on which the interface is to be
715 @param Protocol The numeric ID of the interface
716 @param OldInterface A pointer to the old interface
717 @param NewInterface A pointer to the new interface
719 @retval EFI_SUCCESS The protocol interface was installed
720 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
721 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
726 CoreReinstallProtocolInterface (
727 IN EFI_HANDLE UserHandle
,
728 IN EFI_GUID
*Protocol
,
729 IN VOID
*OldInterface
,
730 IN VOID
*NewInterface
736 Uninstalls all instances of a protocol:interfacer from a handle.
737 If the last protocol interface is remove from the handle, the
740 @param UserHandle The handle to remove the protocol handler from
741 @param Protocol The protocol, of protocol:interface, to remove
742 @param Interface The interface, of protocol:interface, to remove
744 @retval EFI_INVALID_PARAMETER Protocol is NULL.
745 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
750 CoreUninstallProtocolInterface (
751 IN EFI_HANDLE UserHandle
,
752 IN EFI_GUID
*Protocol
,
759 Queries a handle to determine if it supports a specified protocol.
761 @param UserHandle The handle being queried.
762 @param Protocol The published unique identifier of the protocol.
763 @param Interface Supplies the address where a pointer to the
764 corresponding Protocol Interface is returned.
766 @return The requested protocol interface for the handle
772 IN EFI_HANDLE UserHandle
,
773 IN EFI_GUID
*Protocol
,
780 Locates the installed protocol handler for the handle, and
781 invokes it to obtain the protocol interface. Usage information
782 is registered in the protocol data base.
784 @param UserHandle The handle to obtain the protocol interface on
785 @param Protocol The ID of the protocol
786 @param Interface The location to return the protocol interface
787 @param ImageHandle The handle of the Image that is opening the
788 protocol interface specified by Protocol and
790 @param ControllerHandle The controller handle that is requiring this
792 @param Attributes The open mode of the protocol interface
793 specified by Handle and Protocol.
795 @retval EFI_INVALID_PARAMETER Protocol is NULL.
796 @retval EFI_SUCCESS Get the protocol interface.
802 IN EFI_HANDLE UserHandle
,
803 IN EFI_GUID
*Protocol
,
804 OUT VOID
**Interface OPTIONAL
,
805 IN EFI_HANDLE ImageHandle
,
806 IN EFI_HANDLE ControllerHandle
,
813 Return information about Opened protocols in the system
815 @param UserHandle The handle to close the protocol interface on
816 @param Protocol The ID of the protocol
817 @param EntryBuffer A pointer to a buffer of open protocol
818 information in the form of
819 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
820 @param EntryCount Number of EntryBuffer entries
825 CoreOpenProtocolInformation (
826 IN EFI_HANDLE UserHandle
,
827 IN EFI_GUID
*Protocol
,
828 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
829 OUT UINTN
*EntryCount
835 Closes a protocol on a handle that was opened using OpenProtocol().
837 @param UserHandle The handle for the protocol interface that was
838 previously opened with OpenProtocol(), and is
840 @param Protocol The published unique identifier of the protocol.
841 It is the caller's responsibility to pass in a
843 @param AgentHandle The handle of the agent that is closing the
845 @param ControllerHandle If the agent that opened a protocol is a driver
846 that follows the EFI Driver Model, then this
847 parameter is the controller handle that required
848 the protocol interface. If the agent does not
849 follow the EFI Driver Model, then this parameter
850 is optional and may be NULL.
852 @retval EFI_SUCCESS The protocol instance was closed.
853 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
855 @retval EFI_NOT_FOUND Can not find the specified protocol or
862 IN EFI_HANDLE UserHandle
,
863 IN EFI_GUID
*Protocol
,
864 IN EFI_HANDLE AgentHandle
,
865 IN EFI_HANDLE ControllerHandle
871 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
874 @param UserHandle The handle from which to retrieve the list of
875 protocol interface GUIDs.
876 @param ProtocolBuffer A pointer to the list of protocol interface GUID
877 pointers that are installed on Handle.
878 @param ProtocolBufferCount A pointer to the number of GUID pointers present
881 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
882 on Handle was returned in ProtocolBuffer. The
883 number of protocol interface GUIDs was returned
884 in ProtocolBufferCount.
885 @retval EFI_INVALID_PARAMETER Handle is NULL.
886 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
887 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
888 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
889 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
895 CoreProtocolsPerHandle (
896 IN EFI_HANDLE UserHandle
,
897 OUT EFI_GUID
***ProtocolBuffer
,
898 OUT UINTN
*ProtocolBufferCount
904 Add a new protocol notification record for the request protocol.
906 @param Protocol The requested protocol to add the notify
908 @param Event The event to signal
909 @param Registration Returns the registration record
911 @retval EFI_INVALID_PARAMETER Invalid parameter
912 @retval EFI_SUCCESS Successfully returned the registration record
918 CoreRegisterProtocolNotify (
919 IN EFI_GUID
*Protocol
,
921 OUT VOID
**Registration
926 Removes all the events in the protocol database that match Event.
928 @param Event The event to search for in the protocol
931 @return EFI_SUCCESS when done searching the entire database.
935 CoreUnregisterProtocolNotify (
941 Locates the requested handle(s) and returns them in Buffer.
943 @param SearchType The type of search to perform to locate the
945 @param Protocol The protocol to search for
946 @param SearchKey Dependant on SearchType
947 @param BufferSize On input the size of Buffer. On output the
948 size of data returned.
949 @param Buffer The buffer to return the results in
951 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
952 returned in BufferSize.
953 @retval EFI_INVALID_PARAMETER Invalid parameter
954 @retval EFI_SUCCESS Successfully found the requested handle(s) and
955 returns them in Buffer.
961 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
962 IN EFI_GUID
*Protocol OPTIONAL
,
963 IN VOID
*SearchKey OPTIONAL
,
964 IN OUT UINTN
*BufferSize
,
965 OUT EFI_HANDLE
*Buffer
971 Locates the handle to a device on the device path that best matches the specified protocol.
973 @param Protocol The protocol to search for.
974 @param DevicePath On input, a pointer to a pointer to the device
975 path. On output, the device path pointer is
976 modified to point to the remaining part of the
978 @param Device A pointer to the returned device handle.
980 @retval EFI_SUCCESS The resulting handle was returned.
981 @retval EFI_NOT_FOUND No handles matched the search.
982 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
987 CoreLocateDevicePath (
988 IN EFI_GUID
*Protocol
,
989 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
990 OUT EFI_HANDLE
*Device
996 Function returns an array of handles that support the requested protocol
997 in a buffer allocated from pool. This is a version of CoreLocateHandle()
998 that allocates a buffer for the caller.
1000 @param SearchType Specifies which handle(s) are to be returned.
1001 @param Protocol Provides the protocol to search by. This
1002 parameter is only valid for SearchType
1004 @param SearchKey Supplies the search key depending on the
1006 @param NumberHandles The number of handles returned in Buffer.
1007 @param Buffer A pointer to the buffer to return the requested
1008 array of handles that support Protocol.
1010 @retval EFI_SUCCESS The result array of handles was returned.
1011 @retval EFI_NOT_FOUND No handles match the search.
1012 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1014 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1019 CoreLocateHandleBuffer (
1020 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1021 IN EFI_GUID
*Protocol OPTIONAL
,
1022 IN VOID
*SearchKey OPTIONAL
,
1023 IN OUT UINTN
*NumberHandles
,
1024 OUT EFI_HANDLE
**Buffer
1030 Return the first Protocol Interface that matches the Protocol GUID. If
1031 Registration is passed in, return a Protocol Instance that was just add
1032 to the system. If Registration is NULL return the first Protocol Interface
1035 @param Protocol The protocol to search for
1036 @param Registration Optional Registration Key returned from
1037 RegisterProtocolNotify()
1038 @param Interface Return the Protocol interface (instance).
1040 @retval EFI_SUCCESS If a valid Interface is returned
1041 @retval EFI_INVALID_PARAMETER Invalid parameter
1042 @retval EFI_NOT_FOUND Protocol interface not found
1047 CoreLocateProtocol (
1048 IN EFI_GUID
*Protocol
,
1049 IN VOID
*Registration OPTIONAL
,
1050 OUT VOID
**Interface
1055 return handle database key.
1058 @return Handle database key.
1062 CoreGetHandleDatabaseKey (
1068 Go connect any handles that were created or modified while a image executed.
1070 @param Key The Key to show that the handle has been
1075 CoreConnectHandlesByKey (
1082 Connects one or more drivers to a controller.
1084 @param ControllerHandle Handle of the controller to be
1086 @param DriverImageHandle DriverImageHandle A pointer to an
1087 ordered list of driver image
1089 @param RemainingDevicePath RemainingDevicePath A pointer to
1090 the device path that specifies a
1091 child of the controller specified
1092 by ControllerHandle.
1093 @param Recursive Whether the function would be
1094 called recursively or not.
1096 @return Status code.
1101 CoreConnectController (
1102 IN EFI_HANDLE ControllerHandle
,
1103 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1104 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1105 IN BOOLEAN Recursive
1111 Disonnects a controller from a driver
1113 @param ControllerHandle ControllerHandle The handle of
1114 the controller from which
1117 @param DriverImageHandle DriverImageHandle The driver to
1118 disconnect from ControllerHandle.
1119 @param ChildHandle ChildHandle The handle of the
1122 @retval EFI_SUCCESS One or more drivers were
1123 disconnected from the controller.
1124 @retval EFI_SUCCESS On entry, no drivers are managing
1126 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1127 and on entry DriverImageHandle is
1128 not managing ControllerHandle.
1129 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1130 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1131 and it is not a valid EFI_HANDLE.
1132 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1133 is not a valid EFI_HANDLE.
1134 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1135 available to disconnect any
1136 drivers from ControllerHandle.
1137 @retval EFI_DEVICE_ERROR The controller could not be
1138 disconnected because of a device
1144 CoreDisconnectController (
1145 IN EFI_HANDLE ControllerHandle
,
1146 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1147 IN EFI_HANDLE ChildHandle OPTIONAL
1153 Allocates pages from the memory map.
1155 @param Type The type of allocation to perform
1156 @param MemoryType The type of memory to turn the allocated pages
1158 @param NumberOfPages The number of pages to allocate
1159 @param Memory A pointer to receive the base allocated memory
1162 @return Status. On success, Memory is filled in with the base address allocated
1163 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1165 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1166 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1167 @retval EFI_SUCCESS Pages successfully allocated.
1173 IN EFI_ALLOCATE_TYPE Type
,
1174 IN EFI_MEMORY_TYPE MemoryType
,
1175 IN UINTN NumberOfPages
,
1176 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1182 Frees previous allocated pages.
1184 @param Memory Base address of memory being freed
1185 @param NumberOfPages The number of pages to free
1187 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1188 @retval EFI_INVALID_PARAMETER Address not aligned
1189 @return EFI_SUCCESS -Pages successfully freed.
1195 IN EFI_PHYSICAL_ADDRESS Memory
,
1196 IN UINTN NumberOfPages
1202 This function returns a copy of the current memory map. The map is an array of
1203 memory descriptors, each of which describes a contiguous block of memory.
1205 @param MemoryMapSize A pointer to the size, in bytes, of the
1206 MemoryMap buffer. On input, this is the size of
1207 the buffer allocated by the caller. On output,
1208 it is the size of the buffer returned by the
1209 firmware if the buffer was large enough, or the
1210 size of the buffer needed to contain the map if
1211 the buffer was too small.
1212 @param MemoryMap A pointer to the buffer in which firmware places
1213 the current memory map.
1214 @param MapKey A pointer to the location in which firmware
1215 returns the key for the current memory map.
1216 @param DescriptorSize A pointer to the location in which firmware
1217 returns the size, in bytes, of an individual
1218 EFI_MEMORY_DESCRIPTOR.
1219 @param DescriptorVersion A pointer to the location in which firmware
1220 returns the version number associated with the
1221 EFI_MEMORY_DESCRIPTOR.
1223 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1225 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1226 buffer size needed to hold the memory map is
1227 returned in MemoryMapSize.
1228 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1234 IN OUT UINTN
*MemoryMapSize
,
1235 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1237 OUT UINTN
*DescriptorSize
,
1238 OUT UINT32
*DescriptorVersion
1244 Allocate pool of a particular type.
1246 @param PoolType Type of pool to allocate
1247 @param Size The amount of pool to allocate
1248 @param Buffer The address to return a pointer to the allocated
1251 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1252 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1253 @retval EFI_SUCCESS Pool successfully allocated.
1259 IN EFI_MEMORY_TYPE PoolType
,
1269 @param Buffer The allocated pool entry to free
1271 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1272 @retval EFI_SUCCESS Pool successfully freed.
1284 Loads an EFI image into memory and returns a handle to the image.
1286 @param BootPolicy If TRUE, indicates that the request originates
1287 from the boot manager, and that the boot
1288 manager is attempting to load FilePath as a
1290 @param ParentImageHandle The caller's image handle.
1291 @param FilePath The specific file path from which the image is
1293 @param SourceBuffer If not NULL, a pointer to the memory location
1294 containing a copy of the image to be loaded.
1295 @param SourceSize The size in bytes of SourceBuffer.
1296 @param ImageHandle Pointer to the returned image handle that is
1297 created when the image is successfully loaded.
1299 @retval EFI_SUCCESS The image was loaded into memory.
1300 @retval EFI_NOT_FOUND The FilePath was not found.
1301 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1302 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1303 path cannot be parsed to locate the proper
1304 protocol for loading the file.
1305 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1307 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1309 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1310 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1311 image from being loaded. NULL is returned in *ImageHandle.
1312 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1313 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1314 platform policy specifies that the image should not be started.
1320 IN BOOLEAN BootPolicy
,
1321 IN EFI_HANDLE ParentImageHandle
,
1322 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1323 IN VOID
*SourceBuffer OPTIONAL
,
1324 IN UINTN SourceSize
,
1325 OUT EFI_HANDLE
*ImageHandle
1333 @param ImageHandle Handle that identifies the image to be
1336 @retval EFI_SUCCESS The image has been unloaded.
1337 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1339 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1345 IN EFI_HANDLE ImageHandle
1351 Transfer control to a loaded image's entry point.
1353 @param ImageHandle Handle of image to be started.
1354 @param ExitDataSize Pointer of the size to ExitData
1355 @param ExitData Pointer to a pointer to a data buffer that
1356 includes a Null-terminated string,
1357 optionally followed by additional binary data.
1358 The string is a description that the caller may
1359 use to further indicate the reason for the
1362 @retval EFI_INVALID_PARAMETER Invalid parameter
1363 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1364 @retval EFI_SUCCESS Successfully transfer control to the image's
1371 IN EFI_HANDLE ImageHandle
,
1372 OUT UINTN
*ExitDataSize
,
1373 OUT CHAR16
**ExitData OPTIONAL
1379 Terminates the currently loaded EFI image and returns control to boot services.
1381 @param ImageHandle Handle that identifies the image. This
1382 parameter is passed to the image on entry.
1383 @param Status The image's exit code.
1384 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1385 ExitStatus is EFI_SUCCESS.
1386 @param ExitData Pointer to a data buffer that includes a
1387 Null-terminated Unicode string, optionally
1388 followed by additional binary data. The string
1389 is a description that the caller may use to
1390 further indicate the reason for the image's
1393 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1395 @retval EFI_SUCCESS Successfully terminates the currently loaded
1397 @retval EFI_ACCESS_DENIED Should never reach there.
1398 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1404 IN EFI_HANDLE ImageHandle
,
1405 IN EFI_STATUS Status
,
1406 IN UINTN ExitDataSize
,
1407 IN CHAR16
*ExitData OPTIONAL
1415 @param Type The type of event to create and its mode and
1417 @param NotifyTpl The task priority level of event notifications
1418 @param NotifyFunction Pointer to the events notification function
1419 @param NotifyContext Pointer to the notification functions context;
1420 corresponds to parameter "Context" in the
1421 notification function
1422 @param Event Pointer to the newly created event if the call
1423 succeeds; undefined otherwise
1425 @retval EFI_SUCCESS The event structure was created
1426 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1427 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1434 IN EFI_TPL NotifyTpl
,
1435 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1436 IN VOID
*NotifyContext
, OPTIONAL
1437 OUT EFI_EVENT
*Event
1443 Creates an event in a group.
1445 @param Type The type of event to create and its mode and
1447 @param NotifyTpl The task priority level of event notifications
1448 @param NotifyFunction Pointer to the events notification function
1449 @param NotifyContext Pointer to the notification functions context;
1450 corresponds to parameter "Context" in the
1451 notification function
1452 @param EventGroup GUID for EventGroup if NULL act the same as
1454 @param Event Pointer to the newly created event if the call
1455 succeeds; undefined otherwise
1457 @retval EFI_SUCCESS The event structure was created
1458 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1459 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1466 IN EFI_TPL NotifyTpl
,
1467 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1468 IN CONST VOID
*NotifyContext
, OPTIONAL
1469 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1470 OUT EFI_EVENT
*Event
1474 Creates a general-purpose event structure
1476 @param Type The type of event to create and its mode and
1478 @param NotifyTpl The task priority level of event notifications
1479 @param NotifyFunction Pointer to the events notification function
1480 @param NotifyContext Pointer to the notification functions context;
1481 corresponds to parameter "Context" in the
1482 notification function
1483 @param EventGroup GUID for EventGroup if NULL act the same as
1485 @param Event Pointer to the newly created event if the call
1486 succeeds; undefined otherwise
1488 @retval EFI_SUCCESS The event structure was created
1489 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1490 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1495 CoreCreateEventInternal (
1497 IN EFI_TPL NotifyTpl
,
1498 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1499 IN CONST VOID
*NotifyContext
, OPTIONAL
1500 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1501 OUT EFI_EVENT
*Event
1505 Sets the type of timer and the trigger time for a timer event.
1507 @param UserEvent The timer event that is to be signaled at the
1509 @param Type The type of time that is specified in
1511 @param TriggerTime The number of 100ns units until the timer
1514 @retval EFI_SUCCESS The event has been set to be signaled at the
1516 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1522 IN EFI_EVENT UserEvent
,
1523 IN EFI_TIMER_DELAY Type
,
1524 IN UINT64 TriggerTime
1530 Signals the event. Queues the event to be notified if needed.
1532 @param UserEvent The event to signal .
1534 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1535 @retval EFI_SUCCESS The event was signaled.
1541 IN EFI_EVENT UserEvent
1547 Stops execution until an event is signaled.
1549 @param NumberOfEvents The number of events in the UserEvents array
1550 @param UserEvents An array of EFI_EVENT
1551 @param UserIndex Pointer to the index of the event which
1552 satisfied the wait condition
1554 @retval EFI_SUCCESS The event indicated by Index was signaled.
1555 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1556 function or Event was not a valid type
1557 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1563 IN UINTN NumberOfEvents
,
1564 IN EFI_EVENT
*UserEvents
,
1565 OUT UINTN
*UserIndex
1571 Closes an event and frees the event structure.
1573 @param UserEvent Event to close
1575 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1576 @retval EFI_SUCCESS The event has been closed
1582 IN EFI_EVENT UserEvent
1588 Check the status of an event.
1590 @param UserEvent The event to check
1592 @retval EFI_SUCCESS The event is in the signaled state
1593 @retval EFI_NOT_READY The event is not in the signaled state
1594 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1600 IN EFI_EVENT UserEvent
1605 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1606 global coherency domain of the processor.
1608 @param GcdMemoryType Memory type of the memory space.
1609 @param BaseAddress Base address of the memory space.
1610 @param Length Length of the memory space.
1611 @param Capabilities alterable attributes of the memory space.
1613 @retval EFI_SUCCESS Merged this memory space into GCD map.
1618 CoreAddMemorySpace (
1619 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1620 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1622 IN UINT64 Capabilities
1627 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1628 I/O resources from the global coherency domain of the processor.
1630 @param GcdAllocateType The type of allocate operation
1631 @param GcdMemoryType The desired memory type
1632 @param Alignment Align with 2^Alignment
1633 @param Length Length to allocate
1634 @param BaseAddress Base address to allocate
1635 @param ImageHandle The image handle consume the allocated space.
1636 @param DeviceHandle The device handle consume the allocated space.
1638 @retval EFI_INVALID_PARAMETER Invalid parameter.
1639 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1640 @retval EFI_SUCCESS Memory space successfully allocated.
1645 CoreAllocateMemorySpace (
1646 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1647 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1650 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1651 IN EFI_HANDLE ImageHandle
,
1652 IN EFI_HANDLE DeviceHandle OPTIONAL
1657 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1658 I/O resources from the global coherency domain of the processor.
1660 @param BaseAddress Base address of the memory space.
1661 @param Length Length of the memory space.
1663 @retval EFI_SUCCESS Space successfully freed.
1668 CoreFreeMemorySpace (
1669 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1675 Removes reserved memory, system memory, or memory-mapped I/O resources from
1676 the global coherency domain of the processor.
1678 @param BaseAddress Base address of the memory space.
1679 @param Length Length of the memory space.
1681 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1686 CoreRemoveMemorySpace (
1687 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1693 Retrieves the descriptor for a memory region containing a specified address.
1695 @param BaseAddress Specified start address
1696 @param Descriptor Specified length
1698 @retval EFI_INVALID_PARAMETER Invalid parameter
1699 @retval EFI_SUCCESS Successfully get memory space descriptor.
1704 CoreGetMemorySpaceDescriptor (
1705 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1706 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1711 Modifies the attributes for a memory region in the global coherency domain of the
1714 @param BaseAddress Specified start address
1715 @param Length Specified length
1716 @param Attributes Specified attributes
1718 @retval EFI_SUCCESS The attributes were set for the memory region.
1719 @retval EFI_INVALID_PARAMETER Length is zero.
1720 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1721 resource range specified by BaseAddress and Length.
1722 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1723 range specified by BaseAddress and Length.
1724 @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by
1725 BaseAddress and Length cannot be modified.
1726 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1727 the memory resource range.
1728 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1734 CoreSetMemorySpaceAttributes (
1735 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1737 IN UINT64 Attributes
1742 Returns a map of the memory resources in the global coherency domain of the
1745 @param NumberOfDescriptors Number of descriptors.
1746 @param MemorySpaceMap Descriptor array
1748 @retval EFI_INVALID_PARAMETER Invalid parameter
1749 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1750 @retval EFI_SUCCESS Successfully get memory space map.
1755 CoreGetMemorySpaceMap (
1756 OUT UINTN
*NumberOfDescriptors
,
1757 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1762 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1764 @param GcdIoType IO type of the segment.
1765 @param BaseAddress Base address of the segment.
1766 @param Length Length of the segment.
1768 @retval EFI_SUCCESS Merged this segment into GCD map.
1769 @retval EFI_INVALID_PARAMETER Parameter not valid
1775 IN EFI_GCD_IO_TYPE GcdIoType
,
1776 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1782 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1783 domain of the processor.
1785 @param GcdAllocateType The type of allocate operation
1786 @param GcdIoType The desired IO type
1787 @param Alignment Align with 2^Alignment
1788 @param Length Length to allocate
1789 @param BaseAddress Base address to allocate
1790 @param ImageHandle The image handle consume the allocated space.
1791 @param DeviceHandle The device handle consume the allocated space.
1793 @retval EFI_INVALID_PARAMETER Invalid parameter.
1794 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1795 @retval EFI_SUCCESS IO space successfully allocated.
1800 CoreAllocateIoSpace (
1801 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1802 IN EFI_GCD_IO_TYPE GcdIoType
,
1805 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1806 IN EFI_HANDLE ImageHandle
,
1807 IN EFI_HANDLE DeviceHandle OPTIONAL
1812 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1813 domain of the processor.
1815 @param BaseAddress Base address of the segment.
1816 @param Length Length of the segment.
1818 @retval EFI_SUCCESS Space successfully freed.
1824 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1830 Removes reserved I/O or I/O resources from the global coherency domain of the
1833 @param BaseAddress Base address of the segment.
1834 @param Length Length of the segment.
1836 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1842 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1848 Retrieves the descriptor for an I/O region containing a specified address.
1850 @param BaseAddress Specified start address
1851 @param Descriptor Specified length
1853 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1854 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1859 CoreGetIoSpaceDescriptor (
1860 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1861 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1866 Returns a map of the I/O resources in the global coherency domain of the processor.
1868 @param NumberOfDescriptors Number of descriptors.
1869 @param IoSpaceMap Descriptor array
1871 @retval EFI_INVALID_PARAMETER Invalid parameter
1872 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1873 @retval EFI_SUCCESS Successfully get IO space map.
1879 OUT UINTN
*NumberOfDescriptors
,
1880 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1885 This is the main Dispatcher for DXE and it exits when there are no more
1886 drivers to run. Drain the mScheduledQueue and load and start a PE
1887 image for each driver. Search the mDiscoveredList to see if any driver can
1888 be placed on the mScheduledQueue. If no drivers are placed on the
1889 mScheduledQueue exit the function. On exit it is assumed the Bds()
1890 will be called, and when the Bds() exits the Dispatcher will be called
1893 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1894 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1895 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1905 Check every driver and locate a matching one. If the driver is found, the Unrequested
1906 state flag is cleared.
1908 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1909 the firmware file specified by DriverName.
1910 @param DriverName The Driver name to put in the Dependent state.
1912 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1914 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1921 IN EFI_HANDLE FirmwareVolumeHandle
,
1922 IN EFI_GUID
*DriverName
1927 Convert a driver from the Untrused back to the Scheduled state.
1929 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1930 the firmware file specified by DriverName.
1931 @param DriverName The Driver name to put in the Scheduled state
1933 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1934 was promoted to the trusted state.
1935 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1941 IN EFI_HANDLE FirmwareVolumeHandle
,
1942 IN EFI_GUID
*DriverName
1947 This routine is the driver initialization entry point. It initializes the
1948 libraries, and registers two notification functions. These notification
1949 functions are responsible for building the FV stack dynamically.
1951 @param ImageHandle The image handle.
1952 @param SystemTable The system table.
1954 @retval EFI_SUCCESS Function successfully returned.
1960 IN EFI_HANDLE ImageHandle
,
1961 IN EFI_SYSTEM_TABLE
*SystemTable
1966 Entry point of the section extraction code. Initializes an instance of the
1967 section extraction interface and installs it on a new handle.
1969 @param ImageHandle A handle for the image that is initializing this driver
1970 @param SystemTable A pointer to the EFI system table
1972 @retval EFI_SUCCESS Driver initialized successfully
1973 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1978 InitializeSectionExtraction (
1979 IN EFI_HANDLE ImageHandle
,
1980 IN EFI_SYSTEM_TABLE
*SystemTable
1985 This DXE service routine is used to process a firmware volume. In
1986 particular, it can be called by BDS to process a single firmware
1987 volume found in a capsule.
1989 @param FvHeader pointer to a firmware volume header
1990 @param Size the size of the buffer pointed to by FvHeader
1991 @param FVProtocolHandle the handle on which a firmware volume protocol
1992 was produced for the firmware volume passed in.
1994 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1996 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1997 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2003 CoreProcessFirmwareVolume (
2006 OUT EFI_HANDLE
*FVProtocolHandle
2010 //Functions used during debug buils
2014 Displays Architectural protocols that were not loaded and are required for DXE
2015 core to function. Only used in Debug Builds.
2019 CoreDisplayMissingArchProtocols (
2025 Traverse the discovered list for any drivers that were discovered but not loaded
2026 because the dependency experessions evaluated to false.
2030 CoreDisplayDiscoveredNotDispatched (
2036 Place holder function until all the Boot Services and Runtime Services are
2039 @return EFI_NOT_AVAILABLE_YET
2044 CoreEfiNotAvailableYetArg0 (
2050 Place holder function until all the Boot Services and Runtime Services are
2053 @param Arg1 Undefined
2055 @return EFI_NOT_AVAILABLE_YET
2060 CoreEfiNotAvailableYetArg1 (
2066 Place holder function until all the Boot Services and Runtime Services are available.
2068 @param Arg1 Undefined
2069 @param Arg2 Undefined
2071 @return EFI_NOT_AVAILABLE_YET
2076 CoreEfiNotAvailableYetArg2 (
2083 Place holder function until all the Boot Services and Runtime Services are available.
2085 @param Arg1 Undefined
2086 @param Arg2 Undefined
2087 @param Arg3 Undefined
2089 @return EFI_NOT_AVAILABLE_YET
2094 CoreEfiNotAvailableYetArg3 (
2102 Place holder function until all the Boot Services and Runtime Services are available.
2104 @param Arg1 Undefined
2105 @param Arg2 Undefined
2106 @param Arg3 Undefined
2107 @param Arg4 Undefined
2109 @return EFI_NOT_AVAILABLE_YET
2114 CoreEfiNotAvailableYetArg4 (
2123 Place holder function until all the Boot Services and Runtime Services are available.
2125 @param Arg1 Undefined
2126 @param Arg2 Undefined
2127 @param Arg3 Undefined
2128 @param Arg4 Undefined
2129 @param Arg5 Undefined
2131 @return EFI_NOT_AVAILABLE_YET
2136 CoreEfiNotAvailableYetArg5 (
2146 Given a compressed source buffer, this function retrieves the size of the
2147 uncompressed buffer and the size of the scratch buffer required to decompress
2148 the compressed source buffer.
2150 The GetInfo() function retrieves the size of the uncompressed buffer and the
2151 temporary scratch buffer required to decompress the buffer specified by Source
2152 and SourceSize. If the size of the uncompressed buffer or the size of the
2153 scratch buffer cannot be determined from the compressed data specified by
2154 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2155 size of the uncompressed buffer is returned in DestinationSize, the size of
2156 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2157 The GetInfo() function does not have scratch buffer available to perform a
2158 thorough checking of the validity of the source data. It just retrieves the
2159 "Original Size" field from the beginning bytes of the source data and output
2160 it as DestinationSize. And ScratchSize is specific to the decompression
2163 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2164 @param Source The source buffer containing the compressed data.
2165 @param SourceSize The size, in bytes, of the source buffer.
2166 @param DestinationSize A pointer to the size, in bytes, of the
2167 uncompressed buffer that will be generated when the
2168 compressed buffer specified by Source and
2169 SourceSize is decompressed.
2170 @param ScratchSize A pointer to the size, in bytes, of the scratch
2171 buffer that is required to decompress the
2172 compressed buffer specified by Source and
2175 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2176 DestinationSize and the size of the scratch buffer
2177 was returned in ScratchSize.
2178 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2179 the scratch buffer cannot be determined from the
2180 compressed data specified by Source and
2186 DxeMainUefiDecompressGetInfo (
2187 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2189 IN UINT32 SourceSize
,
2190 OUT UINT32
*DestinationSize
,
2191 OUT UINT32
*ScratchSize
2196 Decompresses a compressed source buffer.
2198 The Decompress() function extracts decompressed data to its original form.
2199 This protocol is designed so that the decompression algorithm can be
2200 implemented without using any memory services. As a result, the Decompress()
2201 Function is not allowed to call AllocatePool() or AllocatePages() in its
2202 implementation. It is the caller's responsibility to allocate and free the
2203 Destination and Scratch buffers.
2204 If the compressed source data specified by Source and SourceSize is
2205 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2206 the compressed source data specified by Source and SourceSize is not in a
2207 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2209 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2210 @param Source The source buffer containing the compressed data.
2211 @param SourceSize SourceSizeThe size of source data.
2212 @param Destination On output, the destination buffer that contains
2213 the uncompressed data.
2214 @param DestinationSize The size of the destination buffer. The size of
2215 the destination buffer needed is obtained from
2216 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2217 @param Scratch A temporary scratch buffer that is used to perform
2219 @param ScratchSize The size of scratch buffer. The size of the
2220 scratch buffer needed is obtained from GetInfo().
2222 @retval EFI_SUCCESS Decompression completed successfully, and the
2223 uncompressed buffer is returned in Destination.
2224 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2225 SourceSize is corrupted (not in a valid
2231 DxeMainUefiDecompress (
2232 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2234 IN UINT32 SourceSize
,
2235 IN OUT VOID
*Destination
,
2236 IN UINT32 DestinationSize
,
2237 IN OUT VOID
*Scratch
,
2238 IN UINT32 ScratchSize
2242 SEP member function. This function creates and returns a new section stream
2243 handle to represent the new section stream.
2245 @param SectionStreamLength Size in bytes of the section stream.
2246 @param SectionStream Buffer containing the new section stream.
2247 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2248 output contains the new section stream handle.
2250 @retval EFI_SUCCESS The section stream is created successfully.
2251 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2252 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2259 IN UINTN SectionStreamLength
,
2260 IN VOID
*SectionStream
,
2261 OUT UINTN
*SectionStreamHandle
2267 SEP member function. Retrieves requested section from section stream.
2269 @param SectionStreamHandle The section stream from which to extract the
2271 @param SectionType A pointer to the type of section to search for.
2272 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2273 then SectionDefinitionGuid indicates which of
2274 these types of sections to search for.
2275 @param SectionInstance Indicates which instance of the requested
2277 @param Buffer Double indirection to buffer. If *Buffer is
2278 non-null on input, then the buffer is caller
2279 allocated. If Buffer is NULL, then the buffer
2280 is callee allocated. In either case, the
2281 requried buffer size is returned in *BufferSize.
2282 @param BufferSize On input, indicates the size of *Buffer if
2283 *Buffer is non-null on input. On output,
2284 indicates the required size (allocated size if
2285 callee allocated) of *Buffer.
2286 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2287 indicates the authentication status of the
2288 output buffer. If the input section's
2289 GuidedSectionHeader.Attributes field
2290 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2291 bit as clear, AuthenticationStatus must return
2292 zero. Both local bits (19:16) and aggregate
2293 bits (3:0) in AuthenticationStatus are returned
2294 by ExtractSection(). These bits reflect the
2295 status of the extraction operation. The bit
2296 pattern in both regions must be the same, as
2297 the local and aggregate authentication statuses
2298 have equivalent meaning at this level. If the
2299 function returns anything other than
2300 EFI_SUCCESS, the value of *AuthenticationStatus
2302 @param IsFfs3Fv Indicates the FV format.
2304 @retval EFI_SUCCESS Section was retrieved successfully
2305 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2306 section stream with its
2307 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2308 but there was no corresponding GUIDed Section
2309 Extraction Protocol in the handle database.
2310 *Buffer is unmodified.
2311 @retval EFI_NOT_FOUND An error was encountered when parsing the
2312 SectionStream. This indicates the SectionStream
2313 is not correctly formatted.
2314 @retval EFI_NOT_FOUND The requested section does not exist.
2315 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2317 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2318 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2319 insufficient to contain the requested section.
2320 The input buffer is filled and section contents
2327 IN UINTN SectionStreamHandle
,
2328 IN EFI_SECTION_TYPE
*SectionType
,
2329 IN EFI_GUID
*SectionDefinitionGuid
,
2330 IN UINTN SectionInstance
,
2332 IN OUT UINTN
*BufferSize
,
2333 OUT UINT32
*AuthenticationStatus
,
2339 SEP member function. Deletes an existing section stream
2341 @param StreamHandleToClose Indicates the stream to close
2343 @retval EFI_SUCCESS The section stream is closed sucessfully.
2344 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2345 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2351 CloseSectionStream (
2352 IN UINTN StreamHandleToClose
2356 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2357 table and registers it into the system table.
2360 This function allocates memory, frees it, and then allocates memory at an
2361 address within the initial allocation. Since this function is called early
2362 in DXE core initialization (before drivers are dispatched), this should not
2367 CoreInitializeDebugImageInfoTable (
2373 Update the CRC32 in the Debug Table.
2374 Since the CRC32 service is made available by the Runtime driver, we have to
2375 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2376 This function is called elsewhere by the core when the runtime architectural
2377 protocol is produced.
2381 CoreUpdateDebugTableCrc32 (
2387 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2388 the table if it's not large enough to accomidate another entry.
2390 @param ImageInfoType type of debug image information
2391 @param LoadedImage pointer to the loaded image protocol for the image being
2393 @param ImageHandle image handle for the image being loaded
2397 CoreNewDebugImageInfoEntry (
2398 IN UINT32 ImageInfoType
,
2399 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2400 IN EFI_HANDLE ImageHandle
2405 Removes and frees an entry from the DebugImageInfo Table.
2407 @param ImageHandle image handle for the image being unloaded
2411 CoreRemoveDebugImageInfoEntry (
2412 EFI_HANDLE ImageHandle
2417 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2419 @param ImageHandle The image handle.
2420 @param SystemTable The system table.
2422 @retval EFI_SUCCESS Successfully initialized firmware volume block
2428 FwVolBlockDriverInit (
2429 IN EFI_HANDLE ImageHandle
,
2430 IN EFI_SYSTEM_TABLE
*SystemTable
2435 Get FVB authentication status
2437 @param FvbProtocol FVB protocol.
2439 @return Authentication status.
2443 GetFvbAuthenticationStatus (
2444 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2448 This routine produces a firmware volume block protocol on a given
2451 @param BaseAddress base address of the firmware volume image
2452 @param Length length of the firmware volume image
2453 @param ParentHandle handle of parent firmware volume, if this image
2454 came from an FV image file and section in another firmware
2455 volume (ala capsules)
2456 @param AuthenticationStatus Authentication status inherited, if this image
2457 came from an FV image file and section in another firmware volume.
2458 @param FvProtocol Firmware volume block protocol produced.
2460 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2461 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2462 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2467 ProduceFVBProtocolOnBuffer (
2468 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2470 IN EFI_HANDLE ParentHandle
,
2471 IN UINT32 AuthenticationStatus
,
2472 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2477 Raising to the task priority level of the mutual exclusion
2478 lock, and then acquires ownership of the lock.
2480 @param Lock The lock to acquire
2492 Initialize a basic mutual exclusion lock. Each lock
2493 provides mutual exclusion access at it's task priority
2494 level. Since there is no-premption (at any TPL) or
2495 multiprocessor support, acquiring the lock only consists
2496 of raising to the locks TPL.
2498 @param Lock The EFI_LOCK structure to initialize
2500 @retval EFI_SUCCESS Lock Owned.
2501 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2505 CoreAcquireLockOrFail (
2511 Releases ownership of the mutual exclusion lock, and
2512 restores the previous task priority level.
2514 @param Lock The lock to release
2516 @return Lock unowned
2526 An empty function to pass error checking of CreateEventEx ().
2528 @param Event Event whose notification function is being invoked.
2529 @param Context Pointer to the notification function's context,
2530 which is implementation-dependent.
2535 CoreEmptyCallbackFunction (
2541 Read data from Firmware Block by FVB protocol Read.
2542 The data may cross the multi block ranges.
2544 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2545 @param StartLba Pointer to StartLba.
2546 On input, the start logical block index from which to read.
2547 On output,the end logical block index after reading.
2548 @param Offset Pointer to Offset
2549 On input, offset into the block at which to begin reading.
2550 On output, offset into the end block after reading.
2551 @param DataSize Size of data to be read.
2552 @param Data Pointer to Buffer that the data will be read into.
2554 @retval EFI_SUCCESS Successfully read data from firmware block.
2559 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2560 IN OUT EFI_LBA
*StartLba
,
2561 IN OUT UINTN
*Offset
,
2567 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2568 copy the real length volume header into it.
2570 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2571 read the volume header
2572 @param FwVolHeader Pointer to pointer to allocated buffer in which
2573 the volume header is returned.
2575 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2576 @retval EFI_SUCCESS Successfully read volume header to the allocated
2582 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2583 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2587 Verify checksum of the firmware volume header.
2589 @param FvHeader Points to the firmware volume header to be checked
2591 @retval TRUE Checksum verification passed
2592 @retval FALSE Checksum verification failed
2596 VerifyFvHeaderChecksum (
2597 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader