2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include <Protocol/LoadedImage.h>
24 #include <Protocol/GuidedSectionExtraction.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/Runtime.h>
27 #include <Protocol/LoadFile.h>
28 #include <Protocol/DriverBinding.h>
29 #include <Protocol/VariableWrite.h>
30 #include <Protocol/PlatformDriverOverride.h>
31 #include <Protocol/Variable.h>
32 #include <Protocol/Timer.h>
33 #include <Protocol/SimpleFileSystem.h>
34 #include <Protocol/Bds.h>
35 #include <Protocol/RealTimeClock.h>
36 #include <Protocol/WatchdogTimer.h>
37 #include <Protocol/FirmwareVolume2.h>
38 #include <Protocol/MonotonicCounter.h>
39 #include <Protocol/StatusCode.h>
40 #include <Protocol/Decompress.h>
41 #include <Protocol/LoadPe32Image.h>
42 #include <Protocol/FirmwareVolumeDispatch.h>
43 #include <Protocol/Security.h>
44 #include <Protocol/Ebc.h>
45 #include <Protocol/Reset.h>
46 #include <Protocol/Cpu.h>
47 #include <Protocol/Metronome.h>
48 #include <Protocol/FirmwareVolumeBlock.h>
49 #include <Protocol/Capsule.h>
50 #include <Protocol/BusSpecificDriverOverride.h>
51 #include <Protocol/Performance.h>
52 #include <Protocol/TcgService.h>
53 #include <Protocol/TcgPlatform.h>
54 #include <Guid/MemoryTypeInformation.h>
55 #include <Guid/FirmwareFileSystem2.h>
56 #include <Guid/HobList.h>
57 #include <Guid/DebugImageInfoTable.h>
58 #include <Guid/FileInfo.h>
59 #include <Guid/Apriori.h>
60 #include <Guid/DxeServices.h>
61 #include <Guid/MemoryAllocationHob.h>
62 #include <Guid/EventLegacyBios.h>
63 #include <Guid/EventGroup.h>
66 #include <Library/DxeCoreEntryPoint.h>
67 #include <Library/DebugLib.h>
68 #include <Library/UefiLib.h>
69 #include <Library/BaseLib.h>
70 #include <Library/HobLib.h>
71 #include <Library/PerformanceLib.h>
72 #include <Library/UefiDecompressLib.h>
73 #include <Library/ExtractGuidedSectionLib.h>
74 #include <Library/CacheMaintenanceLib.h>
75 #include <Library/BaseMemoryLib.h>
76 #include <Library/PeCoffLib.h>
77 #include <Library/PcdLib.h>
78 #include <Library/MemoryAllocationLib.h>
79 #include <Library/DevicePathLib.h>
80 #include <Library/UefiBootServicesTableLib.h>
81 #include <Library/ReportStatusCodeLib.h>
83 #include "DebugImageInfo.h"
85 #include "FwVolBlock.h"
86 #include "FwVolDriver.h"
94 // attributes for reserved memory before it is promoted to system memory
96 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
97 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
98 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
101 // range for memory mapped port I/O on IPF
103 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
107 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
108 /// to save time. A EFI_DEP_PUSH is evauated one an
109 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
110 /// Driver Execution Environment Core Interface use 0xff
111 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
112 /// defined to a new value that is not conflicting with PI spec.
114 #define EFI_DEP_REPLACE_TRUE 0xff
117 /// Define the initial size of the dependency expression evaluation stack
119 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
122 EFI_GUID
*ProtocolGuid
;
127 } ARCHITECTURAL_PROTOCOL_ENTRY
;
130 // DXE Dispatcher Data structures
133 #define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w')
136 LIST_ENTRY Link
; // mFvHandleList
141 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r')
144 LIST_ENTRY Link
; // mDriverList
146 LIST_ENTRY ScheduledLink
; // mScheduledQueue
150 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
151 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
158 EFI_GUID BeforeAfterGuid
;
165 BOOLEAN DepexProtocolError
;
167 EFI_HANDLE ImageHandle
;
169 } EFI_CORE_DRIVER_ENTRY
;
172 //The data structure of GCD memory map entry
174 #define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m')
178 EFI_PHYSICAL_ADDRESS BaseAddress
;
182 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
183 EFI_GCD_IO_TYPE GcdIoType
;
184 EFI_HANDLE ImageHandle
;
185 EFI_HANDLE DeviceHandle
;
189 // DXE Core Global Variables
191 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
192 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
193 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
194 extern EFI_HANDLE gDxeCoreImageHandle
;
196 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
198 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
199 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
200 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
201 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
202 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
203 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
204 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
206 extern EFI_TPL gEfiCurrentTpl
;
208 extern EFI_GUID
*gDxeCoreFileName
;
209 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
211 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
213 extern BOOLEAN gDispatcherRunning
;
214 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
217 // Service Initialization Functions
223 Called to initialize the pool.
233 Called to initialize the memory map and add descriptors to
234 the current descriptor list.
235 The first descriptor that is added must be general usable
236 memory as the addition allocates heap.
238 @param Type The type of memory to add
239 @param Start The starting address in the memory range Must be
241 @param NumberOfPages The number of pages in the range
242 @param Attribute Attributes of the memory to add
244 @return None. The range is added to the memory map
248 CoreAddMemoryDescriptor (
249 IN EFI_MEMORY_TYPE Type
,
250 IN EFI_PHYSICAL_ADDRESS Start
,
251 IN UINT64 NumberOfPages
,
257 Release memory lock on mGcdMemorySpaceLock.
261 CoreReleaseGcdMemoryLock (
267 Acquire memory lock on mGcdMemorySpaceLock.
271 CoreAcquireGcdMemoryLock (
277 External function. Initializes the GCD and memory services based on the memory
278 descriptor HOBs. This function is responsible for priming the GCD map and the
279 memory map, so memory allocations and resource allocations can be made. The first
280 part of this function can not depend on any memory services until at least one
281 memory descriptor is provided to the memory services. Then the memory services
282 can be used to intialize the GCD map.
284 @param HobStart The start address of the HOB.
285 @param MemoryBaseAddress Start address of memory region found to init DXE
287 @param MemoryLength Length of memory region found to init DXE core.
289 @retval EFI_SUCCESS Memory services successfully initialized.
293 CoreInitializeMemoryServices (
295 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
296 OUT UINT64
*MemoryLength
302 External function. Initializes the GCD and memory services based on the memory
303 descriptor HOBs. This function is responsible for priming the GCD map and the
304 memory map, so memory allocations and resource allocations can be made. The first
305 part of this function can not depend on any memory services until at least one
306 memory descriptor is provided to the memory services. Then the memory services
307 can be used to intialize the GCD map. The HobStart will be relocated to a pool
310 @param HobStart The start address of the HOB
311 @param MemoryBaseAddress Start address of memory region found to init DXE
313 @param MemoryLength Length of memory region found to init DXE core.
315 @retval EFI_SUCCESS GCD services successfully initialized.
319 CoreInitializeGcdServices (
320 IN OUT VOID
**HobStart
,
321 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
322 IN UINT64 MemoryLength
327 Initializes "event" support and populates parts of the System and Runtime Table.
329 @retval EFI_SUCCESS Always return success
333 CoreInitializeEventServices (
339 Add the Image Services to EFI Boot Services Table and install the protocol
340 interfaces for this image.
342 @param HobStart The HOB to initialize
348 CoreInitializeImageServices (
354 Creates an event that is fired everytime a Protocol of a specific type is installed.
358 CoreNotifyOnArchProtocolInstallation (
364 Return TRUE if all AP services are availible.
366 @retval EFI_SUCCESS All AP services are available
367 @retval EFI_NOT_FOUND At least one AP service is not available
371 CoreAllEfiServicesAvailable (
377 Calcualte the 32-bit CRC in a EFI table using the service provided by the
380 @param Hdr Pointer to an EFI standard header
385 IN OUT EFI_TABLE_HEADER
*Hdr
390 Called by the platform code to process a tick.
392 @param Duration The number of 100ns elasped since the last call
404 Initialize the dispatcher. Initialize the notification function that runs when
405 an FV2 protocol is added to the system.
409 CoreInitializeDispatcher (
415 This is the POSTFIX version of the dependency evaluator. This code does
416 not need to handle Before or After, as it is not valid to call this
417 routine in this case. The SOR is just ignored and is a nop in the grammer.
418 POSTFIX means all the math is done on top of the stack.
420 @param DriverEntry DriverEntry element to update.
422 @retval TRUE If driver is ready to run.
423 @retval FALSE If driver is not ready to run or some fatal error
429 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
434 Preprocess dependency expression and update DriverEntry to reflect the
435 state of Before, After, and SOR dependencies. If DriverEntry->Before
436 or DriverEntry->After is set it will never be cleared. If SOR is set
437 it will be cleared by CoreSchedule(), and then the driver can be
440 @param DriverEntry DriverEntry element to update .
442 @retval EFI_SUCCESS It always works.
446 CorePreProcessDepex (
447 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
453 Terminates all boot services.
455 @param ImageHandle Handle that identifies the exiting image.
456 @param MapKey Key to the latest memory map.
458 @retval EFI_SUCCESS Boot Services terminated
459 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
464 CoreExitBootServices (
465 IN EFI_HANDLE ImageHandle
,
471 Make sure the memory map is following all the construction rules,
472 it is the last time to check memory map error before exit boot services.
474 @param MapKey Memory map key
476 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
478 @retval EFI_SUCCESS Valid memory map.
482 CoreTerminateMemoryMap (
488 Signals all events in the EventGroup.
490 @param EventGroup The list to signal
494 CoreNotifySignalList (
495 IN EFI_GUID
*EventGroup
501 Boot Service called to add, modify, or remove a system configuration table from
502 the EFI System Table.
504 @param Guid Pointer to the GUID for the entry to add, update, or
506 @param Table Pointer to the configuration table for the entry to add,
507 update, or remove, may be NULL.
509 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
510 @return EFI_INVALID_PARAMETER Input GUID not valid.
511 @return EFI_NOT_FOUND Attempted to delete non-existant entry
512 @return EFI_OUT_OF_RESOURCES Not enough memory available
517 CoreInstallConfigurationTable (
525 Raise the task priority level to the new level.
526 High level is implemented by disabling processor interrupts.
528 @param NewTpl New task priority level
530 @return The previous task priority level
542 Lowers the task priority to the previous value. If the new
543 priority unmasks events at a higher priority, they are dispatched.
545 @param NewTpl New, lower, task priority
557 Introduces a fine-grained stall.
559 @param Microseconds The number of microseconds to stall execution.
561 @retval EFI_SUCCESS Execution was stalled for at least the requested
562 amount of microseconds.
563 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
569 IN UINTN Microseconds
575 Sets the system's watchdog timer.
577 @param Timeout The number of seconds to set the watchdog timer to.
578 A value of zero disables the timer.
579 @param WatchdogCode The numeric code to log on a watchdog timer timeout
580 event. The firmware reserves codes 0x0000 to 0xFFFF.
581 Loaders and operating systems may use other timeout
583 @param DataSize The size, in bytes, of WatchdogData.
584 @param WatchdogData A data buffer that includes a Null-terminated Unicode
585 string, optionally followed by additional binary data.
586 The string is a description that the call may use to
587 further indicate the reason to be logged with a
590 @return EFI_SUCCESS Timeout has been set
591 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
592 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
593 @return EFI_DEVICE_ERROR Could not complete due to hardware error
598 CoreSetWatchdogTimer (
600 IN UINT64 WatchdogCode
,
602 IN CHAR16
*WatchdogData OPTIONAL
608 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
609 Calls the private one which contains a BOOLEAN parameter for notifications
611 @param UserHandle The handle to install the protocol handler on,
612 or NULL if a new handle is to be allocated
613 @param Protocol The protocol to add to the handle
614 @param InterfaceType Indicates whether Interface is supplied in
616 @param Interface The interface for the protocol being added
623 CoreInstallProtocolInterface (
624 IN OUT EFI_HANDLE
*UserHandle
,
625 IN EFI_GUID
*Protocol
,
626 IN EFI_INTERFACE_TYPE InterfaceType
,
632 Installs a protocol interface into the boot services environment.
634 @param UserHandle The handle to install the protocol handler on,
635 or NULL if a new handle is to be allocated
636 @param Protocol The protocol to add to the handle
637 @param InterfaceType Indicates whether Interface is supplied in
639 @param Interface The interface for the protocol being added
640 @param Notify indicates whether notify the notification list
643 @retval EFI_INVALID_PARAMETER Invalid parameter
644 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
645 @retval EFI_SUCCESS Protocol interface successfully installed
649 CoreInstallProtocolInterfaceNotify (
650 IN OUT EFI_HANDLE
*UserHandle
,
651 IN EFI_GUID
*Protocol
,
652 IN EFI_INTERFACE_TYPE InterfaceType
,
660 Installs a list of protocol interface into the boot services environment.
661 This function calls InstallProtocolInterface() in a loop. If any error
662 occures all the protocols added by this function are removed. This is
663 basically a lib function to save space.
665 @param Handle The handle to install the protocol handlers on,
666 or NULL if a new handle is to be allocated
667 @param ... EFI_GUID followed by protocol instance. A NULL
668 terminates the list. The pairs are the
669 arguments to InstallProtocolInterface(). All the
670 protocols are added to Handle.
672 @retval EFI_INVALID_PARAMETER Handle is NULL.
673 @retval EFI_SUCCESS Protocol interfaces successfully installed.
678 CoreInstallMultipleProtocolInterfaces (
679 IN OUT EFI_HANDLE
*Handle
,
686 Uninstalls a list of protocol interface in the boot services environment.
687 This function calls UnisatllProtocolInterface() in a loop. This is
688 basically a lib function to save space.
690 @param Handle The handle to uninstall the protocol
691 @param ... EFI_GUID followed by protocol instance. A NULL
692 terminates the list. The pairs are the
693 arguments to UninstallProtocolInterface(). All
694 the protocols are added to Handle.
701 CoreUninstallMultipleProtocolInterfaces (
702 IN EFI_HANDLE Handle
,
709 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
711 @param UserHandle Handle on which the interface is to be
713 @param Protocol The numeric ID of the interface
714 @param OldInterface A pointer to the old interface
715 @param NewInterface A pointer to the new interface
717 @retval EFI_SUCCESS The protocol interface was installed
718 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
719 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
724 CoreReinstallProtocolInterface (
725 IN EFI_HANDLE UserHandle
,
726 IN EFI_GUID
*Protocol
,
727 IN VOID
*OldInterface
,
728 IN VOID
*NewInterface
734 Uninstalls all instances of a protocol:interfacer from a handle.
735 If the last protocol interface is remove from the handle, the
738 @param UserHandle The handle to remove the protocol handler from
739 @param Protocol The protocol, of protocol:interface, to remove
740 @param Interface The interface, of protocol:interface, to remove
742 @retval EFI_INVALID_PARAMETER Protocol is NULL.
743 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
748 CoreUninstallProtocolInterface (
749 IN EFI_HANDLE UserHandle
,
750 IN EFI_GUID
*Protocol
,
757 Queries a handle to determine if it supports a specified protocol.
759 @param UserHandle The handle being queried.
760 @param Protocol The published unique identifier of the protocol.
761 @param Interface Supplies the address where a pointer to the
762 corresponding Protocol Interface is returned.
764 @return The requested protocol interface for the handle
770 IN EFI_HANDLE UserHandle
,
771 IN EFI_GUID
*Protocol
,
778 Locates the installed protocol handler for the handle, and
779 invokes it to obtain the protocol interface. Usage information
780 is registered in the protocol data base.
782 @param UserHandle The handle to obtain the protocol interface on
783 @param Protocol The ID of the protocol
784 @param Interface The location to return the protocol interface
785 @param ImageHandle The handle of the Image that is opening the
786 protocol interface specified by Protocol and
788 @param ControllerHandle The controller handle that is requiring this
790 @param Attributes The open mode of the protocol interface
791 specified by Handle and Protocol.
793 @retval EFI_INVALID_PARAMETER Protocol is NULL.
794 @retval EFI_SUCCESS Get the protocol interface.
800 IN EFI_HANDLE UserHandle
,
801 IN EFI_GUID
*Protocol
,
802 OUT VOID
**Interface OPTIONAL
,
803 IN EFI_HANDLE ImageHandle
,
804 IN EFI_HANDLE ControllerHandle
,
811 Return information about Opened protocols in the system
813 @param UserHandle The handle to close the protocol interface on
814 @param Protocol The ID of the protocol
815 @param EntryBuffer A pointer to a buffer of open protocol
816 information in the form of
817 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
818 @param EntryCount Number of EntryBuffer entries
823 CoreOpenProtocolInformation (
824 IN EFI_HANDLE UserHandle
,
825 IN EFI_GUID
*Protocol
,
826 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
827 OUT UINTN
*EntryCount
833 Closes a protocol on a handle that was opened using OpenProtocol().
835 @param UserHandle The handle for the protocol interface that was
836 previously opened with OpenProtocol(), and is
838 @param Protocol The published unique identifier of the protocol.
839 It is the caller's responsibility to pass in a
841 @param AgentHandle The handle of the agent that is closing the
843 @param ControllerHandle If the agent that opened a protocol is a driver
844 that follows the EFI Driver Model, then this
845 parameter is the controller handle that required
846 the protocol interface. If the agent does not
847 follow the EFI Driver Model, then this parameter
848 is optional and may be NULL.
850 @retval EFI_SUCCESS The protocol instance was closed.
851 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
853 @retval EFI_NOT_FOUND Can not find the specified protocol or
860 IN EFI_HANDLE UserHandle
,
861 IN EFI_GUID
*Protocol
,
862 IN EFI_HANDLE AgentHandle
,
863 IN EFI_HANDLE ControllerHandle
869 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
872 @param UserHandle The handle from which to retrieve the list of
873 protocol interface GUIDs.
874 @param ProtocolBuffer A pointer to the list of protocol interface GUID
875 pointers that are installed on Handle.
876 @param ProtocolBufferCount A pointer to the number of GUID pointers present
879 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
880 on Handle was returned in ProtocolBuffer. The
881 number of protocol interface GUIDs was returned
882 in ProtocolBufferCount.
883 @retval EFI_INVALID_PARAMETER Handle is NULL.
884 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
885 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
886 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
887 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
893 CoreProtocolsPerHandle (
894 IN EFI_HANDLE UserHandle
,
895 OUT EFI_GUID
***ProtocolBuffer
,
896 OUT UINTN
*ProtocolBufferCount
902 Add a new protocol notification record for the request protocol.
904 @param Protocol The requested protocol to add the notify
906 @param Event The event to signal
907 @param Registration Returns the registration record
909 @retval EFI_INVALID_PARAMETER Invalid parameter
910 @retval EFI_SUCCESS Successfully returned the registration record
916 CoreRegisterProtocolNotify (
917 IN EFI_GUID
*Protocol
,
919 OUT VOID
**Registration
925 Locates the requested handle(s) and returns them in Buffer.
927 @param SearchType The type of search to perform to locate the
929 @param Protocol The protocol to search for
930 @param SearchKey Dependant on SearchType
931 @param BufferSize On input the size of Buffer. On output the
932 size of data returned.
933 @param Buffer The buffer to return the results in
935 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
936 returned in BufferSize.
937 @retval EFI_INVALID_PARAMETER Invalid parameter
938 @retval EFI_SUCCESS Successfully found the requested handle(s) and
939 returns them in Buffer.
945 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
946 IN EFI_GUID
*Protocol OPTIONAL
,
947 IN VOID
*SearchKey OPTIONAL
,
948 IN OUT UINTN
*BufferSize
,
949 OUT EFI_HANDLE
*Buffer
955 Locates the handle to a device on the device path that best matches the specified protocol.
957 @param Protocol The protocol to search for.
958 @param DevicePath On input, a pointer to a pointer to the device
959 path. On output, the device path pointer is
960 modified to point to the remaining part of the
962 @param Device A pointer to the returned device handle.
964 @retval EFI_SUCCESS The resulting handle was returned.
965 @retval EFI_NOT_FOUND No handles matched the search.
966 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
971 CoreLocateDevicePath (
972 IN EFI_GUID
*Protocol
,
973 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
974 OUT EFI_HANDLE
*Device
980 Function returns an array of handles that support the requested protocol
981 in a buffer allocated from pool. This is a version of CoreLocateHandle()
982 that allocates a buffer for the caller.
984 @param SearchType Specifies which handle(s) are to be returned.
985 @param Protocol Provides the protocol to search by. This
986 parameter is only valid for SearchType
988 @param SearchKey Supplies the search key depending on the
990 @param NumberHandles The number of handles returned in Buffer.
991 @param Buffer A pointer to the buffer to return the requested
992 array of handles that support Protocol.
994 @retval EFI_SUCCESS The result array of handles was returned.
995 @retval EFI_NOT_FOUND No handles match the search.
996 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
998 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1003 CoreLocateHandleBuffer (
1004 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1005 IN EFI_GUID
*Protocol OPTIONAL
,
1006 IN VOID
*SearchKey OPTIONAL
,
1007 IN OUT UINTN
*NumberHandles
,
1008 OUT EFI_HANDLE
**Buffer
1014 Return the first Protocol Interface that matches the Protocol GUID. If
1015 Registration is pasased in return a Protocol Instance that was just add
1016 to the system. If Retistration is NULL return the first Protocol Interface
1019 @param Protocol The protocol to search for
1020 @param Registration Optional Registration Key returned from
1021 RegisterProtocolNotify()
1022 @param Interface Return the Protocol interface (instance).
1024 @retval EFI_SUCCESS If a valid Interface is returned
1025 @retval EFI_INVALID_PARAMETER Invalid parameter
1026 @retval EFI_NOT_FOUND Protocol interface not found
1031 CoreLocateProtocol (
1032 IN EFI_GUID
*Protocol
,
1033 IN VOID
*Registration OPTIONAL
,
1034 OUT VOID
**Interface
1039 return handle database key.
1042 @return Handle database key.
1046 CoreGetHandleDatabaseKey (
1052 Go connect any handles that were created or modified while a image executed.
1054 @param Key The Key to show that the handle has been
1059 CoreConnectHandlesByKey (
1066 Connects one or more drivers to a controller.
1068 @param ControllerHandle Handle of the controller to be
1070 @param DriverImageHandle DriverImageHandle A pointer to an
1071 ordered list of driver image
1073 @param RemainingDevicePath RemainingDevicePath A pointer to
1074 the device path that specifies a
1075 child of the controller specified
1076 by ControllerHandle.
1077 @param Recursive Whether the function would be
1078 called recursively or not.
1080 @return Status code.
1085 CoreConnectController (
1086 IN EFI_HANDLE ControllerHandle
,
1087 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1088 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1089 IN BOOLEAN Recursive
1095 Disonnects a controller from a driver
1097 @param ControllerHandle ControllerHandle The handle of
1098 the controller from which
1101 @param DriverImageHandle DriverImageHandle The driver to
1102 disconnect from ControllerHandle.
1103 @param ChildHandle ChildHandle The handle of the
1106 @retval EFI_SUCCESS One or more drivers were
1107 disconnected from the controller.
1108 @retval EFI_SUCCESS On entry, no drivers are managing
1110 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1111 and on entry DriverImageHandle is
1112 not managing ControllerHandle.
1113 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1115 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1116 and it is not a valid EFI_HANDLE.
1117 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1118 is not a valid EFI_HANDLE.
1119 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1120 available to disconnect any
1121 drivers from ControllerHandle.
1122 @retval EFI_DEVICE_ERROR The controller could not be
1123 disconnected because of a device
1129 CoreDisconnectController (
1130 IN EFI_HANDLE ControllerHandle
,
1131 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1132 IN EFI_HANDLE ChildHandle OPTIONAL
1138 Allocates pages from the memory map.
1140 @param Type The type of allocation to perform
1141 @param MemoryType The type of memory to turn the allocated pages
1143 @param NumberOfPages The number of pages to allocate
1144 @param Memory A pointer to receive the base allocated memory
1147 @return Status. On success, Memory is filled in with the base address allocated
1148 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1150 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1151 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1152 @retval EFI_SUCCESS Pages successfully allocated.
1158 IN EFI_ALLOCATE_TYPE Type
,
1159 IN EFI_MEMORY_TYPE MemoryType
,
1160 IN UINTN NumberOfPages
,
1161 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1167 Frees previous allocated pages.
1169 @param Memory Base address of memory being freed
1170 @param NumberOfPages The number of pages to free
1172 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1173 @retval EFI_INVALID_PARAMETER Address not aligned
1174 @return EFI_SUCCESS -Pages successfully freed.
1180 IN EFI_PHYSICAL_ADDRESS Memory
,
1181 IN UINTN NumberOfPages
1187 This function returns a copy of the current memory map. The map is an array of
1188 memory descriptors, each of which describes a contiguous block of memory.
1190 @param MemoryMapSize A pointer to the size, in bytes, of the
1191 MemoryMap buffer. On input, this is the size of
1192 the buffer allocated by the caller. On output,
1193 it is the size of the buffer returned by the
1194 firmware if the buffer was large enough, or the
1195 size of the buffer needed to contain the map if
1196 the buffer was too small.
1197 @param MemoryMap A pointer to the buffer in which firmware places
1198 the current memory map.
1199 @param MapKey A pointer to the location in which firmware
1200 returns the key for the current memory map.
1201 @param DescriptorSize A pointer to the location in which firmware
1202 returns the size, in bytes, of an individual
1203 EFI_MEMORY_DESCRIPTOR.
1204 @param DescriptorVersion A pointer to the location in which firmware
1205 returns the version number associated with the
1206 EFI_MEMORY_DESCRIPTOR.
1208 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1210 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1211 buffer size needed to hold the memory map is
1212 returned in MemoryMapSize.
1213 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1219 IN OUT UINTN
*MemoryMapSize
,
1220 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1222 OUT UINTN
*DescriptorSize
,
1223 OUT UINT32
*DescriptorVersion
1229 Allocate pool of a particular type.
1231 @param PoolType Type of pool to allocate
1232 @param Size The amount of pool to allocate
1233 @param Buffer The address to return a pointer to the allocated
1236 @retval EFI_INVALID_PARAMETER PoolType not valid
1237 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1238 @retval EFI_SUCCESS Pool successfully allocated.
1244 IN EFI_MEMORY_TYPE PoolType
,
1254 @param Buffer The allocated pool entry to free
1256 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1257 @retval EFI_SUCCESS Pool successfully freed.
1269 Loads an EFI image into memory and returns a handle to the image.
1271 @param BootPolicy If TRUE, indicates that the request originates
1272 from the boot manager, and that the boot
1273 manager is attempting to load FilePath as a
1275 @param ParentImageHandle The caller's image handle.
1276 @param FilePath The specific file path from which the image is
1278 @param SourceBuffer If not NULL, a pointer to the memory location
1279 containing a copy of the image to be loaded.
1280 @param SourceSize The size in bytes of SourceBuffer.
1281 @param ImageHandle Pointer to the returned image handle that is
1282 created when the image is successfully loaded.
1284 @retval EFI_SUCCESS The image was loaded into memory.
1285 @retval EFI_NOT_FOUND The FilePath was not found.
1286 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1287 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1288 path cannot be parsed to locate the proper
1289 protocol for loading the file.
1290 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1297 IN BOOLEAN BootPolicy
,
1298 IN EFI_HANDLE ParentImageHandle
,
1299 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1300 IN VOID
*SourceBuffer OPTIONAL
,
1301 IN UINTN SourceSize
,
1302 OUT EFI_HANDLE
*ImageHandle
1310 @param ImageHandle Handle that identifies the image to be
1313 @retval EFI_SUCCESS The image has been unloaded.
1314 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1316 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1322 IN EFI_HANDLE ImageHandle
1328 Transfer control to a loaded image's entry point.
1330 @param ImageHandle Handle of image to be started.
1331 @param ExitDataSize Pointer of the size to ExitData
1332 @param ExitData Pointer to a pointer to a data buffer that
1333 includes a Null-terminated Unicode string,
1334 optionally followed by additional binary data.
1335 The string is a description that the caller may
1336 use to further indicate the reason for the
1339 @retval EFI_INVALID_PARAMETER Invalid parameter
1340 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1341 @retval EFI_SUCCESS Successfully transfer control to the image's
1348 IN EFI_HANDLE ImageHandle
,
1349 OUT UINTN
*ExitDataSize
,
1350 OUT CHAR16
**ExitData OPTIONAL
1356 Terminates the currently loaded EFI image and returns control to boot services.
1358 @param ImageHandle Handle that identifies the image. This
1359 parameter is passed to the image on entry.
1360 @param Status The image's exit code.
1361 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1362 ExitStatus is EFI_SUCCESS.
1363 @param ExitData Pointer to a data buffer that includes a
1364 Null-terminated Unicode string, optionally
1365 followed by additional binary data. The string
1366 is a description that the caller may use to
1367 further indicate the reason for the image's
1370 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1372 @retval EFI_SUCCESS Successfully terminates the currently loaded
1374 @retval EFI_ACCESS_DENIED Should never reach there.
1375 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1381 IN EFI_HANDLE ImageHandle
,
1382 IN EFI_STATUS Status
,
1383 IN UINTN ExitDataSize
,
1384 IN CHAR16
*ExitData OPTIONAL
1390 Creates a general-purpose event structure.
1392 @param Type The type of event to create and its mode and
1394 @param NotifyTpl The task priority level of event notifications
1395 @param NotifyFunction Pointer to the events notification function
1396 @param NotifyContext Pointer to the notification functions context;
1397 corresponds to parameter "Context" in the
1398 notification function
1399 @param Event Pointer to the newly created event if the call
1400 succeeds; undefined otherwise
1402 @retval EFI_SUCCESS The event structure was created
1403 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1404 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1411 IN EFI_TPL NotifyTpl
,
1412 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1413 IN VOID
*NotifyContext
, OPTIONAL
1414 OUT EFI_EVENT
*Event
1420 Creates a general-purpose event structure
1422 @param Type The type of event to create and its mode and
1424 @param NotifyTpl The task priority level of event notifications
1425 @param NotifyFunction Pointer to the events notification function
1426 @param NotifyContext Pointer to the notification functions context;
1427 corresponds to parameter "Context" in the
1428 notification function
1429 @param EventGroup GUID for EventGroup if NULL act the same as
1431 @param Event Pointer to the newly created event if the call
1432 succeeds; undefined otherwise
1434 @retval EFI_SUCCESS The event structure was created
1435 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1436 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1443 IN EFI_TPL NotifyTpl
,
1444 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1445 IN CONST VOID
*NotifyContext
, OPTIONAL
1446 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1447 OUT EFI_EVENT
*Event
1453 Sets the type of timer and the trigger time for a timer event.
1455 @param UserEvent The timer event that is to be signaled at the
1457 @param Type The type of time that is specified in
1459 @param TriggerTime The number of 100ns units until the timer
1462 @retval EFI_SUCCESS The event has been set to be signaled at the
1464 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1470 IN EFI_EVENT UserEvent
,
1471 IN EFI_TIMER_DELAY Type
,
1472 IN UINT64 TriggerTime
1478 Signals the event. Queues the event to be notified if needed.
1480 @param UserEvent The event to signal .
1482 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1483 @retval EFI_SUCCESS The event was signaled.
1489 IN EFI_EVENT UserEvent
1495 Stops execution until an event is signaled.
1497 @param NumberOfEvents The number of events in the UserEvents array
1498 @param UserEvents An array of EFI_EVENT
1499 @param UserIndex Pointer to the index of the event which
1500 satisfied the wait condition
1502 @retval EFI_SUCCESS The event indicated by Index was signaled.
1503 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1504 function or Event was not a valid type
1505 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1511 IN UINTN NumberOfEvents
,
1512 IN EFI_EVENT
*UserEvents
,
1513 OUT UINTN
*UserIndex
1519 Closes an event and frees the event structure.
1521 @param UserEvent Event to close
1523 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1524 @retval EFI_SUCCESS The event has been closed
1530 IN EFI_EVENT UserEvent
1536 Check the status of an event.
1538 @param UserEvent The event to check
1540 @retval EFI_SUCCESS The event is in the signaled state
1541 @retval EFI_NOT_READY The event is not in the signaled state
1542 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1548 IN EFI_EVENT UserEvent
1553 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1554 global coherency domain of the processor.
1556 @param GcdMemoryType Memory type of the memory space.
1557 @param BaseAddress Base address of the memory space.
1558 @param Length Length of the memory space.
1559 @param Capabilities alterable attributes of the memory space.
1561 @retval EFI_SUCCESS Merged this memory space into GCD map.
1565 CoreAddMemorySpace (
1566 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1567 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1569 IN UINT64 Capabilities
1574 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1575 I/O resources from the global coherency domain of the processor.
1577 @param GcdAllocateType The type of allocate operation
1578 @param GcdMemoryType The desired memory type
1579 @param Alignment Align with 2^Alignment
1580 @param Length Length to allocate
1581 @param BaseAddress Base address to allocate
1582 @param ImageHandle The image handle consume the allocated space.
1583 @param DeviceHandle The device handle consume the allocated space.
1585 @retval EFI_INVALID_PARAMETER Invalid parameter.
1586 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1587 @retval EFI_SUCCESS Memory space successfully allocated.
1591 CoreAllocateMemorySpace (
1592 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1593 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1596 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1597 IN EFI_HANDLE ImageHandle
,
1598 IN EFI_HANDLE DeviceHandle OPTIONAL
1603 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1604 I/O resources from the global coherency domain of the processor.
1606 @param BaseAddress Base address of the memory space.
1607 @param Length Length of the memory space.
1609 @retval EFI_SUCCESS Space successfully freed.
1613 CoreFreeMemorySpace (
1614 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1620 Removes reserved memory, system memory, or memory-mapped I/O resources from
1621 the global coherency domain of the processor.
1623 @param BaseAddress Base address of the memory space.
1624 @param Length Length of the memory space.
1626 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1630 CoreRemoveMemorySpace (
1631 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1637 Retrieves the descriptor for a memory region containing a specified address.
1639 @param BaseAddress Specified start address
1640 @param Descriptor Specified length
1642 @retval EFI_INVALID_PARAMETER Invalid parameter
1643 @retval EFI_SUCCESS Successfully get memory space descriptor.
1647 CoreGetMemorySpaceDescriptor (
1648 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1649 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1654 Modifies the attributes for a memory region in the global coherency domain of the
1657 @param BaseAddress Specified start address
1658 @param Length Specified length
1659 @param Attributes Specified attributes
1661 @retval EFI_SUCCESS Successfully set attribute of a segment of
1666 CoreSetMemorySpaceAttributes (
1667 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1669 IN UINT64 Attributes
1674 Returns a map of the memory resources in the global coherency domain of the
1677 @param NumberOfDescriptors Number of descriptors.
1678 @param MemorySpaceMap Descriptor array
1680 @retval EFI_INVALID_PARAMETER Invalid parameter
1681 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1682 @retval EFI_SUCCESS Successfully get memory space map.
1686 CoreGetMemorySpaceMap (
1687 OUT UINTN
*NumberOfDescriptors
,
1688 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1693 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1695 @param GcdIoType IO type of the segment.
1696 @param BaseAddress Base address of the segment.
1697 @param Length Length of the segment.
1699 @retval EFI_SUCCESS Merged this segment into GCD map.
1700 @retval EFI_INVALID_PARAMETER Parameter not valid
1705 IN EFI_GCD_IO_TYPE GcdIoType
,
1706 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1712 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1713 domain of the processor.
1715 @param GcdAllocateType The type of allocate operation
1716 @param GcdIoType The desired IO type
1717 @param Alignment Align with 2^Alignment
1718 @param Length Length to allocate
1719 @param BaseAddress Base address to allocate
1720 @param ImageHandle The image handle consume the allocated space.
1721 @param DeviceHandle The device handle consume the allocated space.
1723 @retval EFI_INVALID_PARAMETER Invalid parameter.
1724 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1725 @retval EFI_SUCCESS IO space successfully allocated.
1729 CoreAllocateIoSpace (
1730 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1731 IN EFI_GCD_IO_TYPE GcdIoType
,
1734 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1735 IN EFI_HANDLE ImageHandle
,
1736 IN EFI_HANDLE DeviceHandle OPTIONAL
1741 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1742 domain of the processor.
1744 @param BaseAddress Base address of the segment.
1745 @param Length Length of the segment.
1747 @retval EFI_SUCCESS Space successfully freed.
1752 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1758 Removes reserved I/O or I/O resources from the global coherency domain of the
1761 @param BaseAddress Base address of the segment.
1762 @param Length Length of the segment.
1764 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1769 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1775 Retrieves the descriptor for an I/O region containing a specified address.
1777 @param BaseAddress Specified start address
1778 @param Descriptor Specified length
1780 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1781 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1785 CoreGetIoSpaceDescriptor (
1786 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1787 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1792 Returns a map of the I/O resources in the global coherency domain of the processor.
1794 @param NumberOfDescriptors Number of descriptors.
1795 @param IoSpaceMap Descriptor array
1797 @retval EFI_INVALID_PARAMETER Invalid parameter
1798 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1799 @retval EFI_SUCCESS Successfully get IO space map.
1804 OUT UINTN
*NumberOfDescriptors
,
1805 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1810 This is the main Dispatcher for DXE and it exits when there are no more
1811 drivers to run. Drain the mScheduledQueue and load and start a PE
1812 image for each driver. Search the mDiscoveredList to see if any driver can
1813 be placed on the mScheduledQueue. If no drivers are placed on the
1814 mScheduledQueue exit the function. On exit it is assumed the Bds()
1815 will be called, and when the Bds() exits the Dispatcher will be called
1818 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1819 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1820 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1830 Check every driver and locate a matching one. If the driver is found, the Unrequested
1831 state flag is cleared.
1833 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1834 the firmware file specified by DriverName.
1835 @param DriverName The Driver name to put in the Dependent state.
1837 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1839 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1846 IN EFI_HANDLE FirmwareVolumeHandle
,
1847 IN EFI_GUID
*DriverName
1852 Convert a driver from the Untrused back to the Scheduled state.
1854 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1855 the firmware file specified by DriverName.
1856 @param DriverName The Driver name to put in the Scheduled state
1858 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1859 was promoted to the trusted state.
1860 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1866 IN EFI_HANDLE FirmwareVolumeHandle
,
1867 IN EFI_GUID
*DriverName
1872 Helper function called as part of the code needed
1873 to allocate the proper sized buffer for various
1876 @param Status Current status
1877 @param Buffer Current allocated buffer, or NULL
1878 @param BufferSize Current buffer size needed
1880 @retval TRUE if the buffer was reallocated and the caller
1881 should try the API again.
1882 @retval FALSE buffer could not be allocated and the caller
1883 should not try the API again.
1888 IN OUT EFI_STATUS
*Status
,
1889 IN OUT VOID
**Buffer
,
1895 This routine is the driver initialization entry point. It initializes the
1896 libraries, and registers two notification functions. These notification
1897 functions are responsible for building the FV stack dynamically.
1899 @param ImageHandle The image handle.
1900 @param SystemTable The system table.
1902 @retval EFI_SUCCESS Function successfully returned.
1908 IN EFI_HANDLE ImageHandle
,
1909 IN EFI_SYSTEM_TABLE
*SystemTable
1914 Entry point of the section extraction code. Initializes an instance of the
1915 section extraction interface and installs it on a new handle.
1917 @param ImageHandle A handle for the image that is initializing this driver
1918 @param SystemTable A pointer to the EFI system table
1920 @retval EFI_SUCCESS Driver initialized successfully
1921 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1926 InitializeSectionExtraction (
1927 IN EFI_HANDLE ImageHandle
,
1928 IN EFI_SYSTEM_TABLE
*SystemTable
1933 This DXE service routine is used to process a firmware volume. In
1934 particular, it can be called by BDS to process a single firmware
1935 volume found in a capsule.
1937 @param FvHeader pointer to a firmware volume header
1938 @param Size the size of the buffer pointed to by FvHeader
1939 @param FVProtocolHandle the handle on which a firmware volume protocol
1940 was produced for the firmware volume passed in.
1942 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1944 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1945 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1950 CoreProcessFirmwareVolume (
1953 OUT EFI_HANDLE
*FVProtocolHandle
1957 //Functions used during debug buils
1961 Displays Architectural protocols that were not loaded and are required for DXE
1962 core to function. Only used in Debug Builds.
1966 CoreDisplayMissingArchProtocols (
1972 Traverse the discovered list for any drivers that were discovered but not loaded
1973 because the dependency experessions evaluated to false.
1977 CoreDisplayDiscoveredNotDispatched (
1983 Place holder function until all the Boot Services and Runtime Services are
1986 @return EFI_NOT_AVAILABLE_YET
1991 CoreEfiNotAvailableYetArg0 (
1997 Place holder function until all the Boot Services and Runtime Services are
2000 @param Arg1 Undefined
2002 @return EFI_NOT_AVAILABLE_YET
2007 CoreEfiNotAvailableYetArg1 (
2013 Place holder function until all the Boot Services and Runtime Services are available.
2015 @param Arg1 Undefined
2016 @param Arg2 Undefined
2018 @return EFI_NOT_AVAILABLE_YET
2023 CoreEfiNotAvailableYetArg2 (
2030 Place holder function until all the Boot Services and Runtime Services are available.
2032 @param Arg1 Undefined
2033 @param Arg2 Undefined
2034 @param Arg3 Undefined
2036 @return EFI_NOT_AVAILABLE_YET
2041 CoreEfiNotAvailableYetArg3 (
2049 Place holder function until all the Boot Services and Runtime Services are available.
2051 @param Arg1 Undefined
2052 @param Arg2 Undefined
2053 @param Arg3 Undefined
2054 @param Arg4 Undefined
2056 @return EFI_NOT_AVAILABLE_YET
2061 CoreEfiNotAvailableYetArg4 (
2070 Place holder function until all the Boot Services and Runtime Services are available.
2072 @param Arg1 Undefined
2073 @param Arg2 Undefined
2074 @param Arg3 Undefined
2075 @param Arg4 Undefined
2076 @param Arg5 Undefined
2078 @return EFI_NOT_AVAILABLE_YET
2083 CoreEfiNotAvailableYetArg5 (
2093 Given a compressed source buffer, this function retrieves the size of the
2094 uncompressed buffer and the size of the scratch buffer required to decompress
2095 the compressed source buffer.
2097 The GetInfo() function retrieves the size of the uncompressed buffer and the
2098 temporary scratch buffer required to decompress the buffer specified by Source
2099 and SourceSize. If the size of the uncompressed buffer or the size of the
2100 scratch buffer cannot be determined from the compressed data specified by
2101 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2102 size of the uncompressed buffer is returned in DestinationSize, the size of
2103 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2104 The GetInfo() function does not have scratch buffer available to perform a
2105 thorough checking of the validity of the source data. It just retrieves the
2106 "Original Size" field from the beginning bytes of the source data and output
2107 it as DestinationSize. And ScratchSize is specific to the decompression
2110 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2111 @param Source The source buffer containing the compressed data.
2112 @param SourceSize The size, in bytes, of the source buffer.
2113 @param DestinationSize A pointer to the size, in bytes, of the
2114 uncompressed buffer that will be generated when the
2115 compressed buffer specified by Source and
2116 SourceSize is decompressed.
2117 @param ScratchSize A pointer to the size, in bytes, of the scratch
2118 buffer that is required to decompress the
2119 compressed buffer specified by Source and
2122 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2123 DestinationSize and the size of the scratch buffer
2124 was returned in ScratchSize.
2125 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2126 the scratch buffer cannot be determined from the
2127 compressed data specified by Source and
2133 DxeMainUefiDecompressGetInfo (
2134 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2136 IN UINT32 SourceSize
,
2137 OUT UINT32
*DestinationSize
,
2138 OUT UINT32
*ScratchSize
2143 Decompresses a compressed source buffer.
2145 The Decompress() function extracts decompressed data to its original form.
2146 This protocol is designed so that the decompression algorithm can be
2147 implemented without using any memory services. As a result, the Decompress()
2148 Function is not allowed to call AllocatePool() or AllocatePages() in its
2149 implementation. It is the caller's responsibility to allocate and free the
2150 Destination and Scratch buffers.
2151 If the compressed source data specified by Source and SourceSize is
2152 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2153 the compressed source data specified by Source and SourceSize is not in a
2154 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2156 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2157 @param Source The source buffer containing the compressed data.
2158 @param SourceSize SourceSizeThe size of source data.
2159 @param Destination On output, the destination buffer that contains
2160 the uncompressed data.
2161 @param DestinationSize The size of the destination buffer. The size of
2162 the destination buffer needed is obtained from
2163 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2164 @param Scratch A temporary scratch buffer that is used to perform
2166 @param ScratchSize The size of scratch buffer. The size of the
2167 scratch buffer needed is obtained from GetInfo().
2169 @retval EFI_SUCCESS Decompression completed successfully, and the
2170 uncompressed buffer is returned in Destination.
2171 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2172 SourceSize is corrupted (not in a valid
2178 DxeMainUefiDecompress (
2179 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2181 IN UINT32 SourceSize
,
2182 IN OUT VOID
*Destination
,
2183 IN UINT32 DestinationSize
,
2184 IN OUT VOID
*Scratch
,
2185 IN UINT32 ScratchSize
2189 SEP member function. This function creates and returns a new section stream
2190 handle to represent the new section stream.
2192 @param SectionStreamLength Size in bytes of the section stream.
2193 @param SectionStream Buffer containing the new section stream.
2194 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2195 output contains the new section stream handle.
2197 @retval EFI_SUCCESS The section stream is created successfully.
2198 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2199 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2206 IN UINTN SectionStreamLength
,
2207 IN VOID
*SectionStream
,
2208 OUT UINTN
*SectionStreamHandle
2214 SEP member function. Retrieves requested section from section stream.
2216 @param SectionStreamHandle The section stream from which to extract the
2218 @param SectionType A pointer to the type of section to search for.
2219 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2220 then SectionDefinitionGuid indicates which of
2221 these types of sections to search for.
2222 @param SectionInstance Indicates which instance of the requested
2224 @param Buffer Double indirection to buffer. If *Buffer is
2225 non-null on input, then the buffer is caller
2226 allocated. If Buffer is NULL, then the buffer
2227 is callee allocated. In either case, the
2228 requried buffer size is returned in *BufferSize.
2229 @param BufferSize On input, indicates the size of *Buffer if
2230 *Buffer is non-null on input. On output,
2231 indicates the required size (allocated size if
2232 callee allocated) of *Buffer.
2233 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2234 indicates the authentication status of the
2235 output buffer. If the input section's
2236 GuidedSectionHeader.Attributes field
2237 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2238 bit as clear, AuthenticationStatus must return
2239 zero. Both local bits (19:16) and aggregate
2240 bits (3:0) in AuthenticationStatus are returned
2241 by ExtractSection(). These bits reflect the
2242 status of the extraction operation. The bit
2243 pattern in both regions must be the same, as
2244 the local and aggregate authentication statuses
2245 have equivalent meaning at this level. If the
2246 function returns anything other than
2247 EFI_SUCCESS, the value of *AuthenticationStatus
2250 @retval EFI_SUCCESS Section was retrieved successfully
2251 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2252 section stream with its
2253 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2254 but there was no corresponding GUIDed Section
2255 Extraction Protocol in the handle database.
2256 *Buffer is unmodified.
2257 @retval EFI_NOT_FOUND An error was encountered when parsing the
2258 SectionStream. This indicates the SectionStream
2259 is not correctly formatted.
2260 @retval EFI_NOT_FOUND The requested section does not exist.
2261 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2263 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2264 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2265 insufficient to contain the requested section.
2266 The input buffer is filled and section contents
2273 IN UINTN SectionStreamHandle
,
2274 IN EFI_SECTION_TYPE
*SectionType
,
2275 IN EFI_GUID
*SectionDefinitionGuid
,
2276 IN UINTN SectionInstance
,
2278 IN OUT UINTN
*BufferSize
,
2279 OUT UINT32
*AuthenticationStatus
2284 SEP member function. Deletes an existing section stream
2286 @param StreamHandleToClose Indicates the stream to close
2288 @retval EFI_SUCCESS The section stream is closed sucessfully.
2289 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2290 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2296 CloseSectionStream (
2297 IN UINTN StreamHandleToClose