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 EFI_DECOMPRESS_PROTOCOL gEfiDecompress
;
281 extern EFI_RUNTIME_ARCH_PROTOCOL
*gRuntime
;
282 extern EFI_CPU_ARCH_PROTOCOL
*gCpu
;
283 extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL
*gWatchdogTimer
;
284 extern EFI_METRONOME_ARCH_PROTOCOL
*gMetronome
;
285 extern EFI_TIMER_ARCH_PROTOCOL
*gTimer
;
286 extern EFI_SECURITY_ARCH_PROTOCOL
*gSecurity
;
287 extern EFI_SECURITY2_ARCH_PROTOCOL
*gSecurity2
;
288 extern EFI_BDS_ARCH_PROTOCOL
*gBds
;
289 extern EFI_SMM_BASE2_PROTOCOL
*gSmmBase2
;
291 extern EFI_TPL gEfiCurrentTpl
;
293 extern EFI_GUID
*gDxeCoreFileName
;
294 extern EFI_LOADED_IMAGE_PROTOCOL
*gDxeCoreLoadedImage
;
296 extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation
[EfiMaxMemoryType
+ 1];
298 extern BOOLEAN gDispatcherRunning
;
299 extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate
;
301 extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable
;
302 extern BOOLEAN gLoadFixedAddressCodeMemoryReady
;
304 // Service Initialization Functions
310 Called to initialize the pool.
320 Called to initialize the memory map and add descriptors to
321 the current descriptor list.
322 The first descriptor that is added must be general usable
323 memory as the addition allocates heap.
325 @param Type The type of memory to add
326 @param Start The starting address in the memory range Must be
328 @param NumberOfPages The number of pages in the range
329 @param Attribute Attributes of the memory to add
331 @return None. The range is added to the memory map
335 CoreAddMemoryDescriptor (
336 IN EFI_MEMORY_TYPE Type
,
337 IN EFI_PHYSICAL_ADDRESS Start
,
338 IN UINT64 NumberOfPages
,
344 Release memory lock on mGcdMemorySpaceLock.
348 CoreReleaseGcdMemoryLock (
354 Acquire memory lock on mGcdMemorySpaceLock.
358 CoreAcquireGcdMemoryLock (
364 External function. Initializes memory services based on the memory
365 descriptor HOBs. This function is responsible for priming the memory
366 map, so memory allocations and resource allocations can be made.
367 The first part of this function can not depend on any memory services
368 until at least one memory descriptor is provided to the memory services.
370 @param HobStart The start address of the HOB.
371 @param MemoryBaseAddress Start address of memory region found to init DXE
373 @param MemoryLength Length of memory region found to init DXE core.
375 @retval EFI_SUCCESS Memory services successfully initialized.
379 CoreInitializeMemoryServices (
381 OUT EFI_PHYSICAL_ADDRESS
*MemoryBaseAddress
,
382 OUT UINT64
*MemoryLength
388 External function. Initializes the GCD and memory services based on the memory
389 descriptor HOBs. This function is responsible for priming the GCD map and the
390 memory map, so memory allocations and resource allocations can be made. The
391 HobStart will be relocated to a pool buffer.
393 @param HobStart The start address of the HOB
394 @param MemoryBaseAddress Start address of memory region found to init DXE
396 @param MemoryLength Length of memory region found to init DXE core.
398 @retval EFI_SUCCESS GCD services successfully initialized.
402 CoreInitializeGcdServices (
403 IN OUT VOID
**HobStart
,
404 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress
,
405 IN UINT64 MemoryLength
410 Initializes "event" support.
412 @retval EFI_SUCCESS Always return success
416 CoreInitializeEventServices (
422 Add the Image Services to EFI Boot Services Table and install the protocol
423 interfaces for this image.
425 @param HobStart The HOB to initialize
431 CoreInitializeImageServices (
437 Creates an event that is fired everytime a Protocol of a specific type is installed.
441 CoreNotifyOnProtocolInstallation (
447 Return TRUE if all AP services are availible.
449 @retval EFI_SUCCESS All AP services are available
450 @retval EFI_NOT_FOUND At least one AP service is not available
454 CoreAllEfiServicesAvailable (
460 Calcualte the 32-bit CRC in a EFI table using the service provided by the
463 @param Hdr Pointer to an EFI standard header
468 IN OUT EFI_TABLE_HEADER
*Hdr
473 Called by the platform code to process a tick.
475 @param Duration The number of 100ns elasped since the last call
487 Initialize the dispatcher. Initialize the notification function that runs when
488 an FV2 protocol is added to the system.
492 CoreInitializeDispatcher (
498 This is the POSTFIX version of the dependency evaluator. This code does
499 not need to handle Before or After, as it is not valid to call this
500 routine in this case. The SOR is just ignored and is a nop in the grammer.
501 POSTFIX means all the math is done on top of the stack.
503 @param DriverEntry DriverEntry element to update.
505 @retval TRUE If driver is ready to run.
506 @retval FALSE If driver is not ready to run or some fatal error
512 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
517 Preprocess dependency expression and update DriverEntry to reflect the
518 state of Before, After, and SOR dependencies. If DriverEntry->Before
519 or DriverEntry->After is set it will never be cleared. If SOR is set
520 it will be cleared by CoreSchedule(), and then the driver can be
523 @param DriverEntry DriverEntry element to update .
525 @retval EFI_SUCCESS It always works.
529 CorePreProcessDepex (
530 IN EFI_CORE_DRIVER_ENTRY
*DriverEntry
536 Terminates all boot services.
538 @param ImageHandle Handle that identifies the exiting image.
539 @param MapKey Key to the latest memory map.
541 @retval EFI_SUCCESS Boot Services terminated
542 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
547 CoreExitBootServices (
548 IN EFI_HANDLE ImageHandle
,
554 Make sure the memory map is following all the construction rules,
555 it is the last time to check memory map error before exit boot services.
557 @param MapKey Memory map key
559 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction
561 @retval EFI_SUCCESS Valid memory map.
565 CoreTerminateMemoryMap (
571 Signals all events in the EventGroup.
573 @param EventGroup The list to signal
577 CoreNotifySignalList (
578 IN EFI_GUID
*EventGroup
584 Boot Service called to add, modify, or remove a system configuration table from
585 the EFI System Table.
587 @param Guid Pointer to the GUID for the entry to add, update, or
589 @param Table Pointer to the configuration table for the entry to add,
590 update, or remove, may be NULL.
592 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.
593 @return EFI_INVALID_PARAMETER Input GUID not valid.
594 @return EFI_NOT_FOUND Attempted to delete non-existant entry
595 @return EFI_OUT_OF_RESOURCES Not enough memory available
600 CoreInstallConfigurationTable (
608 Raise the task priority level to the new level.
609 High level is implemented by disabling processor interrupts.
611 @param NewTpl New task priority level
613 @return The previous task priority level
625 Lowers the task priority to the previous value. If the new
626 priority unmasks events at a higher priority, they are dispatched.
628 @param NewTpl New, lower, task priority
640 Introduces a fine-grained stall.
642 @param Microseconds The number of microseconds to stall execution.
644 @retval EFI_SUCCESS Execution was stalled for at least the requested
645 amount of microseconds.
646 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet
652 IN UINTN Microseconds
658 Sets the system's watchdog timer.
660 @param Timeout The number of seconds to set the watchdog timer to.
661 A value of zero disables the timer.
662 @param WatchdogCode The numeric code to log on a watchdog timer timeout
663 event. The firmware reserves codes 0x0000 to 0xFFFF.
664 Loaders and operating systems may use other timeout
666 @param DataSize The size, in bytes, of WatchdogData.
667 @param WatchdogData A data buffer that includes a Null-terminated Unicode
668 string, optionally followed by additional binary data.
669 The string is a description that the call may use to
670 further indicate the reason to be logged with a
673 @return EFI_SUCCESS Timeout has been set
674 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
675 @return EFI_UNSUPPORTED System does not have a timer (currently not used)
676 @return EFI_DEVICE_ERROR Could not complete due to hardware error
681 CoreSetWatchdogTimer (
683 IN UINT64 WatchdogCode
,
685 IN CHAR16
*WatchdogData OPTIONAL
691 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which
692 Calls the private one which contains a BOOLEAN parameter for notifications
694 @param UserHandle The handle to install the protocol handler on,
695 or NULL if a new handle is to be allocated
696 @param Protocol The protocol to add to the handle
697 @param InterfaceType Indicates whether Interface is supplied in
699 @param Interface The interface for the protocol being added
706 CoreInstallProtocolInterface (
707 IN OUT EFI_HANDLE
*UserHandle
,
708 IN EFI_GUID
*Protocol
,
709 IN EFI_INTERFACE_TYPE InterfaceType
,
715 Installs a protocol interface into the boot services environment.
717 @param UserHandle The handle to install the protocol handler on,
718 or NULL if a new handle is to be allocated
719 @param Protocol The protocol to add to the handle
720 @param InterfaceType Indicates whether Interface is supplied in
722 @param Interface The interface for the protocol being added
723 @param Notify indicates whether notify the notification list
726 @retval EFI_INVALID_PARAMETER Invalid parameter
727 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
728 @retval EFI_SUCCESS Protocol interface successfully installed
732 CoreInstallProtocolInterfaceNotify (
733 IN OUT EFI_HANDLE
*UserHandle
,
734 IN EFI_GUID
*Protocol
,
735 IN EFI_INTERFACE_TYPE InterfaceType
,
743 Installs a list of protocol interface into the boot services environment.
744 This function calls InstallProtocolInterface() in a loop. If any error
745 occures all the protocols added by this function are removed. This is
746 basically a lib function to save space.
748 @param Handle The handle to install the protocol handlers on,
749 or NULL if a new handle is to be allocated
750 @param ... EFI_GUID followed by protocol instance. A NULL
751 terminates the list. The pairs are the
752 arguments to InstallProtocolInterface(). All the
753 protocols are added to Handle.
755 @retval EFI_SUCCESS All the protocol interface was installed.
756 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
757 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
759 @retval EFI_INVALID_PARAMETER Handle is NULL.
760 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
765 CoreInstallMultipleProtocolInterfaces (
766 IN OUT EFI_HANDLE
*Handle
,
773 Uninstalls a list of protocol interface in the boot services environment.
774 This function calls UnisatllProtocolInterface() in a loop. This is
775 basically a lib function to save space.
777 @param Handle The handle to uninstall the protocol
778 @param ... EFI_GUID followed by protocol instance. A NULL
779 terminates the list. The pairs are the
780 arguments to UninstallProtocolInterface(). All
781 the protocols are added to Handle.
788 CoreUninstallMultipleProtocolInterfaces (
789 IN EFI_HANDLE Handle
,
796 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
798 @param UserHandle Handle on which the interface is to be
800 @param Protocol The numeric ID of the interface
801 @param OldInterface A pointer to the old interface
802 @param NewInterface A pointer to the new interface
804 @retval EFI_SUCCESS The protocol interface was installed
805 @retval EFI_NOT_FOUND The OldInterface on the handle was not found
806 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
811 CoreReinstallProtocolInterface (
812 IN EFI_HANDLE UserHandle
,
813 IN EFI_GUID
*Protocol
,
814 IN VOID
*OldInterface
,
815 IN VOID
*NewInterface
821 Uninstalls all instances of a protocol:interfacer from a handle.
822 If the last protocol interface is remove from the handle, the
825 @param UserHandle The handle to remove the protocol handler from
826 @param Protocol The protocol, of protocol:interface, to remove
827 @param Interface The interface, of protocol:interface, to remove
829 @retval EFI_INVALID_PARAMETER Protocol is NULL.
830 @retval EFI_SUCCESS Protocol interface successfully uninstalled.
835 CoreUninstallProtocolInterface (
836 IN EFI_HANDLE UserHandle
,
837 IN EFI_GUID
*Protocol
,
844 Queries a handle to determine if it supports a specified protocol.
846 @param UserHandle The handle being queried.
847 @param Protocol The published unique identifier of the protocol.
848 @param Interface Supplies the address where a pointer to the
849 corresponding Protocol Interface is returned.
851 @return The requested protocol interface for the handle
857 IN EFI_HANDLE UserHandle
,
858 IN EFI_GUID
*Protocol
,
865 Locates the installed protocol handler for the handle, and
866 invokes it to obtain the protocol interface. Usage information
867 is registered in the protocol data base.
869 @param UserHandle The handle to obtain the protocol interface on
870 @param Protocol The ID of the protocol
871 @param Interface The location to return the protocol interface
872 @param ImageHandle The handle of the Image that is opening the
873 protocol interface specified by Protocol and
875 @param ControllerHandle The controller handle that is requiring this
877 @param Attributes The open mode of the protocol interface
878 specified by Handle and Protocol.
880 @retval EFI_INVALID_PARAMETER Protocol is NULL.
881 @retval EFI_SUCCESS Get the protocol interface.
887 IN EFI_HANDLE UserHandle
,
888 IN EFI_GUID
*Protocol
,
889 OUT VOID
**Interface OPTIONAL
,
890 IN EFI_HANDLE ImageHandle
,
891 IN EFI_HANDLE ControllerHandle
,
898 Return information about Opened protocols in the system
900 @param UserHandle The handle to close the protocol interface on
901 @param Protocol The ID of the protocol
902 @param EntryBuffer A pointer to a buffer of open protocol
903 information in the form of
904 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
905 @param EntryCount Number of EntryBuffer entries
910 CoreOpenProtocolInformation (
911 IN EFI_HANDLE UserHandle
,
912 IN EFI_GUID
*Protocol
,
913 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
**EntryBuffer
,
914 OUT UINTN
*EntryCount
920 Closes a protocol on a handle that was opened using OpenProtocol().
922 @param UserHandle The handle for the protocol interface that was
923 previously opened with OpenProtocol(), and is
925 @param Protocol The published unique identifier of the protocol.
926 It is the caller's responsibility to pass in a
928 @param AgentHandle The handle of the agent that is closing the
930 @param ControllerHandle If the agent that opened a protocol is a driver
931 that follows the EFI Driver Model, then this
932 parameter is the controller handle that required
933 the protocol interface. If the agent does not
934 follow the EFI Driver Model, then this parameter
935 is optional and may be NULL.
937 @retval EFI_SUCCESS The protocol instance was closed.
938 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a
940 @retval EFI_NOT_FOUND Can not find the specified protocol or
947 IN EFI_HANDLE UserHandle
,
948 IN EFI_GUID
*Protocol
,
949 IN EFI_HANDLE AgentHandle
,
950 IN EFI_HANDLE ControllerHandle
956 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
959 @param UserHandle The handle from which to retrieve the list of
960 protocol interface GUIDs.
961 @param ProtocolBuffer A pointer to the list of protocol interface GUID
962 pointers that are installed on Handle.
963 @param ProtocolBufferCount A pointer to the number of GUID pointers present
966 @retval EFI_SUCCESS The list of protocol interface GUIDs installed
967 on Handle was returned in ProtocolBuffer. The
968 number of protocol interface GUIDs was returned
969 in ProtocolBufferCount.
970 @retval EFI_INVALID_PARAMETER Handle is NULL.
971 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
972 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
973 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
974 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
980 CoreProtocolsPerHandle (
981 IN EFI_HANDLE UserHandle
,
982 OUT EFI_GUID
***ProtocolBuffer
,
983 OUT UINTN
*ProtocolBufferCount
989 Add a new protocol notification record for the request protocol.
991 @param Protocol The requested protocol to add the notify
993 @param Event The event to signal
994 @param Registration Returns the registration record
996 @retval EFI_INVALID_PARAMETER Invalid parameter
997 @retval EFI_SUCCESS Successfully returned the registration record
1003 CoreRegisterProtocolNotify (
1004 IN EFI_GUID
*Protocol
,
1006 OUT VOID
**Registration
1011 Removes all the events in the protocol database that match Event.
1013 @param Event The event to search for in the protocol
1016 @return EFI_SUCCESS when done searching the entire database.
1020 CoreUnregisterProtocolNotify (
1026 Locates the requested handle(s) and returns them in Buffer.
1028 @param SearchType The type of search to perform to locate the
1030 @param Protocol The protocol to search for
1031 @param SearchKey Dependant on SearchType
1032 @param BufferSize On input the size of Buffer. On output the
1033 size of data returned.
1034 @param Buffer The buffer to return the results in
1036 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is
1037 returned in BufferSize.
1038 @retval EFI_INVALID_PARAMETER Invalid parameter
1039 @retval EFI_SUCCESS Successfully found the requested handle(s) and
1040 returns them in Buffer.
1046 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1047 IN EFI_GUID
*Protocol OPTIONAL
,
1048 IN VOID
*SearchKey OPTIONAL
,
1049 IN OUT UINTN
*BufferSize
,
1050 OUT EFI_HANDLE
*Buffer
1056 Locates the handle to a device on the device path that best matches the specified protocol.
1058 @param Protocol The protocol to search for.
1059 @param DevicePath On input, a pointer to a pointer to the device
1060 path. On output, the device path pointer is
1061 modified to point to the remaining part of the
1063 @param Device A pointer to the returned device handle.
1065 @retval EFI_SUCCESS The resulting handle was returned.
1066 @retval EFI_NOT_FOUND No handles matched the search.
1067 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1072 CoreLocateDevicePath (
1073 IN EFI_GUID
*Protocol
,
1074 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
,
1075 OUT EFI_HANDLE
*Device
1081 Function returns an array of handles that support the requested protocol
1082 in a buffer allocated from pool. This is a version of CoreLocateHandle()
1083 that allocates a buffer for the caller.
1085 @param SearchType Specifies which handle(s) are to be returned.
1086 @param Protocol Provides the protocol to search by. This
1087 parameter is only valid for SearchType
1089 @param SearchKey Supplies the search key depending on the
1091 @param NumberHandles The number of handles returned in Buffer.
1092 @param Buffer A pointer to the buffer to return the requested
1093 array of handles that support Protocol.
1095 @retval EFI_SUCCESS The result array of handles was returned.
1096 @retval EFI_NOT_FOUND No handles match the search.
1097 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the
1099 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.
1104 CoreLocateHandleBuffer (
1105 IN EFI_LOCATE_SEARCH_TYPE SearchType
,
1106 IN EFI_GUID
*Protocol OPTIONAL
,
1107 IN VOID
*SearchKey OPTIONAL
,
1108 IN OUT UINTN
*NumberHandles
,
1109 OUT EFI_HANDLE
**Buffer
1115 Return the first Protocol Interface that matches the Protocol GUID. If
1116 Registration is passed in, return a Protocol Instance that was just add
1117 to the system. If Registration is NULL return the first Protocol Interface
1120 @param Protocol The protocol to search for
1121 @param Registration Optional Registration Key returned from
1122 RegisterProtocolNotify()
1123 @param Interface Return the Protocol interface (instance).
1125 @retval EFI_SUCCESS If a valid Interface is returned
1126 @retval EFI_INVALID_PARAMETER Invalid parameter
1127 @retval EFI_NOT_FOUND Protocol interface not found
1132 CoreLocateProtocol (
1133 IN EFI_GUID
*Protocol
,
1134 IN VOID
*Registration OPTIONAL
,
1135 OUT VOID
**Interface
1140 return handle database key.
1143 @return Handle database key.
1147 CoreGetHandleDatabaseKey (
1153 Go connect any handles that were created or modified while a image executed.
1155 @param Key The Key to show that the handle has been
1160 CoreConnectHandlesByKey (
1167 Connects one or more drivers to a controller.
1169 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.
1170 @param DriverImageHandle A pointer to an ordered list handles that support the
1171 EFI_DRIVER_BINDING_PROTOCOL.
1172 @param RemainingDevicePath A pointer to the device path that specifies a child of the
1173 controller specified by ControllerHandle.
1174 @param Recursive If TRUE, then ConnectController() is called recursively
1175 until the entire tree of controllers below the controller specified
1176 by ControllerHandle have been created. If FALSE, then
1177 the tree of controllers is only expanded one level.
1179 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
1180 2) No drivers were connected to ControllerHandle, but
1181 RemainingDevicePath is not NULL, and it is an End Device
1183 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1184 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
1185 present in the system.
1186 2) No drivers were connected to ControllerHandle.
1187 @retval EFI_SECURITY_VIOLATION
1188 The user has no permission to start UEFI device drivers on the device path
1189 associated with the ControllerHandle or specified by the RemainingDevicePath.
1194 CoreConnectController (
1195 IN EFI_HANDLE ControllerHandle
,
1196 IN EFI_HANDLE
*DriverImageHandle OPTIONAL
,
1197 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath OPTIONAL
,
1198 IN BOOLEAN Recursive
1204 Disonnects a controller from a driver
1206 @param ControllerHandle ControllerHandle The handle of
1207 the controller from which
1210 @param DriverImageHandle DriverImageHandle The driver to
1211 disconnect from ControllerHandle.
1212 @param ChildHandle ChildHandle The handle of the
1215 @retval EFI_SUCCESS One or more drivers were
1216 disconnected from the controller.
1217 @retval EFI_SUCCESS On entry, no drivers are managing
1219 @retval EFI_SUCCESS DriverImageHandle is not NULL,
1220 and on entry DriverImageHandle is
1221 not managing ControllerHandle.
1222 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
1223 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,
1224 and it is not a valid EFI_HANDLE.
1225 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it
1226 is not a valid EFI_HANDLE.
1227 @retval EFI_OUT_OF_RESOURCES There are not enough resources
1228 available to disconnect any
1229 drivers from ControllerHandle.
1230 @retval EFI_DEVICE_ERROR The controller could not be
1231 disconnected because of a device
1237 CoreDisconnectController (
1238 IN EFI_HANDLE ControllerHandle
,
1239 IN EFI_HANDLE DriverImageHandle OPTIONAL
,
1240 IN EFI_HANDLE ChildHandle OPTIONAL
1246 Allocates pages from the memory map.
1248 @param Type The type of allocation to perform
1249 @param MemoryType The type of memory to turn the allocated pages
1251 @param NumberOfPages The number of pages to allocate
1252 @param Memory A pointer to receive the base allocated memory
1255 @return Status. On success, Memory is filled in with the base address allocated
1256 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1258 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1259 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1260 @retval EFI_SUCCESS Pages successfully allocated.
1266 IN EFI_ALLOCATE_TYPE Type
,
1267 IN EFI_MEMORY_TYPE MemoryType
,
1268 IN UINTN NumberOfPages
,
1269 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1273 Frees previous allocated pages.
1275 @param Memory Base address of memory being freed
1276 @param NumberOfPages The number of pages to free
1278 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1279 @retval EFI_INVALID_PARAMETER Address not aligned
1280 @return EFI_SUCCESS -Pages successfully freed.
1286 IN EFI_PHYSICAL_ADDRESS Memory
,
1287 IN UINTN NumberOfPages
1291 This function returns a copy of the current memory map. The map is an array of
1292 memory descriptors, each of which describes a contiguous block of memory.
1294 @param MemoryMapSize A pointer to the size, in bytes, of the
1295 MemoryMap buffer. On input, this is the size of
1296 the buffer allocated by the caller. On output,
1297 it is the size of the buffer returned by the
1298 firmware if the buffer was large enough, or the
1299 size of the buffer needed to contain the map if
1300 the buffer was too small.
1301 @param MemoryMap A pointer to the buffer in which firmware places
1302 the current memory map.
1303 @param MapKey A pointer to the location in which firmware
1304 returns the key for the current memory map.
1305 @param DescriptorSize A pointer to the location in which firmware
1306 returns the size, in bytes, of an individual
1307 EFI_MEMORY_DESCRIPTOR.
1308 @param DescriptorVersion A pointer to the location in which firmware
1309 returns the version number associated with the
1310 EFI_MEMORY_DESCRIPTOR.
1312 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1314 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1315 buffer size needed to hold the memory map is
1316 returned in MemoryMapSize.
1317 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1323 IN OUT UINTN
*MemoryMapSize
,
1324 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1326 OUT UINTN
*DescriptorSize
,
1327 OUT UINT32
*DescriptorVersion
1333 Allocate pool of a particular type.
1335 @param PoolType Type of pool to allocate
1336 @param Size The amount of pool to allocate
1337 @param Buffer The address to return a pointer to the allocated
1340 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1341 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1342 @retval EFI_SUCCESS Pool successfully allocated.
1348 IN EFI_MEMORY_TYPE PoolType
,
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.
1368 CoreInternalAllocatePool (
1369 IN EFI_MEMORY_TYPE PoolType
,
1377 @param Buffer The allocated pool entry to free
1379 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1380 @retval EFI_SUCCESS Pool successfully freed.
1392 @param Buffer The allocated pool entry to free
1393 @param PoolType Pointer to pool type
1395 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1396 @retval EFI_SUCCESS Pool successfully freed.
1401 CoreInternalFreePool (
1403 OUT EFI_MEMORY_TYPE
*PoolType OPTIONAL
1407 Loads an EFI image into memory and returns a handle to the image.
1409 @param BootPolicy If TRUE, indicates that the request originates
1410 from the boot manager, and that the boot
1411 manager is attempting to load FilePath as a
1413 @param ParentImageHandle The caller's image handle.
1414 @param FilePath The specific file path from which the image is
1416 @param SourceBuffer If not NULL, a pointer to the memory location
1417 containing a copy of the image to be loaded.
1418 @param SourceSize The size in bytes of SourceBuffer.
1419 @param ImageHandle Pointer to the returned image handle that is
1420 created when the image is successfully loaded.
1422 @retval EFI_SUCCESS The image was loaded into memory.
1423 @retval EFI_NOT_FOUND The FilePath was not found.
1424 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1425 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1426 path cannot be parsed to locate the proper
1427 protocol for loading the file.
1428 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1430 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1432 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1433 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1434 image from being loaded. NULL is returned in *ImageHandle.
1435 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1436 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1437 platform policy specifies that the image should not be started.
1443 IN BOOLEAN BootPolicy
,
1444 IN EFI_HANDLE ParentImageHandle
,
1445 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1446 IN VOID
*SourceBuffer OPTIONAL
,
1447 IN UINTN SourceSize
,
1448 OUT EFI_HANDLE
*ImageHandle
1456 @param ImageHandle Handle that identifies the image to be
1459 @retval EFI_SUCCESS The image has been unloaded.
1460 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1462 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1468 IN EFI_HANDLE ImageHandle
1474 Transfer control to a loaded image's entry point.
1476 @param ImageHandle Handle of image to be started.
1477 @param ExitDataSize Pointer of the size to ExitData
1478 @param ExitData Pointer to a pointer to a data buffer that
1479 includes a Null-terminated string,
1480 optionally followed by additional binary data.
1481 The string is a description that the caller may
1482 use to further indicate the reason for the
1485 @retval EFI_INVALID_PARAMETER Invalid parameter
1486 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1487 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1488 @retval EFI_SUCCESS Successfully transfer control to the image's
1495 IN EFI_HANDLE ImageHandle
,
1496 OUT UINTN
*ExitDataSize
,
1497 OUT CHAR16
**ExitData OPTIONAL
1503 Terminates the currently loaded EFI image and returns control to boot services.
1505 @param ImageHandle Handle that identifies the image. This
1506 parameter is passed to the image on entry.
1507 @param Status The image's exit code.
1508 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1509 ExitStatus is EFI_SUCCESS.
1510 @param ExitData Pointer to a data buffer that includes a
1511 Null-terminated Unicode string, optionally
1512 followed by additional binary data. The string
1513 is a description that the caller may use to
1514 further indicate the reason for the image's
1517 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1519 @retval EFI_SUCCESS Successfully terminates the currently loaded
1521 @retval EFI_ACCESS_DENIED Should never reach there.
1522 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1528 IN EFI_HANDLE ImageHandle
,
1529 IN EFI_STATUS Status
,
1530 IN UINTN ExitDataSize
,
1531 IN CHAR16
*ExitData OPTIONAL
1539 @param Type The type of event to create and its mode and
1541 @param NotifyTpl The task priority level of event notifications
1542 @param NotifyFunction Pointer to the events notification function
1543 @param NotifyContext Pointer to the notification functions context;
1544 corresponds to parameter "Context" in the
1545 notification function
1546 @param Event Pointer to the newly created event if the call
1547 succeeds; undefined otherwise
1549 @retval EFI_SUCCESS The event structure was created
1550 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1551 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1558 IN EFI_TPL NotifyTpl
,
1559 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1560 IN VOID
*NotifyContext
, OPTIONAL
1561 OUT EFI_EVENT
*Event
1567 Creates an event in a group.
1569 @param Type The type of event to create and its mode and
1571 @param NotifyTpl The task priority level of event notifications
1572 @param NotifyFunction Pointer to the events notification function
1573 @param NotifyContext Pointer to the notification functions context;
1574 corresponds to parameter "Context" in the
1575 notification function
1576 @param EventGroup GUID for EventGroup if NULL act the same as
1578 @param Event Pointer to the newly created event if the call
1579 succeeds; undefined otherwise
1581 @retval EFI_SUCCESS The event structure was created
1582 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1583 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1590 IN EFI_TPL NotifyTpl
,
1591 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1592 IN CONST VOID
*NotifyContext
, OPTIONAL
1593 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1594 OUT EFI_EVENT
*Event
1598 Creates a general-purpose event structure
1600 @param Type The type of event to create and its mode and
1602 @param NotifyTpl The task priority level of event notifications
1603 @param NotifyFunction Pointer to the events notification function
1604 @param NotifyContext Pointer to the notification functions context;
1605 corresponds to parameter "Context" in the
1606 notification function
1607 @param EventGroup GUID for EventGroup if NULL act the same as
1609 @param Event Pointer to the newly created event if the call
1610 succeeds; undefined otherwise
1612 @retval EFI_SUCCESS The event structure was created
1613 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1614 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1619 CoreCreateEventInternal (
1621 IN EFI_TPL NotifyTpl
,
1622 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1623 IN CONST VOID
*NotifyContext
, OPTIONAL
1624 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1625 OUT EFI_EVENT
*Event
1629 Sets the type of timer and the trigger time for a timer event.
1631 @param UserEvent The timer event that is to be signaled at the
1633 @param Type The type of time that is specified in
1635 @param TriggerTime The number of 100ns units until the timer
1638 @retval EFI_SUCCESS The event has been set to be signaled at the
1640 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1646 IN EFI_EVENT UserEvent
,
1647 IN EFI_TIMER_DELAY Type
,
1648 IN UINT64 TriggerTime
1654 Signals the event. Queues the event to be notified if needed.
1656 @param UserEvent The event to signal .
1658 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1659 @retval EFI_SUCCESS The event was signaled.
1665 IN EFI_EVENT UserEvent
1671 Stops execution until an event is signaled.
1673 @param NumberOfEvents The number of events in the UserEvents array
1674 @param UserEvents An array of EFI_EVENT
1675 @param UserIndex Pointer to the index of the event which
1676 satisfied the wait condition
1678 @retval EFI_SUCCESS The event indicated by Index was signaled.
1679 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1680 function or Event was not a valid type
1681 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1687 IN UINTN NumberOfEvents
,
1688 IN EFI_EVENT
*UserEvents
,
1689 OUT UINTN
*UserIndex
1695 Closes an event and frees the event structure.
1697 @param UserEvent Event to close
1699 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1700 @retval EFI_SUCCESS The event has been closed
1706 IN EFI_EVENT UserEvent
1712 Check the status of an event.
1714 @param UserEvent The event to check
1716 @retval EFI_SUCCESS The event is in the signaled state
1717 @retval EFI_NOT_READY The event is not in the signaled state
1718 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1724 IN EFI_EVENT UserEvent
1729 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1730 global coherency domain of the processor.
1732 @param GcdMemoryType Memory type of the memory space.
1733 @param BaseAddress Base address of the memory space.
1734 @param Length Length of the memory space.
1735 @param Capabilities alterable attributes of the memory space.
1737 @retval EFI_SUCCESS Merged this memory space into GCD map.
1742 CoreAddMemorySpace (
1743 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1744 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1746 IN UINT64 Capabilities
1751 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1752 I/O resources from the global coherency domain of the processor.
1754 @param GcdAllocateType The type of allocate operation
1755 @param GcdMemoryType The desired memory type
1756 @param Alignment Align with 2^Alignment
1757 @param Length Length to allocate
1758 @param BaseAddress Base address to allocate
1759 @param ImageHandle The image handle consume the allocated space.
1760 @param DeviceHandle The device handle consume the allocated space.
1762 @retval EFI_INVALID_PARAMETER Invalid parameter.
1763 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1764 @retval EFI_SUCCESS Memory space successfully allocated.
1769 CoreAllocateMemorySpace (
1770 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1771 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1774 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1775 IN EFI_HANDLE ImageHandle
,
1776 IN EFI_HANDLE DeviceHandle OPTIONAL
1781 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1782 I/O resources from the global coherency domain of the processor.
1784 @param BaseAddress Base address of the memory space.
1785 @param Length Length of the memory space.
1787 @retval EFI_SUCCESS Space successfully freed.
1792 CoreFreeMemorySpace (
1793 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1799 Removes reserved memory, system memory, or memory-mapped I/O resources from
1800 the global coherency domain of the processor.
1802 @param BaseAddress Base address of the memory space.
1803 @param Length Length of the memory space.
1805 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1810 CoreRemoveMemorySpace (
1811 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1817 Retrieves the descriptor for a memory region containing a specified address.
1819 @param BaseAddress Specified start address
1820 @param Descriptor Specified length
1822 @retval EFI_INVALID_PARAMETER Invalid parameter
1823 @retval EFI_SUCCESS Successfully get memory space descriptor.
1828 CoreGetMemorySpaceDescriptor (
1829 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1830 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1835 Modifies the attributes for a memory region in the global coherency domain of the
1838 @param BaseAddress Specified start address
1839 @param Length Specified length
1840 @param Attributes Specified attributes
1842 @retval EFI_SUCCESS The attributes were set for the memory region.
1843 @retval EFI_INVALID_PARAMETER Length is zero.
1844 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1845 resource range specified by BaseAddress and Length.
1846 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1847 range specified by BaseAddress and Length.
1848 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1849 BaseAddress and Length cannot be modified.
1850 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1851 the memory resource range.
1852 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1858 CoreSetMemorySpaceAttributes (
1859 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1861 IN UINT64 Attributes
1866 Modifies the capabilities for a memory region in the global coherency domain of the
1869 @param BaseAddress The physical address that is the start address of a memory region.
1870 @param Length The size in bytes of the memory region.
1871 @param Capabilities The bit mask of capabilities that the memory region supports.
1873 @retval EFI_SUCCESS The capabilities were set for the memory region.
1874 @retval EFI_INVALID_PARAMETER Length is zero.
1875 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1876 memory region attributes currently in use.
1877 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1878 BaseAddress and Length cannot be modified.
1879 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1880 of the memory resource range.
1884 CoreSetMemorySpaceCapabilities (
1885 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1887 IN UINT64 Capabilities
1892 Returns a map of the memory resources in the global coherency domain of the
1895 @param NumberOfDescriptors Number of descriptors.
1896 @param MemorySpaceMap Descriptor array
1898 @retval EFI_INVALID_PARAMETER Invalid parameter
1899 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1900 @retval EFI_SUCCESS Successfully get memory space map.
1905 CoreGetMemorySpaceMap (
1906 OUT UINTN
*NumberOfDescriptors
,
1907 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1912 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1914 @param GcdIoType IO type of the segment.
1915 @param BaseAddress Base address of the segment.
1916 @param Length Length of the segment.
1918 @retval EFI_SUCCESS Merged this segment into GCD map.
1919 @retval EFI_INVALID_PARAMETER Parameter not valid
1925 IN EFI_GCD_IO_TYPE GcdIoType
,
1926 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1932 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1933 domain of the processor.
1935 @param GcdAllocateType The type of allocate operation
1936 @param GcdIoType The desired IO type
1937 @param Alignment Align with 2^Alignment
1938 @param Length Length to allocate
1939 @param BaseAddress Base address to allocate
1940 @param ImageHandle The image handle consume the allocated space.
1941 @param DeviceHandle The device handle consume the allocated space.
1943 @retval EFI_INVALID_PARAMETER Invalid parameter.
1944 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1945 @retval EFI_SUCCESS IO space successfully allocated.
1950 CoreAllocateIoSpace (
1951 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1952 IN EFI_GCD_IO_TYPE GcdIoType
,
1955 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1956 IN EFI_HANDLE ImageHandle
,
1957 IN EFI_HANDLE DeviceHandle OPTIONAL
1962 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1963 domain of the processor.
1965 @param BaseAddress Base address of the segment.
1966 @param Length Length of the segment.
1968 @retval EFI_SUCCESS Space successfully freed.
1974 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1980 Removes reserved I/O or I/O resources from the global coherency domain of the
1983 @param BaseAddress Base address of the segment.
1984 @param Length Length of the segment.
1986 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1992 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1998 Retrieves the descriptor for an I/O region containing a specified address.
2000 @param BaseAddress Specified start address
2001 @param Descriptor Specified length
2003 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
2004 @retval EFI_SUCCESS Successfully get the IO space descriptor.
2009 CoreGetIoSpaceDescriptor (
2010 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2011 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2016 Returns a map of the I/O resources in the global coherency domain of the processor.
2018 @param NumberOfDescriptors Number of descriptors.
2019 @param IoSpaceMap Descriptor array
2021 @retval EFI_INVALID_PARAMETER Invalid parameter
2022 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2023 @retval EFI_SUCCESS Successfully get IO space map.
2029 OUT UINTN
*NumberOfDescriptors
,
2030 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2035 This is the main Dispatcher for DXE and it exits when there are no more
2036 drivers to run. Drain the mScheduledQueue and load and start a PE
2037 image for each driver. Search the mDiscoveredList to see if any driver can
2038 be placed on the mScheduledQueue. If no drivers are placed on the
2039 mScheduledQueue exit the function. On exit it is assumed the Bds()
2040 will be called, and when the Bds() exits the Dispatcher will be called
2043 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2044 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2045 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2055 Check every driver and locate a matching one. If the driver is found, the Unrequested
2056 state flag is cleared.
2058 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2059 the firmware file specified by DriverName.
2060 @param DriverName The Driver name to put in the Dependent state.
2062 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2064 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2071 IN EFI_HANDLE FirmwareVolumeHandle
,
2072 IN EFI_GUID
*DriverName
2077 Convert a driver from the Untrused back to the Scheduled state.
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 Scheduled state
2083 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2084 was promoted to the trusted state.
2085 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2091 IN EFI_HANDLE FirmwareVolumeHandle
,
2092 IN EFI_GUID
*DriverName
2097 This routine is the driver initialization entry point. It initializes the
2098 libraries, and registers two notification functions. These notification
2099 functions are responsible for building the FV stack dynamically.
2101 @param ImageHandle The image handle.
2102 @param SystemTable The system table.
2104 @retval EFI_SUCCESS Function successfully returned.
2110 IN EFI_HANDLE ImageHandle
,
2111 IN EFI_SYSTEM_TABLE
*SystemTable
2116 Entry point of the section extraction code. Initializes an instance of the
2117 section extraction interface and installs it on a new handle.
2119 @param ImageHandle A handle for the image that is initializing this driver
2120 @param SystemTable A pointer to the EFI system table
2122 @retval EFI_SUCCESS Driver initialized successfully
2123 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2128 InitializeSectionExtraction (
2129 IN EFI_HANDLE ImageHandle
,
2130 IN EFI_SYSTEM_TABLE
*SystemTable
2135 This DXE service routine is used to process a firmware volume. In
2136 particular, it can be called by BDS to process a single firmware
2137 volume found in a capsule.
2139 @param FvHeader pointer to a firmware volume header
2140 @param Size the size of the buffer pointed to by FvHeader
2141 @param FVProtocolHandle the handle on which a firmware volume protocol
2142 was produced for the firmware volume passed in.
2144 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2146 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2147 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2153 CoreProcessFirmwareVolume (
2156 OUT EFI_HANDLE
*FVProtocolHandle
2160 //Functions used during debug buils
2164 Displays Architectural protocols that were not loaded and are required for DXE
2165 core to function. Only used in Debug Builds.
2169 CoreDisplayMissingArchProtocols (
2175 Traverse the discovered list for any drivers that were discovered but not loaded
2176 because the dependency experessions evaluated to false.
2180 CoreDisplayDiscoveredNotDispatched (
2186 Place holder function until all the Boot Services and Runtime Services are
2189 @return EFI_NOT_AVAILABLE_YET
2194 CoreEfiNotAvailableYetArg0 (
2200 Place holder function until all the Boot Services and Runtime Services are
2203 @param Arg1 Undefined
2205 @return EFI_NOT_AVAILABLE_YET
2210 CoreEfiNotAvailableYetArg1 (
2216 Place holder function until all the Boot Services and Runtime Services are available.
2218 @param Arg1 Undefined
2219 @param Arg2 Undefined
2221 @return EFI_NOT_AVAILABLE_YET
2226 CoreEfiNotAvailableYetArg2 (
2233 Place holder function until all the Boot Services and Runtime Services are available.
2235 @param Arg1 Undefined
2236 @param Arg2 Undefined
2237 @param Arg3 Undefined
2239 @return EFI_NOT_AVAILABLE_YET
2244 CoreEfiNotAvailableYetArg3 (
2252 Place holder function until all the Boot Services and Runtime Services are available.
2254 @param Arg1 Undefined
2255 @param Arg2 Undefined
2256 @param Arg3 Undefined
2257 @param Arg4 Undefined
2259 @return EFI_NOT_AVAILABLE_YET
2264 CoreEfiNotAvailableYetArg4 (
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
2279 @param Arg5 Undefined
2281 @return EFI_NOT_AVAILABLE_YET
2286 CoreEfiNotAvailableYetArg5 (
2296 Given a compressed source buffer, this function retrieves the size of the
2297 uncompressed buffer and the size of the scratch buffer required to decompress
2298 the compressed source buffer.
2300 The GetInfo() function retrieves the size of the uncompressed buffer and the
2301 temporary scratch buffer required to decompress the buffer specified by Source
2302 and SourceSize. If the size of the uncompressed buffer or the size of the
2303 scratch buffer cannot be determined from the compressed data specified by
2304 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2305 size of the uncompressed buffer is returned in DestinationSize, the size of
2306 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2307 The GetInfo() function does not have scratch buffer available to perform a
2308 thorough checking of the validity of the source data. It just retrieves the
2309 "Original Size" field from the beginning bytes of the source data and output
2310 it as DestinationSize. And ScratchSize is specific to the decompression
2313 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2314 @param Source The source buffer containing the compressed data.
2315 @param SourceSize The size, in bytes, of the source buffer.
2316 @param DestinationSize A pointer to the size, in bytes, of the
2317 uncompressed buffer that will be generated when the
2318 compressed buffer specified by Source and
2319 SourceSize is decompressed.
2320 @param ScratchSize A pointer to the size, in bytes, of the scratch
2321 buffer that is required to decompress the
2322 compressed buffer specified by Source and
2325 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2326 DestinationSize and the size of the scratch buffer
2327 was returned in ScratchSize.
2328 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2329 the scratch buffer cannot be determined from the
2330 compressed data specified by Source and
2336 DxeMainUefiDecompressGetInfo (
2337 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2339 IN UINT32 SourceSize
,
2340 OUT UINT32
*DestinationSize
,
2341 OUT UINT32
*ScratchSize
2346 Decompresses a compressed source buffer.
2348 The Decompress() function extracts decompressed data to its original form.
2349 This protocol is designed so that the decompression algorithm can be
2350 implemented without using any memory services. As a result, the Decompress()
2351 Function is not allowed to call AllocatePool() or AllocatePages() in its
2352 implementation. It is the caller's responsibility to allocate and free the
2353 Destination and Scratch buffers.
2354 If the compressed source data specified by Source and SourceSize is
2355 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2356 the compressed source data specified by Source and SourceSize is not in a
2357 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2359 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2360 @param Source The source buffer containing the compressed data.
2361 @param SourceSize SourceSizeThe size of source data.
2362 @param Destination On output, the destination buffer that contains
2363 the uncompressed data.
2364 @param DestinationSize The size of the destination buffer. The size of
2365 the destination buffer needed is obtained from
2366 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2367 @param Scratch A temporary scratch buffer that is used to perform
2369 @param ScratchSize The size of scratch buffer. The size of the
2370 scratch buffer needed is obtained from GetInfo().
2372 @retval EFI_SUCCESS Decompression completed successfully, and the
2373 uncompressed buffer is returned in Destination.
2374 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2375 SourceSize is corrupted (not in a valid
2381 DxeMainUefiDecompress (
2382 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2384 IN UINT32 SourceSize
,
2385 IN OUT VOID
*Destination
,
2386 IN UINT32 DestinationSize
,
2387 IN OUT VOID
*Scratch
,
2388 IN UINT32 ScratchSize
2392 SEP member function. This function creates and returns a new section stream
2393 handle to represent the new section stream.
2395 @param SectionStreamLength Size in bytes of the section stream.
2396 @param SectionStream Buffer containing the new section stream.
2397 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2398 output contains the new section stream handle.
2400 @retval EFI_SUCCESS The section stream is created successfully.
2401 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2402 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2409 IN UINTN SectionStreamLength
,
2410 IN VOID
*SectionStream
,
2411 OUT UINTN
*SectionStreamHandle
2417 SEP member function. Retrieves requested section from section stream.
2419 @param SectionStreamHandle The section stream from which to extract the
2421 @param SectionType A pointer to the type of section to search for.
2422 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2423 then SectionDefinitionGuid indicates which of
2424 these types of sections to search for.
2425 @param SectionInstance Indicates which instance of the requested
2427 @param Buffer Double indirection to buffer. If *Buffer is
2428 non-null on input, then the buffer is caller
2429 allocated. If Buffer is NULL, then the buffer
2430 is callee allocated. In either case, the
2431 requried buffer size is returned in *BufferSize.
2432 @param BufferSize On input, indicates the size of *Buffer if
2433 *Buffer is non-null on input. On output,
2434 indicates the required size (allocated size if
2435 callee allocated) of *Buffer.
2436 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2437 indicates the authentication status of the
2438 output buffer. If the input section's
2439 GuidedSectionHeader.Attributes field
2440 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2441 bit as clear, AuthenticationStatus must return
2442 zero. Both local bits (19:16) and aggregate
2443 bits (3:0) in AuthenticationStatus are returned
2444 by ExtractSection(). These bits reflect the
2445 status of the extraction operation. The bit
2446 pattern in both regions must be the same, as
2447 the local and aggregate authentication statuses
2448 have equivalent meaning at this level. If the
2449 function returns anything other than
2450 EFI_SUCCESS, the value of *AuthenticationStatus
2452 @param IsFfs3Fv Indicates the FV format.
2454 @retval EFI_SUCCESS Section was retrieved successfully
2455 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2456 section stream with its
2457 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2458 but there was no corresponding GUIDed Section
2459 Extraction Protocol in the handle database.
2460 *Buffer is unmodified.
2461 @retval EFI_NOT_FOUND An error was encountered when parsing the
2462 SectionStream. This indicates the SectionStream
2463 is not correctly formatted.
2464 @retval EFI_NOT_FOUND The requested section does not exist.
2465 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2467 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2468 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2469 insufficient to contain the requested section.
2470 The input buffer is filled and section contents
2477 IN UINTN SectionStreamHandle
,
2478 IN EFI_SECTION_TYPE
*SectionType
,
2479 IN EFI_GUID
*SectionDefinitionGuid
,
2480 IN UINTN SectionInstance
,
2482 IN OUT UINTN
*BufferSize
,
2483 OUT UINT32
*AuthenticationStatus
,
2489 SEP member function. Deletes an existing section stream
2491 @param StreamHandleToClose Indicates the stream to close
2492 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2493 FALSE - No need to free stream buffer.
2495 @retval EFI_SUCCESS The section stream is closed sucessfully.
2496 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2497 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2503 CloseSectionStream (
2504 IN UINTN StreamHandleToClose
,
2505 IN BOOLEAN FreeStreamBuffer
2509 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2510 table and registers it into the system table.
2513 This function allocates memory, frees it, and then allocates memory at an
2514 address within the initial allocation. Since this function is called early
2515 in DXE core initialization (before drivers are dispatched), this should not
2520 CoreInitializeDebugImageInfoTable (
2526 Update the CRC32 in the Debug Table.
2527 Since the CRC32 service is made available by the Runtime driver, we have to
2528 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2529 This function is called elsewhere by the core when the runtime architectural
2530 protocol is produced.
2534 CoreUpdateDebugTableCrc32 (
2540 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2541 the table if it's not large enough to accomidate another entry.
2543 @param ImageInfoType type of debug image information
2544 @param LoadedImage pointer to the loaded image protocol for the image being
2546 @param ImageHandle image handle for the image being loaded
2550 CoreNewDebugImageInfoEntry (
2551 IN UINT32 ImageInfoType
,
2552 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2553 IN EFI_HANDLE ImageHandle
2558 Removes and frees an entry from the DebugImageInfo Table.
2560 @param ImageHandle image handle for the image being unloaded
2564 CoreRemoveDebugImageInfoEntry (
2565 EFI_HANDLE ImageHandle
2570 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2572 @param ImageHandle The image handle.
2573 @param SystemTable The system table.
2575 @retval EFI_SUCCESS Successfully initialized firmware volume block
2581 FwVolBlockDriverInit (
2582 IN EFI_HANDLE ImageHandle
,
2583 IN EFI_SYSTEM_TABLE
*SystemTable
2588 Get FVB authentication status
2590 @param FvbProtocol FVB protocol.
2592 @return Authentication status.
2596 GetFvbAuthenticationStatus (
2597 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2601 This routine produces a firmware volume block protocol on a given
2604 @param BaseAddress base address of the firmware volume image
2605 @param Length length of the firmware volume image
2606 @param ParentHandle handle of parent firmware volume, if this image
2607 came from an FV image file and section in another firmware
2608 volume (ala capsules)
2609 @param AuthenticationStatus Authentication status inherited, if this image
2610 came from an FV image file and section in another firmware volume.
2611 @param FvProtocol Firmware volume block protocol produced.
2613 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2614 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2615 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2620 ProduceFVBProtocolOnBuffer (
2621 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2623 IN EFI_HANDLE ParentHandle
,
2624 IN UINT32 AuthenticationStatus
,
2625 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2630 Raising to the task priority level of the mutual exclusion
2631 lock, and then acquires ownership of the lock.
2633 @param Lock The lock to acquire
2645 Initialize a basic mutual exclusion lock. Each lock
2646 provides mutual exclusion access at it's task priority
2647 level. Since there is no-premption (at any TPL) or
2648 multiprocessor support, acquiring the lock only consists
2649 of raising to the locks TPL.
2651 @param Lock The EFI_LOCK structure to initialize
2653 @retval EFI_SUCCESS Lock Owned.
2654 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2658 CoreAcquireLockOrFail (
2664 Releases ownership of the mutual exclusion lock, and
2665 restores the previous task priority level.
2667 @param Lock The lock to release
2669 @return Lock unowned
2679 An empty function to pass error checking of CreateEventEx ().
2681 @param Event Event whose notification function is being invoked.
2682 @param Context Pointer to the notification function's context,
2683 which is implementation-dependent.
2688 CoreEmptyCallbackFunction (
2694 Read data from Firmware Block by FVB protocol Read.
2695 The data may cross the multi block ranges.
2697 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2698 @param StartLba Pointer to StartLba.
2699 On input, the start logical block index from which to read.
2700 On output,the end logical block index after reading.
2701 @param Offset Pointer to Offset
2702 On input, offset into the block at which to begin reading.
2703 On output, offset into the end block after reading.
2704 @param DataSize Size of data to be read.
2705 @param Data Pointer to Buffer that the data will be read into.
2707 @retval EFI_SUCCESS Successfully read data from firmware block.
2712 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2713 IN OUT EFI_LBA
*StartLba
,
2714 IN OUT UINTN
*Offset
,
2720 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2721 copy the real length volume header into it.
2723 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2724 read the volume header
2725 @param FwVolHeader Pointer to pointer to allocated buffer in which
2726 the volume header is returned.
2728 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2729 @retval EFI_SUCCESS Successfully read volume header to the allocated
2731 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2732 the file system could not be understood.
2737 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2738 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2742 Verify checksum of the firmware volume header.
2744 @param FvHeader Points to the firmware volume header to be checked
2746 @retval TRUE Checksum verification passed
2747 @retval FALSE Checksum verification failed
2751 VerifyFvHeaderChecksum (
2752 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2756 Initialize memory profile.
2758 @param HobStart The start address of the HOB.
2767 Install memory profile protocol.
2771 MemoryProfileInstallProtocol (
2776 Register image to memory profile.
2778 @param DriverEntry Image info.
2779 @param FileType Image file type.
2781 @retval TRUE Register success.
2782 @retval FALSE Register fail.
2786 RegisterMemoryProfileImage (
2787 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2788 IN EFI_FV_FILETYPE FileType
2792 Unregister image from memory profile.
2794 @param DriverEntry Image info.
2796 @retval TRUE Unregister success.
2797 @retval FALSE Unregister fail.
2801 UnregisterMemoryProfileImage (
2802 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2806 Update memory profile information.
2808 @param CallerAddress Address of caller who call Allocate or Free.
2809 @param Action This Allocate or Free action.
2810 @param MemoryType Memory type.
2811 @param Size Buffer size.
2812 @param Buffer Buffer address.
2814 @retval TRUE Profile udpate success.
2815 @retval FALSE Profile update fail.
2820 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2821 IN MEMORY_PROFILE_ACTION Action
,
2822 IN EFI_MEMORY_TYPE MemoryType
, // Valid for AllocatePages/AllocatePool
2823 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2828 Internal function. Converts a memory range to use new attributes.
2830 @param Start The first address of the range Must be page
2832 @param NumberOfPages The number of pages to convert
2833 @param NewAttributes The new attributes value for the range.
2837 CoreUpdateMemoryAttributes (
2838 IN EFI_PHYSICAL_ADDRESS Start
,
2839 IN UINT64 NumberOfPages
,
2840 IN UINT64 NewAttributes
2844 Initialize PropertiesTable support.
2848 CoreInitializePropertiesTable (
2853 Initialize MemoryAttrubutesTable support.
2857 CoreInitializeMemoryAttributesTable (
2862 Insert image record.
2864 @param RuntimeImage Runtime image information
2868 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2872 Remove Image record.
2874 @param RuntimeImage Runtime image information
2878 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage