2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
15 #include <Protocol/LoadedImage.h>
16 #include <Protocol/GuidedSectionExtraction.h>
17 #include <Protocol/DevicePath.h>
18 #include <Protocol/Runtime.h>
19 #include <Protocol/LoadFile.h>
20 #include <Protocol/LoadFile2.h>
21 #include <Protocol/DriverBinding.h>
22 #include <Protocol/VariableWrite.h>
23 #include <Protocol/PlatformDriverOverride.h>
24 #include <Protocol/Variable.h>
25 #include <Protocol/Timer.h>
26 #include <Protocol/SimpleFileSystem.h>
27 #include <Protocol/Bds.h>
28 #include <Protocol/RealTimeClock.h>
29 #include <Protocol/WatchdogTimer.h>
30 #include <Protocol/FirmwareVolume2.h>
31 #include <Protocol/MonotonicCounter.h>
32 #include <Protocol/StatusCode.h>
33 #include <Protocol/Decompress.h>
34 #include <Protocol/LoadPe32Image.h>
35 #include <Protocol/Security.h>
36 #include <Protocol/Security2.h>
37 #include <Protocol/Reset.h>
38 #include <Protocol/Cpu.h>
39 #include <Protocol/Metronome.h>
40 #include <Protocol/FirmwareVolumeBlock.h>
41 #include <Protocol/Capsule.h>
42 #include <Protocol/BusSpecificDriverOverride.h>
43 #include <Protocol/DriverFamilyOverride.h>
44 #include <Protocol/TcgService.h>
45 #include <Protocol/HiiPackageList.h>
46 #include <Protocol/SmmBase2.h>
47 #include <Protocol/PeCoffImageEmulator.h>
48 #include <Guid/MemoryTypeInformation.h>
49 #include <Guid/FirmwareFileSystem2.h>
50 #include <Guid/FirmwareFileSystem3.h>
51 #include <Guid/HobList.h>
52 #include <Guid/DebugImageInfoTable.h>
53 #include <Guid/FileInfo.h>
54 #include <Guid/Apriori.h>
55 #include <Guid/DxeServices.h>
56 #include <Guid/MemoryAllocationHob.h>
57 #include <Guid/EventLegacyBios.h>
58 #include <Guid/EventGroup.h>
59 #include <Guid/EventExitBootServiceFailed.h>
60 #include <Guid/LoadModuleAtFixedAddress.h>
61 #include <Guid/IdleLoopEvent.h>
62 #include <Guid/VectorHandoffTable.h>
63 #include <Ppi/VectorHandoffInfo.h>
64 #include <Guid/MemoryProfile.h>
66 #include <Library/DxeCoreEntryPoint.h>
67 #include <Library/DebugLib.h>
68 #include <Library/UefiLib.h>
69 #include <Library/BaseLib.h>
70 #include <Library/HobLib.h>
71 #include <Library/PerformanceLib.h>
72 #include <Library/UefiDecompressLib.h>
73 #include <Library/ExtractGuidedSectionLib.h>
74 #include <Library/CacheMaintenanceLib.h>
75 #include <Library/BaseMemoryLib.h>
76 #include <Library/PeCoffLib.h>
77 #include <Library/PeCoffGetEntryPointLib.h>
78 #include <Library/PeCoffExtraActionLib.h>
79 #include <Library/PcdLib.h>
80 #include <Library/MemoryAllocationLib.h>
81 #include <Library/DevicePathLib.h>
82 #include <Library/UefiBootServicesTableLib.h>
83 #include <Library/ReportStatusCodeLib.h>
84 #include <Library/DxeServicesLib.h>
85 #include <Library/DebugAgentLib.h>
86 #include <Library/CpuExceptionHandlerLib.h>
89 // attributes for reserved memory before it is promoted to system memory
91 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
92 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
93 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
96 // range for memory mapped port I/O on IPF
98 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
101 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression
102 /// to save time. A EFI_DEP_PUSH is evaluated one an
103 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
104 /// Driver Execution Environment Core Interface use 0xff
105 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
106 /// defined to a new value that is not conflicting with PI spec.
108 #define EFI_DEP_REPLACE_TRUE 0xff
111 /// Define the initial size of the dependency expression evaluation stack
113 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
116 EFI_GUID
*ProtocolGuid
;
121 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
124 // DXE Dispatcher Data structures
127 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
130 LIST_ENTRY Link
; // mFvHandleList
135 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
138 LIST_ENTRY Link
; // mDriverList
140 LIST_ENTRY ScheduledLink
; // mScheduledQueue
144 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
145 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
152 EFI_GUID BeforeAfterGuid
;
159 BOOLEAN DepexProtocolError
;
161 EFI_HANDLE ImageHandle
;
163 } EFI_CORE_DRIVER_ENTRY
;
166 // The data structure of GCD memory map entry
168 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
172 EFI_PHYSICAL_ADDRESS BaseAddress
;
176 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
177 EFI_GCD_IO_TYPE GcdIoType
;
178 EFI_HANDLE ImageHandle
;
179 EFI_HANDLE DeviceHandle
;
182 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
190 /// If entrypoint has been called
192 /// The image's entry point
193 EFI_IMAGE_ENTRY_POINT EntryPoint
;
194 /// loaded image protocol
195 EFI_LOADED_IMAGE_PROTOCOL Info
;
196 /// Location in memory
197 EFI_PHYSICAL_ADDRESS ImageBasePage
;
200 /// Original fixup data
202 /// Tpl of started image
204 /// Status returned by started image
206 /// Size of ExitData from started image
208 /// Pointer to exit data from started image
210 /// Pointer to pool allocation for context save/restore
212 /// Pointer to buffer for context save/restore
213 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
214 /// Machine type from PE image
216 /// PE/COFF Image Emulator Protocol pointer
217 EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL
*PeCoffEmu
;
218 /// Runtime image list
219 EFI_RUNTIME_IMAGE_ENTRY
*RuntimeData
;
220 /// Pointer to Loaded Image Device Path Protocol
221 EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
;
222 /// PeCoffLoader ImageContext
223 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
224 /// Status returned by LoadImage() service.
225 EFI_STATUS LoadImageStatus
;
226 } LOADED_IMAGE_PRIVATE_DATA
;
228 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
229 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
231 #define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')
236 EFI_PHYSICAL_ADDRESS CodeSegmentBase
;
237 UINT64 CodeSegmentSize
;
238 } IMAGE_PROPERTIES_RECORD_CODE_SECTION
;
240 #define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')
245 EFI_PHYSICAL_ADDRESS ImageBase
;
247 UINTN CodeSegmentCount
;
248 LIST_ENTRY CodeSegmentList
;
249 } IMAGE_PROPERTIES_RECORD
;
252 // DXE Core Global Variables
254 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
255 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
256 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
257 extern EFI_HANDLE gDxeCoreImageHandle
;
259 extern BOOLEAN gMemoryMapTerminated
;
261 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
263 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
264 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
265 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
266 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
267 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
268 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
269 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
270 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
271 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
273 extern EFI_TPL gEfiCurrentTpl
;
275 extern EFI_GUID
*gDxeCoreFileName
;
276 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
278 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
280 extern BOOLEAN gDispatcherRunning
;
281 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
283 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
284 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
286 // Service Initialization Functions
290 Called to initialize the pool.
299 Called to initialize the memory map and add descriptors to
300 the current descriptor list.
301 The first descriptor that is added must be general usable
302 memory as the addition allocates heap.
304 @param Type The type of memory to add
305 @param Start The starting address in the memory range Must be
307 @param NumberOfPages The number of pages in the range
308 @param Attribute Attributes of the memory to add
310 @return None. The range is added to the memory map
314 CoreAddMemoryDescriptor (
315 IN EFI_MEMORY_TYPE Type
,
316 IN EFI_PHYSICAL_ADDRESS Start
,
317 IN UINT64 NumberOfPages
,
322 Release memory lock on mGcdMemorySpaceLock.
326 CoreReleaseGcdMemoryLock (
331 Acquire memory lock on mGcdMemorySpaceLock.
335 CoreAcquireGcdMemoryLock (
340 External function. Initializes memory services based on the memory
341 descriptor HOBs. This function is responsible for priming the memory
342 map, so memory allocations and resource allocations can be made.
343 The first part of this function can not depend on any memory services
344 until at least one memory descriptor is provided to the memory services.
346 @param HobStart The start address of the HOB.
347 @param MemoryBaseAddress Start address of memory region found to init DXE
349 @param MemoryLength Length of memory region found to init DXE core.
351 @retval EFI_SUCCESS Memory services successfully initialized.
355 CoreInitializeMemoryServices (
357 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
358 OUT UINT64
*MemoryLength
362 External function. Initializes the GCD and memory services based on the memory
363 descriptor HOBs. This function is responsible for priming the GCD map and the
364 memory map, so memory allocations and resource allocations can be made. The
365 HobStart will be relocated to a pool buffer.
367 @param HobStart The start address of the HOB
368 @param MemoryBaseAddress Start address of memory region found to init DXE
370 @param MemoryLength Length of memory region found to init DXE core.
372 @retval EFI_SUCCESS GCD services successfully initialized.
376 CoreInitializeGcdServices (
377 IN OUT VOID
**HobStart
,
378 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
379 IN UINT64 MemoryLength
383 Initializes "event" support.
385 @retval EFI_SUCCESS Always return success
389 CoreInitializeEventServices (
394 Add the Image Services to EFI Boot Services Table and install the protocol
395 interfaces for this image.
397 @param HobStart The HOB to initialize
403 CoreInitializeImageServices (
408 Creates an event that is fired everytime a Protocol of a specific type is installed.
412 CoreNotifyOnProtocolInstallation (
417 Return TRUE if all AP services are available.
419 @retval EFI_SUCCESS All AP services are available
420 @retval EFI_NOT_FOUND At least one AP service is not available
424 CoreAllEfiServicesAvailable (
429 Calcualte the 32-bit CRC in a EFI table using the service provided by the
432 @param Hdr Pointer to an EFI standard header
437 IN OUT EFI_TABLE_HEADER
*Hdr
441 Called by the platform code to process a tick.
443 @param Duration The number of 100ns elapsed since the last call
454 Initialize the dispatcher. Initialize the notification function that runs when
455 an FV2 protocol is added to the system.
459 CoreInitializeDispatcher (
464 This is the POSTFIX version of the dependency evaluator. This code does
465 not need to handle Before or After, as it is not valid to call this
466 routine in this case. The SOR is just ignored and is a nop in the grammer.
467 POSTFIX means all the math is done on top of the stack.
469 @param DriverEntry DriverEntry element to update.
471 @retval TRUE If driver is ready to run.
472 @retval FALSE If driver is not ready to run or some fatal error
478 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
482 Preprocess dependency expression and update DriverEntry to reflect the
483 state of Before, After, and SOR dependencies. If DriverEntry->Before
484 or DriverEntry->After is set it will never be cleared. If SOR is set
485 it will be cleared by CoreSchedule(), and then the driver can be
488 @param DriverEntry DriverEntry element to update .
490 @retval EFI_SUCCESS It always works.
494 CorePreProcessDepex (
495 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
499 Terminates all boot services.
501 @param ImageHandle Handle that identifies the exiting image.
502 @param MapKey Key to the latest memory map.
504 @retval EFI_SUCCESS Boot Services terminated
505 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
510 CoreExitBootServices (
511 IN EFI_HANDLE ImageHandle
,
516 Make sure the memory map is following all the construction rules,
517 it is the last time to check memory map error before exit boot services.
519 @param MapKey Memory map key
521 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
523 @retval EFI_SUCCESS Valid memory map.
527 CoreTerminateMemoryMap (
532 Signals all events in the EventGroup.
534 @param EventGroup The list to signal
538 CoreNotifySignalList (
539 IN EFI_GUID
*EventGroup
543 Boot Service called to add, modify, or remove a system configuration table from
544 the EFI System Table.
546 @param Guid Pointer to the GUID for the entry to add, update, or
548 @param Table Pointer to the configuration table for the entry to add,
549 update, or remove, may be NULL.
551 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
552 @return EFI_INVALID_PARAMETER Input GUID not valid.
553 @return EFI_NOT_FOUND Attempted to delete non-existant entry
554 @return EFI_OUT_OF_RESOURCES Not enough memory available
559 CoreInstallConfigurationTable (
565 Raise the task priority level to the new level.
566 High level is implemented by disabling processor interrupts.
568 @param NewTpl New task priority level
570 @return The previous task priority level
580 Lowers the task priority to the previous value. If the new
581 priority unmasks events at a higher priority, they are dispatched.
583 @param NewTpl New, lower, task priority
593 Introduces a fine-grained stall.
595 @param Microseconds The number of microseconds to stall execution.
597 @retval EFI_SUCCESS Execution was stalled for at least the requested
598 amount of microseconds.
599 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
605 IN UINTN Microseconds
609 Sets the system's watchdog timer.
611 @param Timeout The number of seconds to set the watchdog timer to.
612 A value of zero disables the timer.
613 @param WatchdogCode The numeric code to log on a watchdog timer timeout
614 event. The firmware reserves codes 0x0000 to 0xFFFF.
615 Loaders and operating systems may use other timeout
617 @param DataSize The size, in bytes, of WatchdogData.
618 @param WatchdogData A data buffer that includes a Null-terminated Unicode
619 string, optionally followed by additional binary data.
620 The string is a description that the call may use to
621 further indicate the reason to be logged with a
624 @return EFI_SUCCESS Timeout has been set
625 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
626 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
627 @return EFI_DEVICE_ERROR Could not complete due to hardware error
632 CoreSetWatchdogTimer (
634 IN UINT64 WatchdogCode
,
636 IN CHAR16
*WatchdogData OPTIONAL
640 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
641 Calls the private one which contains a BOOLEAN parameter for notifications
643 @param UserHandle The handle to install the protocol handler on,
644 or NULL if a new handle is to be allocated
645 @param Protocol The protocol to add to the handle
646 @param InterfaceType Indicates whether Interface is supplied in
648 @param Interface The interface for the protocol being added
655 CoreInstallProtocolInterface (
656 IN OUT EFI_HANDLE
*UserHandle
,
657 IN EFI_GUID
*Protocol
,
658 IN EFI_INTERFACE_TYPE InterfaceType
,
663 Installs a protocol interface into the boot services environment.
665 @param UserHandle The handle to install the protocol handler on,
666 or NULL if a new handle is to be allocated
667 @param Protocol The protocol to add to the handle
668 @param InterfaceType Indicates whether Interface is supplied in
670 @param Interface The interface for the protocol being added
671 @param Notify indicates whether notify the notification list
674 @retval EFI_INVALID_PARAMETER Invalid parameter
675 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
676 @retval EFI_SUCCESS Protocol interface successfully installed
680 CoreInstallProtocolInterfaceNotify (
681 IN OUT EFI_HANDLE
*UserHandle
,
682 IN EFI_GUID
*Protocol
,
683 IN EFI_INTERFACE_TYPE InterfaceType
,
689 Installs a list of protocol interface into the boot services environment.
690 This function calls InstallProtocolInterface() in a loop. If any error
691 occures all the protocols added by this function are removed. This is
692 basically a lib function to save space.
694 @param Handle The handle to install the protocol handlers on,
695 or NULL if a new handle is to be allocated
696 @param ... EFI_GUID followed by protocol instance. A NULL
697 terminates the list. The pairs are the
698 arguments to InstallProtocolInterface(). All the
699 protocols are added to Handle.
701 @retval EFI_SUCCESS All the protocol interface was installed.
702 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
703 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
705 @retval EFI_INVALID_PARAMETER Handle is NULL.
706 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
711 CoreInstallMultipleProtocolInterfaces (
712 IN OUT EFI_HANDLE
*Handle
,
717 Uninstalls a list of protocol interface in the boot services environment.
718 This function calls UnisatllProtocolInterface() in a loop. This is
719 basically a lib function to save space.
721 @param Handle The handle to uninstall the protocol
722 @param ... EFI_GUID followed by protocol instance. A NULL
723 terminates the list. The pairs are the
724 arguments to UninstallProtocolInterface(). All
725 the protocols are added to Handle.
732 CoreUninstallMultipleProtocolInterfaces (
733 IN EFI_HANDLE Handle
,
738 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
740 @param UserHandle Handle on which the interface is to be
742 @param Protocol The numeric ID of the interface
743 @param OldInterface A pointer to the old interface
744 @param NewInterface A pointer to the new interface
746 @retval EFI_SUCCESS The protocol interface was installed
747 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
748 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
753 CoreReinstallProtocolInterface (
754 IN EFI_HANDLE UserHandle
,
755 IN EFI_GUID
*Protocol
,
756 IN VOID
*OldInterface
,
757 IN VOID
*NewInterface
761 Uninstalls all instances of a protocol:interfacer from a handle.
762 If the last protocol interface is remove from the handle, the
765 @param UserHandle The handle to remove the protocol handler from
766 @param Protocol The protocol, of protocol:interface, to remove
767 @param Interface The interface, of protocol:interface, to remove
769 @retval EFI_INVALID_PARAMETER Protocol is NULL.
770 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
775 CoreUninstallProtocolInterface (
776 IN EFI_HANDLE UserHandle
,
777 IN EFI_GUID
*Protocol
,
782 Queries a handle to determine if it supports a specified protocol.
784 @param UserHandle The handle being queried.
785 @param Protocol The published unique identifier of the protocol.
786 @param Interface Supplies the address where a pointer to the
787 corresponding Protocol Interface is returned.
789 @return The requested protocol interface for the handle
795 IN EFI_HANDLE UserHandle
,
796 IN EFI_GUID
*Protocol
,
801 Locates the installed protocol handler for the handle, and
802 invokes it to obtain the protocol interface. Usage information
803 is registered in the protocol data base.
805 @param UserHandle The handle to obtain the protocol interface on
806 @param Protocol The ID of the protocol
807 @param Interface The location to return the protocol interface
808 @param ImageHandle The handle of the Image that is opening the
809 protocol interface specified by Protocol and
811 @param ControllerHandle The controller handle that is requiring this
813 @param Attributes The open mode of the protocol interface
814 specified by Handle and Protocol.
816 @retval EFI_INVALID_PARAMETER Protocol is NULL.
817 @retval EFI_SUCCESS Get the protocol interface.
823 IN EFI_HANDLE UserHandle
,
824 IN EFI_GUID
*Protocol
,
825 OUT VOID
**Interface OPTIONAL
,
826 IN EFI_HANDLE ImageHandle
,
827 IN EFI_HANDLE ControllerHandle
,
832 Return information about Opened protocols in the system
834 @param UserHandle The handle to close the protocol interface on
835 @param Protocol The ID of the protocol
836 @param EntryBuffer A pointer to a buffer of open protocol
837 information in the form of
838 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
839 @param EntryCount Number of EntryBuffer entries
844 CoreOpenProtocolInformation (
845 IN EFI_HANDLE UserHandle
,
846 IN EFI_GUID
*Protocol
,
847 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
848 OUT UINTN
*EntryCount
852 Closes a protocol on a handle that was opened using OpenProtocol().
854 @param UserHandle The handle for the protocol interface that was
855 previously opened with OpenProtocol(), and is
857 @param Protocol The published unique identifier of the protocol.
858 It is the caller's responsibility to pass in a
860 @param AgentHandle The handle of the agent that is closing the
862 @param ControllerHandle If the agent that opened a protocol is a driver
863 that follows the EFI Driver Model, then this
864 parameter is the controller handle that required
865 the protocol interface. If the agent does not
866 follow the EFI Driver Model, then this parameter
867 is optional and may be NULL.
869 @retval EFI_SUCCESS The protocol instance was closed.
870 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
872 @retval EFI_NOT_FOUND Can not find the specified protocol or
879 IN EFI_HANDLE UserHandle
,
880 IN EFI_GUID
*Protocol
,
881 IN EFI_HANDLE AgentHandle
,
882 IN EFI_HANDLE ControllerHandle
886 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
889 @param UserHandle The handle from which to retrieve the list of
890 protocol interface GUIDs.
891 @param ProtocolBuffer A pointer to the list of protocol interface GUID
892 pointers that are installed on Handle.
893 @param ProtocolBufferCount A pointer to the number of GUID pointers present
896 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
897 on Handle was returned in ProtocolBuffer. The
898 number of protocol interface GUIDs was returned
899 in ProtocolBufferCount.
900 @retval EFI_INVALID_PARAMETER Handle is NULL.
901 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
902 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
903 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
904 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
910 CoreProtocolsPerHandle (
911 IN EFI_HANDLE UserHandle
,
912 OUT EFI_GUID
***ProtocolBuffer
,
913 OUT UINTN
*ProtocolBufferCount
917 Add a new protocol notification record for the request protocol.
919 @param Protocol The requested protocol to add the notify
921 @param Event The event to signal
922 @param Registration Returns the registration record
924 @retval EFI_INVALID_PARAMETER Invalid parameter
925 @retval EFI_SUCCESS Successfully returned the registration record
931 CoreRegisterProtocolNotify (
932 IN EFI_GUID
*Protocol
,
934 OUT VOID
**Registration
938 Removes all the events in the protocol database that match Event.
940 @param Event The event to search for in the protocol
943 @return EFI_SUCCESS when done searching the entire database.
947 CoreUnregisterProtocolNotify (
952 Locates the requested handle(s) and returns them in Buffer.
954 @param SearchType The type of search to perform to locate the
956 @param Protocol The protocol to search for
957 @param SearchKey Dependant on SearchType
958 @param BufferSize On input the size of Buffer. On output the
959 size of data returned.
960 @param Buffer The buffer to return the results in
962 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
963 returned in BufferSize.
964 @retval EFI_INVALID_PARAMETER Invalid parameter
965 @retval EFI_SUCCESS Successfully found the requested handle(s) and
966 returns them in Buffer.
972 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
973 IN EFI_GUID
*Protocol OPTIONAL
,
974 IN VOID
*SearchKey OPTIONAL
,
975 IN OUT UINTN
*BufferSize
,
976 OUT EFI_HANDLE
*Buffer
980 Locates the handle to a device on the device path that best matches the specified protocol.
982 @param Protocol The protocol to search for.
983 @param DevicePath On input, a pointer to a pointer to the device
984 path. On output, the device path pointer is
985 modified to point to the remaining part of the
987 @param Device A pointer to the returned device handle.
989 @retval EFI_SUCCESS The resulting handle was returned.
990 @retval EFI_NOT_FOUND No handles matched the search.
991 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
996 CoreLocateDevicePath (
997 IN EFI_GUID
*Protocol
,
998 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
999 OUT EFI_HANDLE
*Device
1003 Function returns an array of handles that support the requested protocol
1004 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1005 that allocates a buffer for the caller.
1007 @param SearchType Specifies which handle(s) are to be returned.
1008 @param Protocol Provides the protocol to search by. This
1009 parameter is only valid for SearchType
1011 @param SearchKey Supplies the search key depending on the
1013 @param NumberHandles The number of handles returned in Buffer.
1014 @param Buffer A pointer to the buffer to return the requested
1015 array of handles that support Protocol.
1017 @retval EFI_SUCCESS The result array of handles was returned.
1018 @retval EFI_NOT_FOUND No handles match the search.
1019 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1021 @retval EFI_INVALID_PARAMETER One or more parameters are not valid.
1026 CoreLocateHandleBuffer (
1027 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1028 IN EFI_GUID
*Protocol OPTIONAL
,
1029 IN VOID
*SearchKey OPTIONAL
,
1030 IN OUT UINTN
*NumberHandles
,
1031 OUT EFI_HANDLE
**Buffer
1035 Return the first Protocol Interface that matches the Protocol GUID. If
1036 Registration is passed in, return a Protocol Instance that was just add
1037 to the system. If Registration is NULL return the first Protocol Interface
1040 @param Protocol The protocol to search for
1041 @param Registration Optional Registration Key returned from
1042 RegisterProtocolNotify()
1043 @param Interface Return the Protocol interface (instance).
1045 @retval EFI_SUCCESS If a valid Interface is returned
1046 @retval EFI_INVALID_PARAMETER Invalid parameter
1047 @retval EFI_NOT_FOUND Protocol interface not found
1052 CoreLocateProtocol (
1053 IN EFI_GUID
*Protocol
,
1054 IN VOID
*Registration OPTIONAL
,
1055 OUT VOID
**Interface
1059 return handle database key.
1062 @return Handle database key.
1066 CoreGetHandleDatabaseKey (
1071 Go connect any handles that were created or modified while a image executed.
1073 @param Key The Key to show that the handle has been
1078 CoreConnectHandlesByKey (
1083 Connects one or more drivers to a controller.
1085 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1086 @param DriverImageHandle A pointer to an ordered list handles that support the
1087 EFI_DRIVER_BINDING_PROTOCOL.
1088 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1089 controller specified by ControllerHandle.
1090 @param Recursive If TRUE, then ConnectController() is called recursively
1091 until the entire tree of controllers below the controller specified
1092 by ControllerHandle have been created. If FALSE, then
1093 the tree of controllers is only expanded one level.
1095 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1096 2) No drivers were connected to ControllerHandle, but
1097 RemainingDevicePath is not NULL, and it is an End Device
1099 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1100 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1101 present in the system.
1102 2) No drivers were connected to ControllerHandle.
1103 @retval EFI_SECURITY_VIOLATION
1104 The user has no permission to start UEFI device drivers on the device path
1105 associated with the ControllerHandle or specified by the RemainingDevicePath.
1110 CoreConnectController (
1111 IN EFI_HANDLE ControllerHandle
,
1112 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1113 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1114 IN BOOLEAN Recursive
1118 Disonnects a controller from a driver
1120 @param ControllerHandle ControllerHandle The handle of
1121 the controller from which
1124 @param DriverImageHandle DriverImageHandle The driver to
1125 disconnect from ControllerHandle.
1126 @param ChildHandle ChildHandle The handle of the
1129 @retval EFI_SUCCESS One or more drivers were
1130 disconnected from the controller.
1131 @retval EFI_SUCCESS On entry, no drivers are managing
1133 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1134 and on entry DriverImageHandle is
1135 not managing ControllerHandle.
1136 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1137 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1138 and it is not a valid EFI_HANDLE.
1139 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1140 is not a valid EFI_HANDLE.
1141 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1142 available to disconnect any
1143 drivers from ControllerHandle.
1144 @retval EFI_DEVICE_ERROR The controller could not be
1145 disconnected because of a device
1151 CoreDisconnectController (
1152 IN EFI_HANDLE ControllerHandle
,
1153 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1154 IN EFI_HANDLE ChildHandle OPTIONAL
1158 Allocates pages from the memory map.
1160 @param Type The type of allocation to perform
1161 @param MemoryType The type of memory to turn the allocated pages
1163 @param NumberOfPages The number of pages to allocate
1164 @param Memory A pointer to receive the base allocated memory
1167 @return Status. On success, Memory is filled in with the base address allocated
1168 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1170 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1171 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1172 @retval EFI_SUCCESS Pages successfully allocated.
1178 IN EFI_ALLOCATE_TYPE Type
,
1179 IN EFI_MEMORY_TYPE MemoryType
,
1180 IN UINTN NumberOfPages
,
1181 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1185 Frees previous allocated pages.
1187 @param Memory Base address of memory being freed
1188 @param NumberOfPages The number of pages to free
1190 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1191 @retval EFI_INVALID_PARAMETER Address not aligned
1192 @return EFI_SUCCESS -Pages successfully freed.
1198 IN EFI_PHYSICAL_ADDRESS Memory
,
1199 IN UINTN NumberOfPages
1203 This function returns a copy of the current memory map. The map is an array of
1204 memory descriptors, each of which describes a contiguous block of memory.
1206 @param MemoryMapSize A pointer to the size, in bytes, of the
1207 MemoryMap buffer. On input, this is the size of
1208 the buffer allocated by the caller. On output,
1209 it is the size of the buffer returned by the
1210 firmware if the buffer was large enough, or the
1211 size of the buffer needed to contain the map if
1212 the buffer was too small.
1213 @param MemoryMap A pointer to the buffer in which firmware places
1214 the current memory map.
1215 @param MapKey A pointer to the location in which firmware
1216 returns the key for the current memory map.
1217 @param DescriptorSize A pointer to the location in which firmware
1218 returns the size, in bytes, of an individual
1219 EFI_MEMORY_DESCRIPTOR.
1220 @param DescriptorVersion A pointer to the location in which firmware
1221 returns the version number associated with the
1222 EFI_MEMORY_DESCRIPTOR.
1224 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1226 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1227 buffer size needed to hold the memory map is
1228 returned in MemoryMapSize.
1229 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1235 IN OUT UINTN
*MemoryMapSize
,
1236 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1238 OUT UINTN
*DescriptorSize
,
1239 OUT UINT32
*DescriptorVersion
1243 Allocate pool of a particular type.
1245 @param PoolType Type of pool to allocate
1246 @param Size The amount of pool to allocate
1247 @param Buffer The address to return a pointer to the allocated
1250 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1251 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1252 @retval EFI_SUCCESS Pool successfully allocated.
1258 IN EFI_MEMORY_TYPE PoolType
,
1264 Allocate pool of a particular type.
1266 @param PoolType Type of pool to allocate
1267 @param Size The amount of pool to allocate
1268 @param Buffer The address to return a pointer to the allocated
1271 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1272 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1273 @retval EFI_SUCCESS Pool successfully allocated.
1278 CoreInternalAllocatePool (
1279 IN EFI_MEMORY_TYPE PoolType
,
1287 @param Buffer The allocated pool entry to free
1289 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1290 @retval EFI_SUCCESS Pool successfully freed.
1302 @param Buffer The allocated pool entry to free
1303 @param PoolType Pointer to pool type
1305 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1306 @retval EFI_SUCCESS Pool successfully freed.
1311 CoreInternalFreePool (
1313 OUT EFI_MEMORY_TYPE
*PoolType OPTIONAL
1317 Loads an EFI image into memory and returns a handle to the image.
1319 @param BootPolicy If TRUE, indicates that the request originates
1320 from the boot manager, and that the boot
1321 manager is attempting to load FilePath as a
1323 @param ParentImageHandle The caller's image handle.
1324 @param FilePath The specific file path from which the image is
1326 @param SourceBuffer If not NULL, a pointer to the memory location
1327 containing a copy of the image to be loaded.
1328 @param SourceSize The size in bytes of SourceBuffer.
1329 @param ImageHandle Pointer to the returned image handle that is
1330 created when the image is successfully loaded.
1332 @retval EFI_SUCCESS The image was loaded into memory.
1333 @retval EFI_NOT_FOUND The FilePath was not found.
1334 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1335 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1336 path cannot be parsed to locate the proper
1337 protocol for loading the file.
1338 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1340 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1342 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1343 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1344 image from being loaded. NULL is returned in *ImageHandle.
1345 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1346 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1347 platform policy specifies that the image should not be started.
1353 IN BOOLEAN BootPolicy
,
1354 IN EFI_HANDLE ParentImageHandle
,
1355 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1356 IN VOID
*SourceBuffer OPTIONAL
,
1357 IN UINTN SourceSize
,
1358 OUT EFI_HANDLE
*ImageHandle
1364 @param ImageHandle Handle that identifies the image to be
1367 @retval EFI_SUCCESS The image has been unloaded.
1368 @retval EFI_UNSUPPORTED The image has been started, and does not support
1370 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1376 IN EFI_HANDLE ImageHandle
1380 Transfer control to a loaded image's entry point.
1382 @param ImageHandle Handle of image to be started.
1383 @param ExitDataSize Pointer of the size to ExitData
1384 @param ExitData Pointer to a pointer to a data buffer that
1385 includes a Null-terminated string,
1386 optionally followed by additional binary data.
1387 The string is a description that the caller may
1388 use to further indicate the reason for the
1391 @retval EFI_INVALID_PARAMETER Invalid parameter
1392 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1393 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1394 @retval EFI_SUCCESS Successfully transfer control to the image's
1401 IN EFI_HANDLE ImageHandle
,
1402 OUT UINTN
*ExitDataSize
,
1403 OUT CHAR16
**ExitData OPTIONAL
1407 Terminates the currently loaded EFI image and returns control to boot services.
1409 @param ImageHandle Handle that identifies the image. This
1410 parameter is passed to the image on entry.
1411 @param Status The image's exit code.
1412 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1413 ExitStatus is EFI_SUCCESS.
1414 @param ExitData Pointer to a data buffer that includes a
1415 Null-terminated Unicode string, optionally
1416 followed by additional binary data. The string
1417 is a description that the caller may use to
1418 further indicate the reason for the image's
1421 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1423 @retval EFI_SUCCESS Successfully terminates the currently loaded
1425 @retval EFI_ACCESS_DENIED Should never reach there.
1426 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1432 IN EFI_HANDLE ImageHandle
,
1433 IN EFI_STATUS Status
,
1434 IN UINTN ExitDataSize
,
1435 IN CHAR16
*ExitData OPTIONAL
1441 @param Type The type of event to create and its mode and
1443 @param NotifyTpl The task priority level of event notifications
1444 @param NotifyFunction Pointer to the events notification function
1445 @param NotifyContext Pointer to the notification functions context;
1446 corresponds to parameter "Context" in the
1447 notification function
1448 @param Event Pointer to the newly created event if the call
1449 succeeds; undefined otherwise
1451 @retval EFI_SUCCESS The event structure was created
1452 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1453 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1460 IN EFI_TPL NotifyTpl
,
1461 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL
,
1462 IN VOID
*NotifyContext OPTIONAL
,
1463 OUT EFI_EVENT
*Event
1467 Creates an event in a group.
1469 @param Type The type of event to create and its mode and
1471 @param NotifyTpl The task priority level of event notifications
1472 @param NotifyFunction Pointer to the events notification function
1473 @param NotifyContext Pointer to the notification functions context;
1474 corresponds to parameter "Context" in the
1475 notification function
1476 @param EventGroup GUID for EventGroup if NULL act the same as
1478 @param Event Pointer to the newly created event if the call
1479 succeeds; undefined otherwise
1481 @retval EFI_SUCCESS The event structure was created
1482 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1483 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1490 IN EFI_TPL NotifyTpl
,
1491 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL
,
1492 IN CONST VOID
*NotifyContext OPTIONAL
,
1493 IN CONST EFI_GUID
*EventGroup OPTIONAL
,
1494 OUT EFI_EVENT
*Event
1498 Creates a general-purpose event structure
1500 @param Type The type of event to create and its mode and
1502 @param NotifyTpl The task priority level of event notifications
1503 @param NotifyFunction Pointer to the events notification function
1504 @param NotifyContext Pointer to the notification functions context;
1505 corresponds to parameter "Context" in the
1506 notification function
1507 @param EventGroup GUID for EventGroup if NULL act the same as
1509 @param Event Pointer to the newly created event if the call
1510 succeeds; undefined otherwise
1512 @retval EFI_SUCCESS The event structure was created
1513 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1514 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1519 CoreCreateEventInternal (
1521 IN EFI_TPL NotifyTpl
,
1522 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL
,
1523 IN CONST VOID
*NotifyContext OPTIONAL
,
1524 IN CONST EFI_GUID
*EventGroup OPTIONAL
,
1525 OUT EFI_EVENT
*Event
1529 Sets the type of timer and the trigger time for a timer event.
1531 @param UserEvent The timer event that is to be signaled at the
1533 @param Type The type of time that is specified in
1535 @param TriggerTime The number of 100ns units until the timer
1538 @retval EFI_SUCCESS The event has been set to be signaled at the
1540 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1546 IN EFI_EVENT UserEvent
,
1547 IN EFI_TIMER_DELAY Type
,
1548 IN UINT64 TriggerTime
1552 Signals the event. Queues the event to be notified if needed.
1554 @param UserEvent The event to signal .
1556 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1557 @retval EFI_SUCCESS The event was signaled.
1563 IN EFI_EVENT UserEvent
1567 Stops execution until an event is signaled.
1569 @param NumberOfEvents The number of events in the UserEvents array
1570 @param UserEvents An array of EFI_EVENT
1571 @param UserIndex Pointer to the index of the event which
1572 satisfied the wait condition
1574 @retval EFI_SUCCESS The event indicated by Index was signaled.
1575 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1576 function or Event was not a valid type
1577 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1583 IN UINTN NumberOfEvents
,
1584 IN EFI_EVENT
*UserEvents
,
1585 OUT UINTN
*UserIndex
1589 Closes an event and frees the event structure.
1591 @param UserEvent Event to close
1593 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1594 @retval EFI_SUCCESS The event has been closed
1600 IN EFI_EVENT UserEvent
1604 Check the status of an event.
1606 @param UserEvent The event to check
1608 @retval EFI_SUCCESS The event is in the signaled state
1609 @retval EFI_NOT_READY The event is not in the signaled state
1610 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1616 IN EFI_EVENT UserEvent
1620 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1621 global coherency domain of the processor.
1623 @param GcdMemoryType Memory type of the memory space.
1624 @param BaseAddress Base address of the memory space.
1625 @param Length Length of the memory space.
1626 @param Capabilities alterable attributes of the memory space.
1628 @retval EFI_SUCCESS Merged this memory space into GCD map.
1633 CoreAddMemorySpace (
1634 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1635 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1637 IN UINT64 Capabilities
1641 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1642 I/O resources from the global coherency domain of the processor.
1644 @param GcdAllocateType The type of allocate operation
1645 @param GcdMemoryType The desired memory type
1646 @param Alignment Align with 2^Alignment
1647 @param Length Length to allocate
1648 @param BaseAddress Base address to allocate
1649 @param ImageHandle The image handle consume the allocated space.
1650 @param DeviceHandle The device handle consume the allocated space.
1652 @retval EFI_INVALID_PARAMETER Invalid parameter.
1653 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1654 @retval EFI_SUCCESS Memory space successfully allocated.
1659 CoreAllocateMemorySpace (
1660 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1661 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1664 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1665 IN EFI_HANDLE ImageHandle
,
1666 IN EFI_HANDLE DeviceHandle OPTIONAL
1670 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1671 I/O resources from the global coherency domain of the processor.
1673 @param BaseAddress Base address of the memory space.
1674 @param Length Length of the memory space.
1676 @retval EFI_SUCCESS Space successfully freed.
1681 CoreFreeMemorySpace (
1682 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1687 Removes reserved memory, system memory, or memory-mapped I/O resources from
1688 the global coherency domain of the processor.
1690 @param BaseAddress Base address of the memory space.
1691 @param Length Length of the memory space.
1693 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1698 CoreRemoveMemorySpace (
1699 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1704 Retrieves the descriptor for a memory region containing a specified address.
1706 @param BaseAddress Specified start address
1707 @param Descriptor Specified length
1709 @retval EFI_INVALID_PARAMETER Invalid parameter
1710 @retval EFI_SUCCESS Successfully get memory space descriptor.
1715 CoreGetMemorySpaceDescriptor (
1716 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1717 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1721 Modifies the attributes for a memory region in the global coherency domain of the
1724 @param BaseAddress Specified start address
1725 @param Length Specified length
1726 @param Attributes Specified attributes
1728 @retval EFI_SUCCESS The attributes were set for the memory region.
1729 @retval EFI_INVALID_PARAMETER Length is zero.
1730 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1731 resource range specified by BaseAddress and Length.
1732 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1733 range specified by BaseAddress and Length.
1734 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1735 BaseAddress and Length cannot be modified.
1736 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1737 the memory resource range.
1738 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1744 CoreSetMemorySpaceAttributes (
1745 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1747 IN UINT64 Attributes
1751 Modifies the capabilities for a memory region in the global coherency domain of the
1754 @param BaseAddress The physical address that is the start address of a memory region.
1755 @param Length The size in bytes of the memory region.
1756 @param Capabilities The bit mask of capabilities that the memory region supports.
1758 @retval EFI_SUCCESS The capabilities were set for the memory region.
1759 @retval EFI_INVALID_PARAMETER Length is zero.
1760 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1761 memory region attributes currently in use.
1762 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1763 BaseAddress and Length cannot be modified.
1764 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1765 of the memory resource range.
1769 CoreSetMemorySpaceCapabilities (
1770 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1772 IN UINT64 Capabilities
1776 Returns a map of the memory resources in the global coherency domain of the
1779 @param NumberOfDescriptors Number of descriptors.
1780 @param MemorySpaceMap Descriptor array
1782 @retval EFI_INVALID_PARAMETER Invalid parameter
1783 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1784 @retval EFI_SUCCESS Successfully get memory space map.
1789 CoreGetMemorySpaceMap (
1790 OUT UINTN
*NumberOfDescriptors
,
1791 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1795 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1797 @param GcdIoType IO type of the segment.
1798 @param BaseAddress Base address of the segment.
1799 @param Length Length of the segment.
1801 @retval EFI_SUCCESS Merged this segment into GCD map.
1802 @retval EFI_INVALID_PARAMETER Parameter not valid
1808 IN EFI_GCD_IO_TYPE GcdIoType
,
1809 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1814 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1815 domain of the processor.
1817 @param GcdAllocateType The type of allocate operation
1818 @param GcdIoType The desired IO type
1819 @param Alignment Align with 2^Alignment
1820 @param Length Length to allocate
1821 @param BaseAddress Base address to allocate
1822 @param ImageHandle The image handle consume the allocated space.
1823 @param DeviceHandle The device handle consume the allocated space.
1825 @retval EFI_INVALID_PARAMETER Invalid parameter.
1826 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1827 @retval EFI_SUCCESS IO space successfully allocated.
1832 CoreAllocateIoSpace (
1833 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1834 IN EFI_GCD_IO_TYPE GcdIoType
,
1837 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1838 IN EFI_HANDLE ImageHandle
,
1839 IN EFI_HANDLE DeviceHandle OPTIONAL
1843 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1844 domain of the processor.
1846 @param BaseAddress Base address of the segment.
1847 @param Length Length of the segment.
1849 @retval EFI_SUCCESS Space successfully freed.
1855 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1860 Removes reserved I/O or I/O resources from the global coherency domain of the
1863 @param BaseAddress Base address of the segment.
1864 @param Length Length of the segment.
1866 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1872 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1877 Retrieves the descriptor for an I/O region containing a specified address.
1879 @param BaseAddress Specified start address
1880 @param Descriptor Specified length
1882 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1883 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1888 CoreGetIoSpaceDescriptor (
1889 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1890 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
1894 Returns a map of the I/O resources in the global coherency domain of the processor.
1896 @param NumberOfDescriptors Number of descriptors.
1897 @param IoSpaceMap Descriptor array
1899 @retval EFI_INVALID_PARAMETER Invalid parameter
1900 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1901 @retval EFI_SUCCESS Successfully get IO space map.
1907 OUT UINTN
*NumberOfDescriptors
,
1908 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
1912 This is the main Dispatcher for DXE and it exits when there are no more
1913 drivers to run. Drain the mScheduledQueue and load and start a PE
1914 image for each driver. Search the mDiscoveredList to see if any driver can
1915 be placed on the mScheduledQueue. If no drivers are placed on the
1916 mScheduledQueue exit the function. On exit it is assumed the Bds()
1917 will be called, and when the Bds() exits the Dispatcher will be called
1920 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1921 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1922 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1932 Check every driver and locate a matching one. If the driver is found, the Unrequested
1933 state flag is cleared.
1935 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1936 the firmware file specified by DriverName.
1937 @param DriverName The Driver name to put in the Dependent state.
1939 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1941 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1948 IN EFI_HANDLE FirmwareVolumeHandle
,
1949 IN EFI_GUID
*DriverName
1953 Convert a driver from the Untrused back to the Scheduled state.
1955 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1956 the firmware file specified by DriverName.
1957 @param DriverName The Driver name to put in the Scheduled state
1959 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1960 was promoted to the trusted state.
1961 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1967 IN EFI_HANDLE FirmwareVolumeHandle
,
1968 IN EFI_GUID
*DriverName
1972 This routine is the driver initialization entry point. It initializes the
1973 libraries, and registers two notification functions. These notification
1974 functions are responsible for building the FV stack dynamically.
1976 @param ImageHandle The image handle.
1977 @param SystemTable The system table.
1979 @retval EFI_SUCCESS Function successfully returned.
1985 IN EFI_HANDLE ImageHandle
,
1986 IN EFI_SYSTEM_TABLE
*SystemTable
1990 Entry point of the section extraction code. Initializes an instance of the
1991 section extraction interface and installs it on a new handle.
1993 @param ImageHandle A handle for the image that is initializing this driver
1994 @param SystemTable A pointer to the EFI system table
1996 @retval EFI_SUCCESS Driver initialized successfully
1997 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2002 InitializeSectionExtraction (
2003 IN EFI_HANDLE ImageHandle
,
2004 IN EFI_SYSTEM_TABLE
*SystemTable
2008 This DXE service routine is used to process a firmware volume. In
2009 particular, it can be called by BDS to process a single firmware
2010 volume found in a capsule.
2012 @param FvHeader pointer to a firmware volume header
2013 @param Size the size of the buffer pointed to by FvHeader
2014 @param FVProtocolHandle the handle on which a firmware volume protocol
2015 was produced for the firmware volume passed in.
2017 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2019 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2020 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2026 CoreProcessFirmwareVolume (
2029 OUT EFI_HANDLE
*FVProtocolHandle
2033 // Functions used during debug buils
2037 Displays Architectural protocols that were not loaded and are required for DXE
2038 core to function. Only used in Debug Builds.
2042 CoreDisplayMissingArchProtocols (
2047 Traverse the discovered list for any drivers that were discovered but not loaded
2048 because the dependency experessions evaluated to false.
2052 CoreDisplayDiscoveredNotDispatched (
2057 Place holder function until all the Boot Services and Runtime Services are
2060 @param Arg1 Undefined
2062 @return EFI_NOT_AVAILABLE_YET
2067 CoreEfiNotAvailableYetArg1 (
2072 Place holder function until all the Boot Services and Runtime Services are available.
2074 @param Arg1 Undefined
2075 @param Arg2 Undefined
2077 @return EFI_NOT_AVAILABLE_YET
2082 CoreEfiNotAvailableYetArg2 (
2088 Place holder function until all the Boot Services and Runtime Services are available.
2090 @param Arg1 Undefined
2091 @param Arg2 Undefined
2092 @param Arg3 Undefined
2094 @return EFI_NOT_AVAILABLE_YET
2099 CoreEfiNotAvailableYetArg3 (
2106 Place holder function until all the Boot Services and Runtime Services are available.
2108 @param Arg1 Undefined
2109 @param Arg2 Undefined
2110 @param Arg3 Undefined
2111 @param Arg4 Undefined
2113 @return EFI_NOT_AVAILABLE_YET
2118 CoreEfiNotAvailableYetArg4 (
2126 Place holder function until all the Boot Services and Runtime Services are available.
2128 @param Arg1 Undefined
2129 @param Arg2 Undefined
2130 @param Arg3 Undefined
2131 @param Arg4 Undefined
2132 @param Arg5 Undefined
2134 @return EFI_NOT_AVAILABLE_YET
2139 CoreEfiNotAvailableYetArg5 (
2148 Given a compressed source buffer, this function retrieves the size of the
2149 uncompressed buffer and the size of the scratch buffer required to decompress
2150 the compressed source buffer.
2152 The GetInfo() function retrieves the size of the uncompressed buffer and the
2153 temporary scratch buffer required to decompress the buffer specified by Source
2154 and SourceSize. If the size of the uncompressed buffer or the size of the
2155 scratch buffer cannot be determined from the compressed data specified by
2156 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2157 size of the uncompressed buffer is returned in DestinationSize, the size of
2158 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2159 The GetInfo() function does not have scratch buffer available to perform a
2160 thorough checking of the validity of the source data. It just retrieves the
2161 "Original Size" field from the beginning bytes of the source data and output
2162 it as DestinationSize. And ScratchSize is specific to the decompression
2165 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2166 @param Source The source buffer containing the compressed data.
2167 @param SourceSize The size, in bytes, of the source buffer.
2168 @param DestinationSize A pointer to the size, in bytes, of the
2169 uncompressed buffer that will be generated when the
2170 compressed buffer specified by Source and
2171 SourceSize is decompressed.
2172 @param ScratchSize A pointer to the size, in bytes, of the scratch
2173 buffer that is required to decompress the
2174 compressed buffer specified by Source and
2177 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2178 DestinationSize and the size of the scratch buffer
2179 was returned in ScratchSize.
2180 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2181 the scratch buffer cannot be determined from the
2182 compressed data specified by Source and
2188 DxeMainUefiDecompressGetInfo (
2189 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2191 IN UINT32 SourceSize
,
2192 OUT UINT32
*DestinationSize
,
2193 OUT UINT32
*ScratchSize
2197 Decompresses a compressed source buffer.
2199 The Decompress() function extracts decompressed data to its original form.
2200 This protocol is designed so that the decompression algorithm can be
2201 implemented without using any memory services. As a result, the Decompress()
2202 Function is not allowed to call AllocatePool() or AllocatePages() in its
2203 implementation. It is the caller's responsibility to allocate and free the
2204 Destination and Scratch buffers.
2205 If the compressed source data specified by Source and SourceSize is
2206 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2207 the compressed source data specified by Source and SourceSize is not in a
2208 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2210 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2211 @param Source The source buffer containing the compressed data.
2212 @param SourceSize SourceSizeThe size of source data.
2213 @param Destination On output, the destination buffer that contains
2214 the uncompressed data.
2215 @param DestinationSize The size of the destination buffer. The size of
2216 the destination buffer needed is obtained from
2217 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2218 @param Scratch A temporary scratch buffer that is used to perform
2220 @param ScratchSize The size of scratch buffer. The size of the
2221 scratch buffer needed is obtained from GetInfo().
2223 @retval EFI_SUCCESS Decompression completed successfully, and the
2224 uncompressed buffer is returned in Destination.
2225 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2226 SourceSize is corrupted (not in a valid
2232 DxeMainUefiDecompress (
2233 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2235 IN UINT32 SourceSize
,
2236 IN OUT VOID
*Destination
,
2237 IN UINT32 DestinationSize
,
2238 IN OUT VOID
*Scratch
,
2239 IN UINT32 ScratchSize
2243 SEP member function. This function creates and returns a new section stream
2244 handle to represent the new section stream.
2246 @param SectionStreamLength Size in bytes of the section stream.
2247 @param SectionStream Buffer containing the new section stream.
2248 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2249 output contains the new section stream handle.
2251 @retval EFI_SUCCESS The section stream is created successfully.
2252 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2253 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2260 IN UINTN SectionStreamLength
,
2261 IN VOID
*SectionStream
,
2262 OUT UINTN
*SectionStreamHandle
2266 SEP member function. Retrieves requested section from section stream.
2268 @param SectionStreamHandle The section stream from which to extract the
2270 @param SectionType A pointer to the type of section to search for.
2271 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2272 then SectionDefinitionGuid indicates which of
2273 these types of sections to search for.
2274 @param SectionInstance Indicates which instance of the requested
2276 @param Buffer Double indirection to buffer. If *Buffer is
2277 non-null on input, then the buffer is caller
2278 allocated. If Buffer is NULL, then the buffer
2279 is callee allocated. In either case, the
2280 required buffer size is returned in *BufferSize.
2281 @param BufferSize On input, indicates the size of *Buffer if
2282 *Buffer is non-null on input. On output,
2283 indicates the required size (allocated size if
2284 callee allocated) of *Buffer.
2285 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2286 indicates the authentication status of the
2287 output buffer. If the input section's
2288 GuidedSectionHeader.Attributes field
2289 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2290 bit as clear, AuthenticationStatus must return
2291 zero. Both local bits (19:16) and aggregate
2292 bits (3:0) in AuthenticationStatus are returned
2293 by ExtractSection(). These bits reflect the
2294 status of the extraction operation. The bit
2295 pattern in both regions must be the same, as
2296 the local and aggregate authentication statuses
2297 have equivalent meaning at this level. If the
2298 function returns anything other than
2299 EFI_SUCCESS, the value of *AuthenticationStatus
2301 @param IsFfs3Fv Indicates the FV format.
2303 @retval EFI_SUCCESS Section was retrieved successfully
2304 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2305 section stream with its
2306 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2307 but there was no corresponding GUIDed Section
2308 Extraction Protocol in the handle database.
2309 *Buffer is unmodified.
2310 @retval EFI_NOT_FOUND An error was encountered when parsing the
2311 SectionStream. This indicates the SectionStream
2312 is not correctly formatted.
2313 @retval EFI_NOT_FOUND The requested section does not exist.
2314 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2316 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2317 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2318 insufficient to contain the requested section.
2319 The input buffer is filled and section contents
2326 IN UINTN SectionStreamHandle
,
2327 IN EFI_SECTION_TYPE
*SectionType
,
2328 IN EFI_GUID
*SectionDefinitionGuid
,
2329 IN UINTN SectionInstance
,
2331 IN OUT UINTN
*BufferSize
,
2332 OUT UINT32
*AuthenticationStatus
,
2337 SEP member function. Deletes an existing section stream
2339 @param StreamHandleToClose Indicates the stream to close
2340 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2341 FALSE - No need to free stream buffer.
2343 @retval EFI_SUCCESS The section stream is closed sucessfully.
2344 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2345 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2351 CloseSectionStream (
2352 IN UINTN StreamHandleToClose
,
2353 IN BOOLEAN FreeStreamBuffer
2357 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2358 table and registers it into the system table.
2361 This function allocates memory, frees it, and then allocates memory at an
2362 address within the initial allocation. Since this function is called early
2363 in DXE core initialization (before drivers are dispatched), this should not
2368 CoreInitializeDebugImageInfoTable (
2373 Update the CRC32 in the Debug Table.
2374 Since the CRC32 service is made available by the Runtime driver, we have to
2375 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2376 This function is called elsewhere by the core when the runtime architectural
2377 protocol is produced.
2381 CoreUpdateDebugTableCrc32 (
2386 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2387 the table if it's not large enough to accomidate another entry.
2389 @param ImageInfoType type of debug image information
2390 @param LoadedImage pointer to the loaded image protocol for the image being
2392 @param ImageHandle image handle for the image being loaded
2396 CoreNewDebugImageInfoEntry (
2397 IN UINT32 ImageInfoType
,
2398 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2399 IN EFI_HANDLE ImageHandle
2403 Removes and frees an entry from the DebugImageInfo Table.
2405 @param ImageHandle image handle for the image being unloaded
2409 CoreRemoveDebugImageInfoEntry (
2410 EFI_HANDLE ImageHandle
2414 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2416 @param ImageHandle The image handle.
2417 @param SystemTable The system table.
2419 @retval EFI_SUCCESS Successfully initialized firmware volume block
2425 FwVolBlockDriverInit (
2426 IN EFI_HANDLE ImageHandle
,
2427 IN EFI_SYSTEM_TABLE
*SystemTable
2432 Get FVB authentication status
2434 @param FvbProtocol FVB protocol.
2436 @return Authentication status.
2440 GetFvbAuthenticationStatus (
2441 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2445 This routine produces a firmware volume block protocol on a given
2448 @param BaseAddress base address of the firmware volume image
2449 @param Length length of the firmware volume image
2450 @param ParentHandle handle of parent firmware volume, if this image
2451 came from an FV image file and section in another firmware
2452 volume (ala capsules)
2453 @param AuthenticationStatus Authentication status inherited, if this image
2454 came from an FV image file and section in another firmware volume.
2455 @param FvProtocol Firmware volume block protocol produced.
2457 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2458 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2459 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2464 ProduceFVBProtocolOnBuffer (
2465 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2467 IN EFI_HANDLE ParentHandle
,
2468 IN UINT32 AuthenticationStatus
,
2469 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2473 Raising to the task priority level of the mutual exclusion
2474 lock, and then acquires ownership of the lock.
2476 @param Lock The lock to acquire
2487 Initialize a basic mutual exclusion lock. Each lock
2488 provides mutual exclusion access at it's task priority
2489 level. Since there is no-premption (at any TPL) or
2490 multiprocessor support, acquiring the lock only consists
2491 of raising to the locks TPL.
2493 @param Lock The EFI_LOCK structure to initialize
2495 @retval EFI_SUCCESS Lock Owned.
2496 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2500 CoreAcquireLockOrFail (
2505 Releases ownership of the mutual exclusion lock, and
2506 restores the previous task priority level.
2508 @param Lock The lock to release
2510 @return Lock unowned
2519 Read data from Firmware Block by FVB protocol Read.
2520 The data may cross the multi block ranges.
2522 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2523 @param StartLba Pointer to StartLba.
2524 On input, the start logical block index from which to read.
2525 On output,the end logical block index after reading.
2526 @param Offset Pointer to Offset
2527 On input, offset into the block at which to begin reading.
2528 On output, offset into the end block after reading.
2529 @param DataSize Size of data to be read.
2530 @param Data Pointer to Buffer that the data will be read into.
2532 @retval EFI_SUCCESS Successfully read data from firmware block.
2537 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2538 IN OUT EFI_LBA
*StartLba
,
2539 IN OUT UINTN
*Offset
,
2545 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2546 copy the real length volume header into it.
2548 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2549 read the volume header
2550 @param FwVolHeader Pointer to pointer to allocated buffer in which
2551 the volume header is returned.
2553 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2554 @retval EFI_SUCCESS Successfully read volume header to the allocated
2556 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2557 the file system could not be understood.
2562 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2563 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2567 Verify checksum of the firmware volume header.
2569 @param FvHeader Points to the firmware volume header to be checked
2571 @retval TRUE Checksum verification passed
2572 @retval FALSE Checksum verification failed
2576 VerifyFvHeaderChecksum (
2577 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2581 Initialize memory profile.
2583 @param HobStart The start address of the HOB.
2592 Install memory profile protocol.
2596 MemoryProfileInstallProtocol (
2601 Register image to memory profile.
2603 @param DriverEntry Image info.
2604 @param FileType Image file type.
2606 @return EFI_SUCCESS Register successfully.
2607 @return EFI_UNSUPPORTED Memory profile unsupported,
2608 or memory profile for the image is not required.
2609 @return EFI_OUT_OF_RESOURCES No enough resource for this register.
2613 RegisterMemoryProfileImage (
2614 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2615 IN EFI_FV_FILETYPE FileType
2619 Unregister image from memory profile.
2621 @param DriverEntry Image info.
2623 @return EFI_SUCCESS Unregister successfully.
2624 @return EFI_UNSUPPORTED Memory profile unsupported,
2625 or memory profile for the image is not required.
2626 @return EFI_NOT_FOUND The image is not found.
2630 UnregisterMemoryProfileImage (
2631 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2635 Update memory profile information.
2637 @param CallerAddress Address of caller who call Allocate or Free.
2638 @param Action This Allocate or Free action.
2639 @param MemoryType Memory type.
2640 EfiMaxMemoryType means the MemoryType is unknown.
2641 @param Size Buffer size.
2642 @param Buffer Buffer address.
2643 @param ActionString String for memory profile action.
2644 Only needed for user defined allocate action.
2646 @return EFI_SUCCESS Memory profile is updated.
2647 @return EFI_UNSUPPORTED Memory profile is unsupported,
2648 or memory profile for the image is not required,
2649 or memory profile for the memory type is not required.
2650 @return EFI_ACCESS_DENIED It is during memory profile data getting.
2651 @return EFI_ABORTED Memory profile recording is not enabled.
2652 @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
2653 @return EFI_NOT_FOUND No matched allocate info found for free action.
2659 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2660 IN MEMORY_PROFILE_ACTION Action
,
2661 IN EFI_MEMORY_TYPE MemoryType
,
2662 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2664 IN CHAR8
*ActionString OPTIONAL
2668 Internal function. Converts a memory range to use new attributes.
2670 @param Start The first address of the range Must be page
2672 @param NumberOfPages The number of pages to convert
2673 @param NewAttributes The new attributes value for the range.
2677 CoreUpdateMemoryAttributes (
2678 IN EFI_PHYSICAL_ADDRESS Start
,
2679 IN UINT64 NumberOfPages
,
2680 IN UINT64 NewAttributes
2684 Initialize MemoryAttrubutesTable support.
2688 CoreInitializeMemoryAttributesTable (
2693 Initialize Memory Protection support.
2697 CoreInitializeMemoryProtection (
2702 Install MemoryAttributesTable on memory allocation.
2704 @param[in] MemoryType EFI memory type.
2707 InstallMemoryAttributesTableOnMemoryAllocation (
2708 IN EFI_MEMORY_TYPE MemoryType
2712 Insert image record.
2714 @param RuntimeImage Runtime image information
2718 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2722 Remove Image record.
2724 @param RuntimeImage Runtime image information
2728 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2734 @param[in] LoadedImage The loaded image protocol
2735 @param[in] LoadedImageDevicePath The loaded image device path protocol
2739 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2740 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2744 Unprotect UEFI image.
2746 @param[in] LoadedImage The loaded image protocol
2747 @param[in] LoadedImageDevicePath The loaded image device path protocol
2750 UnprotectUefiImage (
2751 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2752 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2756 ExitBootServices Callback function for memory protection.
2759 MemoryProtectionExitBootServicesCallback (
2764 Manage memory permission attributes on a memory range, according to the
2765 configured DXE memory protection policy.
2767 @param OldType The old memory type of the range
2768 @param NewType The new memory type of the range
2769 @param Memory The base address of the range
2770 @param Length The size of the range (in bytes)
2772 @return EFI_SUCCESS If the the CPU arch protocol is not installed yet
2773 @return EFI_SUCCESS If no DXE memory protection policy has been configured
2774 @return EFI_SUCCESS If OldType and NewType use the same permission attributes
2775 @return other Return value of gCpu->SetMemoryAttributes()
2780 ApplyMemoryProtectionPolicy (
2781 IN EFI_MEMORY_TYPE OldType
,
2782 IN EFI_MEMORY_TYPE NewType
,
2783 IN EFI_PHYSICAL_ADDRESS Memory
,
2788 Merge continous memory map entries whose have same attributes.
2790 @param MemoryMap A pointer to the buffer in which firmware places
2791 the current memory map.
2792 @param MemoryMapSize A pointer to the size, in bytes, of the
2793 MemoryMap buffer. On input, this is the size of
2794 the current memory map. On output,
2795 it is the size of new memory map after merge.
2796 @param DescriptorSize Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.
2800 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
2801 IN OUT UINTN
*MemoryMapSize
,
2802 IN UINTN DescriptorSize