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>
80 #include "DebugImageInfo.h"
82 #include "FwVolBlock.h"
83 #include "FwVolDriver.h"
92 // Modifier for EFI DXE Services
94 #define EFI_DXESERVICE
97 // attributes for reserved memory before it is promoted to system memory
99 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
100 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
101 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
104 // range for memory mapped port I/O on IPF
106 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
110 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
111 /// to save time. A EFI_DEP_PUSH is evauated one an
112 /// replaced with EFI_DEP_REPLACE_TRUE
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 EFI_STATUS_CODE_DATA DataHeader
;
132 } EFI_DXE_DEVICE_HANDLE_EXTENDED_DATA
;
134 #define EFI_STATUS_CODE_DXE_CORE_GUID \
135 { 0x335984bd, 0xe805, 0x409a, { 0xb8, 0xf8, 0xd2, 0x7e, 0xce, 0x5f, 0xf7, 0xa6 } }
138 // DXE Dispatcher Data structures
141 #define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w')
144 LIST_ENTRY Link
; // mFvHandleList
149 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r')
152 LIST_ENTRY Link
; // mDriverList
154 LIST_ENTRY ScheduledLink
; // mScheduledQueue
158 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
159 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
166 EFI_GUID BeforeAfterGuid
;
173 BOOLEAN DepexProtocolError
;
175 EFI_HANDLE ImageHandle
;
177 } EFI_CORE_DRIVER_ENTRY
;
180 //The data structure of GCD memory map entry
182 #define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m')
186 EFI_PHYSICAL_ADDRESS BaseAddress
;
190 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
191 EFI_GCD_IO_TYPE GcdIoType
;
192 EFI_HANDLE ImageHandle
;
193 EFI_HANDLE DeviceHandle
;
197 // DXE Core Global Variables
199 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
200 extern EFI_BOOT_SERVICES
*gDxeCoreBS
;
201 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
202 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
203 extern EFI_HANDLE gDxeCoreImageHandle
;
205 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
207 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
208 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
209 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
210 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
211 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
212 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
213 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
214 extern EFI_STATUS_CODE_PROTOCOL
*gStatusCode
;
216 extern EFI_TPL gEfiCurrentTpl
;
218 extern EFI_GUID
*gDxeCoreFileName
;
219 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
221 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
223 extern BOOLEAN gDispatcherRunning
;
224 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
227 // Service Initialization Functions
233 Called to initialize the pool.
243 Called to initialize the memory map and add descriptors to
244 the current descriptor list.
245 The first descriptor that is added must be general usable
246 memory as the addition allocates heap.
248 @param Type The type of memory to add
249 @param Start The starting address in the memory range Must be
251 @param NumberOfPages The number of pages in the range
252 @param Attribute Attributes of the memory to add
254 @return None. The range is added to the memory map
258 CoreAddMemoryDescriptor (
259 IN EFI_MEMORY_TYPE Type
,
260 IN EFI_PHYSICAL_ADDRESS Start
,
261 IN UINT64 NumberOfPages
,
267 Release memory lock on mGcdMemorySpaceLock.
271 CoreReleaseGcdMemoryLock (
277 Acquire memory lock on mGcdMemorySpaceLock.
281 CoreAcquireGcdMemoryLock (
287 External function. Initializes the GCD and memory services based on the memory
288 descriptor HOBs. This function is responsible for priming the GCD map and the
289 memory map, so memory allocations and resource allocations can be made. The first
290 part of this function can not depend on any memory services until at least one
291 memory descriptor is provided to the memory services. Then the memory services
292 can be used to intialize the GCD map.
294 @param HobStart The start address of the HOB.
295 @param MemoryBaseAddress Start address of memory region found to init DXE
297 @param MemoryLength Length of memory region found to init DXE core.
299 @retval EFI_SUCCESS Memory services successfully initialized.
303 CoreInitializeMemoryServices (
305 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
306 OUT UINT64
*MemoryLength
312 External function. Initializes the GCD and memory services based on the memory
313 descriptor HOBs. This function is responsible for priming the GCD map and the
314 memory map, so memory allocations and resource allocations can be made. The first
315 part of this function can not depend on any memory services until at least one
316 memory descriptor is provided to the memory services. Then the memory services
317 can be used to intialize the GCD map. The HobStart will be relocated to a pool
320 @param HobStart The start address of the HOB
321 @param MemoryBaseAddress Start address of memory region found to init DXE
323 @param MemoryLength Length of memory region found to init DXE core.
325 @retval EFI_SUCCESS GCD services successfully initialized.
329 CoreInitializeGcdServices (
330 IN OUT VOID
**HobStart
,
331 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
332 IN UINT64 MemoryLength
337 Initializes "event" support and populates parts of the System and Runtime Table.
339 @retval EFI_SUCCESS Always return success
343 CoreInitializeEventServices (
349 Add the Image Services to EFI Boot Services Table and install the protocol
350 interfaces for this image.
352 @param HobStart The HOB to initialize
358 CoreInitializeImageServices (
364 Creates an event that is fired everytime a Protocol of a specific type is installed.
368 CoreNotifyOnArchProtocolInstallation (
374 Return TRUE if all AP services are availible.
376 @retval EFI_SUCCESS All AP services are available
377 @retval EFI_NOT_FOUND At least one AP service is not available
381 CoreAllEfiServicesAvailable (
387 Calcualte the 32-bit CRC in a EFI table using the service provided by the
390 @param Hdr Pointer to an EFI standard header
395 IN OUT EFI_TABLE_HEADER
*Hdr
400 Called by the platform code to process a tick.
402 @param Duration The number of 100ns elasped since the last call
414 Initialize the dispatcher. Initialize the notification function that runs when
415 an FV2 protocol is added to the system.
419 CoreInitializeDispatcher (
425 This is the POSTFIX version of the dependency evaluator. This code does
426 not need to handle Before or After, as it is not valid to call this
427 routine in this case. The SOR is just ignored and is a nop in the grammer.
428 POSTFIX means all the math is done on top of the stack.
430 @param DriverEntry DriverEntry element to update.
432 @retval TRUE If driver is ready to run.
433 @retval FALSE If driver is not ready to run or some fatal error
439 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
444 Preprocess dependency expression and update DriverEntry to reflect the
445 state of Before, After, and SOR dependencies. If DriverEntry->Before
446 or DriverEntry->After is set it will never be cleared. If SOR is set
447 it will be cleared by CoreSchedule(), and then the driver can be
450 @param DriverEntry DriverEntry element to update .
452 @retval EFI_SUCCESS It always works.
456 CorePreProcessDepex (
457 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
463 Terminates all boot services.
465 @param ImageHandle Handle that identifies the exiting image.
466 @param MapKey Key to the latest memory map.
468 @retval EFI_SUCCESS Boot Services terminated
469 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
474 CoreExitBootServices (
475 IN EFI_HANDLE ImageHandle
,
481 Make sure the memory map is following all the construction rules,
482 it is the last time to check memory map error before exit boot services.
484 @param MapKey Memory map key
486 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
488 @retval EFI_SUCCESS Valid memory map.
492 CoreTerminateMemoryMap (
498 Signals all events in the EventGroup.
500 @param EventGroup The list to signal
504 CoreNotifySignalList (
505 IN EFI_GUID
*EventGroup
511 Boot Service called to add, modify, or remove a system configuration table from
512 the EFI System Table.
514 @param Guid Pointer to the GUID for the entry to add, update, or
516 @param Table Pointer to the configuration table for the entry to add,
517 update, or remove, may be NULL.
519 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
520 @return EFI_INVALID_PARAMETER Input GUID not valid.
521 @return EFI_NOT_FOUND Attempted to delete non-existant entry
522 @return EFI_OUT_OF_RESOURCES Not enough memory available
527 CoreInstallConfigurationTable (
535 Raise the task priority level to the new level.
536 High level is implemented by disabling processor interrupts.
538 @param NewTpl New task priority level
540 @return The previous task priority level
552 Lowers the task priority to the previous value. If the new
553 priority unmasks events at a higher priority, they are dispatched.
555 @param NewTpl New, lower, task priority
567 Introduces a fine-grained stall.
569 @param Microseconds The number of microseconds to stall execution.
571 @retval EFI_SUCCESS Execution was stalled for at least the requested
572 amount of microseconds.
573 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
579 IN UINTN Microseconds
585 Sets the system's watchdog timer.
587 @param Timeout The number of seconds to set the watchdog timer to.
588 A value of zero disables the timer.
589 @param WatchdogCode The numeric code to log on a watchdog timer timeout
590 event. The firmware reserves codes 0x0000 to 0xFFFF.
591 Loaders and operating systems may use other timeout
593 @param DataSize The size, in bytes, of WatchdogData.
594 @param WatchdogData A data buffer that includes a Null-terminated Unicode
595 string, optionally followed by additional binary data.
596 The string is a description that the call may use to
597 further indicate the reason to be logged with a
600 @return EFI_SUCCESS Timeout has been set
601 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
602 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
603 @return EFI_DEVICE_ERROR Could not complete due to hardware error
608 CoreSetWatchdogTimer (
610 IN UINT64 WatchdogCode
,
612 IN CHAR16
*WatchdogData OPTIONAL
618 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
619 Calls the private one which contains a BOOLEAN parameter for notifications
621 @param UserHandle The handle to install the protocol handler on,
622 or NULL if a new handle is to be allocated
623 @param Protocol The protocol to add to the handle
624 @param InterfaceType Indicates whether Interface is supplied in
626 @param Interface The interface for the protocol being added
633 CoreInstallProtocolInterface (
634 IN OUT EFI_HANDLE
*UserHandle
,
635 IN EFI_GUID
*Protocol
,
636 IN EFI_INTERFACE_TYPE InterfaceType
,
642 Installs a protocol interface into the boot services environment.
644 @param UserHandle The handle to install the protocol handler on,
645 or NULL if a new handle is to be allocated
646 @param Protocol The protocol to add to the handle
647 @param InterfaceType Indicates whether Interface is supplied in
649 @param Interface The interface for the protocol being added
650 @param Notify indicates whether notify the notification list
653 @retval EFI_INVALID_PARAMETER Invalid parameter
654 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
655 @retval EFI_SUCCESS Protocol interface successfully installed
659 CoreInstallProtocolInterfaceNotify (
660 IN OUT EFI_HANDLE
*UserHandle
,
661 IN EFI_GUID
*Protocol
,
662 IN EFI_INTERFACE_TYPE InterfaceType
,
670 Installs a list of protocol interface into the boot services environment.
671 This function calls InstallProtocolInterface() in a loop. If any error
672 occures all the protocols added by this function are removed. This is
673 basically a lib function to save space.
675 @param Handle The handle to install the protocol handlers on,
676 or NULL if a new handle is to be allocated
677 @param ... EFI_GUID followed by protocol instance. A NULL
678 terminates the list. The pairs are the
679 arguments to InstallProtocolInterface(). All the
680 protocols are added to Handle.
682 @retval EFI_INVALID_PARAMETER Handle is NULL.
683 @retval EFI_SUCCESS Protocol interfaces successfully installed.
688 CoreInstallMultipleProtocolInterfaces (
689 IN OUT EFI_HANDLE
*Handle
,
696 Uninstalls a list of protocol interface in the boot services environment.
697 This function calls UnisatllProtocolInterface() in a loop. This is
698 basically a lib function to save space.
700 @param Handle The handle to uninstall the protocol
701 @param ... EFI_GUID followed by protocol instance. A NULL
702 terminates the list. The pairs are the
703 arguments to UninstallProtocolInterface(). All
704 the protocols are added to Handle.
711 CoreUninstallMultipleProtocolInterfaces (
712 IN EFI_HANDLE Handle
,
719 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
721 @param UserHandle Handle on which the interface is to be
723 @param Protocol The numeric ID of the interface
724 @param OldInterface A pointer to the old interface
725 @param NewInterface A pointer to the new interface
727 @retval EFI_SUCCESS The protocol interface was installed
728 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
729 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
734 CoreReinstallProtocolInterface (
735 IN EFI_HANDLE UserHandle
,
736 IN EFI_GUID
*Protocol
,
737 IN VOID
*OldInterface
,
738 IN VOID
*NewInterface
744 Uninstalls all instances of a protocol:interfacer from a handle.
745 If the last protocol interface is remove from the handle, the
748 @param UserHandle The handle to remove the protocol handler from
749 @param Protocol The protocol, of protocol:interface, to remove
750 @param Interface The interface, of protocol:interface, to remove
752 @retval EFI_INVALID_PARAMETER Protocol is NULL.
753 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
758 CoreUninstallProtocolInterface (
759 IN EFI_HANDLE UserHandle
,
760 IN EFI_GUID
*Protocol
,
767 Queries a handle to determine if it supports a specified protocol.
769 @param UserHandle The handle being queried.
770 @param Protocol The published unique identifier of the protocol.
771 @param Interface Supplies the address where a pointer to the
772 corresponding Protocol Interface is returned.
774 @return The requested protocol interface for the handle
780 IN EFI_HANDLE UserHandle
,
781 IN EFI_GUID
*Protocol
,
788 Locates the installed protocol handler for the handle, and
789 invokes it to obtain the protocol interface. Usage information
790 is registered in the protocol data base.
792 @param UserHandle The handle to obtain the protocol interface on
793 @param Protocol The ID of the protocol
794 @param Interface The location to return the protocol interface
795 @param ImageHandle The handle of the Image that is opening the
796 protocol interface specified by Protocol and
798 @param ControllerHandle The controller handle that is requiring this
800 @param Attributes The open mode of the protocol interface
801 specified by Handle and Protocol.
803 @retval EFI_INVALID_PARAMETER Protocol is NULL.
804 @retval EFI_SUCCESS Get the protocol interface.
810 IN EFI_HANDLE UserHandle
,
811 IN EFI_GUID
*Protocol
,
812 OUT VOID
**Interface OPTIONAL
,
813 IN EFI_HANDLE ImageHandle
,
814 IN EFI_HANDLE ControllerHandle
,
821 Return information about Opened protocols in the system
823 @param UserHandle The handle to close the protocol interface on
824 @param Protocol The ID of the protocol
825 @param EntryBuffer A pointer to a buffer of open protocol
826 information in the form of
827 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
828 @param EntryCount Number of EntryBuffer entries
833 CoreOpenProtocolInformation (
834 IN EFI_HANDLE UserHandle
,
835 IN EFI_GUID
*Protocol
,
836 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
837 OUT UINTN
*EntryCount
843 Closes a protocol on a handle that was opened using OpenProtocol().
845 @param UserHandle The handle for the protocol interface that was
846 previously opened with OpenProtocol(), and is
848 @param Protocol The published unique identifier of the protocol.
849 It is the caller's responsibility to pass in a
851 @param AgentHandle The handle of the agent that is closing the
853 @param ControllerHandle If the agent that opened a protocol is a driver
854 that follows the EFI Driver Model, then this
855 parameter is the controller handle that required
856 the protocol interface. If the agent does not
857 follow the EFI Driver Model, then this parameter
858 is optional and may be NULL.
860 @retval EFI_SUCCESS The protocol instance was closed.
861 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
863 @retval EFI_NOT_FOUND Can not find the specified protocol or
870 IN EFI_HANDLE UserHandle
,
871 IN EFI_GUID
*Protocol
,
872 IN EFI_HANDLE AgentHandle
,
873 IN EFI_HANDLE ControllerHandle
879 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
882 @param UserHandle The handle from which to retrieve the list of
883 protocol interface GUIDs.
884 @param ProtocolBuffer A pointer to the list of protocol interface GUID
885 pointers that are installed on Handle.
886 @param ProtocolBufferCount A pointer to the number of GUID pointers present
889 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
890 on Handle was returned in ProtocolBuffer. The
891 number of protocol interface GUIDs was returned
892 in ProtocolBufferCount.
893 @retval EFI_INVALID_PARAMETER Handle is NULL.
894 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
895 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
896 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
897 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
903 CoreProtocolsPerHandle (
904 IN EFI_HANDLE UserHandle
,
905 OUT EFI_GUID
***ProtocolBuffer
,
906 OUT UINTN
*ProtocolBufferCount
912 Add a new protocol notification record for the request protocol.
914 @param Protocol The requested protocol to add the notify
916 @param Event The event to signal
917 @param Registration Returns the registration record
919 @retval EFI_INVALID_PARAMETER Invalid parameter
920 @retval EFI_SUCCESS Successfully returned the registration record
926 CoreRegisterProtocolNotify (
927 IN EFI_GUID
*Protocol
,
929 OUT VOID
**Registration
935 Locates the requested handle(s) and returns them in Buffer.
937 @param SearchType The type of search to perform to locate the
939 @param Protocol The protocol to search for
940 @param SearchKey Dependant on SearchType
941 @param BufferSize On input the size of Buffer. On output the
942 size of data returned.
943 @param Buffer The buffer to return the results in
945 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
946 returned in BufferSize.
947 @retval EFI_INVALID_PARAMETER Invalid parameter
948 @retval EFI_SUCCESS Successfully found the requested handle(s) and
949 returns them in Buffer.
955 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
956 IN EFI_GUID
*Protocol OPTIONAL
,
957 IN VOID
*SearchKey OPTIONAL
,
958 IN OUT UINTN
*BufferSize
,
959 OUT EFI_HANDLE
*Buffer
965 Locates the handle to a device on the device path that best matches the specified protocol.
967 @param Protocol The protocol to search for.
968 @param DevicePath On input, a pointer to a pointer to the device
969 path. On output, the device path pointer is
970 modified to point to the remaining part of the
972 @param Device A pointer to the returned device handle.
974 @retval EFI_SUCCESS The resulting handle was returned.
975 @retval EFI_NOT_FOUND No handles matched the search.
976 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
981 CoreLocateDevicePath (
982 IN EFI_GUID
*Protocol
,
983 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
984 OUT EFI_HANDLE
*Device
990 Function returns an array of handles that support the requested protocol
991 in a buffer allocated from pool. This is a version of CoreLocateHandle()
992 that allocates a buffer for the caller.
994 @param SearchType Specifies which handle(s) are to be returned.
995 @param Protocol Provides the protocol to search by. This
996 parameter is only valid for SearchType
998 @param SearchKey Supplies the search key depending on the
1000 @param NumberHandles The number of handles returned in Buffer.
1001 @param Buffer A pointer to the buffer to return the requested
1002 array of handles that support Protocol.
1004 @retval EFI_SUCCESS The result array of handles was returned.
1005 @retval EFI_NOT_FOUND No handles match the search.
1006 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1008 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1013 CoreLocateHandleBuffer (
1014 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1015 IN EFI_GUID
*Protocol OPTIONAL
,
1016 IN VOID
*SearchKey OPTIONAL
,
1017 IN OUT UINTN
*NumberHandles
,
1018 OUT EFI_HANDLE
**Buffer
1024 Return the first Protocol Interface that matches the Protocol GUID. If
1025 Registration is pasased in return a Protocol Instance that was just add
1026 to the system. If Retistration is NULL return the first Protocol Interface
1029 @param Protocol The protocol to search for
1030 @param Registration Optional Registration Key returned from
1031 RegisterProtocolNotify()
1032 @param Interface Return the Protocol interface (instance).
1034 @retval EFI_SUCCESS If a valid Interface is returned
1035 @retval EFI_INVALID_PARAMETER Invalid parameter
1036 @retval EFI_NOT_FOUND Protocol interface not found
1041 CoreLocateProtocol (
1042 IN EFI_GUID
*Protocol
,
1043 IN VOID
*Registration OPTIONAL
,
1044 OUT VOID
**Interface
1049 return handle database key.
1052 @return Handle database key.
1056 CoreGetHandleDatabaseKey (
1062 Go connect any handles that were created or modified while a image executed.
1064 @param Key The Key to show that the handle has been
1069 CoreConnectHandlesByKey (
1076 Connects one or more drivers to a controller.
1078 @param ControllerHandle Handle of the controller to be
1080 @param DriverImageHandle DriverImageHandle A pointer to an
1081 ordered list of driver image
1083 @param RemainingDevicePath RemainingDevicePath A pointer to
1084 the device path that specifies a
1085 child of the controller specified
1086 by ControllerHandle.
1087 @param Recursive Whether the function would be
1088 called recursively or not.
1090 @return Status code.
1095 CoreConnectController (
1096 IN EFI_HANDLE ControllerHandle
,
1097 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1098 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1099 IN BOOLEAN Recursive
1105 Disonnects a controller from a driver
1107 @param ControllerHandle ControllerHandle The handle of
1108 the controller from which
1111 @param DriverImageHandle DriverImageHandle The driver to
1112 disconnect from ControllerHandle.
1113 @param ChildHandle ChildHandle The handle of the
1116 @retval EFI_SUCCESS One or more drivers were
1117 disconnected from the controller.
1118 @retval EFI_SUCCESS On entry, no drivers are managing
1120 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1121 and on entry DriverImageHandle is
1122 not managing ControllerHandle.
1123 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1125 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1126 and it is not a valid EFI_HANDLE.
1127 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1128 is not a valid EFI_HANDLE.
1129 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1130 available to disconnect any
1131 drivers from ControllerHandle.
1132 @retval EFI_DEVICE_ERROR The controller could not be
1133 disconnected because of a device
1139 CoreDisconnectController (
1140 IN EFI_HANDLE ControllerHandle
,
1141 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1142 IN EFI_HANDLE ChildHandle OPTIONAL
1148 Allocates pages from the memory map.
1150 @param Type The type of allocation to perform
1151 @param MemoryType The type of memory to turn the allocated pages
1153 @param NumberOfPages The number of pages to allocate
1154 @param Memory A pointer to receive the base allocated memory
1157 @return Status. On success, Memory is filled in with the base address allocated
1158 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1160 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1161 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1162 @retval EFI_SUCCESS Pages successfully allocated.
1168 IN EFI_ALLOCATE_TYPE Type
,
1169 IN EFI_MEMORY_TYPE MemoryType
,
1170 IN UINTN NumberOfPages
,
1171 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1177 Frees previous allocated pages.
1179 @param Memory Base address of memory being freed
1180 @param NumberOfPages The number of pages to free
1182 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1183 @retval EFI_INVALID_PARAMETER Address not aligned
1184 @return EFI_SUCCESS -Pages successfully freed.
1190 IN EFI_PHYSICAL_ADDRESS Memory
,
1191 IN UINTN NumberOfPages
1197 This function returns a copy of the current memory map. The map is an array of
1198 memory descriptors, each of which describes a contiguous block of memory.
1200 @param MemoryMapSize A pointer to the size, in bytes, of the
1201 MemoryMap buffer. On input, this is the size of
1202 the buffer allocated by the caller. On output,
1203 it is the size of the buffer returned by the
1204 firmware if the buffer was large enough, or the
1205 size of the buffer needed to contain the map if
1206 the buffer was too small.
1207 @param MemoryMap A pointer to the buffer in which firmware places
1208 the current memory map.
1209 @param MapKey A pointer to the location in which firmware
1210 returns the key for the current memory map.
1211 @param DescriptorSize A pointer to the location in which firmware
1212 returns the size, in bytes, of an individual
1213 EFI_MEMORY_DESCRIPTOR.
1214 @param DescriptorVersion A pointer to the location in which firmware
1215 returns the version number associated with the
1216 EFI_MEMORY_DESCRIPTOR.
1218 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1220 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1221 buffer size needed to hold the memory map is
1222 returned in MemoryMapSize.
1223 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1229 IN OUT UINTN
*MemoryMapSize
,
1230 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1232 OUT UINTN
*DescriptorSize
,
1233 OUT UINT32
*DescriptorVersion
1239 Allocate pool of a particular type.
1241 @param PoolType Type of pool to allocate
1242 @param Size The amount of pool to allocate
1243 @param Buffer The address to return a pointer to the allocated
1246 @retval EFI_INVALID_PARAMETER PoolType not valid
1247 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1248 @retval EFI_SUCCESS Pool successfully allocated.
1254 IN EFI_MEMORY_TYPE PoolType
,
1264 @param Buffer The allocated pool entry to free
1266 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1267 @retval EFI_SUCCESS Pool successfully freed.
1279 Loads an EFI image into memory and returns a handle to the image.
1281 @param BootPolicy If TRUE, indicates that the request originates
1282 from the boot manager, and that the boot
1283 manager is attempting to load FilePath as a
1285 @param ParentImageHandle The caller's image handle.
1286 @param FilePath The specific file path from which the image is
1288 @param SourceBuffer If not NULL, a pointer to the memory location
1289 containing a copy of the image to be loaded.
1290 @param SourceSize The size in bytes of SourceBuffer.
1291 @param ImageHandle Pointer to the returned image handle that is
1292 created when the image is successfully loaded.
1294 @retval EFI_SUCCESS The image was loaded into memory.
1295 @retval EFI_NOT_FOUND The FilePath was not found.
1296 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1297 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1298 path cannot be parsed to locate the proper
1299 protocol for loading the file.
1300 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1307 IN BOOLEAN BootPolicy
,
1308 IN EFI_HANDLE ParentImageHandle
,
1309 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1310 IN VOID
*SourceBuffer OPTIONAL
,
1311 IN UINTN SourceSize
,
1312 OUT EFI_HANDLE
*ImageHandle
1320 @param ImageHandle Handle that identifies the image to be
1323 @retval EFI_SUCCESS The image has been unloaded.
1324 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1326 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1332 IN EFI_HANDLE ImageHandle
1338 Transfer control to a loaded image's entry point.
1340 @param ImageHandle Handle of image to be started.
1341 @param ExitDataSize Pointer of the size to ExitData
1342 @param ExitData Pointer to a pointer to a data buffer that
1343 includes a Null-terminated Unicode string,
1344 optionally followed by additional binary data.
1345 The string is a description that the caller may
1346 use to further indicate the reason for the
1349 @retval EFI_INVALID_PARAMETER Invalid parameter
1350 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1351 @retval EFI_SUCCESS Successfully transfer control to the image's
1358 IN EFI_HANDLE ImageHandle
,
1359 OUT UINTN
*ExitDataSize
,
1360 OUT CHAR16
**ExitData OPTIONAL
1366 Terminates the currently loaded EFI image and returns control to boot services.
1368 @param ImageHandle Handle that identifies the image. This
1369 parameter is passed to the image on entry.
1370 @param Status The image's exit code.
1371 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1372 ExitStatus is EFI_SUCCESS.
1373 @param ExitData Pointer to a data buffer that includes a
1374 Null-terminated Unicode string, optionally
1375 followed by additional binary data. The string
1376 is a description that the caller may use to
1377 further indicate the reason for the image's
1380 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1382 @retval EFI_SUCCESS Successfully terminates the currently loaded
1384 @retval EFI_ACCESS_DENIED Should never reach there.
1385 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1391 IN EFI_HANDLE ImageHandle
,
1392 IN EFI_STATUS Status
,
1393 IN UINTN ExitDataSize
,
1394 IN CHAR16
*ExitData OPTIONAL
1400 Creates a general-purpose event structure.
1402 @param Type The type of event to create and its mode and
1404 @param NotifyTpl The task priority level of event notifications
1405 @param NotifyFunction Pointer to the events notification function
1406 @param NotifyContext Pointer to the notification functions context;
1407 corresponds to parameter "Context" in the
1408 notification function
1409 @param Event Pointer to the newly created event if the call
1410 succeeds; undefined otherwise
1412 @retval EFI_SUCCESS The event structure was created
1413 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1414 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1421 IN EFI_TPL NotifyTpl
,
1422 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1423 IN VOID
*NotifyContext
, OPTIONAL
1424 OUT EFI_EVENT
*Event
1430 Creates a general-purpose event structure
1432 @param Type The type of event to create and its mode and
1434 @param NotifyTpl The task priority level of event notifications
1435 @param NotifyFunction Pointer to the events notification function
1436 @param NotifyContext Pointer to the notification functions context;
1437 corresponds to parameter "Context" in the
1438 notification function
1439 @param EventGroup GUID for EventGroup if NULL act the same as
1441 @param Event Pointer to the newly created event if the call
1442 succeeds; undefined otherwise
1444 @retval EFI_SUCCESS The event structure was created
1445 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1446 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1453 IN EFI_TPL NotifyTpl
,
1454 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1455 IN CONST VOID
*NotifyContext
, OPTIONAL
1456 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1457 OUT EFI_EVENT
*Event
1463 Sets the type of timer and the trigger time for a timer event.
1465 @param UserEvent The timer event that is to be signaled at the
1467 @param Type The type of time that is specified in
1469 @param TriggerTime The number of 100ns units until the timer
1472 @retval EFI_SUCCESS The event has been set to be signaled at the
1474 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1480 IN EFI_EVENT UserEvent
,
1481 IN EFI_TIMER_DELAY Type
,
1482 IN UINT64 TriggerTime
1488 Signals the event. Queues the event to be notified if needed.
1490 @param UserEvent The event to signal .
1492 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1493 @retval EFI_SUCCESS The event was signaled.
1499 IN EFI_EVENT UserEvent
1505 Stops execution until an event is signaled.
1507 @param NumberOfEvents The number of events in the UserEvents array
1508 @param UserEvents An array of EFI_EVENT
1509 @param UserIndex Pointer to the index of the event which
1510 satisfied the wait condition
1512 @retval EFI_SUCCESS The event indicated by Index was signaled.
1513 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1514 function or Event was not a valid type
1515 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1521 IN UINTN NumberOfEvents
,
1522 IN EFI_EVENT
*UserEvents
,
1523 OUT UINTN
*UserIndex
1529 Closes an event and frees the event structure.
1531 @param UserEvent Event to close
1533 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1534 @retval EFI_SUCCESS The event has been closed
1540 IN EFI_EVENT UserEvent
1546 Check the status of an event.
1548 @param UserEvent The event to check
1550 @retval EFI_SUCCESS The event is in the signaled state
1551 @retval EFI_NOT_READY The event is not in the signaled state
1552 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1558 IN EFI_EVENT UserEvent
1563 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1564 global coherency domain of the processor.
1566 @param GcdMemoryType Memory type of the memory space.
1567 @param BaseAddress Base address of the memory space.
1568 @param Length Length of the memory space.
1569 @param Capabilities alterable attributes of the memory space.
1571 @retval EFI_SUCCESS Merged this memory space into GCD map.
1575 CoreAddMemorySpace (
1576 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1577 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1579 IN UINT64 Capabilities
1584 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1585 I/O resources from the global coherency domain of the processor.
1587 @param GcdAllocateType The type of allocate operation
1588 @param GcdMemoryType The desired memory type
1589 @param Alignment Align with 2^Alignment
1590 @param Length Length to allocate
1591 @param BaseAddress Base address to allocate
1592 @param ImageHandle The image handle consume the allocated space.
1593 @param DeviceHandle The device handle consume the allocated space.
1595 @retval EFI_INVALID_PARAMETER Invalid parameter.
1596 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1597 @retval EFI_SUCCESS Memory space successfully allocated.
1601 CoreAllocateMemorySpace (
1602 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1603 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1606 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1607 IN EFI_HANDLE ImageHandle
,
1608 IN EFI_HANDLE DeviceHandle OPTIONAL
1613 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1614 I/O resources from the global coherency domain of the processor.
1616 @param BaseAddress Base address of the memory space.
1617 @param Length Length of the memory space.
1619 @retval EFI_SUCCESS Space successfully freed.
1623 CoreFreeMemorySpace (
1624 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1630 Removes reserved memory, system memory, or memory-mapped I/O resources from
1631 the global coherency domain of the processor.
1633 @param BaseAddress Base address of the memory space.
1634 @param Length Length of the memory space.
1636 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1640 CoreRemoveMemorySpace (
1641 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1647 Retrieves the descriptor for a memory region containing a specified address.
1649 @param BaseAddress Specified start address
1650 @param Descriptor Specified length
1652 @retval EFI_INVALID_PARAMETER Invalid parameter
1653 @retval EFI_SUCCESS Successfully get memory space descriptor.
1657 CoreGetMemorySpaceDescriptor (
1658 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1659 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1664 Modifies the attributes for a memory region in the global coherency domain of the
1667 @param BaseAddress Specified start address
1668 @param Length Specified length
1669 @param Attributes Specified attributes
1671 @retval EFI_SUCCESS Successfully set attribute of a segment of
1676 CoreSetMemorySpaceAttributes (
1677 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1679 IN UINT64 Attributes
1684 Returns a map of the memory resources in the global coherency domain of the
1687 @param NumberOfDescriptors Number of descriptors.
1688 @param MemorySpaceMap Descriptor array
1690 @retval EFI_INVALID_PARAMETER Invalid parameter
1691 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1692 @retval EFI_SUCCESS Successfully get memory space map.
1696 CoreGetMemorySpaceMap (
1697 OUT UINTN
*NumberOfDescriptors
,
1698 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1703 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1705 @param GcdIoType IO type of the segment.
1706 @param BaseAddress Base address of the segment.
1707 @param Length Length of the segment.
1709 @retval EFI_SUCCESS Merged this segment into GCD map.
1710 @retval EFI_INVALID_PARAMETER Parameter not valid
1715 IN EFI_GCD_IO_TYPE GcdIoType
,
1716 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1722 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1723 domain of the processor.
1725 @param GcdAllocateType The type of allocate operation
1726 @param GcdIoType The desired IO type
1727 @param Alignment Align with 2^Alignment
1728 @param Length Length to allocate
1729 @param BaseAddress Base address to allocate
1730 @param ImageHandle The image handle consume the allocated space.
1731 @param DeviceHandle The device handle consume the allocated space.
1733 @retval EFI_INVALID_PARAMETER Invalid parameter.
1734 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1735 @retval EFI_SUCCESS IO space successfully allocated.
1739 CoreAllocateIoSpace (
1740 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1741 IN EFI_GCD_IO_TYPE GcdIoType
,
1744 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1745 IN EFI_HANDLE ImageHandle
,
1746 IN EFI_HANDLE DeviceHandle OPTIONAL
1751 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1752 domain of the processor.
1754 @param BaseAddress Base address of the segment.
1755 @param Length Length of the segment.
1757 @retval EFI_SUCCESS Space successfully freed.
1762 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1768 Removes reserved I/O or I/O resources from the global coherency domain of the
1771 @param BaseAddress Base address of the segment.
1772 @param Length Length of the segment.
1774 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1779 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1785 Retrieves the descriptor for an I/O region containing a specified address.
1787 @param BaseAddress Specified start address
1788 @param Descriptor Specified length
1790 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1791 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1795 CoreGetIoSpaceDescriptor (
1796 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1797 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1802 Returns a map of the I/O resources in the global coherency domain of the processor.
1804 @param NumberOfDescriptors Number of descriptors.
1805 @param IoSpaceMap Descriptor array
1807 @retval EFI_INVALID_PARAMETER Invalid parameter
1808 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1809 @retval EFI_SUCCESS Successfully get IO space map.
1814 OUT UINTN
*NumberOfDescriptors
,
1815 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1820 This is the main Dispatcher for DXE and it exits when there are no more
1821 drivers to run. Drain the mScheduledQueue and load and start a PE
1822 image for each driver. Search the mDiscoveredList to see if any driver can
1823 be placed on the mScheduledQueue. If no drivers are placed on the
1824 mScheduledQueue exit the function. On exit it is assumed the Bds()
1825 will be called, and when the Bds() exits the Dispatcher will be called
1828 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1829 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1830 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1840 Check every driver and locate a matching one. If the driver is found, the Unrequested
1841 state flag is cleared.
1843 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1844 the firmware file specified by DriverName.
1845 @param DriverName The Driver name to put in the Dependent state.
1847 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1849 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1856 IN EFI_HANDLE FirmwareVolumeHandle
,
1857 IN EFI_GUID
*DriverName
1862 Convert a driver from the Untrused back to the Scheduled state.
1864 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1865 the firmware file specified by DriverName.
1866 @param DriverName The Driver name to put in the Scheduled state
1868 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1869 was promoted to the trusted state.
1870 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1876 IN EFI_HANDLE FirmwareVolumeHandle
,
1877 IN EFI_GUID
*DriverName
1882 Helper function called as part of the code needed
1883 to allocate the proper sized buffer for various
1886 @param Status Current status
1887 @param Buffer Current allocated buffer, or NULL
1888 @param BufferSize Current buffer size needed
1890 @retval TRUE if the buffer was reallocated and the caller
1891 should try the API again.
1892 @retval FALSE buffer could not be allocated and the caller
1893 should not try the API again.
1898 IN OUT EFI_STATUS
*Status
,
1899 IN OUT VOID
**Buffer
,
1905 This routine is the driver initialization entry point. It initializes the
1906 libraries, and registers two notification functions. These notification
1907 functions are responsible for building the FV stack dynamically.
1909 @param ImageHandle The image handle.
1910 @param SystemTable The system table.
1912 @retval EFI_SUCCESS Function successfully returned.
1918 IN EFI_HANDLE ImageHandle
,
1919 IN EFI_SYSTEM_TABLE
*SystemTable
1924 Entry point of the section extraction code. Initializes an instance of the
1925 section extraction interface and installs it on a new handle.
1927 @param ImageHandle A handle for the image that is initializing this driver
1928 @param SystemTable A pointer to the EFI system table
1930 @retval EFI_SUCCESS Driver initialized successfully
1931 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1936 InitializeSectionExtraction (
1937 IN EFI_HANDLE ImageHandle
,
1938 IN EFI_SYSTEM_TABLE
*SystemTable
1943 This DXE service routine is used to process a firmware volume. In
1944 particular, it can be called by BDS to process a single firmware
1945 volume found in a capsule.
1947 @param FvHeader pointer to a firmware volume header
1948 @param Size the size of the buffer pointed to by FvHeader
1949 @param FVProtocolHandle the handle on which a firmware volume protocol
1950 was produced for the firmware volume passed in.
1952 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1954 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1955 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1960 CoreProcessFirmwareVolume (
1963 OUT EFI_HANDLE
*FVProtocolHandle
1967 //Functions used during debug buils
1971 Displays Architectural protocols that were not loaded and are required for DXE
1972 core to function. Only used in Debug Builds.
1976 CoreDisplayMissingArchProtocols (
1982 Traverse the discovered list for any drivers that were discovered but not loaded
1983 because the dependency experessions evaluated to false.
1987 CoreDisplayDiscoveredNotDispatched (
1993 Place holder function until all the Boot Services and Runtime Services are
1996 @return EFI_NOT_AVAILABLE_YET
2001 CoreEfiNotAvailableYetArg0 (
2007 Place holder function until all the Boot Services and Runtime Services are
2010 @param Arg1 Undefined
2012 @return EFI_NOT_AVAILABLE_YET
2017 CoreEfiNotAvailableYetArg1 (
2023 Place holder function until all the Boot Services and Runtime Services are available.
2025 @param Arg1 Undefined
2026 @param Arg2 Undefined
2028 @return EFI_NOT_AVAILABLE_YET
2033 CoreEfiNotAvailableYetArg2 (
2040 Place holder function until all the Boot Services and Runtime Services are available.
2042 @param Arg1 Undefined
2043 @param Arg2 Undefined
2044 @param Arg3 Undefined
2046 @return EFI_NOT_AVAILABLE_YET
2051 CoreEfiNotAvailableYetArg3 (
2059 Place holder function until all the Boot Services and Runtime Services are available.
2061 @param Arg1 Undefined
2062 @param Arg2 Undefined
2063 @param Arg3 Undefined
2064 @param Arg4 Undefined
2066 @return EFI_NOT_AVAILABLE_YET
2071 CoreEfiNotAvailableYetArg4 (
2080 Place holder function until all the Boot Services and Runtime Services are available.
2082 @param Arg1 Undefined
2083 @param Arg2 Undefined
2084 @param Arg3 Undefined
2085 @param Arg4 Undefined
2086 @param Arg5 Undefined
2088 @return EFI_NOT_AVAILABLE_YET
2093 CoreEfiNotAvailableYetArg5 (
2103 Searches for a Protocol Interface passed from PEI through a HOB.
2105 @param ProtocolGuid The Protocol GUID to search for in the HOB List
2106 @param Interface A pointer to the interface for the Protocol GUID
2108 @retval EFI_SUCCESS The Protocol GUID was found and its interface is
2109 returned in Interface
2110 @retval EFI_NOT_FOUND The Protocol GUID was not found in the HOB List
2114 CoreGetPeiProtocol (
2115 IN EFI_GUID
*ProtocolGuid
,
2121 Given a compressed source buffer, this function retrieves the size of the
2122 uncompressed buffer and the size of the scratch buffer required to decompress
2123 the compressed source buffer.
2125 The GetInfo() function retrieves the size of the uncompressed buffer and the
2126 temporary scratch buffer required to decompress the buffer specified by Source
2127 and SourceSize. If the size of the uncompressed buffer or the size of the
2128 scratch buffer cannot be determined from the compressed data specified by
2129 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2130 size of the uncompressed buffer is returned in DestinationSize, the size of
2131 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2132 The GetInfo() function does not have scratch buffer available to perform a
2133 thorough checking of the validity of the source data. It just retrieves the
2134 "Original Size" field from the beginning bytes of the source data and output
2135 it as DestinationSize. And ScratchSize is specific to the decompression
2138 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2139 @param Source The source buffer containing the compressed data.
2140 @param SourceSize The size, in bytes, of the source buffer.
2141 @param DestinationSize A pointer to the size, in bytes, of the
2142 uncompressed buffer that will be generated when the
2143 compressed buffer specified by Source and
2144 SourceSize is decompressed.
2145 @param ScratchSize A pointer to the size, in bytes, of the scratch
2146 buffer that is required to decompress the
2147 compressed buffer specified by Source and
2150 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2151 DestinationSize and the size of the scratch buffer
2152 was returned in ScratchSize.
2153 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2154 the scratch buffer cannot be determined from the
2155 compressed data specified by Source and
2161 DxeMainUefiDecompressGetInfo (
2162 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2164 IN UINT32 SourceSize
,
2165 OUT UINT32
*DestinationSize
,
2166 OUT UINT32
*ScratchSize
2171 Decompresses a compressed source buffer.
2173 The Decompress() function extracts decompressed data to its original form.
2174 This protocol is designed so that the decompression algorithm can be
2175 implemented without using any memory services. As a result, the Decompress()
2176 Function is not allowed to call AllocatePool() or AllocatePages() in its
2177 implementation. It is the caller's responsibility to allocate and free the
2178 Destination and Scratch buffers.
2179 If the compressed source data specified by Source and SourceSize is
2180 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2181 the compressed source data specified by Source and SourceSize is not in a
2182 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2184 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2185 @param Source The source buffer containing the compressed data.
2186 @param SourceSize SourceSizeThe size of source data.
2187 @param Destination On output, the destination buffer that contains
2188 the uncompressed data.
2189 @param DestinationSize The size of the destination buffer. The size of
2190 the destination buffer needed is obtained from
2191 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2192 @param Scratch A temporary scratch buffer that is used to perform
2194 @param ScratchSize The size of scratch buffer. The size of the
2195 scratch buffer needed is obtained from GetInfo().
2197 @retval EFI_SUCCESS Decompression completed successfully, and the
2198 uncompressed buffer is returned in Destination.
2199 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2200 SourceSize is corrupted (not in a valid
2206 DxeMainUefiDecompress (
2207 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2209 IN UINT32 SourceSize
,
2210 IN OUT VOID
*Destination
,
2211 IN UINT32 DestinationSize
,
2212 IN OUT VOID
*Scratch
,
2213 IN UINT32 ScratchSize
2217 SEP member function. This function creates and returns a new section stream
2218 handle to represent the new section stream.
2220 @param SectionStreamLength Size in bytes of the section stream.
2221 @param SectionStream Buffer containing the new section stream.
2222 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2223 output contains the new section stream handle.
2225 @retval EFI_SUCCESS The section stream is created successfully.
2226 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2227 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2234 IN UINTN SectionStreamLength
,
2235 IN VOID
*SectionStream
,
2236 OUT UINTN
*SectionStreamHandle
2242 SEP member function. Retrieves requested section from section stream.
2244 @param SectionStreamHandle The section stream from which to extract the
2246 @param SectionType A pointer to the type of section to search for.
2247 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2248 then SectionDefinitionGuid indicates which of
2249 these types of sections to search for.
2250 @param SectionInstance Indicates which instance of the requested
2252 @param Buffer Double indirection to buffer. If *Buffer is
2253 non-null on input, then the buffer is caller
2254 allocated. If Buffer is NULL, then the buffer
2255 is callee allocated. In either case, the
2256 requried buffer size is returned in *BufferSize.
2257 @param BufferSize On input, indicates the size of *Buffer if
2258 *Buffer is non-null on input. On output,
2259 indicates the required size (allocated size if
2260 callee allocated) of *Buffer.
2261 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2262 indicates the authentication status of the
2263 output buffer. If the input section's
2264 GuidedSectionHeader.Attributes field
2265 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2266 bit as clear, AuthenticationStatus must return
2267 zero. Both local bits (19:16) and aggregate
2268 bits (3:0) in AuthenticationStatus are returned
2269 by ExtractSection(). These bits reflect the
2270 status of the extraction operation. The bit
2271 pattern in both regions must be the same, as
2272 the local and aggregate authentication statuses
2273 have equivalent meaning at this level. If the
2274 function returns anything other than
2275 EFI_SUCCESS, the value of *AuthenticationStatus
2278 @retval EFI_SUCCESS Section was retrieved successfully
2279 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2280 section stream with its
2281 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2282 but there was no corresponding GUIDed Section
2283 Extraction Protocol in the handle database.
2284 *Buffer is unmodified.
2285 @retval EFI_NOT_FOUND An error was encountered when parsing the
2286 SectionStream. This indicates the SectionStream
2287 is not correctly formatted.
2288 @retval EFI_NOT_FOUND The requested section does not exist.
2289 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2291 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2292 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2293 insufficient to contain the requested section.
2294 The input buffer is filled and section contents
2301 IN UINTN SectionStreamHandle
,
2302 IN EFI_SECTION_TYPE
*SectionType
,
2303 IN EFI_GUID
*SectionDefinitionGuid
,
2304 IN UINTN SectionInstance
,
2306 IN OUT UINTN
*BufferSize
,
2307 OUT UINT32
*AuthenticationStatus
2312 SEP member function. Deletes an existing section stream
2314 @param StreamHandleToClose Indicates the stream to close
2316 @retval EFI_SUCCESS The section stream is closed sucessfully.
2317 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2318 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2324 CloseSectionStream (
2325 IN UINTN StreamHandleToClose