2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2008, Intel Corporation. <BR>
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include <Protocol/LoadedImage.h>
24 #include <Protocol/GuidedSectionExtraction.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/Runtime.h>
27 #include <Protocol/LoadFile.h>
28 #include <Protocol/DriverBinding.h>
29 #include <Protocol/VariableWrite.h>
30 #include <Protocol/PlatformDriverOverride.h>
31 #include <Protocol/Variable.h>
32 #include <Protocol/Timer.h>
33 #include <Protocol/SimpleFileSystem.h>
34 #include <Protocol/Bds.h>
35 #include <Protocol/RealTimeClock.h>
36 #include <Protocol/WatchdogTimer.h>
37 #include <Protocol/FirmwareVolume2.h>
38 #include <Protocol/MonotonicCounter.h>
39 #include <Protocol/StatusCode.h>
40 #include <Protocol/Decompress.h>
41 #include <Protocol/LoadPe32Image.h>
42 #include <Protocol/FirmwareVolumeDispatch.h>
43 #include <Protocol/Security.h>
44 #include <Protocol/Ebc.h>
45 #include <Protocol/Reset.h>
46 #include <Protocol/Cpu.h>
47 #include <Protocol/Metronome.h>
48 #include <Protocol/FirmwareVolumeBlock.h>
49 #include <Protocol/Capsule.h>
50 #include <Protocol/BusSpecificDriverOverride.h>
51 #include <Protocol/Performance.h>
52 #include <Protocol/TcgService.h>
53 #include <Protocol/TcgPlatform.h>
54 #include <Guid/MemoryTypeInformation.h>
55 #include <Guid/FirmwareFileSystem2.h>
56 #include <Guid/HobList.h>
57 #include <Guid/DebugImageInfoTable.h>
58 #include <Guid/FileInfo.h>
59 #include <Guid/Apriori.h>
60 #include <Guid/DxeServices.h>
61 #include <Guid/MemoryAllocationHob.h>
62 #include <Guid/EventLegacyBios.h>
63 #include <Guid/EventGroup.h>
66 #include <Library/DxeCoreEntryPoint.h>
67 #include <Library/DebugLib.h>
68 #include <Library/UefiLib.h>
69 #include <Library/BaseLib.h>
70 #include <Library/HobLib.h>
71 #include <Library/PerformanceLib.h>
72 #include <Library/UefiDecompressLib.h>
73 #include <Library/ExtractGuidedSectionLib.h>
74 #include <Library/CacheMaintenanceLib.h>
75 #include <Library/BaseMemoryLib.h>
76 #include <Library/PeCoffLib.h>
77 #include <Library/PcdLib.h>
78 #include <Library/MemoryAllocationLib.h>
79 #include <Library/DevicePathLib.h>
80 #include <Library/UefiBootServicesTableLib.h>
81 #include <Library/ReportStatusCodeLib.h>
83 #include "DebugImageInfo.h"
85 #include "FwVolBlock.h"
86 #include "FwVolDriver.h"
95 // Modifier for EFI DXE Services
97 #define EFI_DXESERVICE
100 // attributes for reserved memory before it is promoted to system memory
102 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
103 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
104 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
107 // range for memory mapped port I/O on IPF
109 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
113 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
114 /// to save time. A EFI_DEP_PUSH is evauated one an
115 /// replaced with EFI_DEP_REPLACE_TRUE
117 #define EFI_DEP_REPLACE_TRUE 0xff
120 /// Define the initial size of the dependency expression evaluation stack
122 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
125 EFI_GUID
*ProtocolGuid
;
130 } ARCHITECTURAL_PROTOCOL_ENTRY
;
133 // DXE Dispatcher Data structures
136 #define KNOWN_HANDLE_SIGNATURE EFI_SIGNATURE_32('k','n','o','w')
139 LIST_ENTRY Link
; // mFvHandleList
144 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE EFI_SIGNATURE_32('d','r','v','r')
147 LIST_ENTRY Link
; // mDriverList
149 LIST_ENTRY ScheduledLink
; // mScheduledQueue
153 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
154 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
161 EFI_GUID BeforeAfterGuid
;
168 BOOLEAN DepexProtocolError
;
170 EFI_HANDLE ImageHandle
;
172 } EFI_CORE_DRIVER_ENTRY
;
175 //The data structure of GCD memory map entry
177 #define EFI_GCD_MAP_SIGNATURE EFI_SIGNATURE_32('g','c','d','m')
181 EFI_PHYSICAL_ADDRESS BaseAddress
;
185 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
186 EFI_GCD_IO_TYPE GcdIoType
;
187 EFI_HANDLE ImageHandle
;
188 EFI_HANDLE DeviceHandle
;
192 // DXE Core Global Variables
194 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
195 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
196 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
197 extern EFI_HANDLE gDxeCoreImageHandle
;
199 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
201 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
202 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
203 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
204 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
205 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
206 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
207 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
209 extern EFI_TPL gEfiCurrentTpl
;
211 extern EFI_GUID
*gDxeCoreFileName
;
212 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
214 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
216 extern BOOLEAN gDispatcherRunning
;
217 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
220 // Service Initialization Functions
226 Called to initialize the pool.
236 Called to initialize the memory map and add descriptors to
237 the current descriptor list.
238 The first descriptor that is added must be general usable
239 memory as the addition allocates heap.
241 @param Type The type of memory to add
242 @param Start The starting address in the memory range Must be
244 @param NumberOfPages The number of pages in the range
245 @param Attribute Attributes of the memory to add
247 @return None. The range is added to the memory map
251 CoreAddMemoryDescriptor (
252 IN EFI_MEMORY_TYPE Type
,
253 IN EFI_PHYSICAL_ADDRESS Start
,
254 IN UINT64 NumberOfPages
,
260 Release memory lock on mGcdMemorySpaceLock.
264 CoreReleaseGcdMemoryLock (
270 Acquire memory lock on mGcdMemorySpaceLock.
274 CoreAcquireGcdMemoryLock (
280 External function. Initializes the GCD and memory services based on the memory
281 descriptor HOBs. This function is responsible for priming the GCD map and the
282 memory map, so memory allocations and resource allocations can be made. The first
283 part of this function can not depend on any memory services until at least one
284 memory descriptor is provided to the memory services. Then the memory services
285 can be used to intialize the GCD map.
287 @param HobStart The start address of the HOB.
288 @param MemoryBaseAddress Start address of memory region found to init DXE
290 @param MemoryLength Length of memory region found to init DXE core.
292 @retval EFI_SUCCESS Memory services successfully initialized.
296 CoreInitializeMemoryServices (
298 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
299 OUT UINT64
*MemoryLength
305 External function. Initializes the GCD and memory services based on the memory
306 descriptor HOBs. This function is responsible for priming the GCD map and the
307 memory map, so memory allocations and resource allocations can be made. The first
308 part of this function can not depend on any memory services until at least one
309 memory descriptor is provided to the memory services. Then the memory services
310 can be used to intialize the GCD map. The HobStart will be relocated to a pool
313 @param HobStart The start address of the HOB
314 @param MemoryBaseAddress Start address of memory region found to init DXE
316 @param MemoryLength Length of memory region found to init DXE core.
318 @retval EFI_SUCCESS GCD services successfully initialized.
322 CoreInitializeGcdServices (
323 IN OUT VOID
**HobStart
,
324 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
325 IN UINT64 MemoryLength
330 Initializes "event" support and populates parts of the System and Runtime Table.
332 @retval EFI_SUCCESS Always return success
336 CoreInitializeEventServices (
342 Add the Image Services to EFI Boot Services Table and install the protocol
343 interfaces for this image.
345 @param HobStart The HOB to initialize
351 CoreInitializeImageServices (
357 Creates an event that is fired everytime a Protocol of a specific type is installed.
361 CoreNotifyOnArchProtocolInstallation (
367 Return TRUE if all AP services are availible.
369 @retval EFI_SUCCESS All AP services are available
370 @retval EFI_NOT_FOUND At least one AP service is not available
374 CoreAllEfiServicesAvailable (
380 Calcualte the 32-bit CRC in a EFI table using the service provided by the
383 @param Hdr Pointer to an EFI standard header
388 IN OUT EFI_TABLE_HEADER
*Hdr
393 Called by the platform code to process a tick.
395 @param Duration The number of 100ns elasped since the last call
407 Initialize the dispatcher. Initialize the notification function that runs when
408 an FV2 protocol is added to the system.
412 CoreInitializeDispatcher (
418 This is the POSTFIX version of the dependency evaluator. This code does
419 not need to handle Before or After, as it is not valid to call this
420 routine in this case. The SOR is just ignored and is a nop in the grammer.
421 POSTFIX means all the math is done on top of the stack.
423 @param DriverEntry DriverEntry element to update.
425 @retval TRUE If driver is ready to run.
426 @retval FALSE If driver is not ready to run or some fatal error
432 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
437 Preprocess dependency expression and update DriverEntry to reflect the
438 state of Before, After, and SOR dependencies. If DriverEntry->Before
439 or DriverEntry->After is set it will never be cleared. If SOR is set
440 it will be cleared by CoreSchedule(), and then the driver can be
443 @param DriverEntry DriverEntry element to update .
445 @retval EFI_SUCCESS It always works.
449 CorePreProcessDepex (
450 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
456 Terminates all boot services.
458 @param ImageHandle Handle that identifies the exiting image.
459 @param MapKey Key to the latest memory map.
461 @retval EFI_SUCCESS Boot Services terminated
462 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
467 CoreExitBootServices (
468 IN EFI_HANDLE ImageHandle
,
474 Make sure the memory map is following all the construction rules,
475 it is the last time to check memory map error before exit boot services.
477 @param MapKey Memory map key
479 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
481 @retval EFI_SUCCESS Valid memory map.
485 CoreTerminateMemoryMap (
491 Signals all events in the EventGroup.
493 @param EventGroup The list to signal
497 CoreNotifySignalList (
498 IN EFI_GUID
*EventGroup
504 Boot Service called to add, modify, or remove a system configuration table from
505 the EFI System Table.
507 @param Guid Pointer to the GUID for the entry to add, update, or
509 @param Table Pointer to the configuration table for the entry to add,
510 update, or remove, may be NULL.
512 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
513 @return EFI_INVALID_PARAMETER Input GUID not valid.
514 @return EFI_NOT_FOUND Attempted to delete non-existant entry
515 @return EFI_OUT_OF_RESOURCES Not enough memory available
520 CoreInstallConfigurationTable (
528 Raise the task priority level to the new level.
529 High level is implemented by disabling processor interrupts.
531 @param NewTpl New task priority level
533 @return The previous task priority level
545 Lowers the task priority to the previous value. If the new
546 priority unmasks events at a higher priority, they are dispatched.
548 @param NewTpl New, lower, task priority
560 Introduces a fine-grained stall.
562 @param Microseconds The number of microseconds to stall execution.
564 @retval EFI_SUCCESS Execution was stalled for at least the requested
565 amount of microseconds.
566 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
572 IN UINTN Microseconds
578 Sets the system's watchdog timer.
580 @param Timeout The number of seconds to set the watchdog timer to.
581 A value of zero disables the timer.
582 @param WatchdogCode The numeric code to log on a watchdog timer timeout
583 event. The firmware reserves codes 0x0000 to 0xFFFF.
584 Loaders and operating systems may use other timeout
586 @param DataSize The size, in bytes, of WatchdogData.
587 @param WatchdogData A data buffer that includes a Null-terminated Unicode
588 string, optionally followed by additional binary data.
589 The string is a description that the call may use to
590 further indicate the reason to be logged with a
593 @return EFI_SUCCESS Timeout has been set
594 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
595 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
596 @return EFI_DEVICE_ERROR Could not complete due to hardware error
601 CoreSetWatchdogTimer (
603 IN UINT64 WatchdogCode
,
605 IN CHAR16
*WatchdogData OPTIONAL
611 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
612 Calls the private one which contains a BOOLEAN parameter for notifications
614 @param UserHandle The handle to install the protocol handler on,
615 or NULL if a new handle is to be allocated
616 @param Protocol The protocol to add to the handle
617 @param InterfaceType Indicates whether Interface is supplied in
619 @param Interface The interface for the protocol being added
626 CoreInstallProtocolInterface (
627 IN OUT EFI_HANDLE
*UserHandle
,
628 IN EFI_GUID
*Protocol
,
629 IN EFI_INTERFACE_TYPE InterfaceType
,
635 Installs a protocol interface into the boot services environment.
637 @param UserHandle The handle to install the protocol handler on,
638 or NULL if a new handle is to be allocated
639 @param Protocol The protocol to add to the handle
640 @param InterfaceType Indicates whether Interface is supplied in
642 @param Interface The interface for the protocol being added
643 @param Notify indicates whether notify the notification list
646 @retval EFI_INVALID_PARAMETER Invalid parameter
647 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
648 @retval EFI_SUCCESS Protocol interface successfully installed
652 CoreInstallProtocolInterfaceNotify (
653 IN OUT EFI_HANDLE
*UserHandle
,
654 IN EFI_GUID
*Protocol
,
655 IN EFI_INTERFACE_TYPE InterfaceType
,
663 Installs a list of protocol interface into the boot services environment.
664 This function calls InstallProtocolInterface() in a loop. If any error
665 occures all the protocols added by this function are removed. This is
666 basically a lib function to save space.
668 @param Handle The handle to install the protocol handlers on,
669 or NULL if a new handle is to be allocated
670 @param ... EFI_GUID followed by protocol instance. A NULL
671 terminates the list. The pairs are the
672 arguments to InstallProtocolInterface(). All the
673 protocols are added to Handle.
675 @retval EFI_INVALID_PARAMETER Handle is NULL.
676 @retval EFI_SUCCESS Protocol interfaces successfully installed.
681 CoreInstallMultipleProtocolInterfaces (
682 IN OUT EFI_HANDLE
*Handle
,
689 Uninstalls a list of protocol interface in the boot services environment.
690 This function calls UnisatllProtocolInterface() in a loop. This is
691 basically a lib function to save space.
693 @param Handle The handle to uninstall the protocol
694 @param ... EFI_GUID followed by protocol instance. A NULL
695 terminates the list. The pairs are the
696 arguments to UninstallProtocolInterface(). All
697 the protocols are added to Handle.
704 CoreUninstallMultipleProtocolInterfaces (
705 IN EFI_HANDLE Handle
,
712 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
714 @param UserHandle Handle on which the interface is to be
716 @param Protocol The numeric ID of the interface
717 @param OldInterface A pointer to the old interface
718 @param NewInterface A pointer to the new interface
720 @retval EFI_SUCCESS The protocol interface was installed
721 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
722 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
727 CoreReinstallProtocolInterface (
728 IN EFI_HANDLE UserHandle
,
729 IN EFI_GUID
*Protocol
,
730 IN VOID
*OldInterface
,
731 IN VOID
*NewInterface
737 Uninstalls all instances of a protocol:interfacer from a handle.
738 If the last protocol interface is remove from the handle, the
741 @param UserHandle The handle to remove the protocol handler from
742 @param Protocol The protocol, of protocol:interface, to remove
743 @param Interface The interface, of protocol:interface, to remove
745 @retval EFI_INVALID_PARAMETER Protocol is NULL.
746 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
751 CoreUninstallProtocolInterface (
752 IN EFI_HANDLE UserHandle
,
753 IN EFI_GUID
*Protocol
,
760 Queries a handle to determine if it supports a specified protocol.
762 @param UserHandle The handle being queried.
763 @param Protocol The published unique identifier of the protocol.
764 @param Interface Supplies the address where a pointer to the
765 corresponding Protocol Interface is returned.
767 @return The requested protocol interface for the handle
773 IN EFI_HANDLE UserHandle
,
774 IN EFI_GUID
*Protocol
,
781 Locates the installed protocol handler for the handle, and
782 invokes it to obtain the protocol interface. Usage information
783 is registered in the protocol data base.
785 @param UserHandle The handle to obtain the protocol interface on
786 @param Protocol The ID of the protocol
787 @param Interface The location to return the protocol interface
788 @param ImageHandle The handle of the Image that is opening the
789 protocol interface specified by Protocol and
791 @param ControllerHandle The controller handle that is requiring this
793 @param Attributes The open mode of the protocol interface
794 specified by Handle and Protocol.
796 @retval EFI_INVALID_PARAMETER Protocol is NULL.
797 @retval EFI_SUCCESS Get the protocol interface.
803 IN EFI_HANDLE UserHandle
,
804 IN EFI_GUID
*Protocol
,
805 OUT VOID
**Interface OPTIONAL
,
806 IN EFI_HANDLE ImageHandle
,
807 IN EFI_HANDLE ControllerHandle
,
814 Return information about Opened protocols in the system
816 @param UserHandle The handle to close the protocol interface on
817 @param Protocol The ID of the protocol
818 @param EntryBuffer A pointer to a buffer of open protocol
819 information in the form of
820 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
821 @param EntryCount Number of EntryBuffer entries
826 CoreOpenProtocolInformation (
827 IN EFI_HANDLE UserHandle
,
828 IN EFI_GUID
*Protocol
,
829 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
830 OUT UINTN
*EntryCount
836 Closes a protocol on a handle that was opened using OpenProtocol().
838 @param UserHandle The handle for the protocol interface that was
839 previously opened with OpenProtocol(), and is
841 @param Protocol The published unique identifier of the protocol.
842 It is the caller's responsibility to pass in a
844 @param AgentHandle The handle of the agent that is closing the
846 @param ControllerHandle If the agent that opened a protocol is a driver
847 that follows the EFI Driver Model, then this
848 parameter is the controller handle that required
849 the protocol interface. If the agent does not
850 follow the EFI Driver Model, then this parameter
851 is optional and may be NULL.
853 @retval EFI_SUCCESS The protocol instance was closed.
854 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
856 @retval EFI_NOT_FOUND Can not find the specified protocol or
863 IN EFI_HANDLE UserHandle
,
864 IN EFI_GUID
*Protocol
,
865 IN EFI_HANDLE AgentHandle
,
866 IN EFI_HANDLE ControllerHandle
872 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
875 @param UserHandle The handle from which to retrieve the list of
876 protocol interface GUIDs.
877 @param ProtocolBuffer A pointer to the list of protocol interface GUID
878 pointers that are installed on Handle.
879 @param ProtocolBufferCount A pointer to the number of GUID pointers present
882 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
883 on Handle was returned in ProtocolBuffer. The
884 number of protocol interface GUIDs was returned
885 in ProtocolBufferCount.
886 @retval EFI_INVALID_PARAMETER Handle is NULL.
887 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
888 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
889 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
890 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
896 CoreProtocolsPerHandle (
897 IN EFI_HANDLE UserHandle
,
898 OUT EFI_GUID
***ProtocolBuffer
,
899 OUT UINTN
*ProtocolBufferCount
905 Add a new protocol notification record for the request protocol.
907 @param Protocol The requested protocol to add the notify
909 @param Event The event to signal
910 @param Registration Returns the registration record
912 @retval EFI_INVALID_PARAMETER Invalid parameter
913 @retval EFI_SUCCESS Successfully returned the registration record
919 CoreRegisterProtocolNotify (
920 IN EFI_GUID
*Protocol
,
922 OUT VOID
**Registration
928 Locates the requested handle(s) and returns them in Buffer.
930 @param SearchType The type of search to perform to locate the
932 @param Protocol The protocol to search for
933 @param SearchKey Dependant on SearchType
934 @param BufferSize On input the size of Buffer. On output the
935 size of data returned.
936 @param Buffer The buffer to return the results in
938 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
939 returned in BufferSize.
940 @retval EFI_INVALID_PARAMETER Invalid parameter
941 @retval EFI_SUCCESS Successfully found the requested handle(s) and
942 returns them in Buffer.
948 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
949 IN EFI_GUID
*Protocol OPTIONAL
,
950 IN VOID
*SearchKey OPTIONAL
,
951 IN OUT UINTN
*BufferSize
,
952 OUT EFI_HANDLE
*Buffer
958 Locates the handle to a device on the device path that best matches the specified protocol.
960 @param Protocol The protocol to search for.
961 @param DevicePath On input, a pointer to a pointer to the device
962 path. On output, the device path pointer is
963 modified to point to the remaining part of the
965 @param Device A pointer to the returned device handle.
967 @retval EFI_SUCCESS The resulting handle was returned.
968 @retval EFI_NOT_FOUND No handles matched the search.
969 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
974 CoreLocateDevicePath (
975 IN EFI_GUID
*Protocol
,
976 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
977 OUT EFI_HANDLE
*Device
983 Function returns an array of handles that support the requested protocol
984 in a buffer allocated from pool. This is a version of CoreLocateHandle()
985 that allocates a buffer for the caller.
987 @param SearchType Specifies which handle(s) are to be returned.
988 @param Protocol Provides the protocol to search by. This
989 parameter is only valid for SearchType
991 @param SearchKey Supplies the search key depending on the
993 @param NumberHandles The number of handles returned in Buffer.
994 @param Buffer A pointer to the buffer to return the requested
995 array of handles that support Protocol.
997 @retval EFI_SUCCESS The result array of handles was returned.
998 @retval EFI_NOT_FOUND No handles match the search.
999 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1001 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1006 CoreLocateHandleBuffer (
1007 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1008 IN EFI_GUID
*Protocol OPTIONAL
,
1009 IN VOID
*SearchKey OPTIONAL
,
1010 IN OUT UINTN
*NumberHandles
,
1011 OUT EFI_HANDLE
**Buffer
1017 Return the first Protocol Interface that matches the Protocol GUID. If
1018 Registration is pasased in return a Protocol Instance that was just add
1019 to the system. If Retistration is NULL return the first Protocol Interface
1022 @param Protocol The protocol to search for
1023 @param Registration Optional Registration Key returned from
1024 RegisterProtocolNotify()
1025 @param Interface Return the Protocol interface (instance).
1027 @retval EFI_SUCCESS If a valid Interface is returned
1028 @retval EFI_INVALID_PARAMETER Invalid parameter
1029 @retval EFI_NOT_FOUND Protocol interface not found
1034 CoreLocateProtocol (
1035 IN EFI_GUID
*Protocol
,
1036 IN VOID
*Registration OPTIONAL
,
1037 OUT VOID
**Interface
1042 return handle database key.
1045 @return Handle database key.
1049 CoreGetHandleDatabaseKey (
1055 Go connect any handles that were created or modified while a image executed.
1057 @param Key The Key to show that the handle has been
1062 CoreConnectHandlesByKey (
1069 Connects one or more drivers to a controller.
1071 @param ControllerHandle Handle of the controller to be
1073 @param DriverImageHandle DriverImageHandle A pointer to an
1074 ordered list of driver image
1076 @param RemainingDevicePath RemainingDevicePath A pointer to
1077 the device path that specifies a
1078 child of the controller specified
1079 by ControllerHandle.
1080 @param Recursive Whether the function would be
1081 called recursively or not.
1083 @return Status code.
1088 CoreConnectController (
1089 IN EFI_HANDLE ControllerHandle
,
1090 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1091 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1092 IN BOOLEAN Recursive
1098 Disonnects a controller from a driver
1100 @param ControllerHandle ControllerHandle The handle of
1101 the controller from which
1104 @param DriverImageHandle DriverImageHandle The driver to
1105 disconnect from ControllerHandle.
1106 @param ChildHandle ChildHandle The handle of the
1109 @retval EFI_SUCCESS One or more drivers were
1110 disconnected from the controller.
1111 @retval EFI_SUCCESS On entry, no drivers are managing
1113 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1114 and on entry DriverImageHandle is
1115 not managing ControllerHandle.
1116 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid
1118 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1119 and it is not a valid EFI_HANDLE.
1120 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1121 is not a valid EFI_HANDLE.
1122 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1123 available to disconnect any
1124 drivers from ControllerHandle.
1125 @retval EFI_DEVICE_ERROR The controller could not be
1126 disconnected because of a device
1132 CoreDisconnectController (
1133 IN EFI_HANDLE ControllerHandle
,
1134 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1135 IN EFI_HANDLE ChildHandle OPTIONAL
1141 Allocates pages from the memory map.
1143 @param Type The type of allocation to perform
1144 @param MemoryType The type of memory to turn the allocated pages
1146 @param NumberOfPages The number of pages to allocate
1147 @param Memory A pointer to receive the base allocated memory
1150 @return Status. On success, Memory is filled in with the base address allocated
1151 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1153 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1154 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1155 @retval EFI_SUCCESS Pages successfully allocated.
1161 IN EFI_ALLOCATE_TYPE Type
,
1162 IN EFI_MEMORY_TYPE MemoryType
,
1163 IN UINTN NumberOfPages
,
1164 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1170 Frees previous allocated pages.
1172 @param Memory Base address of memory being freed
1173 @param NumberOfPages The number of pages to free
1175 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1176 @retval EFI_INVALID_PARAMETER Address not aligned
1177 @return EFI_SUCCESS -Pages successfully freed.
1183 IN EFI_PHYSICAL_ADDRESS Memory
,
1184 IN UINTN NumberOfPages
1190 This function returns a copy of the current memory map. The map is an array of
1191 memory descriptors, each of which describes a contiguous block of memory.
1193 @param MemoryMapSize A pointer to the size, in bytes, of the
1194 MemoryMap buffer. On input, this is the size of
1195 the buffer allocated by the caller. On output,
1196 it is the size of the buffer returned by the
1197 firmware if the buffer was large enough, or the
1198 size of the buffer needed to contain the map if
1199 the buffer was too small.
1200 @param MemoryMap A pointer to the buffer in which firmware places
1201 the current memory map.
1202 @param MapKey A pointer to the location in which firmware
1203 returns the key for the current memory map.
1204 @param DescriptorSize A pointer to the location in which firmware
1205 returns the size, in bytes, of an individual
1206 EFI_MEMORY_DESCRIPTOR.
1207 @param DescriptorVersion A pointer to the location in which firmware
1208 returns the version number associated with the
1209 EFI_MEMORY_DESCRIPTOR.
1211 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1213 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1214 buffer size needed to hold the memory map is
1215 returned in MemoryMapSize.
1216 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1222 IN OUT UINTN
*MemoryMapSize
,
1223 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1225 OUT UINTN
*DescriptorSize
,
1226 OUT UINT32
*DescriptorVersion
1232 Allocate pool of a particular type.
1234 @param PoolType Type of pool to allocate
1235 @param Size The amount of pool to allocate
1236 @param Buffer The address to return a pointer to the allocated
1239 @retval EFI_INVALID_PARAMETER PoolType not valid
1240 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1241 @retval EFI_SUCCESS Pool successfully allocated.
1247 IN EFI_MEMORY_TYPE PoolType
,
1257 @param Buffer The allocated pool entry to free
1259 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1260 @retval EFI_SUCCESS Pool successfully freed.
1272 Loads an EFI image into memory and returns a handle to the image.
1274 @param BootPolicy If TRUE, indicates that the request originates
1275 from the boot manager, and that the boot
1276 manager is attempting to load FilePath as a
1278 @param ParentImageHandle The caller's image handle.
1279 @param FilePath The specific file path from which the image is
1281 @param SourceBuffer If not NULL, a pointer to the memory location
1282 containing a copy of the image to be loaded.
1283 @param SourceSize The size in bytes of SourceBuffer.
1284 @param ImageHandle Pointer to the returned image handle that is
1285 created when the image is successfully loaded.
1287 @retval EFI_SUCCESS The image was loaded into memory.
1288 @retval EFI_NOT_FOUND The FilePath was not found.
1289 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1290 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1291 path cannot be parsed to locate the proper
1292 protocol for loading the file.
1293 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1300 IN BOOLEAN BootPolicy
,
1301 IN EFI_HANDLE ParentImageHandle
,
1302 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1303 IN VOID
*SourceBuffer OPTIONAL
,
1304 IN UINTN SourceSize
,
1305 OUT EFI_HANDLE
*ImageHandle
1313 @param ImageHandle Handle that identifies the image to be
1316 @retval EFI_SUCCESS The image has been unloaded.
1317 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1319 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1325 IN EFI_HANDLE ImageHandle
1331 Transfer control to a loaded image's entry point.
1333 @param ImageHandle Handle of image to be started.
1334 @param ExitDataSize Pointer of the size to ExitData
1335 @param ExitData Pointer to a pointer to a data buffer that
1336 includes a Null-terminated Unicode string,
1337 optionally followed by additional binary data.
1338 The string is a description that the caller may
1339 use to further indicate the reason for the
1342 @retval EFI_INVALID_PARAMETER Invalid parameter
1343 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1344 @retval EFI_SUCCESS Successfully transfer control to the image's
1351 IN EFI_HANDLE ImageHandle
,
1352 OUT UINTN
*ExitDataSize
,
1353 OUT CHAR16
**ExitData OPTIONAL
1359 Terminates the currently loaded EFI image and returns control to boot services.
1361 @param ImageHandle Handle that identifies the image. This
1362 parameter is passed to the image on entry.
1363 @param Status The image's exit code.
1364 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1365 ExitStatus is EFI_SUCCESS.
1366 @param ExitData Pointer to a data buffer that includes a
1367 Null-terminated Unicode string, optionally
1368 followed by additional binary data. The string
1369 is a description that the caller may use to
1370 further indicate the reason for the image's
1373 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1375 @retval EFI_SUCCESS Successfully terminates the currently loaded
1377 @retval EFI_ACCESS_DENIED Should never reach there.
1378 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1384 IN EFI_HANDLE ImageHandle
,
1385 IN EFI_STATUS Status
,
1386 IN UINTN ExitDataSize
,
1387 IN CHAR16
*ExitData OPTIONAL
1393 Creates a general-purpose event structure.
1395 @param Type The type of event to create and its mode and
1397 @param NotifyTpl The task priority level of event notifications
1398 @param NotifyFunction Pointer to the events notification function
1399 @param NotifyContext Pointer to the notification functions context;
1400 corresponds to parameter "Context" in the
1401 notification function
1402 @param Event Pointer to the newly created event if the call
1403 succeeds; undefined otherwise
1405 @retval EFI_SUCCESS The event structure was created
1406 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1407 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1414 IN EFI_TPL NotifyTpl
,
1415 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1416 IN VOID
*NotifyContext
, OPTIONAL
1417 OUT EFI_EVENT
*Event
1423 Creates a general-purpose event structure
1425 @param Type The type of event to create and its mode and
1427 @param NotifyTpl The task priority level of event notifications
1428 @param NotifyFunction Pointer to the events notification function
1429 @param NotifyContext Pointer to the notification functions context;
1430 corresponds to parameter "Context" in the
1431 notification function
1432 @param EventGroup GUID for EventGroup if NULL act the same as
1434 @param Event Pointer to the newly created event if the call
1435 succeeds; undefined otherwise
1437 @retval EFI_SUCCESS The event structure was created
1438 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1439 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1446 IN EFI_TPL NotifyTpl
,
1447 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1448 IN CONST VOID
*NotifyContext
, OPTIONAL
1449 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1450 OUT EFI_EVENT
*Event
1456 Sets the type of timer and the trigger time for a timer event.
1458 @param UserEvent The timer event that is to be signaled at the
1460 @param Type The type of time that is specified in
1462 @param TriggerTime The number of 100ns units until the timer
1465 @retval EFI_SUCCESS The event has been set to be signaled at the
1467 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1473 IN EFI_EVENT UserEvent
,
1474 IN EFI_TIMER_DELAY Type
,
1475 IN UINT64 TriggerTime
1481 Signals the event. Queues the event to be notified if needed.
1483 @param UserEvent The event to signal .
1485 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1486 @retval EFI_SUCCESS The event was signaled.
1492 IN EFI_EVENT UserEvent
1498 Stops execution until an event is signaled.
1500 @param NumberOfEvents The number of events in the UserEvents array
1501 @param UserEvents An array of EFI_EVENT
1502 @param UserIndex Pointer to the index of the event which
1503 satisfied the wait condition
1505 @retval EFI_SUCCESS The event indicated by Index was signaled.
1506 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1507 function or Event was not a valid type
1508 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1514 IN UINTN NumberOfEvents
,
1515 IN EFI_EVENT
*UserEvents
,
1516 OUT UINTN
*UserIndex
1522 Closes an event and frees the event structure.
1524 @param UserEvent Event to close
1526 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1527 @retval EFI_SUCCESS The event has been closed
1533 IN EFI_EVENT UserEvent
1539 Check the status of an event.
1541 @param UserEvent The event to check
1543 @retval EFI_SUCCESS The event is in the signaled state
1544 @retval EFI_NOT_READY The event is not in the signaled state
1545 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1551 IN EFI_EVENT UserEvent
1556 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1557 global coherency domain of the processor.
1559 @param GcdMemoryType Memory type of the memory space.
1560 @param BaseAddress Base address of the memory space.
1561 @param Length Length of the memory space.
1562 @param Capabilities alterable attributes of the memory space.
1564 @retval EFI_SUCCESS Merged this memory space into GCD map.
1568 CoreAddMemorySpace (
1569 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1570 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1572 IN UINT64 Capabilities
1577 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1578 I/O resources from the global coherency domain of the processor.
1580 @param GcdAllocateType The type of allocate operation
1581 @param GcdMemoryType The desired memory type
1582 @param Alignment Align with 2^Alignment
1583 @param Length Length to allocate
1584 @param BaseAddress Base address to allocate
1585 @param ImageHandle The image handle consume the allocated space.
1586 @param DeviceHandle The device handle consume the allocated space.
1588 @retval EFI_INVALID_PARAMETER Invalid parameter.
1589 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1590 @retval EFI_SUCCESS Memory space successfully allocated.
1594 CoreAllocateMemorySpace (
1595 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1596 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1599 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1600 IN EFI_HANDLE ImageHandle
,
1601 IN EFI_HANDLE DeviceHandle OPTIONAL
1606 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1607 I/O resources from the global coherency domain of the processor.
1609 @param BaseAddress Base address of the memory space.
1610 @param Length Length of the memory space.
1612 @retval EFI_SUCCESS Space successfully freed.
1616 CoreFreeMemorySpace (
1617 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1623 Removes reserved memory, system memory, or memory-mapped I/O resources from
1624 the global coherency domain of the processor.
1626 @param BaseAddress Base address of the memory space.
1627 @param Length Length of the memory space.
1629 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1633 CoreRemoveMemorySpace (
1634 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1640 Retrieves the descriptor for a memory region containing a specified address.
1642 @param BaseAddress Specified start address
1643 @param Descriptor Specified length
1645 @retval EFI_INVALID_PARAMETER Invalid parameter
1646 @retval EFI_SUCCESS Successfully get memory space descriptor.
1650 CoreGetMemorySpaceDescriptor (
1651 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1652 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1657 Modifies the attributes for a memory region in the global coherency domain of the
1660 @param BaseAddress Specified start address
1661 @param Length Specified length
1662 @param Attributes Specified attributes
1664 @retval EFI_SUCCESS Successfully set attribute of a segment of
1669 CoreSetMemorySpaceAttributes (
1670 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1672 IN UINT64 Attributes
1677 Returns a map of the memory resources in the global coherency domain of the
1680 @param NumberOfDescriptors Number of descriptors.
1681 @param MemorySpaceMap Descriptor array
1683 @retval EFI_INVALID_PARAMETER Invalid parameter
1684 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1685 @retval EFI_SUCCESS Successfully get memory space map.
1689 CoreGetMemorySpaceMap (
1690 OUT UINTN
*NumberOfDescriptors
,
1691 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1696 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1698 @param GcdIoType IO type of the segment.
1699 @param BaseAddress Base address of the segment.
1700 @param Length Length of the segment.
1702 @retval EFI_SUCCESS Merged this segment into GCD map.
1703 @retval EFI_INVALID_PARAMETER Parameter not valid
1708 IN EFI_GCD_IO_TYPE GcdIoType
,
1709 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1715 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1716 domain of the processor.
1718 @param GcdAllocateType The type of allocate operation
1719 @param GcdIoType The desired IO type
1720 @param Alignment Align with 2^Alignment
1721 @param Length Length to allocate
1722 @param BaseAddress Base address to allocate
1723 @param ImageHandle The image handle consume the allocated space.
1724 @param DeviceHandle The device handle consume the allocated space.
1726 @retval EFI_INVALID_PARAMETER Invalid parameter.
1727 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1728 @retval EFI_SUCCESS IO space successfully allocated.
1732 CoreAllocateIoSpace (
1733 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1734 IN EFI_GCD_IO_TYPE GcdIoType
,
1737 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1738 IN EFI_HANDLE ImageHandle
,
1739 IN EFI_HANDLE DeviceHandle OPTIONAL
1744 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1745 domain of the processor.
1747 @param BaseAddress Base address of the segment.
1748 @param Length Length of the segment.
1750 @retval EFI_SUCCESS Space successfully freed.
1755 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1761 Removes reserved I/O or I/O resources from the global coherency domain of the
1764 @param BaseAddress Base address of the segment.
1765 @param Length Length of the segment.
1767 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1772 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1778 Retrieves the descriptor for an I/O region containing a specified address.
1780 @param BaseAddress Specified start address
1781 @param Descriptor Specified length
1783 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1784 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1788 CoreGetIoSpaceDescriptor (
1789 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1790 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1795 Returns a map of the I/O resources in the global coherency domain of the processor.
1797 @param NumberOfDescriptors Number of descriptors.
1798 @param IoSpaceMap Descriptor array
1800 @retval EFI_INVALID_PARAMETER Invalid parameter
1801 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1802 @retval EFI_SUCCESS Successfully get IO space map.
1807 OUT UINTN
*NumberOfDescriptors
,
1808 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1813 This is the main Dispatcher for DXE and it exits when there are no more
1814 drivers to run. Drain the mScheduledQueue and load and start a PE
1815 image for each driver. Search the mDiscoveredList to see if any driver can
1816 be placed on the mScheduledQueue. If no drivers are placed on the
1817 mScheduledQueue exit the function. On exit it is assumed the Bds()
1818 will be called, and when the Bds() exits the Dispatcher will be called
1821 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1822 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1823 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1833 Check every driver and locate a matching one. If the driver is found, the Unrequested
1834 state flag is cleared.
1836 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1837 the firmware file specified by DriverName.
1838 @param DriverName The Driver name to put in the Dependent state.
1840 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1842 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1849 IN EFI_HANDLE FirmwareVolumeHandle
,
1850 IN EFI_GUID
*DriverName
1855 Convert a driver from the Untrused back to the Scheduled state.
1857 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1858 the firmware file specified by DriverName.
1859 @param DriverName The Driver name to put in the Scheduled state
1861 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1862 was promoted to the trusted state.
1863 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1869 IN EFI_HANDLE FirmwareVolumeHandle
,
1870 IN EFI_GUID
*DriverName
1875 Helper function called as part of the code needed
1876 to allocate the proper sized buffer for various
1879 @param Status Current status
1880 @param Buffer Current allocated buffer, or NULL
1881 @param BufferSize Current buffer size needed
1883 @retval TRUE if the buffer was reallocated and the caller
1884 should try the API again.
1885 @retval FALSE buffer could not be allocated and the caller
1886 should not try the API again.
1891 IN OUT EFI_STATUS
*Status
,
1892 IN OUT VOID
**Buffer
,
1898 This routine is the driver initialization entry point. It initializes the
1899 libraries, and registers two notification functions. These notification
1900 functions are responsible for building the FV stack dynamically.
1902 @param ImageHandle The image handle.
1903 @param SystemTable The system table.
1905 @retval EFI_SUCCESS Function successfully returned.
1911 IN EFI_HANDLE ImageHandle
,
1912 IN EFI_SYSTEM_TABLE
*SystemTable
1917 Entry point of the section extraction code. Initializes an instance of the
1918 section extraction interface and installs it on a new handle.
1920 @param ImageHandle A handle for the image that is initializing this driver
1921 @param SystemTable A pointer to the EFI system table
1923 @retval EFI_SUCCESS Driver initialized successfully
1924 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1929 InitializeSectionExtraction (
1930 IN EFI_HANDLE ImageHandle
,
1931 IN EFI_SYSTEM_TABLE
*SystemTable
1936 This DXE service routine is used to process a firmware volume. In
1937 particular, it can be called by BDS to process a single firmware
1938 volume found in a capsule.
1940 @param FvHeader pointer to a firmware volume header
1941 @param Size the size of the buffer pointed to by FvHeader
1942 @param FVProtocolHandle the handle on which a firmware volume protocol
1943 was produced for the firmware volume passed in.
1945 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1947 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1948 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1953 CoreProcessFirmwareVolume (
1956 OUT EFI_HANDLE
*FVProtocolHandle
1960 //Functions used during debug buils
1964 Displays Architectural protocols that were not loaded and are required for DXE
1965 core to function. Only used in Debug Builds.
1969 CoreDisplayMissingArchProtocols (
1975 Traverse the discovered list for any drivers that were discovered but not loaded
1976 because the dependency experessions evaluated to false.
1980 CoreDisplayDiscoveredNotDispatched (
1986 Place holder function until all the Boot Services and Runtime Services are
1989 @return EFI_NOT_AVAILABLE_YET
1994 CoreEfiNotAvailableYetArg0 (
2000 Place holder function until all the Boot Services and Runtime Services are
2003 @param Arg1 Undefined
2005 @return EFI_NOT_AVAILABLE_YET
2010 CoreEfiNotAvailableYetArg1 (
2016 Place holder function until all the Boot Services and Runtime Services are available.
2018 @param Arg1 Undefined
2019 @param Arg2 Undefined
2021 @return EFI_NOT_AVAILABLE_YET
2026 CoreEfiNotAvailableYetArg2 (
2033 Place holder function until all the Boot Services and Runtime Services are available.
2035 @param Arg1 Undefined
2036 @param Arg2 Undefined
2037 @param Arg3 Undefined
2039 @return EFI_NOT_AVAILABLE_YET
2044 CoreEfiNotAvailableYetArg3 (
2052 Place holder function until all the Boot Services and Runtime Services are available.
2054 @param Arg1 Undefined
2055 @param Arg2 Undefined
2056 @param Arg3 Undefined
2057 @param Arg4 Undefined
2059 @return EFI_NOT_AVAILABLE_YET
2064 CoreEfiNotAvailableYetArg4 (
2073 Place holder function until all the Boot Services and Runtime Services are available.
2075 @param Arg1 Undefined
2076 @param Arg2 Undefined
2077 @param Arg3 Undefined
2078 @param Arg4 Undefined
2079 @param Arg5 Undefined
2081 @return EFI_NOT_AVAILABLE_YET
2086 CoreEfiNotAvailableYetArg5 (
2096 Given a compressed source buffer, this function retrieves the size of the
2097 uncompressed buffer and the size of the scratch buffer required to decompress
2098 the compressed source buffer.
2100 The GetInfo() function retrieves the size of the uncompressed buffer and the
2101 temporary scratch buffer required to decompress the buffer specified by Source
2102 and SourceSize. If the size of the uncompressed buffer or the size of the
2103 scratch buffer cannot be determined from the compressed data specified by
2104 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2105 size of the uncompressed buffer is returned in DestinationSize, the size of
2106 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2107 The GetInfo() function does not have scratch buffer available to perform a
2108 thorough checking of the validity of the source data. It just retrieves the
2109 "Original Size" field from the beginning bytes of the source data and output
2110 it as DestinationSize. And ScratchSize is specific to the decompression
2113 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2114 @param Source The source buffer containing the compressed data.
2115 @param SourceSize The size, in bytes, of the source buffer.
2116 @param DestinationSize A pointer to the size, in bytes, of the
2117 uncompressed buffer that will be generated when the
2118 compressed buffer specified by Source and
2119 SourceSize is decompressed.
2120 @param ScratchSize A pointer to the size, in bytes, of the scratch
2121 buffer that is required to decompress the
2122 compressed buffer specified by Source and
2125 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2126 DestinationSize and the size of the scratch buffer
2127 was returned in ScratchSize.
2128 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2129 the scratch buffer cannot be determined from the
2130 compressed data specified by Source and
2136 DxeMainUefiDecompressGetInfo (
2137 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2139 IN UINT32 SourceSize
,
2140 OUT UINT32
*DestinationSize
,
2141 OUT UINT32
*ScratchSize
2146 Decompresses a compressed source buffer.
2148 The Decompress() function extracts decompressed data to its original form.
2149 This protocol is designed so that the decompression algorithm can be
2150 implemented without using any memory services. As a result, the Decompress()
2151 Function is not allowed to call AllocatePool() or AllocatePages() in its
2152 implementation. It is the caller's responsibility to allocate and free the
2153 Destination and Scratch buffers.
2154 If the compressed source data specified by Source and SourceSize is
2155 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2156 the compressed source data specified by Source and SourceSize is not in a
2157 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2159 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2160 @param Source The source buffer containing the compressed data.
2161 @param SourceSize SourceSizeThe size of source data.
2162 @param Destination On output, the destination buffer that contains
2163 the uncompressed data.
2164 @param DestinationSize The size of the destination buffer. The size of
2165 the destination buffer needed is obtained from
2166 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2167 @param Scratch A temporary scratch buffer that is used to perform
2169 @param ScratchSize The size of scratch buffer. The size of the
2170 scratch buffer needed is obtained from GetInfo().
2172 @retval EFI_SUCCESS Decompression completed successfully, and the
2173 uncompressed buffer is returned in Destination.
2174 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2175 SourceSize is corrupted (not in a valid
2181 DxeMainUefiDecompress (
2182 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2184 IN UINT32 SourceSize
,
2185 IN OUT VOID
*Destination
,
2186 IN UINT32 DestinationSize
,
2187 IN OUT VOID
*Scratch
,
2188 IN UINT32 ScratchSize
2192 SEP member function. This function creates and returns a new section stream
2193 handle to represent the new section stream.
2195 @param SectionStreamLength Size in bytes of the section stream.
2196 @param SectionStream Buffer containing the new section stream.
2197 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2198 output contains the new section stream handle.
2200 @retval EFI_SUCCESS The section stream is created successfully.
2201 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2202 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2209 IN UINTN SectionStreamLength
,
2210 IN VOID
*SectionStream
,
2211 OUT UINTN
*SectionStreamHandle
2217 SEP member function. Retrieves requested section from section stream.
2219 @param SectionStreamHandle The section stream from which to extract the
2221 @param SectionType A pointer to the type of section to search for.
2222 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2223 then SectionDefinitionGuid indicates which of
2224 these types of sections to search for.
2225 @param SectionInstance Indicates which instance of the requested
2227 @param Buffer Double indirection to buffer. If *Buffer is
2228 non-null on input, then the buffer is caller
2229 allocated. If Buffer is NULL, then the buffer
2230 is callee allocated. In either case, the
2231 requried buffer size is returned in *BufferSize.
2232 @param BufferSize On input, indicates the size of *Buffer if
2233 *Buffer is non-null on input. On output,
2234 indicates the required size (allocated size if
2235 callee allocated) of *Buffer.
2236 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2237 indicates the authentication status of the
2238 output buffer. If the input section's
2239 GuidedSectionHeader.Attributes field
2240 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2241 bit as clear, AuthenticationStatus must return
2242 zero. Both local bits (19:16) and aggregate
2243 bits (3:0) in AuthenticationStatus are returned
2244 by ExtractSection(). These bits reflect the
2245 status of the extraction operation. The bit
2246 pattern in both regions must be the same, as
2247 the local and aggregate authentication statuses
2248 have equivalent meaning at this level. If the
2249 function returns anything other than
2250 EFI_SUCCESS, the value of *AuthenticationStatus
2253 @retval EFI_SUCCESS Section was retrieved successfully
2254 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2255 section stream with its
2256 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2257 but there was no corresponding GUIDed Section
2258 Extraction Protocol in the handle database.
2259 *Buffer is unmodified.
2260 @retval EFI_NOT_FOUND An error was encountered when parsing the
2261 SectionStream. This indicates the SectionStream
2262 is not correctly formatted.
2263 @retval EFI_NOT_FOUND The requested section does not exist.
2264 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2266 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2267 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2268 insufficient to contain the requested section.
2269 The input buffer is filled and section contents
2276 IN UINTN SectionStreamHandle
,
2277 IN EFI_SECTION_TYPE
*SectionType
,
2278 IN EFI_GUID
*SectionDefinitionGuid
,
2279 IN UINTN SectionInstance
,
2281 IN OUT UINTN
*BufferSize
,
2282 OUT UINT32
*AuthenticationStatus
2287 SEP member function. Deletes an existing section stream
2289 @param StreamHandleToClose Indicates the stream to close
2291 @retval EFI_SUCCESS The section stream is closed sucessfully.
2292 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2293 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2299 CloseSectionStream (
2300 IN UINTN StreamHandleToClose