2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
23 #include <Protocol/LoadedImage.h>
24 #include <Protocol/GuidedSectionExtraction.h>
25 #include <Protocol/DevicePath.h>
26 #include <Protocol/Runtime.h>
27 #include <Protocol/LoadFile.h>
28 #include <Protocol/LoadFile2.h>
29 #include <Protocol/DriverBinding.h>
30 #include <Protocol/VariableWrite.h>
31 #include <Protocol/PlatformDriverOverride.h>
32 #include <Protocol/Variable.h>
33 #include <Protocol/Timer.h>
34 #include <Protocol/SimpleFileSystem.h>
35 #include <Protocol/Bds.h>
36 #include <Protocol/RealTimeClock.h>
37 #include <Protocol/WatchdogTimer.h>
38 #include <Protocol/FirmwareVolume2.h>
39 #include <Protocol/MonotonicCounter.h>
40 #include <Protocol/StatusCode.h>
41 #include <Protocol/Decompress.h>
42 #include <Protocol/LoadPe32Image.h>
43 #include <Protocol/Security.h>
44 #include <Protocol/Security2.h>
45 #include <Protocol/Ebc.h>
46 #include <Protocol/Reset.h>
47 #include <Protocol/Cpu.h>
48 #include <Protocol/Metronome.h>
49 #include <Protocol/FirmwareVolumeBlock.h>
50 #include <Protocol/Capsule.h>
51 #include <Protocol/BusSpecificDriverOverride.h>
52 #include <Protocol/DriverFamilyOverride.h>
53 #include <Protocol/TcgService.h>
54 #include <Protocol/HiiPackageList.h>
55 #include <Protocol/SmmBase2.h>
56 #include <Guid/MemoryTypeInformation.h>
57 #include <Guid/FirmwareFileSystem2.h>
58 #include <Guid/FirmwareFileSystem3.h>
59 #include <Guid/HobList.h>
60 #include <Guid/DebugImageInfoTable.h>
61 #include <Guid/FileInfo.h>
62 #include <Guid/Apriori.h>
63 #include <Guid/DxeServices.h>
64 #include <Guid/MemoryAllocationHob.h>
65 #include <Guid/EventLegacyBios.h>
66 #include <Guid/EventGroup.h>
67 #include <Guid/EventExitBootServiceFailed.h>
68 #include <Guid/LoadModuleAtFixedAddress.h>
69 #include <Guid/IdleLoopEvent.h>
70 #include <Guid/VectorHandoffTable.h>
71 #include <Ppi/VectorHandoffInfo.h>
72 #include <Guid/MemoryProfile.h>
74 #include <Library/DxeCoreEntryPoint.h>
75 #include <Library/DebugLib.h>
76 #include <Library/UefiLib.h>
77 #include <Library/BaseLib.h>
78 #include <Library/HobLib.h>
79 #include <Library/PerformanceLib.h>
80 #include <Library/UefiDecompressLib.h>
81 #include <Library/ExtractGuidedSectionLib.h>
82 #include <Library/CacheMaintenanceLib.h>
83 #include <Library/BaseMemoryLib.h>
84 #include <Library/PeCoffLib.h>
85 #include <Library/PeCoffGetEntryPointLib.h>
86 #include <Library/PeCoffExtraActionLib.h>
87 #include <Library/PcdLib.h>
88 #include <Library/MemoryAllocationLib.h>
89 #include <Library/DevicePathLib.h>
90 #include <Library/UefiBootServicesTableLib.h>
91 #include <Library/ReportStatusCodeLib.h>
92 #include <Library/TimerLib.h>
93 #include <Library/DxeServicesLib.h>
94 #include <Library/DebugAgentLib.h>
95 #include <Library/CpuExceptionHandlerLib.h>
99 // attributes for reserved memory before it is promoted to system memory
101 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
102 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
103 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
106 // range for memory mapped port I/O on IPF
108 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
112 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression
113 /// to save time. A EFI_DEP_PUSH is evaluated one an
114 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
115 /// Driver Execution Environment Core Interface use 0xff
116 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
117 /// defined to a new value that is not conflicting with PI spec.
119 #define EFI_DEP_REPLACE_TRUE 0xff
122 /// Define the initial size of the dependency expression evaluation stack
124 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
126 #if defined (MDE_CPU_IPF)
128 /// For Itanium machines make the default allocations 8K aligned
130 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
131 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
133 #elif defined (MDE_CPU_AARCH64)
135 /// 64-bit ARM systems allow the OS to execute with 64 KB page size,
136 /// so for improved interoperability with the firmware, align the
137 /// runtime regions to 64 KB as well
139 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (SIZE_64KB)
140 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
144 /// For generic EFI machines make the default allocations 4K aligned
146 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
147 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
152 EFI_GUID
*ProtocolGuid
;
157 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
160 // DXE Dispatcher Data structures
163 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
166 LIST_ENTRY Link
; // mFvHandleList
172 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
175 LIST_ENTRY Link
; // mDriverList
177 LIST_ENTRY ScheduledLink
; // mScheduledQueue
181 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
182 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
189 EFI_GUID BeforeAfterGuid
;
196 BOOLEAN DepexProtocolError
;
198 EFI_HANDLE ImageHandle
;
201 } EFI_CORE_DRIVER_ENTRY
;
204 //The data structure of GCD memory map entry
206 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
210 EFI_PHYSICAL_ADDRESS BaseAddress
;
214 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
215 EFI_GCD_IO_TYPE GcdIoType
;
216 EFI_HANDLE ImageHandle
;
217 EFI_HANDLE DeviceHandle
;
221 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
229 /// If entrypoint has been called
231 /// The image's entry point
232 EFI_IMAGE_ENTRY_POINT EntryPoint
;
233 /// loaded image protocol
234 EFI_LOADED_IMAGE_PROTOCOL Info
;
235 /// Location in memory
236 EFI_PHYSICAL_ADDRESS ImageBasePage
;
239 /// Original fixup data
241 /// Tpl of started image
243 /// Status returned by started image
245 /// Size of ExitData from started image
247 /// Pointer to exit data from started image
249 /// Pointer to pool allocation for context save/restore
251 /// Pointer to buffer for context save/restore
252 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
253 /// Machine type from PE image
255 /// EBC Protocol pointer
256 EFI_EBC_PROTOCOL
*Ebc
;
257 /// Runtime image list
258 EFI_RUNTIME_IMAGE_ENTRY
*RuntimeData
;
259 /// Pointer to Loaded Image Device Path Protocol
260 EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
;
261 /// PeCoffLoader ImageContext
262 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
263 /// Status returned by LoadImage() service.
264 EFI_STATUS LoadImageStatus
;
265 } LOADED_IMAGE_PRIVATE_DATA
;
267 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
268 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
270 #define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')
275 EFI_PHYSICAL_ADDRESS CodeSegmentBase
;
276 UINT64 CodeSegmentSize
;
277 } IMAGE_PROPERTIES_RECORD_CODE_SECTION
;
279 #define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')
284 EFI_PHYSICAL_ADDRESS ImageBase
;
286 UINTN CodeSegmentCount
;
287 LIST_ENTRY CodeSegmentList
;
288 } IMAGE_PROPERTIES_RECORD
;
291 // DXE Core Global Variables
293 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
294 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
295 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
296 extern EFI_HANDLE gDxeCoreImageHandle
;
298 extern BOOLEAN gMemoryMapTerminated
;
300 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
302 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
303 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
304 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
305 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
306 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
307 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
308 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
309 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
310 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
312 extern EFI_TPL gEfiCurrentTpl
;
314 extern EFI_GUID
*gDxeCoreFileName
;
315 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
317 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
319 extern BOOLEAN gDispatcherRunning
;
320 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
322 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
323 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
325 // Service Initialization Functions
331 Called to initialize the pool.
341 Called to initialize the memory map and add descriptors to
342 the current descriptor list.
343 The first descriptor that is added must be general usable
344 memory as the addition allocates heap.
346 @param Type The type of memory to add
347 @param Start The starting address in the memory range Must be
349 @param NumberOfPages The number of pages in the range
350 @param Attribute Attributes of the memory to add
352 @return None. The range is added to the memory map
356 CoreAddMemoryDescriptor (
357 IN EFI_MEMORY_TYPE Type
,
358 IN EFI_PHYSICAL_ADDRESS Start
,
359 IN UINT64 NumberOfPages
,
365 Release memory lock on mGcdMemorySpaceLock.
369 CoreReleaseGcdMemoryLock (
375 Acquire memory lock on mGcdMemorySpaceLock.
379 CoreAcquireGcdMemoryLock (
385 External function. Initializes memory services based on the memory
386 descriptor HOBs. This function is responsible for priming the memory
387 map, so memory allocations and resource allocations can be made.
388 The first part of this function can not depend on any memory services
389 until at least one memory descriptor is provided to the memory services.
391 @param HobStart The start address of the HOB.
392 @param MemoryBaseAddress Start address of memory region found to init DXE
394 @param MemoryLength Length of memory region found to init DXE core.
396 @retval EFI_SUCCESS Memory services successfully initialized.
400 CoreInitializeMemoryServices (
402 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
403 OUT UINT64
*MemoryLength
409 External function. Initializes the GCD and memory services based on the memory
410 descriptor HOBs. This function is responsible for priming the GCD map and the
411 memory map, so memory allocations and resource allocations can be made. The
412 HobStart will be relocated to a pool buffer.
414 @param HobStart The start address of the HOB
415 @param MemoryBaseAddress Start address of memory region found to init DXE
417 @param MemoryLength Length of memory region found to init DXE core.
419 @retval EFI_SUCCESS GCD services successfully initialized.
423 CoreInitializeGcdServices (
424 IN OUT VOID
**HobStart
,
425 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
426 IN UINT64 MemoryLength
431 Initializes "event" support.
433 @retval EFI_SUCCESS Always return success
437 CoreInitializeEventServices (
443 Add the Image Services to EFI Boot Services Table and install the protocol
444 interfaces for this image.
446 @param HobStart The HOB to initialize
452 CoreInitializeImageServices (
458 Creates an event that is fired everytime a Protocol of a specific type is installed.
462 CoreNotifyOnProtocolInstallation (
468 Return TRUE if all AP services are available.
470 @retval EFI_SUCCESS All AP services are available
471 @retval EFI_NOT_FOUND At least one AP service is not available
475 CoreAllEfiServicesAvailable (
481 Calcualte the 32-bit CRC in a EFI table using the service provided by the
484 @param Hdr Pointer to an EFI standard header
489 IN OUT EFI_TABLE_HEADER
*Hdr
494 Called by the platform code to process a tick.
496 @param Duration The number of 100ns elapsed since the last call
508 Initialize the dispatcher. Initialize the notification function that runs when
509 an FV2 protocol is added to the system.
513 CoreInitializeDispatcher (
519 This is the POSTFIX version of the dependency evaluator. This code does
520 not need to handle Before or After, as it is not valid to call this
521 routine in this case. The SOR is just ignored and is a nop in the grammer.
522 POSTFIX means all the math is done on top of the stack.
524 @param DriverEntry DriverEntry element to update.
526 @retval TRUE If driver is ready to run.
527 @retval FALSE If driver is not ready to run or some fatal error
533 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
538 Preprocess dependency expression and update DriverEntry to reflect the
539 state of Before, After, and SOR dependencies. If DriverEntry->Before
540 or DriverEntry->After is set it will never be cleared. If SOR is set
541 it will be cleared by CoreSchedule(), and then the driver can be
544 @param DriverEntry DriverEntry element to update .
546 @retval EFI_SUCCESS It always works.
550 CorePreProcessDepex (
551 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
557 Terminates all boot services.
559 @param ImageHandle Handle that identifies the exiting image.
560 @param MapKey Key to the latest memory map.
562 @retval EFI_SUCCESS Boot Services terminated
563 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
568 CoreExitBootServices (
569 IN EFI_HANDLE ImageHandle
,
575 Make sure the memory map is following all the construction rules,
576 it is the last time to check memory map error before exit boot services.
578 @param MapKey Memory map key
580 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
582 @retval EFI_SUCCESS Valid memory map.
586 CoreTerminateMemoryMap (
592 Signals all events in the EventGroup.
594 @param EventGroup The list to signal
598 CoreNotifySignalList (
599 IN EFI_GUID
*EventGroup
605 Boot Service called to add, modify, or remove a system configuration table from
606 the EFI System Table.
608 @param Guid Pointer to the GUID for the entry to add, update, or
610 @param Table Pointer to the configuration table for the entry to add,
611 update, or remove, may be NULL.
613 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
614 @return EFI_INVALID_PARAMETER Input GUID not valid.
615 @return EFI_NOT_FOUND Attempted to delete non-existant entry
616 @return EFI_OUT_OF_RESOURCES Not enough memory available
621 CoreInstallConfigurationTable (
629 Raise the task priority level to the new level.
630 High level is implemented by disabling processor interrupts.
632 @param NewTpl New task priority level
634 @return The previous task priority level
646 Lowers the task priority to the previous value. If the new
647 priority unmasks events at a higher priority, they are dispatched.
649 @param NewTpl New, lower, task priority
661 Introduces a fine-grained stall.
663 @param Microseconds The number of microseconds to stall execution.
665 @retval EFI_SUCCESS Execution was stalled for at least the requested
666 amount of microseconds.
667 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
673 IN UINTN Microseconds
679 Sets the system's watchdog timer.
681 @param Timeout The number of seconds to set the watchdog timer to.
682 A value of zero disables the timer.
683 @param WatchdogCode The numeric code to log on a watchdog timer timeout
684 event. The firmware reserves codes 0x0000 to 0xFFFF.
685 Loaders and operating systems may use other timeout
687 @param DataSize The size, in bytes, of WatchdogData.
688 @param WatchdogData A data buffer that includes a Null-terminated Unicode
689 string, optionally followed by additional binary data.
690 The string is a description that the call may use to
691 further indicate the reason to be logged with a
694 @return EFI_SUCCESS Timeout has been set
695 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
696 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
697 @return EFI_DEVICE_ERROR Could not complete due to hardware error
702 CoreSetWatchdogTimer (
704 IN UINT64 WatchdogCode
,
706 IN CHAR16
*WatchdogData OPTIONAL
712 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
713 Calls the private one which contains a BOOLEAN parameter for notifications
715 @param UserHandle The handle to install the protocol handler on,
716 or NULL if a new handle is to be allocated
717 @param Protocol The protocol to add to the handle
718 @param InterfaceType Indicates whether Interface is supplied in
720 @param Interface The interface for the protocol being added
727 CoreInstallProtocolInterface (
728 IN OUT EFI_HANDLE
*UserHandle
,
729 IN EFI_GUID
*Protocol
,
730 IN EFI_INTERFACE_TYPE InterfaceType
,
736 Installs a protocol interface into the boot services environment.
738 @param UserHandle The handle to install the protocol handler on,
739 or NULL if a new handle is to be allocated
740 @param Protocol The protocol to add to the handle
741 @param InterfaceType Indicates whether Interface is supplied in
743 @param Interface The interface for the protocol being added
744 @param Notify indicates whether notify the notification list
747 @retval EFI_INVALID_PARAMETER Invalid parameter
748 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
749 @retval EFI_SUCCESS Protocol interface successfully installed
753 CoreInstallProtocolInterfaceNotify (
754 IN OUT EFI_HANDLE
*UserHandle
,
755 IN EFI_GUID
*Protocol
,
756 IN EFI_INTERFACE_TYPE InterfaceType
,
764 Installs a list of protocol interface into the boot services environment.
765 This function calls InstallProtocolInterface() in a loop. If any error
766 occures all the protocols added by this function are removed. This is
767 basically a lib function to save space.
769 @param Handle The handle to install the protocol handlers on,
770 or NULL if a new handle is to be allocated
771 @param ... EFI_GUID followed by protocol instance. A NULL
772 terminates the list. The pairs are the
773 arguments to InstallProtocolInterface(). All the
774 protocols are added to Handle.
776 @retval EFI_SUCCESS All the protocol interface was installed.
777 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
778 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
780 @retval EFI_INVALID_PARAMETER Handle is NULL.
781 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
786 CoreInstallMultipleProtocolInterfaces (
787 IN OUT EFI_HANDLE
*Handle
,
794 Uninstalls a list of protocol interface in the boot services environment.
795 This function calls UnisatllProtocolInterface() in a loop. This is
796 basically a lib function to save space.
798 @param Handle The handle to uninstall the protocol
799 @param ... EFI_GUID followed by protocol instance. A NULL
800 terminates the list. The pairs are the
801 arguments to UninstallProtocolInterface(). All
802 the protocols are added to Handle.
809 CoreUninstallMultipleProtocolInterfaces (
810 IN EFI_HANDLE Handle
,
817 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
819 @param UserHandle Handle on which the interface is to be
821 @param Protocol The numeric ID of the interface
822 @param OldInterface A pointer to the old interface
823 @param NewInterface A pointer to the new interface
825 @retval EFI_SUCCESS The protocol interface was installed
826 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
827 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
832 CoreReinstallProtocolInterface (
833 IN EFI_HANDLE UserHandle
,
834 IN EFI_GUID
*Protocol
,
835 IN VOID
*OldInterface
,
836 IN VOID
*NewInterface
842 Uninstalls all instances of a protocol:interfacer from a handle.
843 If the last protocol interface is remove from the handle, the
846 @param UserHandle The handle to remove the protocol handler from
847 @param Protocol The protocol, of protocol:interface, to remove
848 @param Interface The interface, of protocol:interface, to remove
850 @retval EFI_INVALID_PARAMETER Protocol is NULL.
851 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
856 CoreUninstallProtocolInterface (
857 IN EFI_HANDLE UserHandle
,
858 IN EFI_GUID
*Protocol
,
865 Queries a handle to determine if it supports a specified protocol.
867 @param UserHandle The handle being queried.
868 @param Protocol The published unique identifier of the protocol.
869 @param Interface Supplies the address where a pointer to the
870 corresponding Protocol Interface is returned.
872 @return The requested protocol interface for the handle
878 IN EFI_HANDLE UserHandle
,
879 IN EFI_GUID
*Protocol
,
886 Locates the installed protocol handler for the handle, and
887 invokes it to obtain the protocol interface. Usage information
888 is registered in the protocol data base.
890 @param UserHandle The handle to obtain the protocol interface on
891 @param Protocol The ID of the protocol
892 @param Interface The location to return the protocol interface
893 @param ImageHandle The handle of the Image that is opening the
894 protocol interface specified by Protocol and
896 @param ControllerHandle The controller handle that is requiring this
898 @param Attributes The open mode of the protocol interface
899 specified by Handle and Protocol.
901 @retval EFI_INVALID_PARAMETER Protocol is NULL.
902 @retval EFI_SUCCESS Get the protocol interface.
908 IN EFI_HANDLE UserHandle
,
909 IN EFI_GUID
*Protocol
,
910 OUT VOID
**Interface OPTIONAL
,
911 IN EFI_HANDLE ImageHandle
,
912 IN EFI_HANDLE ControllerHandle
,
919 Return information about Opened protocols in the system
921 @param UserHandle The handle to close the protocol interface on
922 @param Protocol The ID of the protocol
923 @param EntryBuffer A pointer to a buffer of open protocol
924 information in the form of
925 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
926 @param EntryCount Number of EntryBuffer entries
931 CoreOpenProtocolInformation (
932 IN EFI_HANDLE UserHandle
,
933 IN EFI_GUID
*Protocol
,
934 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
935 OUT UINTN
*EntryCount
941 Closes a protocol on a handle that was opened using OpenProtocol().
943 @param UserHandle The handle for the protocol interface that was
944 previously opened with OpenProtocol(), and is
946 @param Protocol The published unique identifier of the protocol.
947 It is the caller's responsibility to pass in a
949 @param AgentHandle The handle of the agent that is closing the
951 @param ControllerHandle If the agent that opened a protocol is a driver
952 that follows the EFI Driver Model, then this
953 parameter is the controller handle that required
954 the protocol interface. If the agent does not
955 follow the EFI Driver Model, then this parameter
956 is optional and may be NULL.
958 @retval EFI_SUCCESS The protocol instance was closed.
959 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
961 @retval EFI_NOT_FOUND Can not find the specified protocol or
968 IN EFI_HANDLE UserHandle
,
969 IN EFI_GUID
*Protocol
,
970 IN EFI_HANDLE AgentHandle
,
971 IN EFI_HANDLE ControllerHandle
977 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
980 @param UserHandle The handle from which to retrieve the list of
981 protocol interface GUIDs.
982 @param ProtocolBuffer A pointer to the list of protocol interface GUID
983 pointers that are installed on Handle.
984 @param ProtocolBufferCount A pointer to the number of GUID pointers present
987 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
988 on Handle was returned in ProtocolBuffer. The
989 number of protocol interface GUIDs was returned
990 in ProtocolBufferCount.
991 @retval EFI_INVALID_PARAMETER Handle is NULL.
992 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
993 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
994 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
995 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1001 CoreProtocolsPerHandle (
1002 IN EFI_HANDLE UserHandle
,
1003 OUT EFI_GUID
***ProtocolBuffer
,
1004 OUT UINTN
*ProtocolBufferCount
1010 Add a new protocol notification record for the request protocol.
1012 @param Protocol The requested protocol to add the notify
1014 @param Event The event to signal
1015 @param Registration Returns the registration record
1017 @retval EFI_INVALID_PARAMETER Invalid parameter
1018 @retval EFI_SUCCESS Successfully returned the registration record
1024 CoreRegisterProtocolNotify (
1025 IN EFI_GUID
*Protocol
,
1027 OUT VOID
**Registration
1032 Removes all the events in the protocol database that match Event.
1034 @param Event The event to search for in the protocol
1037 @return EFI_SUCCESS when done searching the entire database.
1041 CoreUnregisterProtocolNotify (
1047 Locates the requested handle(s) and returns them in Buffer.
1049 @param SearchType The type of search to perform to locate the
1051 @param Protocol The protocol to search for
1052 @param SearchKey Dependant on SearchType
1053 @param BufferSize On input the size of Buffer. On output the
1054 size of data returned.
1055 @param Buffer The buffer to return the results in
1057 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
1058 returned in BufferSize.
1059 @retval EFI_INVALID_PARAMETER Invalid parameter
1060 @retval EFI_SUCCESS Successfully found the requested handle(s) and
1061 returns them in Buffer.
1067 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1068 IN EFI_GUID
*Protocol OPTIONAL
,
1069 IN VOID
*SearchKey OPTIONAL
,
1070 IN OUT UINTN
*BufferSize
,
1071 OUT EFI_HANDLE
*Buffer
1077 Locates the handle to a device on the device path that best matches the specified protocol.
1079 @param Protocol The protocol to search for.
1080 @param DevicePath On input, a pointer to a pointer to the device
1081 path. On output, the device path pointer is
1082 modified to point to the remaining part of the
1084 @param Device A pointer to the returned device handle.
1086 @retval EFI_SUCCESS The resulting handle was returned.
1087 @retval EFI_NOT_FOUND No handles matched the search.
1088 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1093 CoreLocateDevicePath (
1094 IN EFI_GUID
*Protocol
,
1095 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
1096 OUT EFI_HANDLE
*Device
1102 Function returns an array of handles that support the requested protocol
1103 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1104 that allocates a buffer for the caller.
1106 @param SearchType Specifies which handle(s) are to be returned.
1107 @param Protocol Provides the protocol to search by. This
1108 parameter is only valid for SearchType
1110 @param SearchKey Supplies the search key depending on the
1112 @param NumberHandles The number of handles returned in Buffer.
1113 @param Buffer A pointer to the buffer to return the requested
1114 array of handles that support Protocol.
1116 @retval EFI_SUCCESS The result array of handles was returned.
1117 @retval EFI_NOT_FOUND No handles match the search.
1118 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1120 @retval EFI_INVALID_PARAMETER One or more parameters are not valid.
1125 CoreLocateHandleBuffer (
1126 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1127 IN EFI_GUID
*Protocol OPTIONAL
,
1128 IN VOID
*SearchKey OPTIONAL
,
1129 IN OUT UINTN
*NumberHandles
,
1130 OUT EFI_HANDLE
**Buffer
1136 Return the first Protocol Interface that matches the Protocol GUID. If
1137 Registration is passed in, return a Protocol Instance that was just add
1138 to the system. If Registration is NULL return the first Protocol Interface
1141 @param Protocol The protocol to search for
1142 @param Registration Optional Registration Key returned from
1143 RegisterProtocolNotify()
1144 @param Interface Return the Protocol interface (instance).
1146 @retval EFI_SUCCESS If a valid Interface is returned
1147 @retval EFI_INVALID_PARAMETER Invalid parameter
1148 @retval EFI_NOT_FOUND Protocol interface not found
1153 CoreLocateProtocol (
1154 IN EFI_GUID
*Protocol
,
1155 IN VOID
*Registration OPTIONAL
,
1156 OUT VOID
**Interface
1161 return handle database key.
1164 @return Handle database key.
1168 CoreGetHandleDatabaseKey (
1174 Go connect any handles that were created or modified while a image executed.
1176 @param Key The Key to show that the handle has been
1181 CoreConnectHandlesByKey (
1188 Connects one or more drivers to a controller.
1190 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1191 @param DriverImageHandle A pointer to an ordered list handles that support the
1192 EFI_DRIVER_BINDING_PROTOCOL.
1193 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1194 controller specified by ControllerHandle.
1195 @param Recursive If TRUE, then ConnectController() is called recursively
1196 until the entire tree of controllers below the controller specified
1197 by ControllerHandle have been created. If FALSE, then
1198 the tree of controllers is only expanded one level.
1200 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1201 2) No drivers were connected to ControllerHandle, but
1202 RemainingDevicePath is not NULL, and it is an End Device
1204 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1205 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1206 present in the system.
1207 2) No drivers were connected to ControllerHandle.
1208 @retval EFI_SECURITY_VIOLATION
1209 The user has no permission to start UEFI device drivers on the device path
1210 associated with the ControllerHandle or specified by the RemainingDevicePath.
1215 CoreConnectController (
1216 IN EFI_HANDLE ControllerHandle
,
1217 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1218 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1219 IN BOOLEAN Recursive
1225 Disonnects a controller from a driver
1227 @param ControllerHandle ControllerHandle The handle of
1228 the controller from which
1231 @param DriverImageHandle DriverImageHandle The driver to
1232 disconnect from ControllerHandle.
1233 @param ChildHandle ChildHandle The handle of the
1236 @retval EFI_SUCCESS One or more drivers were
1237 disconnected from the controller.
1238 @retval EFI_SUCCESS On entry, no drivers are managing
1240 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1241 and on entry DriverImageHandle is
1242 not managing ControllerHandle.
1243 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1244 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1245 and it is not a valid EFI_HANDLE.
1246 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1247 is not a valid EFI_HANDLE.
1248 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1249 available to disconnect any
1250 drivers from ControllerHandle.
1251 @retval EFI_DEVICE_ERROR The controller could not be
1252 disconnected because of a device
1258 CoreDisconnectController (
1259 IN EFI_HANDLE ControllerHandle
,
1260 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1261 IN EFI_HANDLE ChildHandle OPTIONAL
1267 Allocates pages from the memory map.
1269 @param Type The type of allocation to perform
1270 @param MemoryType The type of memory to turn the allocated pages
1272 @param NumberOfPages The number of pages to allocate
1273 @param Memory A pointer to receive the base allocated memory
1276 @return Status. On success, Memory is filled in with the base address allocated
1277 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1279 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1280 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1281 @retval EFI_SUCCESS Pages successfully allocated.
1287 IN EFI_ALLOCATE_TYPE Type
,
1288 IN EFI_MEMORY_TYPE MemoryType
,
1289 IN UINTN NumberOfPages
,
1290 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1294 Frees previous allocated pages.
1296 @param Memory Base address of memory being freed
1297 @param NumberOfPages The number of pages to free
1299 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1300 @retval EFI_INVALID_PARAMETER Address not aligned
1301 @return EFI_SUCCESS -Pages successfully freed.
1307 IN EFI_PHYSICAL_ADDRESS Memory
,
1308 IN UINTN NumberOfPages
1312 This function returns a copy of the current memory map. The map is an array of
1313 memory descriptors, each of which describes a contiguous block of memory.
1315 @param MemoryMapSize A pointer to the size, in bytes, of the
1316 MemoryMap buffer. On input, this is the size of
1317 the buffer allocated by the caller. On output,
1318 it is the size of the buffer returned by the
1319 firmware if the buffer was large enough, or the
1320 size of the buffer needed to contain the map if
1321 the buffer was too small.
1322 @param MemoryMap A pointer to the buffer in which firmware places
1323 the current memory map.
1324 @param MapKey A pointer to the location in which firmware
1325 returns the key for the current memory map.
1326 @param DescriptorSize A pointer to the location in which firmware
1327 returns the size, in bytes, of an individual
1328 EFI_MEMORY_DESCRIPTOR.
1329 @param DescriptorVersion A pointer to the location in which firmware
1330 returns the version number associated with the
1331 EFI_MEMORY_DESCRIPTOR.
1333 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1335 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1336 buffer size needed to hold the memory map is
1337 returned in MemoryMapSize.
1338 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1344 IN OUT UINTN
*MemoryMapSize
,
1345 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1347 OUT UINTN
*DescriptorSize
,
1348 OUT UINT32
*DescriptorVersion
1354 Allocate pool of a particular type.
1356 @param PoolType Type of pool to allocate
1357 @param Size The amount of pool to allocate
1358 @param Buffer The address to return a pointer to the allocated
1361 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1362 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1363 @retval EFI_SUCCESS Pool successfully allocated.
1369 IN EFI_MEMORY_TYPE PoolType
,
1375 Allocate pool of a particular type.
1377 @param PoolType Type of pool to allocate
1378 @param Size The amount of pool to allocate
1379 @param Buffer The address to return a pointer to the allocated
1382 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1383 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1384 @retval EFI_SUCCESS Pool successfully allocated.
1389 CoreInternalAllocatePool (
1390 IN EFI_MEMORY_TYPE PoolType
,
1398 @param Buffer The allocated pool entry to free
1400 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1401 @retval EFI_SUCCESS Pool successfully freed.
1413 @param Buffer The allocated pool entry to free
1414 @param PoolType Pointer to pool type
1416 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1417 @retval EFI_SUCCESS Pool successfully freed.
1422 CoreInternalFreePool (
1424 OUT EFI_MEMORY_TYPE
*PoolType OPTIONAL
1428 Loads an EFI image into memory and returns a handle to the image.
1430 @param BootPolicy If TRUE, indicates that the request originates
1431 from the boot manager, and that the boot
1432 manager is attempting to load FilePath as a
1434 @param ParentImageHandle The caller's image handle.
1435 @param FilePath The specific file path from which the image is
1437 @param SourceBuffer If not NULL, a pointer to the memory location
1438 containing a copy of the image to be loaded.
1439 @param SourceSize The size in bytes of SourceBuffer.
1440 @param ImageHandle Pointer to the returned image handle that is
1441 created when the image is successfully loaded.
1443 @retval EFI_SUCCESS The image was loaded into memory.
1444 @retval EFI_NOT_FOUND The FilePath was not found.
1445 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1446 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1447 path cannot be parsed to locate the proper
1448 protocol for loading the file.
1449 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1451 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1453 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1454 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1455 image from being loaded. NULL is returned in *ImageHandle.
1456 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1457 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1458 platform policy specifies that the image should not be started.
1464 IN BOOLEAN BootPolicy
,
1465 IN EFI_HANDLE ParentImageHandle
,
1466 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1467 IN VOID
*SourceBuffer OPTIONAL
,
1468 IN UINTN SourceSize
,
1469 OUT EFI_HANDLE
*ImageHandle
1477 @param ImageHandle Handle that identifies the image to be
1480 @retval EFI_SUCCESS The image has been unloaded.
1481 @retval EFI_UNSUPPORTED The image has been started, and does not support
1483 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1489 IN EFI_HANDLE ImageHandle
1495 Transfer control to a loaded image's entry point.
1497 @param ImageHandle Handle of image to be started.
1498 @param ExitDataSize Pointer of the size to ExitData
1499 @param ExitData Pointer to a pointer to a data buffer that
1500 includes a Null-terminated string,
1501 optionally followed by additional binary data.
1502 The string is a description that the caller may
1503 use to further indicate the reason for the
1506 @retval EFI_INVALID_PARAMETER Invalid parameter
1507 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1508 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1509 @retval EFI_SUCCESS Successfully transfer control to the image's
1516 IN EFI_HANDLE ImageHandle
,
1517 OUT UINTN
*ExitDataSize
,
1518 OUT CHAR16
**ExitData OPTIONAL
1524 Terminates the currently loaded EFI image and returns control to boot services.
1526 @param ImageHandle Handle that identifies the image. This
1527 parameter is passed to the image on entry.
1528 @param Status The image's exit code.
1529 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1530 ExitStatus is EFI_SUCCESS.
1531 @param ExitData Pointer to a data buffer that includes a
1532 Null-terminated Unicode string, optionally
1533 followed by additional binary data. The string
1534 is a description that the caller may use to
1535 further indicate the reason for the image's
1538 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1540 @retval EFI_SUCCESS Successfully terminates the currently loaded
1542 @retval EFI_ACCESS_DENIED Should never reach there.
1543 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1549 IN EFI_HANDLE ImageHandle
,
1550 IN EFI_STATUS Status
,
1551 IN UINTN ExitDataSize
,
1552 IN CHAR16
*ExitData OPTIONAL
1560 @param Type The type of event to create and its mode and
1562 @param NotifyTpl The task priority level of event notifications
1563 @param NotifyFunction Pointer to the events notification function
1564 @param NotifyContext Pointer to the notification functions context;
1565 corresponds to parameter "Context" in the
1566 notification function
1567 @param Event Pointer to the newly created event if the call
1568 succeeds; undefined otherwise
1570 @retval EFI_SUCCESS The event structure was created
1571 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1572 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1579 IN EFI_TPL NotifyTpl
,
1580 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1581 IN VOID
*NotifyContext
, OPTIONAL
1582 OUT EFI_EVENT
*Event
1588 Creates an event in a group.
1590 @param Type The type of event to create and its mode and
1592 @param NotifyTpl The task priority level of event notifications
1593 @param NotifyFunction Pointer to the events notification function
1594 @param NotifyContext Pointer to the notification functions context;
1595 corresponds to parameter "Context" in the
1596 notification function
1597 @param EventGroup GUID for EventGroup if NULL act the same as
1599 @param Event Pointer to the newly created event if the call
1600 succeeds; undefined otherwise
1602 @retval EFI_SUCCESS The event structure was created
1603 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1604 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1611 IN EFI_TPL NotifyTpl
,
1612 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1613 IN CONST VOID
*NotifyContext
, OPTIONAL
1614 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1615 OUT EFI_EVENT
*Event
1619 Creates a general-purpose event structure
1621 @param Type The type of event to create and its mode and
1623 @param NotifyTpl The task priority level of event notifications
1624 @param NotifyFunction Pointer to the events notification function
1625 @param NotifyContext Pointer to the notification functions context;
1626 corresponds to parameter "Context" in the
1627 notification function
1628 @param EventGroup GUID for EventGroup if NULL act the same as
1630 @param Event Pointer to the newly created event if the call
1631 succeeds; undefined otherwise
1633 @retval EFI_SUCCESS The event structure was created
1634 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1635 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1640 CoreCreateEventInternal (
1642 IN EFI_TPL NotifyTpl
,
1643 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1644 IN CONST VOID
*NotifyContext
, OPTIONAL
1645 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1646 OUT EFI_EVENT
*Event
1650 Sets the type of timer and the trigger time for a timer event.
1652 @param UserEvent The timer event that is to be signaled at the
1654 @param Type The type of time that is specified in
1656 @param TriggerTime The number of 100ns units until the timer
1659 @retval EFI_SUCCESS The event has been set to be signaled at the
1661 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1667 IN EFI_EVENT UserEvent
,
1668 IN EFI_TIMER_DELAY Type
,
1669 IN UINT64 TriggerTime
1675 Signals the event. Queues the event to be notified if needed.
1677 @param UserEvent The event to signal .
1679 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1680 @retval EFI_SUCCESS The event was signaled.
1686 IN EFI_EVENT UserEvent
1692 Stops execution until an event is signaled.
1694 @param NumberOfEvents The number of events in the UserEvents array
1695 @param UserEvents An array of EFI_EVENT
1696 @param UserIndex Pointer to the index of the event which
1697 satisfied the wait condition
1699 @retval EFI_SUCCESS The event indicated by Index was signaled.
1700 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1701 function or Event was not a valid type
1702 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1708 IN UINTN NumberOfEvents
,
1709 IN EFI_EVENT
*UserEvents
,
1710 OUT UINTN
*UserIndex
1716 Closes an event and frees the event structure.
1718 @param UserEvent Event to close
1720 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1721 @retval EFI_SUCCESS The event has been closed
1727 IN EFI_EVENT UserEvent
1733 Check the status of an event.
1735 @param UserEvent The event to check
1737 @retval EFI_SUCCESS The event is in the signaled state
1738 @retval EFI_NOT_READY The event is not in the signaled state
1739 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1745 IN EFI_EVENT UserEvent
1750 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1751 global coherency domain of the processor.
1753 @param GcdMemoryType Memory type of the memory space.
1754 @param BaseAddress Base address of the memory space.
1755 @param Length Length of the memory space.
1756 @param Capabilities alterable attributes of the memory space.
1758 @retval EFI_SUCCESS Merged this memory space into GCD map.
1763 CoreAddMemorySpace (
1764 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1765 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1767 IN UINT64 Capabilities
1772 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1773 I/O resources from the global coherency domain of the processor.
1775 @param GcdAllocateType The type of allocate operation
1776 @param GcdMemoryType The desired memory type
1777 @param Alignment Align with 2^Alignment
1778 @param Length Length to allocate
1779 @param BaseAddress Base address to allocate
1780 @param ImageHandle The image handle consume the allocated space.
1781 @param DeviceHandle The device handle consume the allocated space.
1783 @retval EFI_INVALID_PARAMETER Invalid parameter.
1784 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1785 @retval EFI_SUCCESS Memory space successfully allocated.
1790 CoreAllocateMemorySpace (
1791 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1792 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1795 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1796 IN EFI_HANDLE ImageHandle
,
1797 IN EFI_HANDLE DeviceHandle OPTIONAL
1802 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1803 I/O resources from the global coherency domain of the processor.
1805 @param BaseAddress Base address of the memory space.
1806 @param Length Length of the memory space.
1808 @retval EFI_SUCCESS Space successfully freed.
1813 CoreFreeMemorySpace (
1814 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1820 Removes reserved memory, system memory, or memory-mapped I/O resources from
1821 the global coherency domain of the processor.
1823 @param BaseAddress Base address of the memory space.
1824 @param Length Length of the memory space.
1826 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1831 CoreRemoveMemorySpace (
1832 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1838 Retrieves the descriptor for a memory region containing a specified address.
1840 @param BaseAddress Specified start address
1841 @param Descriptor Specified length
1843 @retval EFI_INVALID_PARAMETER Invalid parameter
1844 @retval EFI_SUCCESS Successfully get memory space descriptor.
1849 CoreGetMemorySpaceDescriptor (
1850 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1851 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1856 Modifies the attributes for a memory region in the global coherency domain of the
1859 @param BaseAddress Specified start address
1860 @param Length Specified length
1861 @param Attributes Specified attributes
1863 @retval EFI_SUCCESS The attributes were set for the memory region.
1864 @retval EFI_INVALID_PARAMETER Length is zero.
1865 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1866 resource range specified by BaseAddress and Length.
1867 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1868 range specified by BaseAddress and Length.
1869 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1870 BaseAddress and Length cannot be modified.
1871 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1872 the memory resource range.
1873 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1879 CoreSetMemorySpaceAttributes (
1880 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1882 IN UINT64 Attributes
1887 Modifies the capabilities for a memory region in the global coherency domain of the
1890 @param BaseAddress The physical address that is the start address of a memory region.
1891 @param Length The size in bytes of the memory region.
1892 @param Capabilities The bit mask of capabilities that the memory region supports.
1894 @retval EFI_SUCCESS The capabilities were set for the memory region.
1895 @retval EFI_INVALID_PARAMETER Length is zero.
1896 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1897 memory region attributes currently in use.
1898 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1899 BaseAddress and Length cannot be modified.
1900 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1901 of the memory resource range.
1905 CoreSetMemorySpaceCapabilities (
1906 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1908 IN UINT64 Capabilities
1913 Returns a map of the memory resources in the global coherency domain of the
1916 @param NumberOfDescriptors Number of descriptors.
1917 @param MemorySpaceMap Descriptor array
1919 @retval EFI_INVALID_PARAMETER Invalid parameter
1920 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1921 @retval EFI_SUCCESS Successfully get memory space map.
1926 CoreGetMemorySpaceMap (
1927 OUT UINTN
*NumberOfDescriptors
,
1928 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1933 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1935 @param GcdIoType IO type of the segment.
1936 @param BaseAddress Base address of the segment.
1937 @param Length Length of the segment.
1939 @retval EFI_SUCCESS Merged this segment into GCD map.
1940 @retval EFI_INVALID_PARAMETER Parameter not valid
1946 IN EFI_GCD_IO_TYPE GcdIoType
,
1947 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1953 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1954 domain of the processor.
1956 @param GcdAllocateType The type of allocate operation
1957 @param GcdIoType The desired IO type
1958 @param Alignment Align with 2^Alignment
1959 @param Length Length to allocate
1960 @param BaseAddress Base address to allocate
1961 @param ImageHandle The image handle consume the allocated space.
1962 @param DeviceHandle The device handle consume the allocated space.
1964 @retval EFI_INVALID_PARAMETER Invalid parameter.
1965 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1966 @retval EFI_SUCCESS IO space successfully allocated.
1971 CoreAllocateIoSpace (
1972 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1973 IN EFI_GCD_IO_TYPE GcdIoType
,
1976 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1977 IN EFI_HANDLE ImageHandle
,
1978 IN EFI_HANDLE DeviceHandle OPTIONAL
1983 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1984 domain of the processor.
1986 @param BaseAddress Base address of the segment.
1987 @param Length Length of the segment.
1989 @retval EFI_SUCCESS Space successfully freed.
1995 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2001 Removes reserved I/O or I/O resources from the global coherency domain of the
2004 @param BaseAddress Base address of the segment.
2005 @param Length Length of the segment.
2007 @retval EFI_SUCCESS Successfully removed a segment of IO space.
2013 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2019 Retrieves the descriptor for an I/O region containing a specified address.
2021 @param BaseAddress Specified start address
2022 @param Descriptor Specified length
2024 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
2025 @retval EFI_SUCCESS Successfully get the IO space descriptor.
2030 CoreGetIoSpaceDescriptor (
2031 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2032 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2037 Returns a map of the I/O resources in the global coherency domain of the processor.
2039 @param NumberOfDescriptors Number of descriptors.
2040 @param IoSpaceMap Descriptor array
2042 @retval EFI_INVALID_PARAMETER Invalid parameter
2043 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2044 @retval EFI_SUCCESS Successfully get IO space map.
2050 OUT UINTN
*NumberOfDescriptors
,
2051 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2056 This is the main Dispatcher for DXE and it exits when there are no more
2057 drivers to run. Drain the mScheduledQueue and load and start a PE
2058 image for each driver. Search the mDiscoveredList to see if any driver can
2059 be placed on the mScheduledQueue. If no drivers are placed on the
2060 mScheduledQueue exit the function. On exit it is assumed the Bds()
2061 will be called, and when the Bds() exits the Dispatcher will be called
2064 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2065 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2066 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2076 Check every driver and locate a matching one. If the driver is found, the Unrequested
2077 state flag is cleared.
2079 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2080 the firmware file specified by DriverName.
2081 @param DriverName The Driver name to put in the Dependent state.
2083 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2085 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2092 IN EFI_HANDLE FirmwareVolumeHandle
,
2093 IN EFI_GUID
*DriverName
2098 Convert a driver from the Untrused back to the Scheduled state.
2100 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2101 the firmware file specified by DriverName.
2102 @param DriverName The Driver name to put in the Scheduled state
2104 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2105 was promoted to the trusted state.
2106 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2112 IN EFI_HANDLE FirmwareVolumeHandle
,
2113 IN EFI_GUID
*DriverName
2118 This routine is the driver initialization entry point. It initializes the
2119 libraries, and registers two notification functions. These notification
2120 functions are responsible for building the FV stack dynamically.
2122 @param ImageHandle The image handle.
2123 @param SystemTable The system table.
2125 @retval EFI_SUCCESS Function successfully returned.
2131 IN EFI_HANDLE ImageHandle
,
2132 IN EFI_SYSTEM_TABLE
*SystemTable
2137 Entry point of the section extraction code. Initializes an instance of the
2138 section extraction interface and installs it on a new handle.
2140 @param ImageHandle A handle for the image that is initializing this driver
2141 @param SystemTable A pointer to the EFI system table
2143 @retval EFI_SUCCESS Driver initialized successfully
2144 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2149 InitializeSectionExtraction (
2150 IN EFI_HANDLE ImageHandle
,
2151 IN EFI_SYSTEM_TABLE
*SystemTable
2156 This DXE service routine is used to process a firmware volume. In
2157 particular, it can be called by BDS to process a single firmware
2158 volume found in a capsule.
2160 @param FvHeader pointer to a firmware volume header
2161 @param Size the size of the buffer pointed to by FvHeader
2162 @param FVProtocolHandle the handle on which a firmware volume protocol
2163 was produced for the firmware volume passed in.
2165 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2167 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2168 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2174 CoreProcessFirmwareVolume (
2177 OUT EFI_HANDLE
*FVProtocolHandle
2181 //Functions used during debug buils
2185 Displays Architectural protocols that were not loaded and are required for DXE
2186 core to function. Only used in Debug Builds.
2190 CoreDisplayMissingArchProtocols (
2196 Traverse the discovered list for any drivers that were discovered but not loaded
2197 because the dependency experessions evaluated to false.
2201 CoreDisplayDiscoveredNotDispatched (
2207 Place holder function until all the Boot Services and Runtime Services are
2210 @return EFI_NOT_AVAILABLE_YET
2215 CoreEfiNotAvailableYetArg0 (
2221 Place holder function until all the Boot Services and Runtime Services are
2224 @param Arg1 Undefined
2226 @return EFI_NOT_AVAILABLE_YET
2231 CoreEfiNotAvailableYetArg1 (
2237 Place holder function until all the Boot Services and Runtime Services are available.
2239 @param Arg1 Undefined
2240 @param Arg2 Undefined
2242 @return EFI_NOT_AVAILABLE_YET
2247 CoreEfiNotAvailableYetArg2 (
2254 Place holder function until all the Boot Services and Runtime Services are available.
2256 @param Arg1 Undefined
2257 @param Arg2 Undefined
2258 @param Arg3 Undefined
2260 @return EFI_NOT_AVAILABLE_YET
2265 CoreEfiNotAvailableYetArg3 (
2273 Place holder function until all the Boot Services and Runtime Services are available.
2275 @param Arg1 Undefined
2276 @param Arg2 Undefined
2277 @param Arg3 Undefined
2278 @param Arg4 Undefined
2280 @return EFI_NOT_AVAILABLE_YET
2285 CoreEfiNotAvailableYetArg4 (
2294 Place holder function until all the Boot Services and Runtime Services are available.
2296 @param Arg1 Undefined
2297 @param Arg2 Undefined
2298 @param Arg3 Undefined
2299 @param Arg4 Undefined
2300 @param Arg5 Undefined
2302 @return EFI_NOT_AVAILABLE_YET
2307 CoreEfiNotAvailableYetArg5 (
2317 Given a compressed source buffer, this function retrieves the size of the
2318 uncompressed buffer and the size of the scratch buffer required to decompress
2319 the compressed source buffer.
2321 The GetInfo() function retrieves the size of the uncompressed buffer and the
2322 temporary scratch buffer required to decompress the buffer specified by Source
2323 and SourceSize. If the size of the uncompressed buffer or the size of the
2324 scratch buffer cannot be determined from the compressed data specified by
2325 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2326 size of the uncompressed buffer is returned in DestinationSize, the size of
2327 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2328 The GetInfo() function does not have scratch buffer available to perform a
2329 thorough checking of the validity of the source data. It just retrieves the
2330 "Original Size" field from the beginning bytes of the source data and output
2331 it as DestinationSize. And ScratchSize is specific to the decompression
2334 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2335 @param Source The source buffer containing the compressed data.
2336 @param SourceSize The size, in bytes, of the source buffer.
2337 @param DestinationSize A pointer to the size, in bytes, of the
2338 uncompressed buffer that will be generated when the
2339 compressed buffer specified by Source and
2340 SourceSize is decompressed.
2341 @param ScratchSize A pointer to the size, in bytes, of the scratch
2342 buffer that is required to decompress the
2343 compressed buffer specified by Source and
2346 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2347 DestinationSize and the size of the scratch buffer
2348 was returned in ScratchSize.
2349 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2350 the scratch buffer cannot be determined from the
2351 compressed data specified by Source and
2357 DxeMainUefiDecompressGetInfo (
2358 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2360 IN UINT32 SourceSize
,
2361 OUT UINT32
*DestinationSize
,
2362 OUT UINT32
*ScratchSize
2367 Decompresses a compressed source buffer.
2369 The Decompress() function extracts decompressed data to its original form.
2370 This protocol is designed so that the decompression algorithm can be
2371 implemented without using any memory services. As a result, the Decompress()
2372 Function is not allowed to call AllocatePool() or AllocatePages() in its
2373 implementation. It is the caller's responsibility to allocate and free the
2374 Destination and Scratch buffers.
2375 If the compressed source data specified by Source and SourceSize is
2376 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2377 the compressed source data specified by Source and SourceSize is not in a
2378 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2380 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2381 @param Source The source buffer containing the compressed data.
2382 @param SourceSize SourceSizeThe size of source data.
2383 @param Destination On output, the destination buffer that contains
2384 the uncompressed data.
2385 @param DestinationSize The size of the destination buffer. The size of
2386 the destination buffer needed is obtained from
2387 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2388 @param Scratch A temporary scratch buffer that is used to perform
2390 @param ScratchSize The size of scratch buffer. The size of the
2391 scratch buffer needed is obtained from GetInfo().
2393 @retval EFI_SUCCESS Decompression completed successfully, and the
2394 uncompressed buffer is returned in Destination.
2395 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2396 SourceSize is corrupted (not in a valid
2402 DxeMainUefiDecompress (
2403 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2405 IN UINT32 SourceSize
,
2406 IN OUT VOID
*Destination
,
2407 IN UINT32 DestinationSize
,
2408 IN OUT VOID
*Scratch
,
2409 IN UINT32 ScratchSize
2413 SEP member function. This function creates and returns a new section stream
2414 handle to represent the new section stream.
2416 @param SectionStreamLength Size in bytes of the section stream.
2417 @param SectionStream Buffer containing the new section stream.
2418 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2419 output contains the new section stream handle.
2421 @retval EFI_SUCCESS The section stream is created successfully.
2422 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2423 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2430 IN UINTN SectionStreamLength
,
2431 IN VOID
*SectionStream
,
2432 OUT UINTN
*SectionStreamHandle
2438 SEP member function. Retrieves requested section from section stream.
2440 @param SectionStreamHandle The section stream from which to extract the
2442 @param SectionType A pointer to the type of section to search for.
2443 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2444 then SectionDefinitionGuid indicates which of
2445 these types of sections to search for.
2446 @param SectionInstance Indicates which instance of the requested
2448 @param Buffer Double indirection to buffer. If *Buffer is
2449 non-null on input, then the buffer is caller
2450 allocated. If Buffer is NULL, then the buffer
2451 is callee allocated. In either case, the
2452 required buffer size is returned in *BufferSize.
2453 @param BufferSize On input, indicates the size of *Buffer if
2454 *Buffer is non-null on input. On output,
2455 indicates the required size (allocated size if
2456 callee allocated) of *Buffer.
2457 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2458 indicates the authentication status of the
2459 output buffer. If the input section's
2460 GuidedSectionHeader.Attributes field
2461 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2462 bit as clear, AuthenticationStatus must return
2463 zero. Both local bits (19:16) and aggregate
2464 bits (3:0) in AuthenticationStatus are returned
2465 by ExtractSection(). These bits reflect the
2466 status of the extraction operation. The bit
2467 pattern in both regions must be the same, as
2468 the local and aggregate authentication statuses
2469 have equivalent meaning at this level. If the
2470 function returns anything other than
2471 EFI_SUCCESS, the value of *AuthenticationStatus
2473 @param IsFfs3Fv Indicates the FV format.
2475 @retval EFI_SUCCESS Section was retrieved successfully
2476 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2477 section stream with its
2478 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2479 but there was no corresponding GUIDed Section
2480 Extraction Protocol in the handle database.
2481 *Buffer is unmodified.
2482 @retval EFI_NOT_FOUND An error was encountered when parsing the
2483 SectionStream. This indicates the SectionStream
2484 is not correctly formatted.
2485 @retval EFI_NOT_FOUND The requested section does not exist.
2486 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2488 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2489 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2490 insufficient to contain the requested section.
2491 The input buffer is filled and section contents
2498 IN UINTN SectionStreamHandle
,
2499 IN EFI_SECTION_TYPE
*SectionType
,
2500 IN EFI_GUID
*SectionDefinitionGuid
,
2501 IN UINTN SectionInstance
,
2503 IN OUT UINTN
*BufferSize
,
2504 OUT UINT32
*AuthenticationStatus
,
2510 SEP member function. Deletes an existing section stream
2512 @param StreamHandleToClose Indicates the stream to close
2513 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2514 FALSE - No need to free stream buffer.
2516 @retval EFI_SUCCESS The section stream is closed sucessfully.
2517 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2518 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2524 CloseSectionStream (
2525 IN UINTN StreamHandleToClose
,
2526 IN BOOLEAN FreeStreamBuffer
2530 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2531 table and registers it into the system table.
2534 This function allocates memory, frees it, and then allocates memory at an
2535 address within the initial allocation. Since this function is called early
2536 in DXE core initialization (before drivers are dispatched), this should not
2541 CoreInitializeDebugImageInfoTable (
2547 Update the CRC32 in the Debug Table.
2548 Since the CRC32 service is made available by the Runtime driver, we have to
2549 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2550 This function is called elsewhere by the core when the runtime architectural
2551 protocol is produced.
2555 CoreUpdateDebugTableCrc32 (
2561 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2562 the table if it's not large enough to accomidate another entry.
2564 @param ImageInfoType type of debug image information
2565 @param LoadedImage pointer to the loaded image protocol for the image being
2567 @param ImageHandle image handle for the image being loaded
2571 CoreNewDebugImageInfoEntry (
2572 IN UINT32 ImageInfoType
,
2573 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2574 IN EFI_HANDLE ImageHandle
2579 Removes and frees an entry from the DebugImageInfo Table.
2581 @param ImageHandle image handle for the image being unloaded
2585 CoreRemoveDebugImageInfoEntry (
2586 EFI_HANDLE ImageHandle
2591 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2593 @param ImageHandle The image handle.
2594 @param SystemTable The system table.
2596 @retval EFI_SUCCESS Successfully initialized firmware volume block
2602 FwVolBlockDriverInit (
2603 IN EFI_HANDLE ImageHandle
,
2604 IN EFI_SYSTEM_TABLE
*SystemTable
2609 Get FVB authentication status
2611 @param FvbProtocol FVB protocol.
2613 @return Authentication status.
2617 GetFvbAuthenticationStatus (
2618 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2622 This routine produces a firmware volume block protocol on a given
2625 @param BaseAddress base address of the firmware volume image
2626 @param Length length of the firmware volume image
2627 @param ParentHandle handle of parent firmware volume, if this image
2628 came from an FV image file and section in another firmware
2629 volume (ala capsules)
2630 @param AuthenticationStatus Authentication status inherited, if this image
2631 came from an FV image file and section in another firmware volume.
2632 @param FvProtocol Firmware volume block protocol produced.
2634 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2635 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2636 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2641 ProduceFVBProtocolOnBuffer (
2642 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2644 IN EFI_HANDLE ParentHandle
,
2645 IN UINT32 AuthenticationStatus
,
2646 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2651 Raising to the task priority level of the mutual exclusion
2652 lock, and then acquires ownership of the lock.
2654 @param Lock The lock to acquire
2666 Initialize a basic mutual exclusion lock. Each lock
2667 provides mutual exclusion access at it's task priority
2668 level. Since there is no-premption (at any TPL) or
2669 multiprocessor support, acquiring the lock only consists
2670 of raising to the locks TPL.
2672 @param Lock The EFI_LOCK structure to initialize
2674 @retval EFI_SUCCESS Lock Owned.
2675 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2679 CoreAcquireLockOrFail (
2685 Releases ownership of the mutual exclusion lock, and
2686 restores the previous task priority level.
2688 @param Lock The lock to release
2690 @return Lock unowned
2699 Read data from Firmware Block by FVB protocol Read.
2700 The data may cross the multi block ranges.
2702 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2703 @param StartLba Pointer to StartLba.
2704 On input, the start logical block index from which to read.
2705 On output,the end logical block index after reading.
2706 @param Offset Pointer to Offset
2707 On input, offset into the block at which to begin reading.
2708 On output, offset into the end block after reading.
2709 @param DataSize Size of data to be read.
2710 @param Data Pointer to Buffer that the data will be read into.
2712 @retval EFI_SUCCESS Successfully read data from firmware block.
2717 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2718 IN OUT EFI_LBA
*StartLba
,
2719 IN OUT UINTN
*Offset
,
2725 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2726 copy the real length volume header into it.
2728 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2729 read the volume header
2730 @param FwVolHeader Pointer to pointer to allocated buffer in which
2731 the volume header is returned.
2733 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2734 @retval EFI_SUCCESS Successfully read volume header to the allocated
2736 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2737 the file system could not be understood.
2742 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2743 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2747 Verify checksum of the firmware volume header.
2749 @param FvHeader Points to the firmware volume header to be checked
2751 @retval TRUE Checksum verification passed
2752 @retval FALSE Checksum verification failed
2756 VerifyFvHeaderChecksum (
2757 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2761 Initialize memory profile.
2763 @param HobStart The start address of the HOB.
2772 Install memory profile protocol.
2776 MemoryProfileInstallProtocol (
2781 Register image to memory profile.
2783 @param DriverEntry Image info.
2784 @param FileType Image file type.
2786 @return EFI_SUCCESS Register successfully.
2787 @return EFI_UNSUPPORTED Memory profile unsupported,
2788 or memory profile for the image is not required.
2789 @return EFI_OUT_OF_RESOURCES No enough resource for this register.
2793 RegisterMemoryProfileImage (
2794 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2795 IN EFI_FV_FILETYPE FileType
2799 Unregister image from memory profile.
2801 @param DriverEntry Image info.
2803 @return EFI_SUCCESS Unregister successfully.
2804 @return EFI_UNSUPPORTED Memory profile unsupported,
2805 or memory profile for the image is not required.
2806 @return EFI_NOT_FOUND The image is not found.
2810 UnregisterMemoryProfileImage (
2811 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2815 Update memory profile information.
2817 @param CallerAddress Address of caller who call Allocate or Free.
2818 @param Action This Allocate or Free action.
2819 @param MemoryType Memory type.
2820 EfiMaxMemoryType means the MemoryType is unknown.
2821 @param Size Buffer size.
2822 @param Buffer Buffer address.
2823 @param ActionString String for memory profile action.
2824 Only needed for user defined allocate action.
2826 @return EFI_SUCCESS Memory profile is updated.
2827 @return EFI_UNSUPPORTED Memory profile is unsupported,
2828 or memory profile for the image is not required,
2829 or memory profile for the memory type is not required.
2830 @return EFI_ACCESS_DENIED It is during memory profile data getting.
2831 @return EFI_ABORTED Memory profile recording is not enabled.
2832 @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.
2833 @return EFI_NOT_FOUND No matched allocate info found for free action.
2839 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2840 IN MEMORY_PROFILE_ACTION Action
,
2841 IN EFI_MEMORY_TYPE MemoryType
,
2842 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2844 IN CHAR8
*ActionString OPTIONAL
2848 Internal function. Converts a memory range to use new attributes.
2850 @param Start The first address of the range Must be page
2852 @param NumberOfPages The number of pages to convert
2853 @param NewAttributes The new attributes value for the range.
2857 CoreUpdateMemoryAttributes (
2858 IN EFI_PHYSICAL_ADDRESS Start
,
2859 IN UINT64 NumberOfPages
,
2860 IN UINT64 NewAttributes
2864 Initialize PropertiesTable support.
2868 CoreInitializePropertiesTable (
2873 Initialize MemoryAttrubutesTable support.
2877 CoreInitializeMemoryAttributesTable (
2882 Initialize Memory Protection support.
2886 CoreInitializeMemoryProtection (
2891 Install MemoryAttributesTable on memory allocation.
2893 @param[in] MemoryType EFI memory type.
2896 InstallMemoryAttributesTableOnMemoryAllocation (
2897 IN EFI_MEMORY_TYPE MemoryType
2901 Insert image record.
2903 @param RuntimeImage Runtime image information
2907 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2911 Remove Image record.
2913 @param RuntimeImage Runtime image information
2917 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2923 @param[in] LoadedImage The loaded image protocol
2924 @param[in] LoadedImageDevicePath The loaded image device path protocol
2928 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2929 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2933 Unprotect UEFI image.
2935 @param[in] LoadedImage The loaded image protocol
2936 @param[in] LoadedImageDevicePath The loaded image device path protocol
2939 UnprotectUefiImage (
2940 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2941 IN EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
2945 ExitBootServices Callback function for memory protection.
2948 MemoryProtectionExitBootServicesCallback (