2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2016, 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/ZeroGuid.h>
73 #include <Guid/MemoryProfile.h>
75 #include <Library/DxeCoreEntryPoint.h>
76 #include <Library/DebugLib.h>
77 #include <Library/UefiLib.h>
78 #include <Library/BaseLib.h>
79 #include <Library/HobLib.h>
80 #include <Library/PerformanceLib.h>
81 #include <Library/UefiDecompressLib.h>
82 #include <Library/ExtractGuidedSectionLib.h>
83 #include <Library/CacheMaintenanceLib.h>
84 #include <Library/BaseMemoryLib.h>
85 #include <Library/PeCoffLib.h>
86 #include <Library/PeCoffGetEntryPointLib.h>
87 #include <Library/PeCoffExtraActionLib.h>
88 #include <Library/PcdLib.h>
89 #include <Library/MemoryAllocationLib.h>
90 #include <Library/DevicePathLib.h>
91 #include <Library/UefiBootServicesTableLib.h>
92 #include <Library/ReportStatusCodeLib.h>
93 #include <Library/TimerLib.h>
94 #include <Library/DxeServicesLib.h>
95 #include <Library/DebugAgentLib.h>
96 #include <Library/CpuExceptionHandlerLib.h>
100 // attributes for reserved memory before it is promoted to system memory
102 #define EFI_MEMORY_PRESENT 0x0100000000000000ULL
103 #define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL
104 #define EFI_MEMORY_TESTED 0x0400000000000000ULL
107 // range for memory mapped port I/O on IPF
109 #define EFI_MEMORY_PORT_IO 0x4000000000000000ULL
113 /// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependecy expression
114 /// to save time. A EFI_DEP_PUSH is evauated one an
115 /// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2
116 /// Driver Execution Environment Core Interface use 0xff
117 /// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be
118 /// defined to a new value that is not conflicting with PI spec.
120 #define EFI_DEP_REPLACE_TRUE 0xff
123 /// Define the initial size of the dependency expression evaluation stack
125 #define DEPEX_STACK_SIZE_INCREMENT 0x1000
127 #if defined (MDE_CPU_IPF)
129 /// For Itanium machines make the default allocations 8K aligned
131 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE * 2)
132 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE * 2)
134 #elif defined (MDE_CPU_AARCH64)
136 /// 64-bit ARM systems allow the OS to execute with 64 KB page size,
137 /// so for improved interoperability with the firmware, align the
138 /// runtime regions to 64 KB as well
140 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (SIZE_64KB)
141 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
145 /// For genric EFI machines make the default allocations 4K aligned
147 #define EFI_ACPI_RUNTIME_PAGE_ALLOCATION_ALIGNMENT (EFI_PAGE_SIZE)
148 #define DEFAULT_PAGE_ALLOCATION (EFI_PAGE_SIZE)
153 EFI_GUID
*ProtocolGuid
;
158 } EFI_CORE_PROTOCOL_NOTIFY_ENTRY
;
161 // DXE Dispatcher Data structures
164 #define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')
167 LIST_ENTRY Link
; // mFvHandleList
173 #define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')
176 LIST_ENTRY Link
; // mDriverList
178 LIST_ENTRY ScheduledLink
; // mScheduledQueue
182 EFI_DEVICE_PATH_PROTOCOL
*FvFileDevicePath
;
183 EFI_FIRMWARE_VOLUME2_PROTOCOL
*Fv
;
190 EFI_GUID BeforeAfterGuid
;
197 BOOLEAN DepexProtocolError
;
199 EFI_HANDLE ImageHandle
;
202 } EFI_CORE_DRIVER_ENTRY
;
205 //The data structure of GCD memory map entry
207 #define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')
211 EFI_PHYSICAL_ADDRESS BaseAddress
;
215 EFI_GCD_MEMORY_TYPE GcdMemoryType
;
216 EFI_GCD_IO_TYPE GcdIoType
;
217 EFI_HANDLE ImageHandle
;
218 EFI_HANDLE DeviceHandle
;
222 #define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')
230 /// If entrypoint has been called
232 /// The image's entry point
233 EFI_IMAGE_ENTRY_POINT EntryPoint
;
234 /// loaded image protocol
235 EFI_LOADED_IMAGE_PROTOCOL Info
;
236 /// Location in memory
237 EFI_PHYSICAL_ADDRESS ImageBasePage
;
240 /// Original fixup data
242 /// Tpl of started image
244 /// Status returned by started image
246 /// Size of ExitData from started image
248 /// Pointer to exit data from started image
250 /// Pointer to pool allocation for context save/retore
252 /// Pointer to buffer for context save/retore
253 BASE_LIBRARY_JUMP_BUFFER
*JumpContext
;
254 /// Machine type from PE image
256 /// EBC Protocol pointer
257 EFI_EBC_PROTOCOL
*Ebc
;
258 /// Runtime image list
259 EFI_RUNTIME_IMAGE_ENTRY
*RuntimeData
;
260 /// Pointer to Loaded Image Device Path Protocl
261 EFI_DEVICE_PATH_PROTOCOL
*LoadedImageDevicePath
;
262 /// PeCoffLoader ImageContext
263 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext
;
264 /// Status returned by LoadImage() service.
265 EFI_STATUS LoadImageStatus
;
266 } LOADED_IMAGE_PRIVATE_DATA
;
268 #define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \
269 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)
272 // DXE Core Global Variables
274 extern EFI_SYSTEM_TABLE
*gDxeCoreST
;
275 extern EFI_RUNTIME_SERVICES
*gDxeCoreRT
;
276 extern EFI_DXE_SERVICES
*gDxeCoreDS
;
277 extern EFI_HANDLE gDxeCoreImageHandle
;
279 extern BOOLEAN gMemoryMapTerminated
;
281 extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
283 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
284 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
285 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
286 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
287 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
288 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
289 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
290 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
291 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
293 extern EFI_TPL gEfiCurrentTpl
;
295 extern EFI_GUID
*gDxeCoreFileName
;
296 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
298 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
300 extern BOOLEAN gDispatcherRunning
;
301 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
303 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
304 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
306 // Service Initialization Functions
312 Called to initialize the pool.
322 Called to initialize the memory map and add descriptors to
323 the current descriptor list.
324 The first descriptor that is added must be general usable
325 memory as the addition allocates heap.
327 @param Type The type of memory to add
328 @param Start The starting address in the memory range Must be
330 @param NumberOfPages The number of pages in the range
331 @param Attribute Attributes of the memory to add
333 @return None. The range is added to the memory map
337 CoreAddMemoryDescriptor (
338 IN EFI_MEMORY_TYPE Type
,
339 IN EFI_PHYSICAL_ADDRESS Start
,
340 IN UINT64 NumberOfPages
,
346 Release memory lock on mGcdMemorySpaceLock.
350 CoreReleaseGcdMemoryLock (
356 Acquire memory lock on mGcdMemorySpaceLock.
360 CoreAcquireGcdMemoryLock (
366 External function. Initializes memory services based on the memory
367 descriptor HOBs. This function is responsible for priming the memory
368 map, so memory allocations and resource allocations can be made.
369 The first part of this function can not depend on any memory services
370 until at least one memory descriptor is provided to the memory services.
372 @param HobStart The start address of the HOB.
373 @param MemoryBaseAddress Start address of memory region found to init DXE
375 @param MemoryLength Length of memory region found to init DXE core.
377 @retval EFI_SUCCESS Memory services successfully initialized.
381 CoreInitializeMemoryServices (
383 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
384 OUT UINT64
*MemoryLength
390 External function. Initializes the GCD and memory services based on the memory
391 descriptor HOBs. This function is responsible for priming the GCD map and the
392 memory map, so memory allocations and resource allocations can be made. The
393 HobStart will be relocated to a pool buffer.
395 @param HobStart The start address of the HOB
396 @param MemoryBaseAddress Start address of memory region found to init DXE
398 @param MemoryLength Length of memory region found to init DXE core.
400 @retval EFI_SUCCESS GCD services successfully initialized.
404 CoreInitializeGcdServices (
405 IN OUT VOID
**HobStart
,
406 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
407 IN UINT64 MemoryLength
412 Initializes "event" support.
414 @retval EFI_SUCCESS Always return success
418 CoreInitializeEventServices (
424 Add the Image Services to EFI Boot Services Table and install the protocol
425 interfaces for this image.
427 @param HobStart The HOB to initialize
433 CoreInitializeImageServices (
439 Creates an event that is fired everytime a Protocol of a specific type is installed.
443 CoreNotifyOnProtocolInstallation (
449 Return TRUE if all AP services are availible.
451 @retval EFI_SUCCESS All AP services are available
452 @retval EFI_NOT_FOUND At least one AP service is not available
456 CoreAllEfiServicesAvailable (
462 Calcualte the 32-bit CRC in a EFI table using the service provided by the
465 @param Hdr Pointer to an EFI standard header
470 IN OUT EFI_TABLE_HEADER
*Hdr
475 Called by the platform code to process a tick.
477 @param Duration The number of 100ns elasped since the last call
489 Initialize the dispatcher. Initialize the notification function that runs when
490 an FV2 protocol is added to the system.
494 CoreInitializeDispatcher (
500 This is the POSTFIX version of the dependency evaluator. This code does
501 not need to handle Before or After, as it is not valid to call this
502 routine in this case. The SOR is just ignored and is a nop in the grammer.
503 POSTFIX means all the math is done on top of the stack.
505 @param DriverEntry DriverEntry element to update.
507 @retval TRUE If driver is ready to run.
508 @retval FALSE If driver is not ready to run or some fatal error
514 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
519 Preprocess dependency expression and update DriverEntry to reflect the
520 state of Before, After, and SOR dependencies. If DriverEntry->Before
521 or DriverEntry->After is set it will never be cleared. If SOR is set
522 it will be cleared by CoreSchedule(), and then the driver can be
525 @param DriverEntry DriverEntry element to update .
527 @retval EFI_SUCCESS It always works.
531 CorePreProcessDepex (
532 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
538 Terminates all boot services.
540 @param ImageHandle Handle that identifies the exiting image.
541 @param MapKey Key to the latest memory map.
543 @retval EFI_SUCCESS Boot Services terminated
544 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
549 CoreExitBootServices (
550 IN EFI_HANDLE ImageHandle
,
556 Make sure the memory map is following all the construction rules,
557 it is the last time to check memory map error before exit boot services.
559 @param MapKey Memory map key
561 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
563 @retval EFI_SUCCESS Valid memory map.
567 CoreTerminateMemoryMap (
573 Signals all events in the EventGroup.
575 @param EventGroup The list to signal
579 CoreNotifySignalList (
580 IN EFI_GUID
*EventGroup
586 Boot Service called to add, modify, or remove a system configuration table from
587 the EFI System Table.
589 @param Guid Pointer to the GUID for the entry to add, update, or
591 @param Table Pointer to the configuration table for the entry to add,
592 update, or remove, may be NULL.
594 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
595 @return EFI_INVALID_PARAMETER Input GUID not valid.
596 @return EFI_NOT_FOUND Attempted to delete non-existant entry
597 @return EFI_OUT_OF_RESOURCES Not enough memory available
602 CoreInstallConfigurationTable (
610 Raise the task priority level to the new level.
611 High level is implemented by disabling processor interrupts.
613 @param NewTpl New task priority level
615 @return The previous task priority level
627 Lowers the task priority to the previous value. If the new
628 priority unmasks events at a higher priority, they are dispatched.
630 @param NewTpl New, lower, task priority
642 Introduces a fine-grained stall.
644 @param Microseconds The number of microseconds to stall execution.
646 @retval EFI_SUCCESS Execution was stalled for at least the requested
647 amount of microseconds.
648 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
654 IN UINTN Microseconds
660 Sets the system's watchdog timer.
662 @param Timeout The number of seconds to set the watchdog timer to.
663 A value of zero disables the timer.
664 @param WatchdogCode The numeric code to log on a watchdog timer timeout
665 event. The firmware reserves codes 0x0000 to 0xFFFF.
666 Loaders and operating systems may use other timeout
668 @param DataSize The size, in bytes, of WatchdogData.
669 @param WatchdogData A data buffer that includes a Null-terminated Unicode
670 string, optionally followed by additional binary data.
671 The string is a description that the call may use to
672 further indicate the reason to be logged with a
675 @return EFI_SUCCESS Timeout has been set
676 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
677 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
678 @return EFI_DEVICE_ERROR Could not complete due to hardware error
683 CoreSetWatchdogTimer (
685 IN UINT64 WatchdogCode
,
687 IN CHAR16
*WatchdogData OPTIONAL
693 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
694 Calls the private one which contains a BOOLEAN parameter for notifications
696 @param UserHandle The handle to install the protocol handler on,
697 or NULL if a new handle is to be allocated
698 @param Protocol The protocol to add to the handle
699 @param InterfaceType Indicates whether Interface is supplied in
701 @param Interface The interface for the protocol being added
708 CoreInstallProtocolInterface (
709 IN OUT EFI_HANDLE
*UserHandle
,
710 IN EFI_GUID
*Protocol
,
711 IN EFI_INTERFACE_TYPE InterfaceType
,
717 Installs a protocol interface into the boot services environment.
719 @param UserHandle The handle to install the protocol handler on,
720 or NULL if a new handle is to be allocated
721 @param Protocol The protocol to add to the handle
722 @param InterfaceType Indicates whether Interface is supplied in
724 @param Interface The interface for the protocol being added
725 @param Notify indicates whether notify the notification list
728 @retval EFI_INVALID_PARAMETER Invalid parameter
729 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
730 @retval EFI_SUCCESS Protocol interface successfully installed
734 CoreInstallProtocolInterfaceNotify (
735 IN OUT EFI_HANDLE
*UserHandle
,
736 IN EFI_GUID
*Protocol
,
737 IN EFI_INTERFACE_TYPE InterfaceType
,
745 Installs a list of protocol interface into the boot services environment.
746 This function calls InstallProtocolInterface() in a loop. If any error
747 occures all the protocols added by this function are removed. This is
748 basically a lib function to save space.
750 @param Handle The handle to install the protocol handlers on,
751 or NULL if a new handle is to be allocated
752 @param ... EFI_GUID followed by protocol instance. A NULL
753 terminates the list. The pairs are the
754 arguments to InstallProtocolInterface(). All the
755 protocols are added to Handle.
757 @retval EFI_SUCCESS All the protocol interface was installed.
758 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
759 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
761 @retval EFI_INVALID_PARAMETER Handle is NULL.
762 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
767 CoreInstallMultipleProtocolInterfaces (
768 IN OUT EFI_HANDLE
*Handle
,
775 Uninstalls a list of protocol interface in the boot services environment.
776 This function calls UnisatllProtocolInterface() in a loop. This is
777 basically a lib function to save space.
779 @param Handle The handle to uninstall the protocol
780 @param ... EFI_GUID followed by protocol instance. A NULL
781 terminates the list. The pairs are the
782 arguments to UninstallProtocolInterface(). All
783 the protocols are added to Handle.
790 CoreUninstallMultipleProtocolInterfaces (
791 IN EFI_HANDLE Handle
,
798 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
800 @param UserHandle Handle on which the interface is to be
802 @param Protocol The numeric ID of the interface
803 @param OldInterface A pointer to the old interface
804 @param NewInterface A pointer to the new interface
806 @retval EFI_SUCCESS The protocol interface was installed
807 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
808 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
813 CoreReinstallProtocolInterface (
814 IN EFI_HANDLE UserHandle
,
815 IN EFI_GUID
*Protocol
,
816 IN VOID
*OldInterface
,
817 IN VOID
*NewInterface
823 Uninstalls all instances of a protocol:interfacer from a handle.
824 If the last protocol interface is remove from the handle, the
827 @param UserHandle The handle to remove the protocol handler from
828 @param Protocol The protocol, of protocol:interface, to remove
829 @param Interface The interface, of protocol:interface, to remove
831 @retval EFI_INVALID_PARAMETER Protocol is NULL.
832 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
837 CoreUninstallProtocolInterface (
838 IN EFI_HANDLE UserHandle
,
839 IN EFI_GUID
*Protocol
,
846 Queries a handle to determine if it supports a specified protocol.
848 @param UserHandle The handle being queried.
849 @param Protocol The published unique identifier of the protocol.
850 @param Interface Supplies the address where a pointer to the
851 corresponding Protocol Interface is returned.
853 @return The requested protocol interface for the handle
859 IN EFI_HANDLE UserHandle
,
860 IN EFI_GUID
*Protocol
,
867 Locates the installed protocol handler for the handle, and
868 invokes it to obtain the protocol interface. Usage information
869 is registered in the protocol data base.
871 @param UserHandle The handle to obtain the protocol interface on
872 @param Protocol The ID of the protocol
873 @param Interface The location to return the protocol interface
874 @param ImageHandle The handle of the Image that is opening the
875 protocol interface specified by Protocol and
877 @param ControllerHandle The controller handle that is requiring this
879 @param Attributes The open mode of the protocol interface
880 specified by Handle and Protocol.
882 @retval EFI_INVALID_PARAMETER Protocol is NULL.
883 @retval EFI_SUCCESS Get the protocol interface.
889 IN EFI_HANDLE UserHandle
,
890 IN EFI_GUID
*Protocol
,
891 OUT VOID
**Interface OPTIONAL
,
892 IN EFI_HANDLE ImageHandle
,
893 IN EFI_HANDLE ControllerHandle
,
900 Return information about Opened protocols in the system
902 @param UserHandle The handle to close the protocol interface on
903 @param Protocol The ID of the protocol
904 @param EntryBuffer A pointer to a buffer of open protocol
905 information in the form of
906 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
907 @param EntryCount Number of EntryBuffer entries
912 CoreOpenProtocolInformation (
913 IN EFI_HANDLE UserHandle
,
914 IN EFI_GUID
*Protocol
,
915 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
916 OUT UINTN
*EntryCount
922 Closes a protocol on a handle that was opened using OpenProtocol().
924 @param UserHandle The handle for the protocol interface that was
925 previously opened with OpenProtocol(), and is
927 @param Protocol The published unique identifier of the protocol.
928 It is the caller's responsibility to pass in a
930 @param AgentHandle The handle of the agent that is closing the
932 @param ControllerHandle If the agent that opened a protocol is a driver
933 that follows the EFI Driver Model, then this
934 parameter is the controller handle that required
935 the protocol interface. If the agent does not
936 follow the EFI Driver Model, then this parameter
937 is optional and may be NULL.
939 @retval EFI_SUCCESS The protocol instance was closed.
940 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
942 @retval EFI_NOT_FOUND Can not find the specified protocol or
949 IN EFI_HANDLE UserHandle
,
950 IN EFI_GUID
*Protocol
,
951 IN EFI_HANDLE AgentHandle
,
952 IN EFI_HANDLE ControllerHandle
958 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
961 @param UserHandle The handle from which to retrieve the list of
962 protocol interface GUIDs.
963 @param ProtocolBuffer A pointer to the list of protocol interface GUID
964 pointers that are installed on Handle.
965 @param ProtocolBufferCount A pointer to the number of GUID pointers present
968 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
969 on Handle was returned in ProtocolBuffer. The
970 number of protocol interface GUIDs was returned
971 in ProtocolBufferCount.
972 @retval EFI_INVALID_PARAMETER Handle is NULL.
973 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
974 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
975 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
976 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
982 CoreProtocolsPerHandle (
983 IN EFI_HANDLE UserHandle
,
984 OUT EFI_GUID
***ProtocolBuffer
,
985 OUT UINTN
*ProtocolBufferCount
991 Add a new protocol notification record for the request protocol.
993 @param Protocol The requested protocol to add the notify
995 @param Event The event to signal
996 @param Registration Returns the registration record
998 @retval EFI_INVALID_PARAMETER Invalid parameter
999 @retval EFI_SUCCESS Successfully returned the registration record
1005 CoreRegisterProtocolNotify (
1006 IN EFI_GUID
*Protocol
,
1008 OUT VOID
**Registration
1013 Removes all the events in the protocol database that match Event.
1015 @param Event The event to search for in the protocol
1018 @return EFI_SUCCESS when done searching the entire database.
1022 CoreUnregisterProtocolNotify (
1028 Locates the requested handle(s) and returns them in Buffer.
1030 @param SearchType The type of search to perform to locate the
1032 @param Protocol The protocol to search for
1033 @param SearchKey Dependant on SearchType
1034 @param BufferSize On input the size of Buffer. On output the
1035 size of data returned.
1036 @param Buffer The buffer to return the results in
1038 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
1039 returned in BufferSize.
1040 @retval EFI_INVALID_PARAMETER Invalid parameter
1041 @retval EFI_SUCCESS Successfully found the requested handle(s) and
1042 returns them in Buffer.
1048 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1049 IN EFI_GUID
*Protocol OPTIONAL
,
1050 IN VOID
*SearchKey OPTIONAL
,
1051 IN OUT UINTN
*BufferSize
,
1052 OUT EFI_HANDLE
*Buffer
1058 Locates the handle to a device on the device path that best matches the specified protocol.
1060 @param Protocol The protocol to search for.
1061 @param DevicePath On input, a pointer to a pointer to the device
1062 path. On output, the device path pointer is
1063 modified to point to the remaining part of the
1065 @param Device A pointer to the returned device handle.
1067 @retval EFI_SUCCESS The resulting handle was returned.
1068 @retval EFI_NOT_FOUND No handles matched the search.
1069 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1074 CoreLocateDevicePath (
1075 IN EFI_GUID
*Protocol
,
1076 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
1077 OUT EFI_HANDLE
*Device
1083 Function returns an array of handles that support the requested protocol
1084 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1085 that allocates a buffer for the caller.
1087 @param SearchType Specifies which handle(s) are to be returned.
1088 @param Protocol Provides the protocol to search by. This
1089 parameter is only valid for SearchType
1091 @param SearchKey Supplies the search key depending on the
1093 @param NumberHandles The number of handles returned in Buffer.
1094 @param Buffer A pointer to the buffer to return the requested
1095 array of handles that support Protocol.
1097 @retval EFI_SUCCESS The result array of handles was returned.
1098 @retval EFI_NOT_FOUND No handles match the search.
1099 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1101 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1106 CoreLocateHandleBuffer (
1107 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1108 IN EFI_GUID
*Protocol OPTIONAL
,
1109 IN VOID
*SearchKey OPTIONAL
,
1110 IN OUT UINTN
*NumberHandles
,
1111 OUT EFI_HANDLE
**Buffer
1117 Return the first Protocol Interface that matches the Protocol GUID. If
1118 Registration is passed in, return a Protocol Instance that was just add
1119 to the system. If Registration is NULL return the first Protocol Interface
1122 @param Protocol The protocol to search for
1123 @param Registration Optional Registration Key returned from
1124 RegisterProtocolNotify()
1125 @param Interface Return the Protocol interface (instance).
1127 @retval EFI_SUCCESS If a valid Interface is returned
1128 @retval EFI_INVALID_PARAMETER Invalid parameter
1129 @retval EFI_NOT_FOUND Protocol interface not found
1134 CoreLocateProtocol (
1135 IN EFI_GUID
*Protocol
,
1136 IN VOID
*Registration OPTIONAL
,
1137 OUT VOID
**Interface
1142 return handle database key.
1145 @return Handle database key.
1149 CoreGetHandleDatabaseKey (
1155 Go connect any handles that were created or modified while a image executed.
1157 @param Key The Key to show that the handle has been
1162 CoreConnectHandlesByKey (
1169 Connects one or more drivers to a controller.
1171 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1172 @param DriverImageHandle A pointer to an ordered list handles that support the
1173 EFI_DRIVER_BINDING_PROTOCOL.
1174 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1175 controller specified by ControllerHandle.
1176 @param Recursive If TRUE, then ConnectController() is called recursively
1177 until the entire tree of controllers below the controller specified
1178 by ControllerHandle have been created. If FALSE, then
1179 the tree of controllers is only expanded one level.
1181 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1182 2) No drivers were connected to ControllerHandle, but
1183 RemainingDevicePath is not NULL, and it is an End Device
1185 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1186 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1187 present in the system.
1188 2) No drivers were connected to ControllerHandle.
1189 @retval EFI_SECURITY_VIOLATION
1190 The user has no permission to start UEFI device drivers on the device path
1191 associated with the ControllerHandle or specified by the RemainingDevicePath.
1196 CoreConnectController (
1197 IN EFI_HANDLE ControllerHandle
,
1198 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1199 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1200 IN BOOLEAN Recursive
1206 Disonnects a controller from a driver
1208 @param ControllerHandle ControllerHandle The handle of
1209 the controller from which
1212 @param DriverImageHandle DriverImageHandle The driver to
1213 disconnect from ControllerHandle.
1214 @param ChildHandle ChildHandle The handle of the
1217 @retval EFI_SUCCESS One or more drivers were
1218 disconnected from the controller.
1219 @retval EFI_SUCCESS On entry, no drivers are managing
1221 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1222 and on entry DriverImageHandle is
1223 not managing ControllerHandle.
1224 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1225 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1226 and it is not a valid EFI_HANDLE.
1227 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1228 is not a valid EFI_HANDLE.
1229 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1230 available to disconnect any
1231 drivers from ControllerHandle.
1232 @retval EFI_DEVICE_ERROR The controller could not be
1233 disconnected because of a device
1239 CoreDisconnectController (
1240 IN EFI_HANDLE ControllerHandle
,
1241 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1242 IN EFI_HANDLE ChildHandle OPTIONAL
1248 Allocates pages from the memory map.
1250 @param Type The type of allocation to perform
1251 @param MemoryType The type of memory to turn the allocated pages
1253 @param NumberOfPages The number of pages to allocate
1254 @param Memory A pointer to receive the base allocated memory
1257 @return Status. On success, Memory is filled in with the base address allocated
1258 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1260 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1261 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1262 @retval EFI_SUCCESS Pages successfully allocated.
1268 IN EFI_ALLOCATE_TYPE Type
,
1269 IN EFI_MEMORY_TYPE MemoryType
,
1270 IN UINTN NumberOfPages
,
1271 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1275 Frees previous allocated pages.
1277 @param Memory Base address of memory being freed
1278 @param NumberOfPages The number of pages to free
1280 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1281 @retval EFI_INVALID_PARAMETER Address not aligned
1282 @return EFI_SUCCESS -Pages successfully freed.
1288 IN EFI_PHYSICAL_ADDRESS Memory
,
1289 IN UINTN NumberOfPages
1293 This function returns a copy of the current memory map. The map is an array of
1294 memory descriptors, each of which describes a contiguous block of memory.
1296 @param MemoryMapSize A pointer to the size, in bytes, of the
1297 MemoryMap buffer. On input, this is the size of
1298 the buffer allocated by the caller. On output,
1299 it is the size of the buffer returned by the
1300 firmware if the buffer was large enough, or the
1301 size of the buffer needed to contain the map if
1302 the buffer was too small.
1303 @param MemoryMap A pointer to the buffer in which firmware places
1304 the current memory map.
1305 @param MapKey A pointer to the location in which firmware
1306 returns the key for the current memory map.
1307 @param DescriptorSize A pointer to the location in which firmware
1308 returns the size, in bytes, of an individual
1309 EFI_MEMORY_DESCRIPTOR.
1310 @param DescriptorVersion A pointer to the location in which firmware
1311 returns the version number associated with the
1312 EFI_MEMORY_DESCRIPTOR.
1314 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1316 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1317 buffer size needed to hold the memory map is
1318 returned in MemoryMapSize.
1319 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1325 IN OUT UINTN
*MemoryMapSize
,
1326 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1328 OUT UINTN
*DescriptorSize
,
1329 OUT UINT32
*DescriptorVersion
1335 Allocate pool of a particular type.
1337 @param PoolType Type of pool to allocate
1338 @param Size The amount of pool to allocate
1339 @param Buffer The address to return a pointer to the allocated
1342 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1343 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1344 @retval EFI_SUCCESS Pool successfully allocated.
1350 IN EFI_MEMORY_TYPE PoolType
,
1356 Allocate pool of a particular type.
1358 @param PoolType Type of pool to allocate
1359 @param Size The amount of pool to allocate
1360 @param Buffer The address to return a pointer to the allocated
1363 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1364 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1365 @retval EFI_SUCCESS Pool successfully allocated.
1370 CoreInternalAllocatePool (
1371 IN EFI_MEMORY_TYPE PoolType
,
1379 @param Buffer The allocated pool entry to free
1381 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1382 @retval EFI_SUCCESS Pool successfully freed.
1394 @param Buffer The allocated pool entry to free
1395 @param PoolType Pointer to pool type
1397 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1398 @retval EFI_SUCCESS Pool successfully freed.
1403 CoreInternalFreePool (
1405 OUT EFI_MEMORY_TYPE
*PoolType OPTIONAL
1409 Loads an EFI image into memory and returns a handle to the image.
1411 @param BootPolicy If TRUE, indicates that the request originates
1412 from the boot manager, and that the boot
1413 manager is attempting to load FilePath as a
1415 @param ParentImageHandle The caller's image handle.
1416 @param FilePath The specific file path from which the image is
1418 @param SourceBuffer If not NULL, a pointer to the memory location
1419 containing a copy of the image to be loaded.
1420 @param SourceSize The size in bytes of SourceBuffer.
1421 @param ImageHandle Pointer to the returned image handle that is
1422 created when the image is successfully loaded.
1424 @retval EFI_SUCCESS The image was loaded into memory.
1425 @retval EFI_NOT_FOUND The FilePath was not found.
1426 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1427 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1428 path cannot be parsed to locate the proper
1429 protocol for loading the file.
1430 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1432 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1434 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1435 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1436 image from being loaded. NULL is returned in *ImageHandle.
1437 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1438 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1439 platform policy specifies that the image should not be started.
1445 IN BOOLEAN BootPolicy
,
1446 IN EFI_HANDLE ParentImageHandle
,
1447 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1448 IN VOID
*SourceBuffer OPTIONAL
,
1449 IN UINTN SourceSize
,
1450 OUT EFI_HANDLE
*ImageHandle
1458 @param ImageHandle Handle that identifies the image to be
1461 @retval EFI_SUCCESS The image has been unloaded.
1462 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1464 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1470 IN EFI_HANDLE ImageHandle
1476 Transfer control to a loaded image's entry point.
1478 @param ImageHandle Handle of image to be started.
1479 @param ExitDataSize Pointer of the size to ExitData
1480 @param ExitData Pointer to a pointer to a data buffer that
1481 includes a Null-terminated string,
1482 optionally followed by additional binary data.
1483 The string is a description that the caller may
1484 use to further indicate the reason for the
1487 @retval EFI_INVALID_PARAMETER Invalid parameter
1488 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1489 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1490 @retval EFI_SUCCESS Successfully transfer control to the image's
1497 IN EFI_HANDLE ImageHandle
,
1498 OUT UINTN
*ExitDataSize
,
1499 OUT CHAR16
**ExitData OPTIONAL
1505 Terminates the currently loaded EFI image and returns control to boot services.
1507 @param ImageHandle Handle that identifies the image. This
1508 parameter is passed to the image on entry.
1509 @param Status The image's exit code.
1510 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1511 ExitStatus is EFI_SUCCESS.
1512 @param ExitData Pointer to a data buffer that includes a
1513 Null-terminated Unicode string, optionally
1514 followed by additional binary data. The string
1515 is a description that the caller may use to
1516 further indicate the reason for the image's
1519 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1521 @retval EFI_SUCCESS Successfully terminates the currently loaded
1523 @retval EFI_ACCESS_DENIED Should never reach there.
1524 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1530 IN EFI_HANDLE ImageHandle
,
1531 IN EFI_STATUS Status
,
1532 IN UINTN ExitDataSize
,
1533 IN CHAR16
*ExitData OPTIONAL
1541 @param Type The type of event to create and its mode and
1543 @param NotifyTpl The task priority level of event notifications
1544 @param NotifyFunction Pointer to the events notification function
1545 @param NotifyContext Pointer to the notification functions context;
1546 corresponds to parameter "Context" in the
1547 notification function
1548 @param Event Pointer to the newly created event if the call
1549 succeeds; undefined otherwise
1551 @retval EFI_SUCCESS The event structure was created
1552 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1553 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1560 IN EFI_TPL NotifyTpl
,
1561 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1562 IN VOID
*NotifyContext
, OPTIONAL
1563 OUT EFI_EVENT
*Event
1569 Creates an event in a group.
1571 @param Type The type of event to create and its mode and
1573 @param NotifyTpl The task priority level of event notifications
1574 @param NotifyFunction Pointer to the events notification function
1575 @param NotifyContext Pointer to the notification functions context;
1576 corresponds to parameter "Context" in the
1577 notification function
1578 @param EventGroup GUID for EventGroup if NULL act the same as
1580 @param Event Pointer to the newly created event if the call
1581 succeeds; undefined otherwise
1583 @retval EFI_SUCCESS The event structure was created
1584 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1585 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1592 IN EFI_TPL NotifyTpl
,
1593 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1594 IN CONST VOID
*NotifyContext
, OPTIONAL
1595 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1596 OUT EFI_EVENT
*Event
1600 Creates a general-purpose event structure
1602 @param Type The type of event to create and its mode and
1604 @param NotifyTpl The task priority level of event notifications
1605 @param NotifyFunction Pointer to the events notification function
1606 @param NotifyContext Pointer to the notification functions context;
1607 corresponds to parameter "Context" in the
1608 notification function
1609 @param EventGroup GUID for EventGroup if NULL act the same as
1611 @param Event Pointer to the newly created event if the call
1612 succeeds; undefined otherwise
1614 @retval EFI_SUCCESS The event structure was created
1615 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1616 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1621 CoreCreateEventInternal (
1623 IN EFI_TPL NotifyTpl
,
1624 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1625 IN CONST VOID
*NotifyContext
, OPTIONAL
1626 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1627 OUT EFI_EVENT
*Event
1631 Sets the type of timer and the trigger time for a timer event.
1633 @param UserEvent The timer event that is to be signaled at the
1635 @param Type The type of time that is specified in
1637 @param TriggerTime The number of 100ns units until the timer
1640 @retval EFI_SUCCESS The event has been set to be signaled at the
1642 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1648 IN EFI_EVENT UserEvent
,
1649 IN EFI_TIMER_DELAY Type
,
1650 IN UINT64 TriggerTime
1656 Signals the event. Queues the event to be notified if needed.
1658 @param UserEvent The event to signal .
1660 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1661 @retval EFI_SUCCESS The event was signaled.
1667 IN EFI_EVENT UserEvent
1673 Stops execution until an event is signaled.
1675 @param NumberOfEvents The number of events in the UserEvents array
1676 @param UserEvents An array of EFI_EVENT
1677 @param UserIndex Pointer to the index of the event which
1678 satisfied the wait condition
1680 @retval EFI_SUCCESS The event indicated by Index was signaled.
1681 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1682 function or Event was not a valid type
1683 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1689 IN UINTN NumberOfEvents
,
1690 IN EFI_EVENT
*UserEvents
,
1691 OUT UINTN
*UserIndex
1697 Closes an event and frees the event structure.
1699 @param UserEvent Event to close
1701 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1702 @retval EFI_SUCCESS The event has been closed
1708 IN EFI_EVENT UserEvent
1714 Check the status of an event.
1716 @param UserEvent The event to check
1718 @retval EFI_SUCCESS The event is in the signaled state
1719 @retval EFI_NOT_READY The event is not in the signaled state
1720 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1726 IN EFI_EVENT UserEvent
1731 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1732 global coherency domain of the processor.
1734 @param GcdMemoryType Memory type of the memory space.
1735 @param BaseAddress Base address of the memory space.
1736 @param Length Length of the memory space.
1737 @param Capabilities alterable attributes of the memory space.
1739 @retval EFI_SUCCESS Merged this memory space into GCD map.
1744 CoreAddMemorySpace (
1745 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1746 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1748 IN UINT64 Capabilities
1753 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1754 I/O resources from the global coherency domain of the processor.
1756 @param GcdAllocateType The type of allocate operation
1757 @param GcdMemoryType The desired memory type
1758 @param Alignment Align with 2^Alignment
1759 @param Length Length to allocate
1760 @param BaseAddress Base address to allocate
1761 @param ImageHandle The image handle consume the allocated space.
1762 @param DeviceHandle The device handle consume the allocated space.
1764 @retval EFI_INVALID_PARAMETER Invalid parameter.
1765 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1766 @retval EFI_SUCCESS Memory space successfully allocated.
1771 CoreAllocateMemorySpace (
1772 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1773 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1776 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1777 IN EFI_HANDLE ImageHandle
,
1778 IN EFI_HANDLE DeviceHandle OPTIONAL
1783 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1784 I/O resources from the global coherency domain of the processor.
1786 @param BaseAddress Base address of the memory space.
1787 @param Length Length of the memory space.
1789 @retval EFI_SUCCESS Space successfully freed.
1794 CoreFreeMemorySpace (
1795 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1801 Removes reserved memory, system memory, or memory-mapped I/O resources from
1802 the global coherency domain of the processor.
1804 @param BaseAddress Base address of the memory space.
1805 @param Length Length of the memory space.
1807 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1812 CoreRemoveMemorySpace (
1813 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1819 Retrieves the descriptor for a memory region containing a specified address.
1821 @param BaseAddress Specified start address
1822 @param Descriptor Specified length
1824 @retval EFI_INVALID_PARAMETER Invalid parameter
1825 @retval EFI_SUCCESS Successfully get memory space descriptor.
1830 CoreGetMemorySpaceDescriptor (
1831 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1832 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1837 Modifies the attributes for a memory region in the global coherency domain of the
1840 @param BaseAddress Specified start address
1841 @param Length Specified length
1842 @param Attributes Specified attributes
1844 @retval EFI_SUCCESS The attributes were set for the memory region.
1845 @retval EFI_INVALID_PARAMETER Length is zero.
1846 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1847 resource range specified by BaseAddress and Length.
1848 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1849 range specified by BaseAddress and Length.
1850 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1851 BaseAddress and Length cannot be modified.
1852 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1853 the memory resource range.
1854 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1860 CoreSetMemorySpaceAttributes (
1861 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1863 IN UINT64 Attributes
1868 Modifies the capabilities for a memory region in the global coherency domain of the
1871 @param BaseAddress The physical address that is the start address of a memory region.
1872 @param Length The size in bytes of the memory region.
1873 @param Capabilities The bit mask of capabilities that the memory region supports.
1875 @retval EFI_SUCCESS The capabilities were set for the memory region.
1876 @retval EFI_INVALID_PARAMETER Length is zero.
1877 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1878 memory region attributes currently in use.
1879 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1880 BaseAddress and Length cannot be modified.
1881 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1882 of the memory resource range.
1886 CoreSetMemorySpaceCapabilities (
1887 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1889 IN UINT64 Capabilities
1894 Returns a map of the memory resources in the global coherency domain of the
1897 @param NumberOfDescriptors Number of descriptors.
1898 @param MemorySpaceMap Descriptor array
1900 @retval EFI_INVALID_PARAMETER Invalid parameter
1901 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1902 @retval EFI_SUCCESS Successfully get memory space map.
1907 CoreGetMemorySpaceMap (
1908 OUT UINTN
*NumberOfDescriptors
,
1909 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1914 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1916 @param GcdIoType IO type of the segment.
1917 @param BaseAddress Base address of the segment.
1918 @param Length Length of the segment.
1920 @retval EFI_SUCCESS Merged this segment into GCD map.
1921 @retval EFI_INVALID_PARAMETER Parameter not valid
1927 IN EFI_GCD_IO_TYPE GcdIoType
,
1928 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1934 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1935 domain of the processor.
1937 @param GcdAllocateType The type of allocate operation
1938 @param GcdIoType The desired IO type
1939 @param Alignment Align with 2^Alignment
1940 @param Length Length to allocate
1941 @param BaseAddress Base address to allocate
1942 @param ImageHandle The image handle consume the allocated space.
1943 @param DeviceHandle The device handle consume the allocated space.
1945 @retval EFI_INVALID_PARAMETER Invalid parameter.
1946 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1947 @retval EFI_SUCCESS IO space successfully allocated.
1952 CoreAllocateIoSpace (
1953 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1954 IN EFI_GCD_IO_TYPE GcdIoType
,
1957 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1958 IN EFI_HANDLE ImageHandle
,
1959 IN EFI_HANDLE DeviceHandle OPTIONAL
1964 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1965 domain of the processor.
1967 @param BaseAddress Base address of the segment.
1968 @param Length Length of the segment.
1970 @retval EFI_SUCCESS Space successfully freed.
1976 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1982 Removes reserved I/O or I/O resources from the global coherency domain of the
1985 @param BaseAddress Base address of the segment.
1986 @param Length Length of the segment.
1988 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1994 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2000 Retrieves the descriptor for an I/O region containing a specified address.
2002 @param BaseAddress Specified start address
2003 @param Descriptor Specified length
2005 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
2006 @retval EFI_SUCCESS Successfully get the IO space descriptor.
2011 CoreGetIoSpaceDescriptor (
2012 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2013 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2018 Returns a map of the I/O resources in the global coherency domain of the processor.
2020 @param NumberOfDescriptors Number of descriptors.
2021 @param IoSpaceMap Descriptor array
2023 @retval EFI_INVALID_PARAMETER Invalid parameter
2024 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2025 @retval EFI_SUCCESS Successfully get IO space map.
2031 OUT UINTN
*NumberOfDescriptors
,
2032 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2037 This is the main Dispatcher for DXE and it exits when there are no more
2038 drivers to run. Drain the mScheduledQueue and load and start a PE
2039 image for each driver. Search the mDiscoveredList to see if any driver can
2040 be placed on the mScheduledQueue. If no drivers are placed on the
2041 mScheduledQueue exit the function. On exit it is assumed the Bds()
2042 will be called, and when the Bds() exits the Dispatcher will be called
2045 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2046 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2047 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2057 Check every driver and locate a matching one. If the driver is found, the Unrequested
2058 state flag is cleared.
2060 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2061 the firmware file specified by DriverName.
2062 @param DriverName The Driver name to put in the Dependent state.
2064 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2066 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2073 IN EFI_HANDLE FirmwareVolumeHandle
,
2074 IN EFI_GUID
*DriverName
2079 Convert a driver from the Untrused back to the Scheduled state.
2081 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2082 the firmware file specified by DriverName.
2083 @param DriverName The Driver name to put in the Scheduled state
2085 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2086 was promoted to the trusted state.
2087 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2093 IN EFI_HANDLE FirmwareVolumeHandle
,
2094 IN EFI_GUID
*DriverName
2099 This routine is the driver initialization entry point. It initializes the
2100 libraries, and registers two notification functions. These notification
2101 functions are responsible for building the FV stack dynamically.
2103 @param ImageHandle The image handle.
2104 @param SystemTable The system table.
2106 @retval EFI_SUCCESS Function successfully returned.
2112 IN EFI_HANDLE ImageHandle
,
2113 IN EFI_SYSTEM_TABLE
*SystemTable
2118 Entry point of the section extraction code. Initializes an instance of the
2119 section extraction interface and installs it on a new handle.
2121 @param ImageHandle A handle for the image that is initializing this driver
2122 @param SystemTable A pointer to the EFI system table
2124 @retval EFI_SUCCESS Driver initialized successfully
2125 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2130 InitializeSectionExtraction (
2131 IN EFI_HANDLE ImageHandle
,
2132 IN EFI_SYSTEM_TABLE
*SystemTable
2137 This DXE service routine is used to process a firmware volume. In
2138 particular, it can be called by BDS to process a single firmware
2139 volume found in a capsule.
2141 @param FvHeader pointer to a firmware volume header
2142 @param Size the size of the buffer pointed to by FvHeader
2143 @param FVProtocolHandle the handle on which a firmware volume protocol
2144 was produced for the firmware volume passed in.
2146 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2148 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2149 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2155 CoreProcessFirmwareVolume (
2158 OUT EFI_HANDLE
*FVProtocolHandle
2162 //Functions used during debug buils
2166 Displays Architectural protocols that were not loaded and are required for DXE
2167 core to function. Only used in Debug Builds.
2171 CoreDisplayMissingArchProtocols (
2177 Traverse the discovered list for any drivers that were discovered but not loaded
2178 because the dependency experessions evaluated to false.
2182 CoreDisplayDiscoveredNotDispatched (
2188 Place holder function until all the Boot Services and Runtime Services are
2191 @return EFI_NOT_AVAILABLE_YET
2196 CoreEfiNotAvailableYetArg0 (
2202 Place holder function until all the Boot Services and Runtime Services are
2205 @param Arg1 Undefined
2207 @return EFI_NOT_AVAILABLE_YET
2212 CoreEfiNotAvailableYetArg1 (
2218 Place holder function until all the Boot Services and Runtime Services are available.
2220 @param Arg1 Undefined
2221 @param Arg2 Undefined
2223 @return EFI_NOT_AVAILABLE_YET
2228 CoreEfiNotAvailableYetArg2 (
2235 Place holder function until all the Boot Services and Runtime Services are available.
2237 @param Arg1 Undefined
2238 @param Arg2 Undefined
2239 @param Arg3 Undefined
2241 @return EFI_NOT_AVAILABLE_YET
2246 CoreEfiNotAvailableYetArg3 (
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
2259 @param Arg4 Undefined
2261 @return EFI_NOT_AVAILABLE_YET
2266 CoreEfiNotAvailableYetArg4 (
2275 Place holder function until all the Boot Services and Runtime Services are available.
2277 @param Arg1 Undefined
2278 @param Arg2 Undefined
2279 @param Arg3 Undefined
2280 @param Arg4 Undefined
2281 @param Arg5 Undefined
2283 @return EFI_NOT_AVAILABLE_YET
2288 CoreEfiNotAvailableYetArg5 (
2298 Given a compressed source buffer, this function retrieves the size of the
2299 uncompressed buffer and the size of the scratch buffer required to decompress
2300 the compressed source buffer.
2302 The GetInfo() function retrieves the size of the uncompressed buffer and the
2303 temporary scratch buffer required to decompress the buffer specified by Source
2304 and SourceSize. If the size of the uncompressed buffer or the size of the
2305 scratch buffer cannot be determined from the compressed data specified by
2306 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2307 size of the uncompressed buffer is returned in DestinationSize, the size of
2308 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2309 The GetInfo() function does not have scratch buffer available to perform a
2310 thorough checking of the validity of the source data. It just retrieves the
2311 "Original Size" field from the beginning bytes of the source data and output
2312 it as DestinationSize. And ScratchSize is specific to the decompression
2315 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2316 @param Source The source buffer containing the compressed data.
2317 @param SourceSize The size, in bytes, of the source buffer.
2318 @param DestinationSize A pointer to the size, in bytes, of the
2319 uncompressed buffer that will be generated when the
2320 compressed buffer specified by Source and
2321 SourceSize is decompressed.
2322 @param ScratchSize A pointer to the size, in bytes, of the scratch
2323 buffer that is required to decompress the
2324 compressed buffer specified by Source and
2327 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2328 DestinationSize and the size of the scratch buffer
2329 was returned in ScratchSize.
2330 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2331 the scratch buffer cannot be determined from the
2332 compressed data specified by Source and
2338 DxeMainUefiDecompressGetInfo (
2339 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2341 IN UINT32 SourceSize
,
2342 OUT UINT32
*DestinationSize
,
2343 OUT UINT32
*ScratchSize
2348 Decompresses a compressed source buffer.
2350 The Decompress() function extracts decompressed data to its original form.
2351 This protocol is designed so that the decompression algorithm can be
2352 implemented without using any memory services. As a result, the Decompress()
2353 Function is not allowed to call AllocatePool() or AllocatePages() in its
2354 implementation. It is the caller's responsibility to allocate and free the
2355 Destination and Scratch buffers.
2356 If the compressed source data specified by Source and SourceSize is
2357 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2358 the compressed source data specified by Source and SourceSize is not in a
2359 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2361 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2362 @param Source The source buffer containing the compressed data.
2363 @param SourceSize SourceSizeThe size of source data.
2364 @param Destination On output, the destination buffer that contains
2365 the uncompressed data.
2366 @param DestinationSize The size of the destination buffer. The size of
2367 the destination buffer needed is obtained from
2368 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2369 @param Scratch A temporary scratch buffer that is used to perform
2371 @param ScratchSize The size of scratch buffer. The size of the
2372 scratch buffer needed is obtained from GetInfo().
2374 @retval EFI_SUCCESS Decompression completed successfully, and the
2375 uncompressed buffer is returned in Destination.
2376 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2377 SourceSize is corrupted (not in a valid
2383 DxeMainUefiDecompress (
2384 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2386 IN UINT32 SourceSize
,
2387 IN OUT VOID
*Destination
,
2388 IN UINT32 DestinationSize
,
2389 IN OUT VOID
*Scratch
,
2390 IN UINT32 ScratchSize
2394 SEP member function. This function creates and returns a new section stream
2395 handle to represent the new section stream.
2397 @param SectionStreamLength Size in bytes of the section stream.
2398 @param SectionStream Buffer containing the new section stream.
2399 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2400 output contains the new section stream handle.
2402 @retval EFI_SUCCESS The section stream is created successfully.
2403 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2404 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2411 IN UINTN SectionStreamLength
,
2412 IN VOID
*SectionStream
,
2413 OUT UINTN
*SectionStreamHandle
2419 SEP member function. Retrieves requested section from section stream.
2421 @param SectionStreamHandle The section stream from which to extract the
2423 @param SectionType A pointer to the type of section to search for.
2424 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2425 then SectionDefinitionGuid indicates which of
2426 these types of sections to search for.
2427 @param SectionInstance Indicates which instance of the requested
2429 @param Buffer Double indirection to buffer. If *Buffer is
2430 non-null on input, then the buffer is caller
2431 allocated. If Buffer is NULL, then the buffer
2432 is callee allocated. In either case, the
2433 requried buffer size is returned in *BufferSize.
2434 @param BufferSize On input, indicates the size of *Buffer if
2435 *Buffer is non-null on input. On output,
2436 indicates the required size (allocated size if
2437 callee allocated) of *Buffer.
2438 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2439 indicates the authentication status of the
2440 output buffer. If the input section's
2441 GuidedSectionHeader.Attributes field
2442 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2443 bit as clear, AuthenticationStatus must return
2444 zero. Both local bits (19:16) and aggregate
2445 bits (3:0) in AuthenticationStatus are returned
2446 by ExtractSection(). These bits reflect the
2447 status of the extraction operation. The bit
2448 pattern in both regions must be the same, as
2449 the local and aggregate authentication statuses
2450 have equivalent meaning at this level. If the
2451 function returns anything other than
2452 EFI_SUCCESS, the value of *AuthenticationStatus
2454 @param IsFfs3Fv Indicates the FV format.
2456 @retval EFI_SUCCESS Section was retrieved successfully
2457 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2458 section stream with its
2459 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2460 but there was no corresponding GUIDed Section
2461 Extraction Protocol in the handle database.
2462 *Buffer is unmodified.
2463 @retval EFI_NOT_FOUND An error was encountered when parsing the
2464 SectionStream. This indicates the SectionStream
2465 is not correctly formatted.
2466 @retval EFI_NOT_FOUND The requested section does not exist.
2467 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2469 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2470 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2471 insufficient to contain the requested section.
2472 The input buffer is filled and section contents
2479 IN UINTN SectionStreamHandle
,
2480 IN EFI_SECTION_TYPE
*SectionType
,
2481 IN EFI_GUID
*SectionDefinitionGuid
,
2482 IN UINTN SectionInstance
,
2484 IN OUT UINTN
*BufferSize
,
2485 OUT UINT32
*AuthenticationStatus
,
2491 SEP member function. Deletes an existing section stream
2493 @param StreamHandleToClose Indicates the stream to close
2494 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2495 FALSE - No need to free stream buffer.
2497 @retval EFI_SUCCESS The section stream is closed sucessfully.
2498 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2499 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2505 CloseSectionStream (
2506 IN UINTN StreamHandleToClose
,
2507 IN BOOLEAN FreeStreamBuffer
2511 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2512 table and registers it into the system table.
2515 This function allocates memory, frees it, and then allocates memory at an
2516 address within the initial allocation. Since this function is called early
2517 in DXE core initialization (before drivers are dispatched), this should not
2522 CoreInitializeDebugImageInfoTable (
2528 Update the CRC32 in the Debug Table.
2529 Since the CRC32 service is made available by the Runtime driver, we have to
2530 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2531 This function is called elsewhere by the core when the runtime architectural
2532 protocol is produced.
2536 CoreUpdateDebugTableCrc32 (
2542 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2543 the table if it's not large enough to accomidate another entry.
2545 @param ImageInfoType type of debug image information
2546 @param LoadedImage pointer to the loaded image protocol for the image being
2548 @param ImageHandle image handle for the image being loaded
2552 CoreNewDebugImageInfoEntry (
2553 IN UINT32 ImageInfoType
,
2554 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2555 IN EFI_HANDLE ImageHandle
2560 Removes and frees an entry from the DebugImageInfo Table.
2562 @param ImageHandle image handle for the image being unloaded
2566 CoreRemoveDebugImageInfoEntry (
2567 EFI_HANDLE ImageHandle
2572 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2574 @param ImageHandle The image handle.
2575 @param SystemTable The system table.
2577 @retval EFI_SUCCESS Successfully initialized firmware volume block
2583 FwVolBlockDriverInit (
2584 IN EFI_HANDLE ImageHandle
,
2585 IN EFI_SYSTEM_TABLE
*SystemTable
2590 Get FVB authentication status
2592 @param FvbProtocol FVB protocol.
2594 @return Authentication status.
2598 GetFvbAuthenticationStatus (
2599 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2603 This routine produces a firmware volume block protocol on a given
2606 @param BaseAddress base address of the firmware volume image
2607 @param Length length of the firmware volume image
2608 @param ParentHandle handle of parent firmware volume, if this image
2609 came from an FV image file and section in another firmware
2610 volume (ala capsules)
2611 @param AuthenticationStatus Authentication status inherited, if this image
2612 came from an FV image file and section in another firmware volume.
2613 @param FvProtocol Firmware volume block protocol produced.
2615 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2616 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2617 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2622 ProduceFVBProtocolOnBuffer (
2623 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2625 IN EFI_HANDLE ParentHandle
,
2626 IN UINT32 AuthenticationStatus
,
2627 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2632 Raising to the task priority level of the mutual exclusion
2633 lock, and then acquires ownership of the lock.
2635 @param Lock The lock to acquire
2647 Initialize a basic mutual exclusion lock. Each lock
2648 provides mutual exclusion access at it's task priority
2649 level. Since there is no-premption (at any TPL) or
2650 multiprocessor support, acquiring the lock only consists
2651 of raising to the locks TPL.
2653 @param Lock The EFI_LOCK structure to initialize
2655 @retval EFI_SUCCESS Lock Owned.
2656 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2660 CoreAcquireLockOrFail (
2666 Releases ownership of the mutual exclusion lock, and
2667 restores the previous task priority level.
2669 @param Lock The lock to release
2671 @return Lock unowned
2681 An empty function to pass error checking of CreateEventEx ().
2683 @param Event Event whose notification function is being invoked.
2684 @param Context Pointer to the notification function's context,
2685 which is implementation-dependent.
2690 CoreEmptyCallbackFunction (
2696 Read data from Firmware Block by FVB protocol Read.
2697 The data may cross the multi block ranges.
2699 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2700 @param StartLba Pointer to StartLba.
2701 On input, the start logical block index from which to read.
2702 On output,the end logical block index after reading.
2703 @param Offset Pointer to Offset
2704 On input, offset into the block at which to begin reading.
2705 On output, offset into the end block after reading.
2706 @param DataSize Size of data to be read.
2707 @param Data Pointer to Buffer that the data will be read into.
2709 @retval EFI_SUCCESS Successfully read data from firmware block.
2714 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2715 IN OUT EFI_LBA
*StartLba
,
2716 IN OUT UINTN
*Offset
,
2722 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2723 copy the real length volume header into it.
2725 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2726 read the volume header
2727 @param FwVolHeader Pointer to pointer to allocated buffer in which
2728 the volume header is returned.
2730 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2731 @retval EFI_SUCCESS Successfully read volume header to the allocated
2733 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2734 the file system could not be understood.
2739 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2740 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2744 Verify checksum of the firmware volume header.
2746 @param FvHeader Points to the firmware volume header to be checked
2748 @retval TRUE Checksum verification passed
2749 @retval FALSE Checksum verification failed
2753 VerifyFvHeaderChecksum (
2754 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2758 Initialize memory profile.
2760 @param HobStart The start address of the HOB.
2769 Install memory profile protocol.
2773 MemoryProfileInstallProtocol (
2778 Register image to memory profile.
2780 @param DriverEntry Image info.
2781 @param FileType Image file type.
2783 @retval TRUE Register success.
2784 @retval FALSE Register fail.
2788 RegisterMemoryProfileImage (
2789 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2790 IN EFI_FV_FILETYPE FileType
2794 Unregister image from memory profile.
2796 @param DriverEntry Image info.
2798 @retval TRUE Unregister success.
2799 @retval FALSE Unregister fail.
2803 UnregisterMemoryProfileImage (
2804 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2808 Update memory profile information.
2810 @param CallerAddress Address of caller who call Allocate or Free.
2811 @param Action This Allocate or Free action.
2812 @param MemoryType Memory type.
2813 @param Size Buffer size.
2814 @param Buffer Buffer address.
2816 @retval TRUE Profile udpate success.
2817 @retval FALSE Profile update fail.
2822 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2823 IN MEMORY_PROFILE_ACTION Action
,
2824 IN EFI_MEMORY_TYPE MemoryType
,
2825 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2830 Internal function. Converts a memory range to use new attributes.
2832 @param Start The first address of the range Must be page
2834 @param NumberOfPages The number of pages to convert
2835 @param NewAttributes The new attributes value for the range.
2839 CoreUpdateMemoryAttributes (
2840 IN EFI_PHYSICAL_ADDRESS Start
,
2841 IN UINT64 NumberOfPages
,
2842 IN UINT64 NewAttributes
2846 Initialize PropertiesTable support.
2850 CoreInitializePropertiesTable (
2855 Initialize MemoryAttrubutesTable support.
2859 CoreInitializeMemoryAttributesTable (
2864 Install MemoryAttributesTable on memory allocation.
2866 @param[in] MemoryType EFI memory type.
2869 InstallMemoryAttributesTableOnMemoryAllocation (
2870 IN EFI_MEMORY_TYPE MemoryType
2874 Insert image record.
2876 @param RuntimeImage Runtime image information
2880 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2884 Remove Image record.
2886 @param RuntimeImage Runtime image information
2890 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage