2 The internal header file includes the common header files, defines
3 internal structure and functions used by DxeCore module.
5 Copyright (c) 2006 - 2014, 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 Allocates pages from the memory map.
1275 @param Type The type of allocation to perform
1276 @param MemoryType The type of memory to turn the allocated pages
1278 @param NumberOfPages The number of pages to allocate
1279 @param Memory A pointer to receive the base allocated memory
1282 @return Status. On success, Memory is filled in with the base address allocated
1283 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in
1285 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.
1286 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.
1287 @retval EFI_SUCCESS Pages successfully allocated.
1292 CoreInternalAllocatePages (
1293 IN EFI_ALLOCATE_TYPE Type
,
1294 IN EFI_MEMORY_TYPE MemoryType
,
1295 IN UINTN NumberOfPages
,
1296 IN OUT EFI_PHYSICAL_ADDRESS
*Memory
1300 Frees previous allocated pages.
1302 @param Memory Base address of memory being freed
1303 @param NumberOfPages The number of pages to free
1305 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1306 @retval EFI_INVALID_PARAMETER Address not aligned
1307 @return EFI_SUCCESS -Pages successfully freed.
1313 IN EFI_PHYSICAL_ADDRESS Memory
,
1314 IN UINTN NumberOfPages
1318 Frees previous allocated pages.
1320 @param Memory Base address of memory being freed
1321 @param NumberOfPages The number of pages to free
1323 @retval EFI_NOT_FOUND Could not find the entry that covers the range
1324 @retval EFI_INVALID_PARAMETER Address not aligned
1325 @return EFI_SUCCESS -Pages successfully freed.
1330 CoreInternalFreePages (
1331 IN EFI_PHYSICAL_ADDRESS Memory
,
1332 IN UINTN NumberOfPages
1336 This function returns a copy of the current memory map. The map is an array of
1337 memory descriptors, each of which describes a contiguous block of memory.
1339 @param MemoryMapSize A pointer to the size, in bytes, of the
1340 MemoryMap buffer. On input, this is the size of
1341 the buffer allocated by the caller. On output,
1342 it is the size of the buffer returned by the
1343 firmware if the buffer was large enough, or the
1344 size of the buffer needed to contain the map if
1345 the buffer was too small.
1346 @param MemoryMap A pointer to the buffer in which firmware places
1347 the current memory map.
1348 @param MapKey A pointer to the location in which firmware
1349 returns the key for the current memory map.
1350 @param DescriptorSize A pointer to the location in which firmware
1351 returns the size, in bytes, of an individual
1352 EFI_MEMORY_DESCRIPTOR.
1353 @param DescriptorVersion A pointer to the location in which firmware
1354 returns the version number associated with the
1355 EFI_MEMORY_DESCRIPTOR.
1357 @retval EFI_SUCCESS The memory map was returned in the MemoryMap
1359 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current
1360 buffer size needed to hold the memory map is
1361 returned in MemoryMapSize.
1362 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1368 IN OUT UINTN
*MemoryMapSize
,
1369 IN OUT EFI_MEMORY_DESCRIPTOR
*MemoryMap
,
1371 OUT UINTN
*DescriptorSize
,
1372 OUT UINT32
*DescriptorVersion
1378 Allocate pool of a particular type.
1380 @param PoolType Type of pool to allocate
1381 @param Size The amount of pool to allocate
1382 @param Buffer The address to return a pointer to the allocated
1385 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1386 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1387 @retval EFI_SUCCESS Pool successfully allocated.
1393 IN EFI_MEMORY_TYPE PoolType
,
1399 Allocate pool of a particular type.
1401 @param PoolType Type of pool to allocate
1402 @param Size The amount of pool to allocate
1403 @param Buffer The address to return a pointer to the allocated
1406 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL
1407 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.
1408 @retval EFI_SUCCESS Pool successfully allocated.
1413 CoreInternalAllocatePool (
1414 IN EFI_MEMORY_TYPE PoolType
,
1422 @param Buffer The allocated pool entry to free
1424 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1425 @retval EFI_SUCCESS Pool successfully freed.
1437 @param Buffer The allocated pool entry to free
1439 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.
1440 @retval EFI_SUCCESS Pool successfully freed.
1445 CoreInternalFreePool (
1450 Loads an EFI image into memory and returns a handle to the image.
1452 @param BootPolicy If TRUE, indicates that the request originates
1453 from the boot manager, and that the boot
1454 manager is attempting to load FilePath as a
1456 @param ParentImageHandle The caller's image handle.
1457 @param FilePath The specific file path from which the image is
1459 @param SourceBuffer If not NULL, a pointer to the memory location
1460 containing a copy of the image to be loaded.
1461 @param SourceSize The size in bytes of SourceBuffer.
1462 @param ImageHandle Pointer to the returned image handle that is
1463 created when the image is successfully loaded.
1465 @retval EFI_SUCCESS The image was loaded into memory.
1466 @retval EFI_NOT_FOUND The FilePath was not found.
1467 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.
1468 @retval EFI_UNSUPPORTED The image type is not supported, or the device
1469 path cannot be parsed to locate the proper
1470 protocol for loading the file.
1471 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient
1473 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
1475 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
1476 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
1477 image from being loaded. NULL is returned in *ImageHandle.
1478 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
1479 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
1480 platform policy specifies that the image should not be started.
1486 IN BOOLEAN BootPolicy
,
1487 IN EFI_HANDLE ParentImageHandle
,
1488 IN EFI_DEVICE_PATH_PROTOCOL
*FilePath
,
1489 IN VOID
*SourceBuffer OPTIONAL
,
1490 IN UINTN SourceSize
,
1491 OUT EFI_HANDLE
*ImageHandle
1499 @param ImageHandle Handle that identifies the image to be
1502 @retval EFI_SUCCESS The image has been unloaded.
1503 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1505 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1511 IN EFI_HANDLE ImageHandle
1517 Transfer control to a loaded image's entry point.
1519 @param ImageHandle Handle of image to be started.
1520 @param ExitDataSize Pointer of the size to ExitData
1521 @param ExitData Pointer to a pointer to a data buffer that
1522 includes a Null-terminated string,
1523 optionally followed by additional binary data.
1524 The string is a description that the caller may
1525 use to further indicate the reason for the
1528 @retval EFI_INVALID_PARAMETER Invalid parameter
1529 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1530 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
1531 @retval EFI_SUCCESS Successfully transfer control to the image's
1538 IN EFI_HANDLE ImageHandle
,
1539 OUT UINTN
*ExitDataSize
,
1540 OUT CHAR16
**ExitData OPTIONAL
1546 Terminates the currently loaded EFI image and returns control to boot services.
1548 @param ImageHandle Handle that identifies the image. This
1549 parameter is passed to the image on entry.
1550 @param Status The image's exit code.
1551 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1552 ExitStatus is EFI_SUCCESS.
1553 @param ExitData Pointer to a data buffer that includes a
1554 Null-terminated Unicode string, optionally
1555 followed by additional binary data. The string
1556 is a description that the caller may use to
1557 further indicate the reason for the image's
1560 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1562 @retval EFI_SUCCESS Successfully terminates the currently loaded
1564 @retval EFI_ACCESS_DENIED Should never reach there.
1565 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1571 IN EFI_HANDLE ImageHandle
,
1572 IN EFI_STATUS Status
,
1573 IN UINTN ExitDataSize
,
1574 IN CHAR16
*ExitData OPTIONAL
1582 @param Type The type of event to create and its mode and
1584 @param NotifyTpl The task priority level of event notifications
1585 @param NotifyFunction Pointer to the events notification function
1586 @param NotifyContext Pointer to the notification functions context;
1587 corresponds to parameter "Context" in the
1588 notification function
1589 @param Event Pointer to the newly created event if the call
1590 succeeds; undefined otherwise
1592 @retval EFI_SUCCESS The event structure was created
1593 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1594 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1601 IN EFI_TPL NotifyTpl
,
1602 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1603 IN VOID
*NotifyContext
, OPTIONAL
1604 OUT EFI_EVENT
*Event
1610 Creates an event in a group.
1612 @param Type The type of event to create and its mode and
1614 @param NotifyTpl The task priority level of event notifications
1615 @param NotifyFunction Pointer to the events notification function
1616 @param NotifyContext Pointer to the notification functions context;
1617 corresponds to parameter "Context" in the
1618 notification function
1619 @param EventGroup GUID for EventGroup if NULL act the same as
1621 @param Event Pointer to the newly created event if the call
1622 succeeds; undefined otherwise
1624 @retval EFI_SUCCESS The event structure was created
1625 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1626 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1633 IN EFI_TPL NotifyTpl
,
1634 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1635 IN CONST VOID
*NotifyContext
, OPTIONAL
1636 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1637 OUT EFI_EVENT
*Event
1641 Creates a general-purpose event structure
1643 @param Type The type of event to create and its mode and
1645 @param NotifyTpl The task priority level of event notifications
1646 @param NotifyFunction Pointer to the events notification function
1647 @param NotifyContext Pointer to the notification functions context;
1648 corresponds to parameter "Context" in the
1649 notification function
1650 @param EventGroup GUID for EventGroup if NULL act the same as
1652 @param Event Pointer to the newly created event if the call
1653 succeeds; undefined otherwise
1655 @retval EFI_SUCCESS The event structure was created
1656 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1657 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1662 CoreCreateEventInternal (
1664 IN EFI_TPL NotifyTpl
,
1665 IN EFI_EVENT_NOTIFY NotifyFunction
, OPTIONAL
1666 IN CONST VOID
*NotifyContext
, OPTIONAL
1667 IN CONST EFI_GUID
*EventGroup
, OPTIONAL
1668 OUT EFI_EVENT
*Event
1672 Sets the type of timer and the trigger time for a timer event.
1674 @param UserEvent The timer event that is to be signaled at the
1676 @param Type The type of time that is specified in
1678 @param TriggerTime The number of 100ns units until the timer
1681 @retval EFI_SUCCESS The event has been set to be signaled at the
1683 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1689 IN EFI_EVENT UserEvent
,
1690 IN EFI_TIMER_DELAY Type
,
1691 IN UINT64 TriggerTime
1697 Signals the event. Queues the event to be notified if needed.
1699 @param UserEvent The event to signal .
1701 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1702 @retval EFI_SUCCESS The event was signaled.
1708 IN EFI_EVENT UserEvent
1714 Stops execution until an event is signaled.
1716 @param NumberOfEvents The number of events in the UserEvents array
1717 @param UserEvents An array of EFI_EVENT
1718 @param UserIndex Pointer to the index of the event which
1719 satisfied the wait condition
1721 @retval EFI_SUCCESS The event indicated by Index was signaled.
1722 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1723 function or Event was not a valid type
1724 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1730 IN UINTN NumberOfEvents
,
1731 IN EFI_EVENT
*UserEvents
,
1732 OUT UINTN
*UserIndex
1738 Closes an event and frees the event structure.
1740 @param UserEvent Event to close
1742 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1743 @retval EFI_SUCCESS The event has been closed
1749 IN EFI_EVENT UserEvent
1755 Check the status of an event.
1757 @param UserEvent The event to check
1759 @retval EFI_SUCCESS The event is in the signaled state
1760 @retval EFI_NOT_READY The event is not in the signaled state
1761 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1767 IN EFI_EVENT UserEvent
1772 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1773 global coherency domain of the processor.
1775 @param GcdMemoryType Memory type of the memory space.
1776 @param BaseAddress Base address of the memory space.
1777 @param Length Length of the memory space.
1778 @param Capabilities alterable attributes of the memory space.
1780 @retval EFI_SUCCESS Merged this memory space into GCD map.
1785 CoreAddMemorySpace (
1786 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1787 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1789 IN UINT64 Capabilities
1794 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1795 I/O resources from the global coherency domain of the processor.
1797 @param GcdAllocateType The type of allocate operation
1798 @param GcdMemoryType The desired memory type
1799 @param Alignment Align with 2^Alignment
1800 @param Length Length to allocate
1801 @param BaseAddress Base address to allocate
1802 @param ImageHandle The image handle consume the allocated space.
1803 @param DeviceHandle The device handle consume the allocated space.
1805 @retval EFI_INVALID_PARAMETER Invalid parameter.
1806 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1807 @retval EFI_SUCCESS Memory space successfully allocated.
1812 CoreAllocateMemorySpace (
1813 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1814 IN EFI_GCD_MEMORY_TYPE GcdMemoryType
,
1817 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1818 IN EFI_HANDLE ImageHandle
,
1819 IN EFI_HANDLE DeviceHandle OPTIONAL
1824 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1825 I/O resources from the global coherency domain of the processor.
1827 @param BaseAddress Base address of the memory space.
1828 @param Length Length of the memory space.
1830 @retval EFI_SUCCESS Space successfully freed.
1835 CoreFreeMemorySpace (
1836 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1842 Removes reserved memory, system memory, or memory-mapped I/O resources from
1843 the global coherency domain of the processor.
1845 @param BaseAddress Base address of the memory space.
1846 @param Length Length of the memory space.
1848 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1853 CoreRemoveMemorySpace (
1854 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1860 Retrieves the descriptor for a memory region containing a specified address.
1862 @param BaseAddress Specified start address
1863 @param Descriptor Specified length
1865 @retval EFI_INVALID_PARAMETER Invalid parameter
1866 @retval EFI_SUCCESS Successfully get memory space descriptor.
1871 CoreGetMemorySpaceDescriptor (
1872 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1873 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
*Descriptor
1878 Modifies the attributes for a memory region in the global coherency domain of the
1881 @param BaseAddress Specified start address
1882 @param Length Specified length
1883 @param Attributes Specified attributes
1885 @retval EFI_SUCCESS The attributes were set for the memory region.
1886 @retval EFI_INVALID_PARAMETER Length is zero.
1887 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory
1888 resource range specified by BaseAddress and Length.
1889 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource
1890 range specified by BaseAddress and Length.
1891 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by
1892 BaseAddress and Length cannot be modified.
1893 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
1894 the memory resource range.
1895 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is
1901 CoreSetMemorySpaceAttributes (
1902 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1904 IN UINT64 Attributes
1909 Modifies the capabilities for a memory region in the global coherency domain of the
1912 @param BaseAddress The physical address that is the start address of a memory region.
1913 @param Length The size in bytes of the memory region.
1914 @param Capabilities The bit mask of capabilities that the memory region supports.
1916 @retval EFI_SUCCESS The capabilities were set for the memory region.
1917 @retval EFI_INVALID_PARAMETER Length is zero.
1918 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the
1919 memory region attributes currently in use.
1920 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by
1921 BaseAddress and Length cannot be modified.
1922 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities
1923 of the memory resource range.
1927 CoreSetMemorySpaceCapabilities (
1928 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1930 IN UINT64 Capabilities
1935 Returns a map of the memory resources in the global coherency domain of the
1938 @param NumberOfDescriptors Number of descriptors.
1939 @param MemorySpaceMap Descriptor array
1941 @retval EFI_INVALID_PARAMETER Invalid parameter
1942 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1943 @retval EFI_SUCCESS Successfully get memory space map.
1948 CoreGetMemorySpaceMap (
1949 OUT UINTN
*NumberOfDescriptors
,
1950 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR
**MemorySpaceMap
1955 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1957 @param GcdIoType IO type of the segment.
1958 @param BaseAddress Base address of the segment.
1959 @param Length Length of the segment.
1961 @retval EFI_SUCCESS Merged this segment into GCD map.
1962 @retval EFI_INVALID_PARAMETER Parameter not valid
1968 IN EFI_GCD_IO_TYPE GcdIoType
,
1969 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
1975 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1976 domain of the processor.
1978 @param GcdAllocateType The type of allocate operation
1979 @param GcdIoType The desired IO type
1980 @param Alignment Align with 2^Alignment
1981 @param Length Length to allocate
1982 @param BaseAddress Base address to allocate
1983 @param ImageHandle The image handle consume the allocated space.
1984 @param DeviceHandle The device handle consume the allocated space.
1986 @retval EFI_INVALID_PARAMETER Invalid parameter.
1987 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1988 @retval EFI_SUCCESS IO space successfully allocated.
1993 CoreAllocateIoSpace (
1994 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType
,
1995 IN EFI_GCD_IO_TYPE GcdIoType
,
1998 IN OUT EFI_PHYSICAL_ADDRESS
*BaseAddress
,
1999 IN EFI_HANDLE ImageHandle
,
2000 IN EFI_HANDLE DeviceHandle OPTIONAL
2005 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
2006 domain of the processor.
2008 @param BaseAddress Base address of the segment.
2009 @param Length Length of the segment.
2011 @retval EFI_SUCCESS Space successfully freed.
2017 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2023 Removes reserved I/O or I/O resources from the global coherency domain of the
2026 @param BaseAddress Base address of the segment.
2027 @param Length Length of the segment.
2029 @retval EFI_SUCCESS Successfully removed a segment of IO space.
2035 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2041 Retrieves the descriptor for an I/O region containing a specified address.
2043 @param BaseAddress Specified start address
2044 @param Descriptor Specified length
2046 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
2047 @retval EFI_SUCCESS Successfully get the IO space descriptor.
2052 CoreGetIoSpaceDescriptor (
2053 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2054 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
*Descriptor
2059 Returns a map of the I/O resources in the global coherency domain of the processor.
2061 @param NumberOfDescriptors Number of descriptors.
2062 @param IoSpaceMap Descriptor array
2064 @retval EFI_INVALID_PARAMETER Invalid parameter
2065 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
2066 @retval EFI_SUCCESS Successfully get IO space map.
2072 OUT UINTN
*NumberOfDescriptors
,
2073 OUT EFI_GCD_IO_SPACE_DESCRIPTOR
**IoSpaceMap
2078 This is the main Dispatcher for DXE and it exits when there are no more
2079 drivers to run. Drain the mScheduledQueue and load and start a PE
2080 image for each driver. Search the mDiscoveredList to see if any driver can
2081 be placed on the mScheduledQueue. If no drivers are placed on the
2082 mScheduledQueue exit the function. On exit it is assumed the Bds()
2083 will be called, and when the Bds() exits the Dispatcher will be called
2086 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
2087 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
2088 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
2098 Check every driver and locate a matching one. If the driver is found, the Unrequested
2099 state flag is cleared.
2101 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2102 the firmware file specified by DriverName.
2103 @param DriverName The Driver name to put in the Dependent state.
2105 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
2107 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
2114 IN EFI_HANDLE FirmwareVolumeHandle
,
2115 IN EFI_GUID
*DriverName
2120 Convert a driver from the Untrused back to the Scheduled state.
2122 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
2123 the firmware file specified by DriverName.
2124 @param DriverName The Driver name to put in the Scheduled state
2126 @retval EFI_SUCCESS The file was found in the untrusted state, and it
2127 was promoted to the trusted state.
2128 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
2134 IN EFI_HANDLE FirmwareVolumeHandle
,
2135 IN EFI_GUID
*DriverName
2140 This routine is the driver initialization entry point. It initializes the
2141 libraries, and registers two notification functions. These notification
2142 functions are responsible for building the FV stack dynamically.
2144 @param ImageHandle The image handle.
2145 @param SystemTable The system table.
2147 @retval EFI_SUCCESS Function successfully returned.
2153 IN EFI_HANDLE ImageHandle
,
2154 IN EFI_SYSTEM_TABLE
*SystemTable
2159 Entry point of the section extraction code. Initializes an instance of the
2160 section extraction interface and installs it on a new handle.
2162 @param ImageHandle A handle for the image that is initializing this driver
2163 @param SystemTable A pointer to the EFI system table
2165 @retval EFI_SUCCESS Driver initialized successfully
2166 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
2171 InitializeSectionExtraction (
2172 IN EFI_HANDLE ImageHandle
,
2173 IN EFI_SYSTEM_TABLE
*SystemTable
2178 This DXE service routine is used to process a firmware volume. In
2179 particular, it can be called by BDS to process a single firmware
2180 volume found in a capsule.
2182 @param FvHeader pointer to a firmware volume header
2183 @param Size the size of the buffer pointed to by FvHeader
2184 @param FVProtocolHandle the handle on which a firmware volume protocol
2185 was produced for the firmware volume passed in.
2187 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
2189 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
2190 @retval EFI_SUCCESS a firmware volume protocol was produced for the
2196 CoreProcessFirmwareVolume (
2199 OUT EFI_HANDLE
*FVProtocolHandle
2203 //Functions used during debug buils
2207 Displays Architectural protocols that were not loaded and are required for DXE
2208 core to function. Only used in Debug Builds.
2212 CoreDisplayMissingArchProtocols (
2218 Traverse the discovered list for any drivers that were discovered but not loaded
2219 because the dependency experessions evaluated to false.
2223 CoreDisplayDiscoveredNotDispatched (
2229 Place holder function until all the Boot Services and Runtime Services are
2232 @return EFI_NOT_AVAILABLE_YET
2237 CoreEfiNotAvailableYetArg0 (
2243 Place holder function until all the Boot Services and Runtime Services are
2246 @param Arg1 Undefined
2248 @return EFI_NOT_AVAILABLE_YET
2253 CoreEfiNotAvailableYetArg1 (
2259 Place holder function until all the Boot Services and Runtime Services are available.
2261 @param Arg1 Undefined
2262 @param Arg2 Undefined
2264 @return EFI_NOT_AVAILABLE_YET
2269 CoreEfiNotAvailableYetArg2 (
2276 Place holder function until all the Boot Services and Runtime Services are available.
2278 @param Arg1 Undefined
2279 @param Arg2 Undefined
2280 @param Arg3 Undefined
2282 @return EFI_NOT_AVAILABLE_YET
2287 CoreEfiNotAvailableYetArg3 (
2295 Place holder function until all the Boot Services and Runtime Services are available.
2297 @param Arg1 Undefined
2298 @param Arg2 Undefined
2299 @param Arg3 Undefined
2300 @param Arg4 Undefined
2302 @return EFI_NOT_AVAILABLE_YET
2307 CoreEfiNotAvailableYetArg4 (
2316 Place holder function until all the Boot Services and Runtime Services are available.
2318 @param Arg1 Undefined
2319 @param Arg2 Undefined
2320 @param Arg3 Undefined
2321 @param Arg4 Undefined
2322 @param Arg5 Undefined
2324 @return EFI_NOT_AVAILABLE_YET
2329 CoreEfiNotAvailableYetArg5 (
2339 Given a compressed source buffer, this function retrieves the size of the
2340 uncompressed buffer and the size of the scratch buffer required to decompress
2341 the compressed source buffer.
2343 The GetInfo() function retrieves the size of the uncompressed buffer and the
2344 temporary scratch buffer required to decompress the buffer specified by Source
2345 and SourceSize. If the size of the uncompressed buffer or the size of the
2346 scratch buffer cannot be determined from the compressed data specified by
2347 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2348 size of the uncompressed buffer is returned in DestinationSize, the size of
2349 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2350 The GetInfo() function does not have scratch buffer available to perform a
2351 thorough checking of the validity of the source data. It just retrieves the
2352 "Original Size" field from the beginning bytes of the source data and output
2353 it as DestinationSize. And ScratchSize is specific to the decompression
2356 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2357 @param Source The source buffer containing the compressed data.
2358 @param SourceSize The size, in bytes, of the source buffer.
2359 @param DestinationSize A pointer to the size, in bytes, of the
2360 uncompressed buffer that will be generated when the
2361 compressed buffer specified by Source and
2362 SourceSize is decompressed.
2363 @param ScratchSize A pointer to the size, in bytes, of the scratch
2364 buffer that is required to decompress the
2365 compressed buffer specified by Source and
2368 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2369 DestinationSize and the size of the scratch buffer
2370 was returned in ScratchSize.
2371 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2372 the scratch buffer cannot be determined from the
2373 compressed data specified by Source and
2379 DxeMainUefiDecompressGetInfo (
2380 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2382 IN UINT32 SourceSize
,
2383 OUT UINT32
*DestinationSize
,
2384 OUT UINT32
*ScratchSize
2389 Decompresses a compressed source buffer.
2391 The Decompress() function extracts decompressed data to its original form.
2392 This protocol is designed so that the decompression algorithm can be
2393 implemented without using any memory services. As a result, the Decompress()
2394 Function is not allowed to call AllocatePool() or AllocatePages() in its
2395 implementation. It is the caller's responsibility to allocate and free the
2396 Destination and Scratch buffers.
2397 If the compressed source data specified by Source and SourceSize is
2398 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2399 the compressed source data specified by Source and SourceSize is not in a
2400 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2402 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2403 @param Source The source buffer containing the compressed data.
2404 @param SourceSize SourceSizeThe size of source data.
2405 @param Destination On output, the destination buffer that contains
2406 the uncompressed data.
2407 @param DestinationSize The size of the destination buffer. The size of
2408 the destination buffer needed is obtained from
2409 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2410 @param Scratch A temporary scratch buffer that is used to perform
2412 @param ScratchSize The size of scratch buffer. The size of the
2413 scratch buffer needed is obtained from GetInfo().
2415 @retval EFI_SUCCESS Decompression completed successfully, and the
2416 uncompressed buffer is returned in Destination.
2417 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2418 SourceSize is corrupted (not in a valid
2424 DxeMainUefiDecompress (
2425 IN EFI_DECOMPRESS_PROTOCOL
*This
,
2427 IN UINT32 SourceSize
,
2428 IN OUT VOID
*Destination
,
2429 IN UINT32 DestinationSize
,
2430 IN OUT VOID
*Scratch
,
2431 IN UINT32 ScratchSize
2435 SEP member function. This function creates and returns a new section stream
2436 handle to represent the new section stream.
2438 @param SectionStreamLength Size in bytes of the section stream.
2439 @param SectionStream Buffer containing the new section stream.
2440 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2441 output contains the new section stream handle.
2443 @retval EFI_SUCCESS The section stream is created successfully.
2444 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2445 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2452 IN UINTN SectionStreamLength
,
2453 IN VOID
*SectionStream
,
2454 OUT UINTN
*SectionStreamHandle
2460 SEP member function. Retrieves requested section from section stream.
2462 @param SectionStreamHandle The section stream from which to extract the
2464 @param SectionType A pointer to the type of section to search for.
2465 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2466 then SectionDefinitionGuid indicates which of
2467 these types of sections to search for.
2468 @param SectionInstance Indicates which instance of the requested
2470 @param Buffer Double indirection to buffer. If *Buffer is
2471 non-null on input, then the buffer is caller
2472 allocated. If Buffer is NULL, then the buffer
2473 is callee allocated. In either case, the
2474 requried buffer size is returned in *BufferSize.
2475 @param BufferSize On input, indicates the size of *Buffer if
2476 *Buffer is non-null on input. On output,
2477 indicates the required size (allocated size if
2478 callee allocated) of *Buffer.
2479 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2480 indicates the authentication status of the
2481 output buffer. If the input section's
2482 GuidedSectionHeader.Attributes field
2483 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2484 bit as clear, AuthenticationStatus must return
2485 zero. Both local bits (19:16) and aggregate
2486 bits (3:0) in AuthenticationStatus are returned
2487 by ExtractSection(). These bits reflect the
2488 status of the extraction operation. The bit
2489 pattern in both regions must be the same, as
2490 the local and aggregate authentication statuses
2491 have equivalent meaning at this level. If the
2492 function returns anything other than
2493 EFI_SUCCESS, the value of *AuthenticationStatus
2495 @param IsFfs3Fv Indicates the FV format.
2497 @retval EFI_SUCCESS Section was retrieved successfully
2498 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2499 section stream with its
2500 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2501 but there was no corresponding GUIDed Section
2502 Extraction Protocol in the handle database.
2503 *Buffer is unmodified.
2504 @retval EFI_NOT_FOUND An error was encountered when parsing the
2505 SectionStream. This indicates the SectionStream
2506 is not correctly formatted.
2507 @retval EFI_NOT_FOUND The requested section does not exist.
2508 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2510 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2511 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2512 insufficient to contain the requested section.
2513 The input buffer is filled and section contents
2520 IN UINTN SectionStreamHandle
,
2521 IN EFI_SECTION_TYPE
*SectionType
,
2522 IN EFI_GUID
*SectionDefinitionGuid
,
2523 IN UINTN SectionInstance
,
2525 IN OUT UINTN
*BufferSize
,
2526 OUT UINT32
*AuthenticationStatus
,
2532 SEP member function. Deletes an existing section stream
2534 @param StreamHandleToClose Indicates the stream to close
2535 @param FreeStreamBuffer TRUE - Need to free stream buffer;
2536 FALSE - No need to free stream buffer.
2538 @retval EFI_SUCCESS The section stream is closed sucessfully.
2539 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2540 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2546 CloseSectionStream (
2547 IN UINTN StreamHandleToClose
,
2548 IN BOOLEAN FreeStreamBuffer
2552 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2553 table and registers it into the system table.
2556 This function allocates memory, frees it, and then allocates memory at an
2557 address within the initial allocation. Since this function is called early
2558 in DXE core initialization (before drivers are dispatched), this should not
2563 CoreInitializeDebugImageInfoTable (
2569 Update the CRC32 in the Debug Table.
2570 Since the CRC32 service is made available by the Runtime driver, we have to
2571 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2572 This function is called elsewhere by the core when the runtime architectural
2573 protocol is produced.
2577 CoreUpdateDebugTableCrc32 (
2583 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2584 the table if it's not large enough to accomidate another entry.
2586 @param ImageInfoType type of debug image information
2587 @param LoadedImage pointer to the loaded image protocol for the image being
2589 @param ImageHandle image handle for the image being loaded
2593 CoreNewDebugImageInfoEntry (
2594 IN UINT32 ImageInfoType
,
2595 IN EFI_LOADED_IMAGE_PROTOCOL
*LoadedImage
,
2596 IN EFI_HANDLE ImageHandle
2601 Removes and frees an entry from the DebugImageInfo Table.
2603 @param ImageHandle image handle for the image being unloaded
2607 CoreRemoveDebugImageInfoEntry (
2608 EFI_HANDLE ImageHandle
2613 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2615 @param ImageHandle The image handle.
2616 @param SystemTable The system table.
2618 @retval EFI_SUCCESS Successfully initialized firmware volume block
2624 FwVolBlockDriverInit (
2625 IN EFI_HANDLE ImageHandle
,
2626 IN EFI_SYSTEM_TABLE
*SystemTable
2631 Get FVB authentication status
2633 @param FvbProtocol FVB protocol.
2635 @return Authentication status.
2639 GetFvbAuthenticationStatus (
2640 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*FvbProtocol
2644 This routine produces a firmware volume block protocol on a given
2647 @param BaseAddress base address of the firmware volume image
2648 @param Length length of the firmware volume image
2649 @param ParentHandle handle of parent firmware volume, if this image
2650 came from an FV image file and section in another firmware
2651 volume (ala capsules)
2652 @param AuthenticationStatus Authentication status inherited, if this image
2653 came from an FV image file and section in another firmware volume.
2654 @param FvProtocol Firmware volume block protocol produced.
2656 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2657 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2658 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2663 ProduceFVBProtocolOnBuffer (
2664 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
2666 IN EFI_HANDLE ParentHandle
,
2667 IN UINT32 AuthenticationStatus
,
2668 OUT EFI_HANDLE
*FvProtocol OPTIONAL
2673 Raising to the task priority level of the mutual exclusion
2674 lock, and then acquires ownership of the lock.
2676 @param Lock The lock to acquire
2688 Initialize a basic mutual exclusion lock. Each lock
2689 provides mutual exclusion access at it's task priority
2690 level. Since there is no-premption (at any TPL) or
2691 multiprocessor support, acquiring the lock only consists
2692 of raising to the locks TPL.
2694 @param Lock The EFI_LOCK structure to initialize
2696 @retval EFI_SUCCESS Lock Owned.
2697 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2701 CoreAcquireLockOrFail (
2707 Releases ownership of the mutual exclusion lock, and
2708 restores the previous task priority level.
2710 @param Lock The lock to release
2712 @return Lock unowned
2722 An empty function to pass error checking of CreateEventEx ().
2724 @param Event Event whose notification function is being invoked.
2725 @param Context Pointer to the notification function's context,
2726 which is implementation-dependent.
2731 CoreEmptyCallbackFunction (
2737 Read data from Firmware Block by FVB protocol Read.
2738 The data may cross the multi block ranges.
2740 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.
2741 @param StartLba Pointer to StartLba.
2742 On input, the start logical block index from which to read.
2743 On output,the end logical block index after reading.
2744 @param Offset Pointer to Offset
2745 On input, offset into the block at which to begin reading.
2746 On output, offset into the end block after reading.
2747 @param DataSize Size of data to be read.
2748 @param Data Pointer to Buffer that the data will be read into.
2750 @retval EFI_SUCCESS Successfully read data from firmware block.
2755 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2756 IN OUT EFI_LBA
*StartLba
,
2757 IN OUT UINTN
*Offset
,
2763 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and
2764 copy the real length volume header into it.
2766 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to
2767 read the volume header
2768 @param FwVolHeader Pointer to pointer to allocated buffer in which
2769 the volume header is returned.
2771 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.
2772 @retval EFI_SUCCESS Successfully read volume header to the allocated
2774 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or
2775 the file system could not be understood.
2780 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
*Fvb
,
2781 OUT EFI_FIRMWARE_VOLUME_HEADER
**FwVolHeader
2785 Verify checksum of the firmware volume header.
2787 @param FvHeader Points to the firmware volume header to be checked
2789 @retval TRUE Checksum verification passed
2790 @retval FALSE Checksum verification failed
2794 VerifyFvHeaderChecksum (
2795 IN EFI_FIRMWARE_VOLUME_HEADER
*FvHeader
2799 Initialize memory profile.
2801 @param HobStart The start address of the HOB.
2810 Install memory profile protocol.
2814 MemoryProfileInstallProtocol (
2819 Register image to memory profile.
2821 @param DriverEntry Image info.
2822 @param FileType Image file type.
2824 @retval TRUE Register success.
2825 @retval FALSE Register fail.
2829 RegisterMemoryProfileImage (
2830 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
,
2831 IN EFI_FV_FILETYPE FileType
2835 Unregister image from memory profile.
2837 @param DriverEntry Image info.
2839 @retval TRUE Unregister success.
2840 @retval FALSE Unregister fail.
2844 UnregisterMemoryProfileImage (
2845 IN LOADED_IMAGE_PRIVATE_DATA
*DriverEntry
2849 Update memory profile information.
2851 @param CallerAddress Address of caller who call Allocate or Free.
2852 @param Action This Allocate or Free action.
2853 @param MemoryType Memory type.
2854 @param Size Buffer size.
2855 @param Buffer Buffer address.
2857 @retval TRUE Profile udpate success.
2858 @retval FALSE Profile update fail.
2863 IN EFI_PHYSICAL_ADDRESS CallerAddress
,
2864 IN MEMORY_PROFILE_ACTION Action
,
2865 IN EFI_MEMORY_TYPE MemoryType
, // Valid for AllocatePages/AllocatePool
2866 IN UINTN Size
, // Valid for AllocatePages/FreePages/AllocatePool
2871 Internal function. Converts a memory range to use new attributes.
2873 @param Start The first address of the range Must be page
2875 @param NumberOfPages The number of pages to convert
2876 @param NewAttributes The new attributes value for the range.
2880 CoreUpdateMemoryAttributes (
2881 IN EFI_PHYSICAL_ADDRESS Start
,
2882 IN UINT64 NumberOfPages
,
2883 IN UINT64 NewAttributes
2887 Initialize PropertiesTable support.
2891 CoreInitializePropertiesTable (
2896 Insert image record.
2898 @param RuntimeImage Runtime image information
2902 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage
2906 Remove Image record.
2908 @param RuntimeImage Runtime image information
2912 IN EFI_RUNTIME_IMAGE_ENTRY
*RuntimeImage