]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/DxeMain.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / DxeMain.h
CommitLineData
162ed594 1/** @file\r
504214c4
LG
2 The internal header file includes the common header files, defines\r
3 internal structure and functions used by DxeCore module.\r
23c98c94 4\r
d1102dba 5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
28a00297 7\r
797a9d67 8**/\r
28a00297 9\r
10#ifndef _DXE_MAIN_H_\r
11#define _DXE_MAIN_H_\r
12\r
28a00297 13#include <PiDxe.h>\r
ed7748fe 14\r
28a00297 15#include <Protocol/LoadedImage.h>\r
16#include <Protocol/GuidedSectionExtraction.h>\r
28a00297 17#include <Protocol/DevicePath.h>\r
18#include <Protocol/Runtime.h>\r
19#include <Protocol/LoadFile.h>\r
0a9fe763 20#include <Protocol/LoadFile2.h>\r
28a00297 21#include <Protocol/DriverBinding.h>\r
22#include <Protocol/VariableWrite.h>\r
23#include <Protocol/PlatformDriverOverride.h>\r
24#include <Protocol/Variable.h>\r
28a00297 25#include <Protocol/Timer.h>\r
26#include <Protocol/SimpleFileSystem.h>\r
27#include <Protocol/Bds.h>\r
28a00297 28#include <Protocol/RealTimeClock.h>\r
28a00297 29#include <Protocol/WatchdogTimer.h>\r
0c2b5da8 30#include <Protocol/FirmwareVolume2.h>\r
28a00297 31#include <Protocol/MonotonicCounter.h>\r
28a00297 32#include <Protocol/StatusCode.h>\r
28a00297 33#include <Protocol/Decompress.h>\r
023c0fec 34#include <Protocol/LoadPe32Image.h>\r
28a00297 35#include <Protocol/Security.h>\r
bc2dfdbc 36#include <Protocol/Security2.h>\r
28a00297 37#include <Protocol/Reset.h>\r
28a00297 38#include <Protocol/Cpu.h>\r
28a00297 39#include <Protocol/Metronome.h>\r
40#include <Protocol/FirmwareVolumeBlock.h>\r
41#include <Protocol/Capsule.h>\r
42#include <Protocol/BusSpecificDriverOverride.h>\r
396e9039 43#include <Protocol/DriverFamilyOverride.h>\r
022c6d45 44#include <Protocol/TcgService.h>\r
7547649f 45#include <Protocol/HiiPackageList.h>\r
0803854b 46#include <Protocol/SmmBase2.h>\r
57df17fe 47#include <Protocol/PeCoffImageEmulator.h>\r
022c6d45 48#include <Guid/MemoryTypeInformation.h>\r
49#include <Guid/FirmwareFileSystem2.h>\r
6c85d162 50#include <Guid/FirmwareFileSystem3.h>\r
022c6d45 51#include <Guid/HobList.h>\r
52#include <Guid/DebugImageInfoTable.h>\r
53#include <Guid/FileInfo.h>\r
54#include <Guid/Apriori.h>\r
55#include <Guid/DxeServices.h>\r
56#include <Guid/MemoryAllocationHob.h>\r
57#include <Guid/EventLegacyBios.h>\r
58#include <Guid/EventGroup.h>\r
044824d9 59#include <Guid/EventExitBootServiceFailed.h>\r
54ea99a7 60#include <Guid/LoadModuleAtFixedAddress.h>\r
54cd17e9 61#include <Guid/IdleLoopEvent.h>\r
57f360f2
JF
62#include <Guid/VectorHandoffTable.h>\r
63#include <Ppi/VectorHandoffInfo.h>\r
84edd20b 64#include <Guid/MemoryProfile.h>\r
ed7748fe 65\r
28a00297 66#include <Library/DxeCoreEntryPoint.h>\r
67#include <Library/DebugLib.h>\r
68#include <Library/UefiLib.h>\r
69#include <Library/BaseLib.h>\r
70#include <Library/HobLib.h>\r
71#include <Library/PerformanceLib.h>\r
72#include <Library/UefiDecompressLib.h>\r
18fd8d65 73#include <Library/ExtractGuidedSectionLib.h>\r
28a00297 74#include <Library/CacheMaintenanceLib.h>\r
75#include <Library/BaseMemoryLib.h>\r
3d7b0992 76#include <Library/PeCoffLib.h>\r
b43619d0 77#include <Library/PeCoffGetEntryPointLib.h>\r
78#include <Library/PeCoffExtraActionLib.h>\r
797a9d67 79#include <Library/PcdLib.h>\r
c4869732 80#include <Library/MemoryAllocationLib.h>\r
070f0cf7 81#include <Library/DevicePathLib.h>\r
0e9b156d 82#include <Library/UefiBootServicesTableLib.h>\r
2680a308 83#include <Library/ReportStatusCodeLib.h>\r
7748df3d 84#include <Library/DxeServicesLib.h>\r
e7af83ae 85#include <Library/DebugAgentLib.h>\r
1e172d6b 86#include <Library/CpuExceptionHandlerLib.h>\r
28a00297 87\r
28a00297 88//\r
89// attributes for reserved memory before it is promoted to system memory\r
90//\r
91#define EFI_MEMORY_PRESENT 0x0100000000000000ULL\r
92#define EFI_MEMORY_INITIALIZED 0x0200000000000000ULL\r
93#define EFI_MEMORY_TESTED 0x0400000000000000ULL\r
94\r
95//\r
96// range for memory mapped port I/O on IPF\r
97//\r
98#define EFI_MEMORY_PORT_IO 0x4000000000000000ULL\r
99\r
28a00297 100///\r
6393d9c8
GL
101/// EFI_DEP_REPLACE_TRUE - Used to dynamically patch the dependency expression\r
102/// to save time. A EFI_DEP_PUSH is evaluated one an\r
7f932291 103/// replaced with EFI_DEP_REPLACE_TRUE. If PI spec's Vol 2\r
104/// Driver Execution Environment Core Interface use 0xff\r
105/// as new DEPEX opcode. EFI_DEP_REPLACE_TRUE should be\r
106/// defined to a new value that is not conflicting with PI spec.\r
28a00297 107///\r
108#define EFI_DEP_REPLACE_TRUE 0xff\r
109\r
110///\r
111/// Define the initial size of the dependency expression evaluation stack\r
112///\r
113#define DEPEX_STACK_SIZE_INCREMENT 0x1000\r
114\r
115typedef struct {\r
1436aea4
MK
116 EFI_GUID *ProtocolGuid;\r
117 VOID **Protocol;\r
118 EFI_EVENT Event;\r
119 VOID *Registration;\r
120 BOOLEAN Present;\r
74e44290 121} EFI_CORE_PROTOCOL_NOTIFY_ENTRY;\r
28a00297 122\r
28a00297 123//\r
124// DXE Dispatcher Data structures\r
125//\r
126\r
f3f2e05d 127#define KNOWN_HANDLE_SIGNATURE SIGNATURE_32('k','n','o','w')\r
28a00297 128typedef struct {\r
1436aea4
MK
129 UINTN Signature;\r
130 LIST_ENTRY Link; // mFvHandleList\r
131 EFI_HANDLE Handle;\r
132 EFI_GUID FvNameGuid;\r
28a00297 133} KNOWN_HANDLE;\r
134\r
1436aea4 135#define EFI_CORE_DRIVER_ENTRY_SIGNATURE SIGNATURE_32('d','r','v','r')\r
28a00297 136typedef struct {\r
1436aea4
MK
137 UINTN Signature;\r
138 LIST_ENTRY Link; // mDriverList\r
28a00297 139\r
1436aea4 140 LIST_ENTRY ScheduledLink; // mScheduledQueue\r
28a00297 141\r
1436aea4
MK
142 EFI_HANDLE FvHandle;\r
143 EFI_GUID FileName;\r
144 EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;\r
145 EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;\r
28a00297 146\r
1436aea4
MK
147 VOID *Depex;\r
148 UINTN DepexSize;\r
28a00297 149\r
1436aea4
MK
150 BOOLEAN Before;\r
151 BOOLEAN After;\r
152 EFI_GUID BeforeAfterGuid;\r
28a00297 153\r
1436aea4
MK
154 BOOLEAN Dependent;\r
155 BOOLEAN Unrequested;\r
156 BOOLEAN Scheduled;\r
157 BOOLEAN Untrusted;\r
158 BOOLEAN Initialized;\r
159 BOOLEAN DepexProtocolError;\r
28a00297 160\r
1436aea4
MK
161 EFI_HANDLE ImageHandle;\r
162 BOOLEAN IsFvImage;\r
28a00297 163} EFI_CORE_DRIVER_ENTRY;\r
164\r
165//\r
1436aea4 166// The data structure of GCD memory map entry\r
28a00297 167//\r
f3f2e05d 168#define EFI_GCD_MAP_SIGNATURE SIGNATURE_32('g','c','d','m')\r
28a00297 169typedef struct {\r
1436aea4
MK
170 UINTN Signature;\r
171 LIST_ENTRY Link;\r
172 EFI_PHYSICAL_ADDRESS BaseAddress;\r
173 UINT64 EndAddress;\r
174 UINT64 Capabilities;\r
175 UINT64 Attributes;\r
176 EFI_GCD_MEMORY_TYPE GcdMemoryType;\r
177 EFI_GCD_IO_TYPE GcdIoType;\r
178 EFI_HANDLE ImageHandle;\r
179 EFI_HANDLE DeviceHandle;\r
28a00297 180} EFI_GCD_MAP_ENTRY;\r
181\r
1436aea4 182#define LOADED_IMAGE_PRIVATE_DATA_SIGNATURE SIGNATURE_32('l','d','r','i')\r
84edd20b
SZ
183\r
184typedef struct {\r
1436aea4 185 UINTN Signature;\r
84edd20b 186 /// Image handle\r
1436aea4 187 EFI_HANDLE Handle;\r
84edd20b 188 /// Image type\r
1436aea4 189 UINTN Type;\r
84edd20b 190 /// If entrypoint has been called\r
1436aea4 191 BOOLEAN Started;\r
84edd20b 192 /// The image's entry point\r
1436aea4 193 EFI_IMAGE_ENTRY_POINT EntryPoint;\r
84edd20b 194 /// loaded image protocol\r
1436aea4 195 EFI_LOADED_IMAGE_PROTOCOL Info;\r
84edd20b 196 /// Location in memory\r
1436aea4 197 EFI_PHYSICAL_ADDRESS ImageBasePage;\r
84edd20b 198 /// Number of pages\r
1436aea4 199 UINTN NumberOfPages;\r
84edd20b 200 /// Original fixup data\r
1436aea4 201 CHAR8 *FixupData;\r
84edd20b 202 /// Tpl of started image\r
1436aea4 203 EFI_TPL Tpl;\r
84edd20b 204 /// Status returned by started image\r
1436aea4 205 EFI_STATUS Status;\r
84edd20b 206 /// Size of ExitData from started image\r
1436aea4 207 UINTN ExitDataSize;\r
84edd20b 208 /// Pointer to exit data from started image\r
1436aea4 209 VOID *ExitData;\r
6393d9c8 210 /// Pointer to pool allocation for context save/restore\r
1436aea4 211 VOID *JumpBuffer;\r
6393d9c8 212 /// Pointer to buffer for context save/restore\r
1436aea4 213 BASE_LIBRARY_JUMP_BUFFER *JumpContext;\r
84edd20b 214 /// Machine type from PE image\r
1436aea4 215 UINT16 Machine;\r
57df17fe 216 /// PE/COFF Image Emulator Protocol pointer\r
1436aea4 217 EDKII_PECOFF_IMAGE_EMULATOR_PROTOCOL *PeCoffEmu;\r
84edd20b 218 /// Runtime image list\r
1436aea4 219 EFI_RUNTIME_IMAGE_ENTRY *RuntimeData;\r
6393d9c8 220 /// Pointer to Loaded Image Device Path Protocol\r
1436aea4 221 EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;\r
84edd20b 222 /// PeCoffLoader ImageContext\r
1436aea4 223 PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;\r
84edd20b 224 /// Status returned by LoadImage() service.\r
1436aea4 225 EFI_STATUS LoadImageStatus;\r
84edd20b
SZ
226} LOADED_IMAGE_PRIVATE_DATA;\r
227\r
228#define LOADED_IMAGE_PRIVATE_DATA_FROM_THIS(a) \\r
229 CR(a, LOADED_IMAGE_PRIVATE_DATA, Info, LOADED_IMAGE_PRIVATE_DATA_SIGNATURE)\r
230\r
1436aea4 231#define IMAGE_PROPERTIES_RECORD_CODE_SECTION_SIGNATURE SIGNATURE_32 ('I','P','R','C')\r
d0e92aad
JY
232\r
233typedef struct {\r
1436aea4
MK
234 UINT32 Signature;\r
235 LIST_ENTRY Link;\r
236 EFI_PHYSICAL_ADDRESS CodeSegmentBase;\r
237 UINT64 CodeSegmentSize;\r
d0e92aad
JY
238} IMAGE_PROPERTIES_RECORD_CODE_SECTION;\r
239\r
1436aea4 240#define IMAGE_PROPERTIES_RECORD_SIGNATURE SIGNATURE_32 ('I','P','R','D')\r
d0e92aad
JY
241\r
242typedef struct {\r
1436aea4
MK
243 UINT32 Signature;\r
244 LIST_ENTRY Link;\r
245 EFI_PHYSICAL_ADDRESS ImageBase;\r
246 UINT64 ImageSize;\r
247 UINTN CodeSegmentCount;\r
248 LIST_ENTRY CodeSegmentList;\r
d0e92aad
JY
249} IMAGE_PROPERTIES_RECORD;\r
250\r
28a00297 251//\r
252// DXE Core Global Variables\r
253//\r
1436aea4
MK
254extern EFI_SYSTEM_TABLE *gDxeCoreST;\r
255extern EFI_RUNTIME_SERVICES *gDxeCoreRT;\r
256extern EFI_DXE_SERVICES *gDxeCoreDS;\r
257extern EFI_HANDLE gDxeCoreImageHandle;\r
28a00297 258\r
1436aea4 259extern BOOLEAN gMemoryMapTerminated;\r
74a88770 260\r
1436aea4 261extern EFI_DECOMPRESS_PROTOCOL gEfiDecompress;\r
28a00297 262\r
1436aea4
MK
263extern EFI_RUNTIME_ARCH_PROTOCOL *gRuntime;\r
264extern EFI_CPU_ARCH_PROTOCOL *gCpu;\r
265extern EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer;\r
266extern EFI_METRONOME_ARCH_PROTOCOL *gMetronome;\r
267extern EFI_TIMER_ARCH_PROTOCOL *gTimer;\r
268extern EFI_SECURITY_ARCH_PROTOCOL *gSecurity;\r
269extern EFI_SECURITY2_ARCH_PROTOCOL *gSecurity2;\r
270extern EFI_BDS_ARCH_PROTOCOL *gBds;\r
271extern EFI_SMM_BASE2_PROTOCOL *gSmmBase2;\r
28a00297 272\r
1436aea4 273extern EFI_TPL gEfiCurrentTpl;\r
28a00297 274\r
1436aea4
MK
275extern EFI_GUID *gDxeCoreFileName;\r
276extern EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;\r
28a00297 277\r
1436aea4 278extern EFI_MEMORY_TYPE_INFORMATION gMemoryTypeInformation[EfiMaxMemoryType + 1];\r
28a00297 279\r
1436aea4
MK
280extern BOOLEAN gDispatcherRunning;\r
281extern EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate;\r
28a00297 282\r
1436aea4
MK
283extern EFI_LOAD_FIXED_ADDRESS_CONFIGURATION_TABLE gLoadModuleAtFixAddressConfigurationTable;\r
284extern BOOLEAN gLoadFixedAddressCodeMemoryReady;\r
28a00297 285//\r
286// Service Initialization Functions\r
287//\r
288\r
162ed594 289/**\r
290 Called to initialize the pool.\r
291\r
292**/\r
28a00297 293VOID\r
294CoreInitializePool (\r
295 VOID\r
23c98c94 296 );\r
28a00297 297\r
162ed594 298/**\r
299 Called to initialize the memory map and add descriptors to\r
300 the current descriptor list.\r
301 The first descriptor that is added must be general usable\r
302 memory as the addition allocates heap.\r
28a00297 303\r
022c6d45 304 @param Type The type of memory to add\r
305 @param Start The starting address in the memory range Must be\r
306 page aligned\r
307 @param NumberOfPages The number of pages in the range\r
308 @param Attribute Attributes of the memory to add\r
28a00297 309\r
162ed594 310 @return None. The range is added to the memory map\r
28a00297 311\r
162ed594 312**/\r
28a00297 313VOID\r
314CoreAddMemoryDescriptor (\r
315 IN EFI_MEMORY_TYPE Type,\r
316 IN EFI_PHYSICAL_ADDRESS Start,\r
317 IN UINT64 NumberOfPages,\r
318 IN UINT64 Attribute\r
23c98c94 319 );\r
28a00297 320\r
162ed594 321/**\r
322 Release memory lock on mGcdMemorySpaceLock.\r
28a00297 323\r
162ed594 324**/\r
28a00297 325VOID\r
326CoreReleaseGcdMemoryLock (\r
327 VOID\r
23c98c94 328 );\r
28a00297 329\r
162ed594 330/**\r
331 Acquire memory lock on mGcdMemorySpaceLock.\r
28a00297 332\r
162ed594 333**/\r
28a00297 334VOID\r
335CoreAcquireGcdMemoryLock (\r
336 VOID\r
23c98c94 337 );\r
28a00297 338\r
162ed594 339/**\r
c18f12d3 340 External function. Initializes memory services based on the memory\r
341 descriptor HOBs. This function is responsible for priming the memory\r
342 map, so memory allocations and resource allocations can be made.\r
343 The first part of this function can not depend on any memory services\r
344 until at least one memory descriptor is provided to the memory services.\r
28a00297 345\r
022c6d45 346 @param HobStart The start address of the HOB.\r
347 @param MemoryBaseAddress Start address of memory region found to init DXE\r
348 core.\r
349 @param MemoryLength Length of memory region found to init DXE core.\r
28a00297 350\r
162ed594 351 @retval EFI_SUCCESS Memory services successfully initialized.\r
28a00297 352\r
162ed594 353**/\r
28a00297 354EFI_STATUS\r
355CoreInitializeMemoryServices (\r
23c98c94 356 IN VOID **HobStart,\r
357 OUT EFI_PHYSICAL_ADDRESS *MemoryBaseAddress,\r
358 OUT UINT64 *MemoryLength\r
359 );\r
162ed594 360\r
162ed594 361/**\r
362 External function. Initializes the GCD and memory services based on the memory\r
28a00297 363 descriptor HOBs. This function is responsible for priming the GCD map and the\r
c18f12d3 364 memory map, so memory allocations and resource allocations can be made. The\r
365 HobStart will be relocated to a pool buffer.\r
28a00297 366\r
022c6d45 367 @param HobStart The start address of the HOB\r
368 @param MemoryBaseAddress Start address of memory region found to init DXE\r
369 core.\r
370 @param MemoryLength Length of memory region found to init DXE core.\r
28a00297 371\r
162ed594 372 @retval EFI_SUCCESS GCD services successfully initialized.\r
28a00297 373\r
162ed594 374**/\r
28a00297 375EFI_STATUS\r
376CoreInitializeGcdServices (\r
022c6d45 377 IN OUT VOID **HobStart,\r
28a00297 378 IN EFI_PHYSICAL_ADDRESS MemoryBaseAddress,\r
379 IN UINT64 MemoryLength\r
23c98c94 380 );\r
28a00297 381\r
162ed594 382/**\r
1947c70c 383 Initializes "event" support.\r
28a00297 384\r
162ed594 385 @retval EFI_SUCCESS Always return success\r
28a00297 386\r
162ed594 387**/\r
28a00297 388EFI_STATUS\r
389CoreInitializeEventServices (\r
390 VOID\r
23c98c94 391 );\r
28a00297 392\r
162ed594 393/**\r
394 Add the Image Services to EFI Boot Services Table and install the protocol\r
395 interfaces for this image.\r
28a00297 396\r
022c6d45 397 @param HobStart The HOB to initialize\r
28a00297 398\r
162ed594 399 @return Status code.\r
28a00297 400\r
162ed594 401**/\r
28a00297 402EFI_STATUS\r
403CoreInitializeImageServices (\r
1436aea4 404 IN VOID *HobStart\r
23c98c94 405 );\r
28a00297 406\r
162ed594 407/**\r
408 Creates an event that is fired everytime a Protocol of a specific type is installed.\r
28a00297 409\r
162ed594 410**/\r
28a00297 411VOID\r
74e44290 412CoreNotifyOnProtocolInstallation (\r
28a00297 413 VOID\r
23c98c94 414 );\r
28a00297 415\r
162ed594 416/**\r
6393d9c8 417 Return TRUE if all AP services are available.\r
28a00297 418\r
022c6d45 419 @retval EFI_SUCCESS All AP services are available\r
162ed594 420 @retval EFI_NOT_FOUND At least one AP service is not available\r
28a00297 421\r
162ed594 422**/\r
28a00297 423EFI_STATUS\r
424CoreAllEfiServicesAvailable (\r
425 VOID\r
23c98c94 426 );\r
28a00297 427\r
162ed594 428/**\r
429 Calcualte the 32-bit CRC in a EFI table using the service provided by the\r
430 gRuntime service.\r
28a00297 431\r
162ed594 432 @param Hdr Pointer to an EFI standard header\r
28a00297 433\r
162ed594 434**/\r
28a00297 435VOID\r
436CalculateEfiHdrCrc (\r
1436aea4 437 IN OUT EFI_TABLE_HEADER *Hdr\r
23c98c94 438 );\r
28a00297 439\r
162ed594 440/**\r
441 Called by the platform code to process a tick.\r
28a00297 442\r
6393d9c8 443 @param Duration The number of 100ns elapsed since the last call\r
162ed594 444 to TimerTick\r
28a00297 445\r
162ed594 446**/\r
28a00297 447VOID\r
448EFIAPI\r
449CoreTimerTick (\r
1436aea4 450 IN UINT64 Duration\r
23c98c94 451 );\r
28a00297 452\r
162ed594 453/**\r
454 Initialize the dispatcher. Initialize the notification function that runs when\r
022c6d45 455 an FV2 protocol is added to the system.\r
28a00297 456\r
162ed594 457**/\r
28a00297 458VOID\r
459CoreInitializeDispatcher (\r
460 VOID\r
23c98c94 461 );\r
28a00297 462\r
162ed594 463/**\r
464 This is the POSTFIX version of the dependency evaluator. This code does\r
465 not need to handle Before or After, as it is not valid to call this\r
466 routine in this case. The SOR is just ignored and is a nop in the grammer.\r
467 POSTFIX means all the math is done on top of the stack.\r
28a00297 468\r
022c6d45 469 @param DriverEntry DriverEntry element to update.\r
28a00297 470\r
022c6d45 471 @retval TRUE If driver is ready to run.\r
472 @retval FALSE If driver is not ready to run or some fatal error\r
162ed594 473 was found.\r
28a00297 474\r
162ed594 475**/\r
28a00297 476BOOLEAN\r
477CoreIsSchedulable (\r
1436aea4 478 IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r
23c98c94 479 );\r
28a00297 480\r
162ed594 481/**\r
482 Preprocess dependency expression and update DriverEntry to reflect the\r
483 state of Before, After, and SOR dependencies. If DriverEntry->Before\r
484 or DriverEntry->After is set it will never be cleared. If SOR is set\r
485 it will be cleared by CoreSchedule(), and then the driver can be\r
486 dispatched.\r
28a00297 487\r
022c6d45 488 @param DriverEntry DriverEntry element to update .\r
28a00297 489\r
162ed594 490 @retval EFI_SUCCESS It always works.\r
28a00297 491\r
162ed594 492**/\r
28a00297 493EFI_STATUS\r
494CorePreProcessDepex (\r
1436aea4 495 IN EFI_CORE_DRIVER_ENTRY *DriverEntry\r
23c98c94 496 );\r
28a00297 497\r
162ed594 498/**\r
499 Terminates all boot services.\r
28a00297 500\r
022c6d45 501 @param ImageHandle Handle that identifies the exiting image.\r
162ed594 502 @param MapKey Key to the latest memory map.\r
28a00297 503\r
022c6d45 504 @retval EFI_SUCCESS Boot Services terminated\r
162ed594 505 @retval EFI_INVALID_PARAMETER MapKey is incorrect.\r
28a00297 506\r
162ed594 507**/\r
28a00297 508EFI_STATUS\r
509EFIAPI\r
510CoreExitBootServices (\r
1436aea4
MK
511 IN EFI_HANDLE ImageHandle,\r
512 IN UINTN MapKey\r
23c98c94 513 );\r
28a00297 514\r
162ed594 515/**\r
516 Make sure the memory map is following all the construction rules,\r
517 it is the last time to check memory map error before exit boot services.\r
28a00297 518\r
022c6d45 519 @param MapKey Memory map key\r
28a00297 520\r
022c6d45 521 @retval EFI_INVALID_PARAMETER Memory map not consistent with construction\r
522 rules.\r
162ed594 523 @retval EFI_SUCCESS Valid memory map.\r
28a00297 524\r
162ed594 525**/\r
28a00297 526EFI_STATUS\r
527CoreTerminateMemoryMap (\r
1436aea4 528 IN UINTN MapKey\r
23c98c94 529 );\r
28a00297 530\r
162ed594 531/**\r
532 Signals all events in the EventGroup.\r
28a00297 533\r
162ed594 534 @param EventGroup The list to signal\r
28a00297 535\r
162ed594 536**/\r
28a00297 537VOID\r
538CoreNotifySignalList (\r
1436aea4 539 IN EFI_GUID *EventGroup\r
23c98c94 540 );\r
28a00297 541\r
162ed594 542/**\r
543 Boot Service called to add, modify, or remove a system configuration table from\r
544 the EFI System Table.\r
28a00297 545\r
022c6d45 546 @param Guid Pointer to the GUID for the entry to add, update, or\r
547 remove\r
548 @param Table Pointer to the configuration table for the entry to add,\r
549 update, or remove, may be NULL.\r
28a00297 550\r
162ed594 551 @return EFI_SUCCESS Guid, Table pair added, updated, or removed.\r
552 @return EFI_INVALID_PARAMETER Input GUID not valid.\r
553 @return EFI_NOT_FOUND Attempted to delete non-existant entry\r
554 @return EFI_OUT_OF_RESOURCES Not enough memory available\r
28a00297 555\r
162ed594 556**/\r
28a00297 557EFI_STATUS\r
558EFIAPI\r
559CoreInstallConfigurationTable (\r
1436aea4
MK
560 IN EFI_GUID *Guid,\r
561 IN VOID *Table\r
23c98c94 562 );\r
28a00297 563\r
162ed594 564/**\r
565 Raise the task priority level to the new level.\r
566 High level is implemented by disabling processor interrupts.\r
28a00297 567\r
022c6d45 568 @param NewTpl New task priority level\r
28a00297 569\r
162ed594 570 @return The previous task priority level\r
28a00297 571\r
162ed594 572**/\r
28a00297 573EFI_TPL\r
574EFIAPI\r
575CoreRaiseTpl (\r
1436aea4 576 IN EFI_TPL NewTpl\r
23c98c94 577 );\r
28a00297 578\r
162ed594 579/**\r
580 Lowers the task priority to the previous value. If the new\r
581 priority unmasks events at a higher priority, they are dispatched.\r
28a00297 582\r
162ed594 583 @param NewTpl New, lower, task priority\r
28a00297 584\r
162ed594 585**/\r
28a00297 586VOID\r
587EFIAPI\r
588CoreRestoreTpl (\r
1436aea4 589 IN EFI_TPL NewTpl\r
23c98c94 590 );\r
28a00297 591\r
162ed594 592/**\r
593 Introduces a fine-grained stall.\r
28a00297 594\r
162ed594 595 @param Microseconds The number of microseconds to stall execution.\r
28a00297 596\r
022c6d45 597 @retval EFI_SUCCESS Execution was stalled for at least the requested\r
598 amount of microseconds.\r
162ed594 599 @retval EFI_NOT_AVAILABLE_YET gMetronome is not available yet\r
28a00297 600\r
162ed594 601**/\r
28a00297 602EFI_STATUS\r
603EFIAPI\r
604CoreStall (\r
1436aea4 605 IN UINTN Microseconds\r
23c98c94 606 );\r
28a00297 607\r
162ed594 608/**\r
609 Sets the system's watchdog timer.\r
28a00297 610\r
162ed594 611 @param Timeout The number of seconds to set the watchdog timer to.\r
612 A value of zero disables the timer.\r
613 @param WatchdogCode The numeric code to log on a watchdog timer timeout\r
614 event. The firmware reserves codes 0x0000 to 0xFFFF.\r
615 Loaders and operating systems may use other timeout\r
616 codes.\r
617 @param DataSize The size, in bytes, of WatchdogData.\r
618 @param WatchdogData A data buffer that includes a Null-terminated Unicode\r
619 string, optionally followed by additional binary data.\r
620 The string is a description that the call may use to\r
621 further indicate the reason to be logged with a\r
622 watchdog event.\r
623\r
624 @return EFI_SUCCESS Timeout has been set\r
625 @return EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet\r
626 @return EFI_UNSUPPORTED System does not have a timer (currently not used)\r
627 @return EFI_DEVICE_ERROR Could not complete due to hardware error\r
28a00297 628\r
162ed594 629**/\r
28a00297 630EFI_STATUS\r
631EFIAPI\r
632CoreSetWatchdogTimer (\r
1436aea4
MK
633 IN UINTN Timeout,\r
634 IN UINT64 WatchdogCode,\r
635 IN UINTN DataSize,\r
636 IN CHAR16 *WatchdogData OPTIONAL\r
23c98c94 637 );\r
28a00297 638\r
162ed594 639/**\r
640 Wrapper function to CoreInstallProtocolInterfaceNotify. This is the public API which\r
641 Calls the private one which contains a BOOLEAN parameter for notifications\r
28a00297 642\r
022c6d45 643 @param UserHandle The handle to install the protocol handler on,\r
644 or NULL if a new handle is to be allocated\r
645 @param Protocol The protocol to add to the handle\r
646 @param InterfaceType Indicates whether Interface is supplied in\r
647 native form.\r
648 @param Interface The interface for the protocol being added\r
28a00297 649\r
162ed594 650 @return Status code\r
28a00297 651\r
162ed594 652**/\r
28a00297 653EFI_STATUS\r
654EFIAPI\r
655CoreInstallProtocolInterface (\r
1436aea4
MK
656 IN OUT EFI_HANDLE *UserHandle,\r
657 IN EFI_GUID *Protocol,\r
658 IN EFI_INTERFACE_TYPE InterfaceType,\r
659 IN VOID *Interface\r
23c98c94 660 );\r
28a00297 661\r
162ed594 662/**\r
663 Installs a protocol interface into the boot services environment.\r
28a00297 664\r
022c6d45 665 @param UserHandle The handle to install the protocol handler on,\r
666 or NULL if a new handle is to be allocated\r
667 @param Protocol The protocol to add to the handle\r
668 @param InterfaceType Indicates whether Interface is supplied in\r
669 native form.\r
670 @param Interface The interface for the protocol being added\r
671 @param Notify indicates whether notify the notification list\r
672 for this protocol\r
28a00297 673\r
022c6d45 674 @retval EFI_INVALID_PARAMETER Invalid parameter\r
675 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 676 @retval EFI_SUCCESS Protocol interface successfully installed\r
28a00297 677\r
162ed594 678**/\r
28a00297 679EFI_STATUS\r
680CoreInstallProtocolInterfaceNotify (\r
1436aea4
MK
681 IN OUT EFI_HANDLE *UserHandle,\r
682 IN EFI_GUID *Protocol,\r
683 IN EFI_INTERFACE_TYPE InterfaceType,\r
684 IN VOID *Interface,\r
685 IN BOOLEAN Notify\r
23c98c94 686 );\r
28a00297 687\r
162ed594 688/**\r
689 Installs a list of protocol interface into the boot services environment.\r
690 This function calls InstallProtocolInterface() in a loop. If any error\r
691 occures all the protocols added by this function are removed. This is\r
692 basically a lib function to save space.\r
28a00297 693\r
022c6d45 694 @param Handle The handle to install the protocol handlers on,\r
695 or NULL if a new handle is to be allocated\r
696 @param ... EFI_GUID followed by protocol instance. A NULL\r
697 terminates the list. The pairs are the\r
698 arguments to InstallProtocolInterface(). All the\r
699 protocols are added to Handle.\r
28a00297 700\r
5a7b9bbe
SQ
701 @retval EFI_SUCCESS All the protocol interface was installed.\r
702 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
703 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r
704 the handle database.\r
022c6d45 705 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
5a7b9bbe 706 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.\r
28a00297 707\r
162ed594 708**/\r
28a00297 709EFI_STATUS\r
710EFIAPI\r
711CoreInstallMultipleProtocolInterfaces (\r
1436aea4 712 IN OUT EFI_HANDLE *Handle,\r
28a00297 713 ...\r
23c98c94 714 );\r
28a00297 715\r
162ed594 716/**\r
717 Uninstalls a list of protocol interface in the boot services environment.\r
718 This function calls UnisatllProtocolInterface() in a loop. This is\r
719 basically a lib function to save space.\r
28a00297 720\r
022c6d45 721 @param Handle The handle to uninstall the protocol\r
722 @param ... EFI_GUID followed by protocol instance. A NULL\r
723 terminates the list. The pairs are the\r
724 arguments to UninstallProtocolInterface(). All\r
725 the protocols are added to Handle.\r
28a00297 726\r
162ed594 727 @return Status code\r
28a00297 728\r
162ed594 729**/\r
28a00297 730EFI_STATUS\r
731EFIAPI\r
732CoreUninstallMultipleProtocolInterfaces (\r
1436aea4 733 IN EFI_HANDLE Handle,\r
28a00297 734 ...\r
23c98c94 735 );\r
28a00297 736\r
162ed594 737/**\r
738 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.\r
28a00297 739\r
022c6d45 740 @param UserHandle Handle on which the interface is to be\r
741 reinstalled\r
742 @param Protocol The numeric ID of the interface\r
743 @param OldInterface A pointer to the old interface\r
744 @param NewInterface A pointer to the new interface\r
28a00297 745\r
162ed594 746 @retval EFI_SUCCESS The protocol interface was installed\r
747 @retval EFI_NOT_FOUND The OldInterface on the handle was not found\r
748 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
28a00297 749\r
162ed594 750**/\r
28a00297 751EFI_STATUS\r
752EFIAPI\r
753CoreReinstallProtocolInterface (\r
1436aea4
MK
754 IN EFI_HANDLE UserHandle,\r
755 IN EFI_GUID *Protocol,\r
756 IN VOID *OldInterface,\r
757 IN VOID *NewInterface\r
23c98c94 758 );\r
28a00297 759\r
162ed594 760/**\r
761 Uninstalls all instances of a protocol:interfacer from a handle.\r
762 If the last protocol interface is remove from the handle, the\r
763 handle is freed.\r
28a00297 764\r
022c6d45 765 @param UserHandle The handle to remove the protocol handler from\r
766 @param Protocol The protocol, of protocol:interface, to remove\r
767 @param Interface The interface, of protocol:interface, to remove\r
28a00297 768\r
022c6d45 769 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
162ed594 770 @retval EFI_SUCCESS Protocol interface successfully uninstalled.\r
28a00297 771\r
162ed594 772**/\r
28a00297 773EFI_STATUS\r
774EFIAPI\r
775CoreUninstallProtocolInterface (\r
1436aea4
MK
776 IN EFI_HANDLE UserHandle,\r
777 IN EFI_GUID *Protocol,\r
778 IN VOID *Interface\r
23c98c94 779 );\r
28a00297 780\r
162ed594 781/**\r
782 Queries a handle to determine if it supports a specified protocol.\r
28a00297 783\r
022c6d45 784 @param UserHandle The handle being queried.\r
785 @param Protocol The published unique identifier of the protocol.\r
786 @param Interface Supplies the address where a pointer to the\r
787 corresponding Protocol Interface is returned.\r
28a00297 788\r
162ed594 789 @return The requested protocol interface for the handle\r
28a00297 790\r
162ed594 791**/\r
28a00297 792EFI_STATUS\r
793EFIAPI\r
794CoreHandleProtocol (\r
1436aea4
MK
795 IN EFI_HANDLE UserHandle,\r
796 IN EFI_GUID *Protocol,\r
797 OUT VOID **Interface\r
23c98c94 798 );\r
28a00297 799\r
162ed594 800/**\r
801 Locates the installed protocol handler for the handle, and\r
802 invokes it to obtain the protocol interface. Usage information\r
803 is registered in the protocol data base.\r
28a00297 804\r
022c6d45 805 @param UserHandle The handle to obtain the protocol interface on\r
806 @param Protocol The ID of the protocol\r
807 @param Interface The location to return the protocol interface\r
808 @param ImageHandle The handle of the Image that is opening the\r
809 protocol interface specified by Protocol and\r
810 Interface.\r
811 @param ControllerHandle The controller handle that is requiring this\r
812 interface.\r
813 @param Attributes The open mode of the protocol interface\r
814 specified by Handle and Protocol.\r
815\r
816 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
162ed594 817 @retval EFI_SUCCESS Get the protocol interface.\r
28a00297 818\r
162ed594 819**/\r
28a00297 820EFI_STATUS\r
821EFIAPI\r
822CoreOpenProtocol (\r
1436aea4
MK
823 IN EFI_HANDLE UserHandle,\r
824 IN EFI_GUID *Protocol,\r
825 OUT VOID **Interface OPTIONAL,\r
826 IN EFI_HANDLE ImageHandle,\r
827 IN EFI_HANDLE ControllerHandle,\r
828 IN UINT32 Attributes\r
23c98c94 829 );\r
28a00297 830\r
162ed594 831/**\r
832 Return information about Opened protocols in the system\r
28a00297 833\r
022c6d45 834 @param UserHandle The handle to close the protocol interface on\r
835 @param Protocol The ID of the protocol\r
836 @param EntryBuffer A pointer to a buffer of open protocol\r
837 information in the form of\r
838 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.\r
162ed594 839 @param EntryCount Number of EntryBuffer entries\r
28a00297 840\r
162ed594 841**/\r
28a00297 842EFI_STATUS\r
843EFIAPI\r
844CoreOpenProtocolInformation (\r
1436aea4
MK
845 IN EFI_HANDLE UserHandle,\r
846 IN EFI_GUID *Protocol,\r
847 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
848 OUT UINTN *EntryCount\r
23c98c94 849 );\r
28a00297 850\r
162ed594 851/**\r
852 Closes a protocol on a handle that was opened using OpenProtocol().\r
28a00297 853\r
022c6d45 854 @param UserHandle The handle for the protocol interface that was\r
855 previously opened with OpenProtocol(), and is\r
856 now being closed.\r
857 @param Protocol The published unique identifier of the protocol.\r
858 It is the caller's responsibility to pass in a\r
859 valid GUID.\r
860 @param AgentHandle The handle of the agent that is closing the\r
861 protocol interface.\r
862 @param ControllerHandle If the agent that opened a protocol is a driver\r
863 that follows the EFI Driver Model, then this\r
864 parameter is the controller handle that required\r
865 the protocol interface. If the agent does not\r
866 follow the EFI Driver Model, then this parameter\r
867 is optional and may be NULL.\r
868\r
869 @retval EFI_SUCCESS The protocol instance was closed.\r
870 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a\r
871 valid EFI_HANDLE.\r
872 @retval EFI_NOT_FOUND Can not find the specified protocol or\r
162ed594 873 AgentHandle.\r
28a00297 874\r
162ed594 875**/\r
28a00297 876EFI_STATUS\r
877EFIAPI\r
878CoreCloseProtocol (\r
1436aea4
MK
879 IN EFI_HANDLE UserHandle,\r
880 IN EFI_GUID *Protocol,\r
881 IN EFI_HANDLE AgentHandle,\r
882 IN EFI_HANDLE ControllerHandle\r
23c98c94 883 );\r
28a00297 884\r
162ed594 885/**\r
886 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
887 from pool.\r
888\r
022c6d45 889 @param UserHandle The handle from which to retrieve the list of\r
890 protocol interface GUIDs.\r
891 @param ProtocolBuffer A pointer to the list of protocol interface GUID\r
892 pointers that are installed on Handle.\r
893 @param ProtocolBufferCount A pointer to the number of GUID pointers present\r
894 in ProtocolBuffer.\r
895\r
896 @retval EFI_SUCCESS The list of protocol interface GUIDs installed\r
897 on Handle was returned in ProtocolBuffer. The\r
898 number of protocol interface GUIDs was returned\r
899 in ProtocolBufferCount.\r
900 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
901 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
902 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.\r
903 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.\r
904 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
162ed594 905 results.\r
28a00297 906\r
162ed594 907**/\r
28a00297 908EFI_STATUS\r
909EFIAPI\r
910CoreProtocolsPerHandle (\r
1436aea4
MK
911 IN EFI_HANDLE UserHandle,\r
912 OUT EFI_GUID ***ProtocolBuffer,\r
913 OUT UINTN *ProtocolBufferCount\r
23c98c94 914 );\r
28a00297 915\r
162ed594 916/**\r
917 Add a new protocol notification record for the request protocol.\r
28a00297 918\r
022c6d45 919 @param Protocol The requested protocol to add the notify\r
920 registration\r
921 @param Event The event to signal\r
922 @param Registration Returns the registration record\r
28a00297 923\r
022c6d45 924 @retval EFI_INVALID_PARAMETER Invalid parameter\r
925 @retval EFI_SUCCESS Successfully returned the registration record\r
162ed594 926 that has been added\r
28a00297 927\r
162ed594 928**/\r
28a00297 929EFI_STATUS\r
930EFIAPI\r
931CoreRegisterProtocolNotify (\r
1436aea4
MK
932 IN EFI_GUID *Protocol,\r
933 IN EFI_EVENT Event,\r
934 OUT VOID **Registration\r
23c98c94 935 );\r
022c6d45 936\r
ec90508b 937/**\r
938 Removes all the events in the protocol database that match Event.\r
939\r
940 @param Event The event to search for in the protocol\r
941 database.\r
942\r
943 @return EFI_SUCCESS when done searching the entire database.\r
944\r
945**/\r
946EFI_STATUS\r
947CoreUnregisterProtocolNotify (\r
1436aea4 948 IN EFI_EVENT Event\r
ec90508b 949 );\r
950\r
162ed594 951/**\r
952 Locates the requested handle(s) and returns them in Buffer.\r
28a00297 953\r
022c6d45 954 @param SearchType The type of search to perform to locate the\r
955 handles\r
956 @param Protocol The protocol to search for\r
957 @param SearchKey Dependant on SearchType\r
958 @param BufferSize On input the size of Buffer. On output the\r
959 size of data returned.\r
960 @param Buffer The buffer to return the results in\r
28a00297 961\r
022c6d45 962 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is\r
963 returned in BufferSize.\r
964 @retval EFI_INVALID_PARAMETER Invalid parameter\r
965 @retval EFI_SUCCESS Successfully found the requested handle(s) and\r
162ed594 966 returns them in Buffer.\r
28a00297 967\r
162ed594 968**/\r
28a00297 969EFI_STATUS\r
970EFIAPI\r
971CoreLocateHandle (\r
1436aea4
MK
972 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
973 IN EFI_GUID *Protocol OPTIONAL,\r
974 IN VOID *SearchKey OPTIONAL,\r
975 IN OUT UINTN *BufferSize,\r
976 OUT EFI_HANDLE *Buffer\r
23c98c94 977 );\r
022c6d45 978\r
162ed594 979/**\r
980 Locates the handle to a device on the device path that best matches the specified protocol.\r
28a00297 981\r
022c6d45 982 @param Protocol The protocol to search for.\r
983 @param DevicePath On input, a pointer to a pointer to the device\r
984 path. On output, the device path pointer is\r
985 modified to point to the remaining part of the\r
986 devicepath.\r
987 @param Device A pointer to the returned device handle.\r
28a00297 988\r
022c6d45 989 @retval EFI_SUCCESS The resulting handle was returned.\r
990 @retval EFI_NOT_FOUND No handles matched the search.\r
162ed594 991 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
28a00297 992\r
162ed594 993**/\r
28a00297 994EFI_STATUS\r
995EFIAPI\r
996CoreLocateDevicePath (\r
1436aea4
MK
997 IN EFI_GUID *Protocol,\r
998 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
999 OUT EFI_HANDLE *Device\r
23c98c94 1000 );\r
28a00297 1001\r
162ed594 1002/**\r
1003 Function returns an array of handles that support the requested protocol\r
1004 in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
1005 that allocates a buffer for the caller.\r
28a00297 1006\r
022c6d45 1007 @param SearchType Specifies which handle(s) are to be returned.\r
1008 @param Protocol Provides the protocol to search by. This\r
1009 parameter is only valid for SearchType\r
1010 ByProtocol.\r
1011 @param SearchKey Supplies the search key depending on the\r
1012 SearchType.\r
1013 @param NumberHandles The number of handles returned in Buffer.\r
1014 @param Buffer A pointer to the buffer to return the requested\r
1015 array of handles that support Protocol.\r
1016\r
1017 @retval EFI_SUCCESS The result array of handles was returned.\r
1018 @retval EFI_NOT_FOUND No handles match the search.\r
1019 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
1020 matching results.\r
6393d9c8 1021 @retval EFI_INVALID_PARAMETER One or more parameters are not valid.\r
28a00297 1022\r
162ed594 1023**/\r
28a00297 1024EFI_STATUS\r
1025EFIAPI\r
1026CoreLocateHandleBuffer (\r
1436aea4
MK
1027 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
1028 IN EFI_GUID *Protocol OPTIONAL,\r
1029 IN VOID *SearchKey OPTIONAL,\r
1030 IN OUT UINTN *NumberHandles,\r
1031 OUT EFI_HANDLE **Buffer\r
23c98c94 1032 );\r
28a00297 1033\r
162ed594 1034/**\r
1035 Return the first Protocol Interface that matches the Protocol GUID. If\r
8bc18cc6 1036 Registration is passed in, return a Protocol Instance that was just add\r
1037 to the system. If Registration is NULL return the first Protocol Interface\r
162ed594 1038 you find.\r
28a00297 1039\r
44310938 1040 @param Protocol The protocol to search for\r
1041 @param Registration Optional Registration Key returned from\r
1042 RegisterProtocolNotify()\r
1043 @param Interface Return the Protocol interface (instance).\r
28a00297 1044\r
44310938 1045 @retval EFI_SUCCESS If a valid Interface is returned\r
1046 @retval EFI_INVALID_PARAMETER Invalid parameter\r
162ed594 1047 @retval EFI_NOT_FOUND Protocol interface not found\r
28a00297 1048\r
162ed594 1049**/\r
28a00297 1050EFI_STATUS\r
1051EFIAPI\r
1052CoreLocateProtocol (\r
23c98c94 1053 IN EFI_GUID *Protocol,\r
1054 IN VOID *Registration OPTIONAL,\r
1055 OUT VOID **Interface\r
1056 );\r
28a00297 1057\r
162ed594 1058/**\r
1059 return handle database key.\r
28a00297 1060\r
28a00297 1061\r
162ed594 1062 @return Handle database key.\r
28a00297 1063\r
162ed594 1064**/\r
28a00297 1065UINT64\r
1066CoreGetHandleDatabaseKey (\r
1067 VOID\r
23c98c94 1068 );\r
28a00297 1069\r
162ed594 1070/**\r
1071 Go connect any handles that were created or modified while a image executed.\r
28a00297 1072\r
022c6d45 1073 @param Key The Key to show that the handle has been\r
162ed594 1074 created/modified\r
28a00297 1075\r
162ed594 1076**/\r
28a00297 1077VOID\r
1078CoreConnectHandlesByKey (\r
1079 UINT64 Key\r
23c98c94 1080 );\r
28a00297 1081\r
162ed594 1082/**\r
1083 Connects one or more drivers to a controller.\r
28a00297 1084\r
bc2dfdbc
LG
1085 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
1086 @param DriverImageHandle A pointer to an ordered list handles that support the\r
1087 EFI_DRIVER_BINDING_PROTOCOL.\r
1088 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
1089 controller specified by ControllerHandle.\r
1090 @param Recursive If TRUE, then ConnectController() is called recursively\r
1091 until the entire tree of controllers below the controller specified\r
1092 by ControllerHandle have been created. If FALSE, then\r
1093 the tree of controllers is only expanded one level.\r
1094\r
1095 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
1096 2) No drivers were connected to ControllerHandle, but\r
1097 RemainingDevicePath is not NULL, and it is an End Device\r
1098 Path Node.\r
1099 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
1100 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
1101 present in the system.\r
1102 2) No drivers were connected to ControllerHandle.\r
d1102dba
LG
1103 @retval EFI_SECURITY_VIOLATION\r
1104 The user has no permission to start UEFI device drivers on the device path\r
bc2dfdbc 1105 associated with the ControllerHandle or specified by the RemainingDevicePath.\r
28a00297 1106\r
162ed594 1107**/\r
022c6d45 1108EFI_STATUS\r
28a00297 1109EFIAPI\r
1110CoreConnectController (\r
1111 IN EFI_HANDLE ControllerHandle,\r
1112 IN EFI_HANDLE *DriverImageHandle OPTIONAL,\r
1113 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,\r
1114 IN BOOLEAN Recursive\r
23c98c94 1115 );\r
28a00297 1116\r
162ed594 1117/**\r
1118 Disonnects a controller from a driver\r
28a00297 1119\r
022c6d45 1120 @param ControllerHandle ControllerHandle The handle of\r
1121 the controller from which\r
1122 driver(s) are to be\r
1123 disconnected.\r
1124 @param DriverImageHandle DriverImageHandle The driver to\r
1125 disconnect from ControllerHandle.\r
1126 @param ChildHandle ChildHandle The handle of the\r
1127 child to destroy.\r
1128\r
1129 @retval EFI_SUCCESS One or more drivers were\r
1130 disconnected from the controller.\r
1131 @retval EFI_SUCCESS On entry, no drivers are managing\r
1132 ControllerHandle.\r
1133 @retval EFI_SUCCESS DriverImageHandle is not NULL,\r
1134 and on entry DriverImageHandle is\r
1135 not managing ControllerHandle.\r
284ee2e8 1136 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
022c6d45 1137 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,\r
1138 and it is not a valid EFI_HANDLE.\r
1139 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it\r
1140 is not a valid EFI_HANDLE.\r
1141 @retval EFI_OUT_OF_RESOURCES There are not enough resources\r
1142 available to disconnect any\r
1143 drivers from ControllerHandle.\r
1144 @retval EFI_DEVICE_ERROR The controller could not be\r
1145 disconnected because of a device\r
162ed594 1146 error.\r
28a00297 1147\r
162ed594 1148**/\r
022c6d45 1149EFI_STATUS\r
28a00297 1150EFIAPI\r
1151CoreDisconnectController (\r
23c98c94 1152 IN EFI_HANDLE ControllerHandle,\r
1153 IN EFI_HANDLE DriverImageHandle OPTIONAL,\r
1154 IN EFI_HANDLE ChildHandle OPTIONAL\r
1155 );\r
28a00297 1156\r
162ed594 1157/**\r
1158 Allocates pages from the memory map.\r
28a00297 1159\r
022c6d45 1160 @param Type The type of allocation to perform\r
1161 @param MemoryType The type of memory to turn the allocated pages\r
1162 into\r
1163 @param NumberOfPages The number of pages to allocate\r
1164 @param Memory A pointer to receive the base allocated memory\r
1165 address\r
28a00297 1166\r
162ed594 1167 @return Status. On success, Memory is filled in with the base address allocated\r
022c6d45 1168 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in\r
1169 spec.\r
1170 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r
1171 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r
162ed594 1172 @retval EFI_SUCCESS Pages successfully allocated.\r
28a00297 1173\r
162ed594 1174**/\r
28a00297 1175EFI_STATUS\r
1176EFIAPI\r
1177CoreAllocatePages (\r
1436aea4
MK
1178 IN EFI_ALLOCATE_TYPE Type,\r
1179 IN EFI_MEMORY_TYPE MemoryType,\r
1180 IN UINTN NumberOfPages,\r
23c98c94 1181 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
1182 );\r
28a00297 1183\r
162ed594 1184/**\r
1185 Frees previous allocated pages.\r
28a00297 1186\r
022c6d45 1187 @param Memory Base address of memory being freed\r
1188 @param NumberOfPages The number of pages to free\r
28a00297 1189\r
022c6d45 1190 @retval EFI_NOT_FOUND Could not find the entry that covers the range\r
1191 @retval EFI_INVALID_PARAMETER Address not aligned\r
162ed594 1192 @return EFI_SUCCESS -Pages successfully freed.\r
28a00297 1193\r
162ed594 1194**/\r
022c6d45 1195EFI_STATUS\r
28a00297 1196EFIAPI\r
1197CoreFreePages (\r
1436aea4
MK
1198 IN EFI_PHYSICAL_ADDRESS Memory,\r
1199 IN UINTN NumberOfPages\r
23c98c94 1200 );\r
28a00297 1201\r
162ed594 1202/**\r
1203 This function returns a copy of the current memory map. The map is an array of\r
1204 memory descriptors, each of which describes a contiguous block of memory.\r
28a00297 1205\r
022c6d45 1206 @param MemoryMapSize A pointer to the size, in bytes, of the\r
1207 MemoryMap buffer. On input, this is the size of\r
1208 the buffer allocated by the caller. On output,\r
1209 it is the size of the buffer returned by the\r
1210 firmware if the buffer was large enough, or the\r
1211 size of the buffer needed to contain the map if\r
1212 the buffer was too small.\r
1213 @param MemoryMap A pointer to the buffer in which firmware places\r
1214 the current memory map.\r
1215 @param MapKey A pointer to the location in which firmware\r
1216 returns the key for the current memory map.\r
1217 @param DescriptorSize A pointer to the location in which firmware\r
1218 returns the size, in bytes, of an individual\r
1219 EFI_MEMORY_DESCRIPTOR.\r
1220 @param DescriptorVersion A pointer to the location in which firmware\r
1221 returns the version number associated with the\r
1222 EFI_MEMORY_DESCRIPTOR.\r
1223\r
1224 @retval EFI_SUCCESS The memory map was returned in the MemoryMap\r
1225 buffer.\r
1226 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current\r
1227 buffer size needed to hold the memory map is\r
1228 returned in MemoryMapSize.\r
162ed594 1229 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
28a00297 1230\r
162ed594 1231**/\r
28a00297 1232EFI_STATUS\r
1233EFIAPI\r
1234CoreGetMemoryMap (\r
23c98c94 1235 IN OUT UINTN *MemoryMapSize,\r
1236 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
1237 OUT UINTN *MapKey,\r
1238 OUT UINTN *DescriptorSize,\r
1239 OUT UINT32 *DescriptorVersion\r
1240 );\r
28a00297 1241\r
162ed594 1242/**\r
1243 Allocate pool of a particular type.\r
28a00297 1244\r
022c6d45 1245 @param PoolType Type of pool to allocate\r
1246 @param Size The amount of pool to allocate\r
1247 @param Buffer The address to return a pointer to the allocated\r
1248 pool\r
28a00297 1249\r
3e058701 1250 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r
022c6d45 1251 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
162ed594 1252 @retval EFI_SUCCESS Pool successfully allocated.\r
28a00297 1253\r
162ed594 1254**/\r
28a00297 1255EFI_STATUS\r
1256EFIAPI\r
1257CoreAllocatePool (\r
23c98c94 1258 IN EFI_MEMORY_TYPE PoolType,\r
1259 IN UINTN Size,\r
1260 OUT VOID **Buffer\r
1261 );\r
28a00297 1262\r
84edd20b
SZ
1263/**\r
1264 Allocate pool of a particular type.\r
1265\r
1266 @param PoolType Type of pool to allocate\r
1267 @param Size The amount of pool to allocate\r
1268 @param Buffer The address to return a pointer to the allocated\r
1269 pool\r
28a00297 1270\r
84edd20b
SZ
1271 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r
1272 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
1273 @retval EFI_SUCCESS Pool successfully allocated.\r
1274\r
1275**/\r
1276EFI_STATUS\r
1277EFIAPI\r
1278CoreInternalAllocatePool (\r
1279 IN EFI_MEMORY_TYPE PoolType,\r
1280 IN UINTN Size,\r
1281 OUT VOID **Buffer\r
1282 );\r
28a00297 1283\r
162ed594 1284/**\r
1285 Frees pool.\r
28a00297 1286\r
022c6d45 1287 @param Buffer The allocated pool entry to free\r
28a00297 1288\r
022c6d45 1289 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
162ed594 1290 @retval EFI_SUCCESS Pool successfully freed.\r
28a00297 1291\r
162ed594 1292**/\r
28a00297 1293EFI_STATUS\r
1294EFIAPI\r
1295CoreFreePool (\r
1436aea4 1296 IN VOID *Buffer\r
23c98c94 1297 );\r
28a00297 1298\r
84edd20b
SZ
1299/**\r
1300 Frees pool.\r
1301\r
1302 @param Buffer The allocated pool entry to free\r
925f0d1a 1303 @param PoolType Pointer to pool type\r
28a00297 1304\r
84edd20b
SZ
1305 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
1306 @retval EFI_SUCCESS Pool successfully freed.\r
1307\r
1308**/\r
1309EFI_STATUS\r
1310EFIAPI\r
1311CoreInternalFreePool (\r
1436aea4
MK
1312 IN VOID *Buffer,\r
1313 OUT EFI_MEMORY_TYPE *PoolType OPTIONAL\r
84edd20b 1314 );\r
28a00297 1315\r
162ed594 1316/**\r
1317 Loads an EFI image into memory and returns a handle to the image.\r
28a00297 1318\r
022c6d45 1319 @param BootPolicy If TRUE, indicates that the request originates\r
1320 from the boot manager, and that the boot\r
1321 manager is attempting to load FilePath as a\r
1322 boot selection.\r
1323 @param ParentImageHandle The caller's image handle.\r
1324 @param FilePath The specific file path from which the image is\r
1325 loaded.\r
1326 @param SourceBuffer If not NULL, a pointer to the memory location\r
1327 containing a copy of the image to be loaded.\r
1328 @param SourceSize The size in bytes of SourceBuffer.\r
1329 @param ImageHandle Pointer to the returned image handle that is\r
1330 created when the image is successfully loaded.\r
1331\r
1332 @retval EFI_SUCCESS The image was loaded into memory.\r
1333 @retval EFI_NOT_FOUND The FilePath was not found.\r
1334 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1335 @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
1336 path cannot be parsed to locate the proper\r
1337 protocol for loading the file.\r
1338 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
162ed594 1339 resources.\r
b695e7ff
LG
1340 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
1341 understood.\r
1342 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
d1102dba 1343 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the\r
b695e7ff 1344 image from being loaded. NULL is returned in *ImageHandle.\r
d1102dba
LG
1345 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a\r
1346 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current\r
b695e7ff 1347 platform policy specifies that the image should not be started.\r
28a00297 1348\r
162ed594 1349**/\r
28a00297 1350EFI_STATUS\r
1351EFIAPI\r
1352CoreLoadImage (\r
1436aea4
MK
1353 IN BOOLEAN BootPolicy,\r
1354 IN EFI_HANDLE ParentImageHandle,\r
1355 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
1356 IN VOID *SourceBuffer OPTIONAL,\r
1357 IN UINTN SourceSize,\r
1358 OUT EFI_HANDLE *ImageHandle\r
23c98c94 1359 );\r
28a00297 1360\r
162ed594 1361/**\r
1362 Unloads an image.\r
28a00297 1363\r
022c6d45 1364 @param ImageHandle Handle that identifies the image to be\r
1365 unloaded.\r
28a00297 1366\r
022c6d45 1367 @retval EFI_SUCCESS The image has been unloaded.\r
6393d9c8 1368 @retval EFI_UNSUPPORTED The image has been started, and does not support\r
022c6d45 1369 unload.\r
162ed594 1370 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.\r
28a00297 1371\r
162ed594 1372**/\r
28a00297 1373EFI_STATUS\r
1374EFIAPI\r
1375CoreUnloadImage (\r
1376 IN EFI_HANDLE ImageHandle\r
23c98c94 1377 );\r
28a00297 1378\r
162ed594 1379/**\r
1380 Transfer control to a loaded image's entry point.\r
28a00297 1381\r
022c6d45 1382 @param ImageHandle Handle of image to be started.\r
1383 @param ExitDataSize Pointer of the size to ExitData\r
1384 @param ExitData Pointer to a pointer to a data buffer that\r
b695e7ff 1385 includes a Null-terminated string,\r
022c6d45 1386 optionally followed by additional binary data.\r
1387 The string is a description that the caller may\r
1388 use to further indicate the reason for the\r
1389 image's exit.\r
1390\r
1391 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1392 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
bc2dfdbc 1393 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.\r
022c6d45 1394 @retval EFI_SUCCESS Successfully transfer control to the image's\r
162ed594 1395 entry point.\r
28a00297 1396\r
162ed594 1397**/\r
28a00297 1398EFI_STATUS\r
1399EFIAPI\r
1400CoreStartImage (\r
23c98c94 1401 IN EFI_HANDLE ImageHandle,\r
1402 OUT UINTN *ExitDataSize,\r
1403 OUT CHAR16 **ExitData OPTIONAL\r
1404 );\r
28a00297 1405\r
162ed594 1406/**\r
1407 Terminates the currently loaded EFI image and returns control to boot services.\r
28a00297 1408\r
022c6d45 1409 @param ImageHandle Handle that identifies the image. This\r
1410 parameter is passed to the image on entry.\r
1411 @param Status The image's exit code.\r
1412 @param ExitDataSize The size, in bytes, of ExitData. Ignored if\r
1413 ExitStatus is EFI_SUCCESS.\r
1414 @param ExitData Pointer to a data buffer that includes a\r
1415 Null-terminated Unicode string, optionally\r
1416 followed by additional binary data. The string\r
1417 is a description that the caller may use to\r
1418 further indicate the reason for the image's\r
1419 exit.\r
1420\r
1421 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current\r
1422 image.\r
1423 @retval EFI_SUCCESS Successfully terminates the currently loaded\r
1424 EFI image.\r
1425 @retval EFI_ACCESS_DENIED Should never reach there.\r
162ed594 1426 @retval EFI_OUT_OF_RESOURCES Could not allocate pool\r
28a00297 1427\r
162ed594 1428**/\r
28a00297 1429EFI_STATUS\r
1430EFIAPI\r
1431CoreExit (\r
1432 IN EFI_HANDLE ImageHandle,\r
1433 IN EFI_STATUS Status,\r
1434 IN UINTN ExitDataSize,\r
1435 IN CHAR16 *ExitData OPTIONAL\r
23c98c94 1436 );\r
28a00297 1437\r
162ed594 1438/**\r
670d4d88 1439 Creates an event.\r
28a00297 1440\r
022c6d45 1441 @param Type The type of event to create and its mode and\r
1442 attributes\r
1443 @param NotifyTpl The task priority level of event notifications\r
1444 @param NotifyFunction Pointer to the events notification function\r
1445 @param NotifyContext Pointer to the notification functions context;\r
1446 corresponds to parameter "Context" in the\r
1447 notification function\r
1448 @param Event Pointer to the newly created event if the call\r
1449 succeeds; undefined otherwise\r
1450\r
1451 @retval EFI_SUCCESS The event structure was created\r
1452 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
162ed594 1453 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
28a00297 1454\r
162ed594 1455**/\r
28a00297 1456EFI_STATUS\r
1457EFIAPI\r
1458CoreCreateEvent (\r
1436aea4
MK
1459 IN UINT32 Type,\r
1460 IN EFI_TPL NotifyTpl,\r
1461 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,\r
1462 IN VOID *NotifyContext OPTIONAL,\r
1463 OUT EFI_EVENT *Event\r
23c98c94 1464 );\r
28a00297 1465\r
162ed594 1466/**\r
670d4d88 1467 Creates an event in a group.\r
28a00297 1468\r
022c6d45 1469 @param Type The type of event to create and its mode and\r
1470 attributes\r
1471 @param NotifyTpl The task priority level of event notifications\r
1472 @param NotifyFunction Pointer to the events notification function\r
1473 @param NotifyContext Pointer to the notification functions context;\r
1474 corresponds to parameter "Context" in the\r
1475 notification function\r
1476 @param EventGroup GUID for EventGroup if NULL act the same as\r
1477 gBS->CreateEvent().\r
1478 @param Event Pointer to the newly created event if the call\r
1479 succeeds; undefined otherwise\r
1480\r
1481 @retval EFI_SUCCESS The event structure was created\r
1482 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
162ed594 1483 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
28a00297 1484\r
162ed594 1485**/\r
28a00297 1486EFI_STATUS\r
1487EFIAPI\r
1488CoreCreateEventEx (\r
1436aea4
MK
1489 IN UINT32 Type,\r
1490 IN EFI_TPL NotifyTpl,\r
1491 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,\r
1492 IN CONST VOID *NotifyContext OPTIONAL,\r
1493 IN CONST EFI_GUID *EventGroup OPTIONAL,\r
1494 OUT EFI_EVENT *Event\r
23c98c94 1495 );\r
28a00297 1496\r
670d4d88
SZ
1497/**\r
1498 Creates a general-purpose event structure\r
1499\r
1500 @param Type The type of event to create and its mode and\r
1501 attributes\r
1502 @param NotifyTpl The task priority level of event notifications\r
1503 @param NotifyFunction Pointer to the events notification function\r
1504 @param NotifyContext Pointer to the notification functions context;\r
1505 corresponds to parameter "Context" in the\r
1506 notification function\r
1507 @param EventGroup GUID for EventGroup if NULL act the same as\r
1508 gBS->CreateEvent().\r
1509 @param Event Pointer to the newly created event if the call\r
1510 succeeds; undefined otherwise\r
28a00297 1511\r
670d4d88
SZ
1512 @retval EFI_SUCCESS The event structure was created\r
1513 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1514 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1515\r
1516**/\r
1517EFI_STATUS\r
1518EFIAPI\r
1519CoreCreateEventInternal (\r
1436aea4
MK
1520 IN UINT32 Type,\r
1521 IN EFI_TPL NotifyTpl,\r
1522 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,\r
1523 IN CONST VOID *NotifyContext OPTIONAL,\r
1524 IN CONST EFI_GUID *EventGroup OPTIONAL,\r
1525 OUT EFI_EVENT *Event\r
670d4d88 1526 );\r
28a00297 1527\r
162ed594 1528/**\r
1529 Sets the type of timer and the trigger time for a timer event.\r
28a00297 1530\r
022c6d45 1531 @param UserEvent The timer event that is to be signaled at the\r
1532 specified time\r
1533 @param Type The type of time that is specified in\r
1534 TriggerTime\r
1535 @param TriggerTime The number of 100ns units until the timer\r
1536 expires\r
28a00297 1537\r
022c6d45 1538 @retval EFI_SUCCESS The event has been set to be signaled at the\r
1539 requested time\r
162ed594 1540 @retval EFI_INVALID_PARAMETER Event or Type is not valid\r
28a00297 1541\r
162ed594 1542**/\r
28a00297 1543EFI_STATUS\r
1544EFIAPI\r
1545CoreSetTimer (\r
1436aea4
MK
1546 IN EFI_EVENT UserEvent,\r
1547 IN EFI_TIMER_DELAY Type,\r
1548 IN UINT64 TriggerTime\r
23c98c94 1549 );\r
28a00297 1550\r
162ed594 1551/**\r
022c6d45 1552 Signals the event. Queues the event to be notified if needed.\r
28a00297 1553\r
022c6d45 1554 @param UserEvent The event to signal .\r
28a00297 1555\r
022c6d45 1556 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1557 @retval EFI_SUCCESS The event was signaled.\r
28a00297 1558\r
162ed594 1559**/\r
28a00297 1560EFI_STATUS\r
1561EFIAPI\r
1562CoreSignalEvent (\r
1436aea4 1563 IN EFI_EVENT UserEvent\r
23c98c94 1564 );\r
28a00297 1565\r
162ed594 1566/**\r
1567 Stops execution until an event is signaled.\r
28a00297 1568\r
022c6d45 1569 @param NumberOfEvents The number of events in the UserEvents array\r
1570 @param UserEvents An array of EFI_EVENT\r
1571 @param UserIndex Pointer to the index of the event which\r
1572 satisfied the wait condition\r
28a00297 1573\r
022c6d45 1574 @retval EFI_SUCCESS The event indicated by Index was signaled.\r
1575 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification\r
1576 function or Event was not a valid type\r
162ed594 1577 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION\r
28a00297 1578\r
162ed594 1579**/\r
28a00297 1580EFI_STATUS\r
1581EFIAPI\r
1582CoreWaitForEvent (\r
1436aea4
MK
1583 IN UINTN NumberOfEvents,\r
1584 IN EFI_EVENT *UserEvents,\r
1585 OUT UINTN *UserIndex\r
23c98c94 1586 );\r
28a00297 1587\r
162ed594 1588/**\r
1589 Closes an event and frees the event structure.\r
28a00297 1590\r
022c6d45 1591 @param UserEvent Event to close\r
28a00297 1592\r
022c6d45 1593 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1594 @retval EFI_SUCCESS The event has been closed\r
28a00297 1595\r
162ed594 1596**/\r
28a00297 1597EFI_STATUS\r
1598EFIAPI\r
1599CoreCloseEvent (\r
1436aea4 1600 IN EFI_EVENT UserEvent\r
23c98c94 1601 );\r
28a00297 1602\r
162ed594 1603/**\r
1604 Check the status of an event.\r
28a00297 1605\r
022c6d45 1606 @param UserEvent The event to check\r
28a00297 1607\r
022c6d45 1608 @retval EFI_SUCCESS The event is in the signaled state\r
1609 @retval EFI_NOT_READY The event is not in the signaled state\r
162ed594 1610 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL\r
28a00297 1611\r
162ed594 1612**/\r
28a00297 1613EFI_STATUS\r
1614EFIAPI\r
1615CoreCheckEvent (\r
1436aea4 1616 IN EFI_EVENT UserEvent\r
23c98c94 1617 );\r
28a00297 1618\r
162ed594 1619/**\r
1620 Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
1621 global coherency domain of the processor.\r
28a00297 1622\r
022c6d45 1623 @param GcdMemoryType Memory type of the memory space.\r
1624 @param BaseAddress Base address of the memory space.\r
1625 @param Length Length of the memory space.\r
1626 @param Capabilities alterable attributes of the memory space.\r
28a00297 1627\r
162ed594 1628 @retval EFI_SUCCESS Merged this memory space into GCD map.\r
28a00297 1629\r
162ed594 1630**/\r
28a00297 1631EFI_STATUS\r
3b6ffb6a 1632EFIAPI\r
28a00297 1633CoreAddMemorySpace (\r
1634 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1635 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1636 IN UINT64 Length,\r
1637 IN UINT64 Capabilities\r
23c98c94 1638 );\r
28a00297 1639\r
162ed594 1640/**\r
1641 Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
1642 I/O resources from the global coherency domain of the processor.\r
28a00297 1643\r
022c6d45 1644 @param GcdAllocateType The type of allocate operation\r
1645 @param GcdMemoryType The desired memory type\r
1646 @param Alignment Align with 2^Alignment\r
1647 @param Length Length to allocate\r
1648 @param BaseAddress Base address to allocate\r
1649 @param ImageHandle The image handle consume the allocated space.\r
1650 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1651\r
022c6d45 1652 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1653 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1654 @retval EFI_SUCCESS Memory space successfully allocated.\r
28a00297 1655\r
162ed594 1656**/\r
28a00297 1657EFI_STATUS\r
3b6ffb6a 1658EFIAPI\r
28a00297 1659CoreAllocateMemorySpace (\r
1660 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1661 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1662 IN UINTN Alignment,\r
1663 IN UINT64 Length,\r
1664 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1665 IN EFI_HANDLE ImageHandle,\r
1666 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1667 );\r
28a00297 1668\r
162ed594 1669/**\r
1670 Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
1671 I/O resources from the global coherency domain of the processor.\r
28a00297 1672\r
022c6d45 1673 @param BaseAddress Base address of the memory space.\r
1674 @param Length Length of the memory space.\r
28a00297 1675\r
162ed594 1676 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1677\r
162ed594 1678**/\r
28a00297 1679EFI_STATUS\r
3b6ffb6a 1680EFIAPI\r
28a00297 1681CoreFreeMemorySpace (\r
1682 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1683 IN UINT64 Length\r
23c98c94 1684 );\r
28a00297 1685\r
162ed594 1686/**\r
1687 Removes reserved memory, system memory, or memory-mapped I/O resources from\r
1688 the global coherency domain of the processor.\r
28a00297 1689\r
022c6d45 1690 @param BaseAddress Base address of the memory space.\r
1691 @param Length Length of the memory space.\r
28a00297 1692\r
162ed594 1693 @retval EFI_SUCCESS Successfully remove a segment of memory space.\r
28a00297 1694\r
162ed594 1695**/\r
28a00297 1696EFI_STATUS\r
3b6ffb6a 1697EFIAPI\r
28a00297 1698CoreRemoveMemorySpace (\r
1699 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1700 IN UINT64 Length\r
23c98c94 1701 );\r
28a00297 1702\r
162ed594 1703/**\r
1704 Retrieves the descriptor for a memory region containing a specified address.\r
28a00297 1705\r
022c6d45 1706 @param BaseAddress Specified start address\r
1707 @param Descriptor Specified length\r
28a00297 1708\r
022c6d45 1709 @retval EFI_INVALID_PARAMETER Invalid parameter\r
162ed594 1710 @retval EFI_SUCCESS Successfully get memory space descriptor.\r
28a00297 1711\r
162ed594 1712**/\r
28a00297 1713EFI_STATUS\r
3b6ffb6a 1714EFIAPI\r
28a00297 1715CoreGetMemorySpaceDescriptor (\r
1716 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1717 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1718 );\r
28a00297 1719\r
162ed594 1720/**\r
1721 Modifies the attributes for a memory region in the global coherency domain of the\r
1722 processor.\r
28a00297 1723\r
022c6d45 1724 @param BaseAddress Specified start address\r
1725 @param Length Specified length\r
1726 @param Attributes Specified attributes\r
28a00297 1727\r
fc8ff20f 1728 @retval EFI_SUCCESS The attributes were set for the memory region.\r
d1102dba 1729 @retval EFI_INVALID_PARAMETER Length is zero.\r
fc8ff20f 1730 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory\r
1731 resource range specified by BaseAddress and Length.\r
1732 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource\r
1733 range specified by BaseAddress and Length.\r
771ee501 1734 @retval EFI_ACCESS_DENIED The attributes for the memory resource range specified by\r
fc8ff20f 1735 BaseAddress and Length cannot be modified.\r
1736 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of\r
1737 the memory resource range.\r
1738 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
1739 not available yet.\r
28a00297 1740\r
162ed594 1741**/\r
28a00297 1742EFI_STATUS\r
3b6ffb6a 1743EFIAPI\r
28a00297 1744CoreSetMemorySpaceAttributes (\r
1745 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1746 IN UINT64 Length,\r
1747 IN UINT64 Attributes\r
23c98c94 1748 );\r
28a00297 1749\r
771ee501
EC
1750/**\r
1751 Modifies the capabilities for a memory region in the global coherency domain of the\r
1752 processor.\r
1753\r
1754 @param BaseAddress The physical address that is the start address of a memory region.\r
1755 @param Length The size in bytes of the memory region.\r
1756 @param Capabilities The bit mask of capabilities that the memory region supports.\r
1757\r
1758 @retval EFI_SUCCESS The capabilities were set for the memory region.\r
1759 @retval EFI_INVALID_PARAMETER Length is zero.\r
1760 @retval EFI_UNSUPPORTED The capabilities specified by Capabilities do not include the\r
1761 memory region attributes currently in use.\r
1762 @retval EFI_ACCESS_DENIED The capabilities for the memory resource range specified by\r
1763 BaseAddress and Length cannot be modified.\r
1764 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the capabilities\r
1765 of the memory resource range.\r
1766**/\r
1767EFI_STATUS\r
1768EFIAPI\r
1769CoreSetMemorySpaceCapabilities (\r
1770 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1771 IN UINT64 Length,\r
1772 IN UINT64 Capabilities\r
1773 );\r
1774\r
162ed594 1775/**\r
1776 Returns a map of the memory resources in the global coherency domain of the\r
1777 processor.\r
28a00297 1778\r
022c6d45 1779 @param NumberOfDescriptors Number of descriptors.\r
1780 @param MemorySpaceMap Descriptor array\r
28a00297 1781\r
022c6d45 1782 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1783 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1784 @retval EFI_SUCCESS Successfully get memory space map.\r
28a00297 1785\r
162ed594 1786**/\r
28a00297 1787EFI_STATUS\r
3b6ffb6a 1788EFIAPI\r
28a00297 1789CoreGetMemorySpaceMap (\r
1790 OUT UINTN *NumberOfDescriptors,\r
1791 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
23c98c94 1792 );\r
28a00297 1793\r
162ed594 1794/**\r
1795 Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
28a00297 1796\r
022c6d45 1797 @param GcdIoType IO type of the segment.\r
1798 @param BaseAddress Base address of the segment.\r
1799 @param Length Length of the segment.\r
28a00297 1800\r
022c6d45 1801 @retval EFI_SUCCESS Merged this segment into GCD map.\r
162ed594 1802 @retval EFI_INVALID_PARAMETER Parameter not valid\r
28a00297 1803\r
162ed594 1804**/\r
28a00297 1805EFI_STATUS\r
3b6ffb6a 1806EFIAPI\r
28a00297 1807CoreAddIoSpace (\r
1808 IN EFI_GCD_IO_TYPE GcdIoType,\r
1809 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1810 IN UINT64 Length\r
23c98c94 1811 );\r
28a00297 1812\r
162ed594 1813/**\r
1814 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1815 domain of the processor.\r
28a00297 1816\r
022c6d45 1817 @param GcdAllocateType The type of allocate operation\r
1818 @param GcdIoType The desired IO type\r
1819 @param Alignment Align with 2^Alignment\r
1820 @param Length Length to allocate\r
1821 @param BaseAddress Base address to allocate\r
1822 @param ImageHandle The image handle consume the allocated space.\r
1823 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1824\r
022c6d45 1825 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1826 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1827 @retval EFI_SUCCESS IO space successfully allocated.\r
28a00297 1828\r
162ed594 1829**/\r
28a00297 1830EFI_STATUS\r
3b6ffb6a 1831EFIAPI\r
28a00297 1832CoreAllocateIoSpace (\r
1833 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1834 IN EFI_GCD_IO_TYPE GcdIoType,\r
1835 IN UINTN Alignment,\r
1836 IN UINT64 Length,\r
1837 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1838 IN EFI_HANDLE ImageHandle,\r
1839 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1840 );\r
28a00297 1841\r
162ed594 1842/**\r
1843 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1844 domain of the processor.\r
28a00297 1845\r
022c6d45 1846 @param BaseAddress Base address of the segment.\r
1847 @param Length Length of the segment.\r
28a00297 1848\r
162ed594 1849 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1850\r
162ed594 1851**/\r
28a00297 1852EFI_STATUS\r
3b6ffb6a 1853EFIAPI\r
28a00297 1854CoreFreeIoSpace (\r
1855 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1856 IN UINT64 Length\r
23c98c94 1857 );\r
28a00297 1858\r
162ed594 1859/**\r
1860 Removes reserved I/O or I/O resources from the global coherency domain of the\r
1861 processor.\r
28a00297 1862\r
022c6d45 1863 @param BaseAddress Base address of the segment.\r
1864 @param Length Length of the segment.\r
28a00297 1865\r
162ed594 1866 @retval EFI_SUCCESS Successfully removed a segment of IO space.\r
28a00297 1867\r
162ed594 1868**/\r
28a00297 1869EFI_STATUS\r
3b6ffb6a 1870EFIAPI\r
28a00297 1871CoreRemoveIoSpace (\r
1872 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1873 IN UINT64 Length\r
23c98c94 1874 );\r
28a00297 1875\r
162ed594 1876/**\r
1877 Retrieves the descriptor for an I/O region containing a specified address.\r
28a00297 1878\r
022c6d45 1879 @param BaseAddress Specified start address\r
1880 @param Descriptor Specified length\r
28a00297 1881\r
022c6d45 1882 @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r
162ed594 1883 @retval EFI_SUCCESS Successfully get the IO space descriptor.\r
28a00297 1884\r
162ed594 1885**/\r
28a00297 1886EFI_STATUS\r
3b6ffb6a 1887EFIAPI\r
28a00297 1888CoreGetIoSpaceDescriptor (\r
1889 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1890 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1891 );\r
28a00297 1892\r
162ed594 1893/**\r
1894 Returns a map of the I/O resources in the global coherency domain of the processor.\r
28a00297 1895\r
022c6d45 1896 @param NumberOfDescriptors Number of descriptors.\r
1897 @param IoSpaceMap Descriptor array\r
28a00297 1898\r
022c6d45 1899 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1900 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1901 @retval EFI_SUCCESS Successfully get IO space map.\r
28a00297 1902\r
162ed594 1903**/\r
28a00297 1904EFI_STATUS\r
3b6ffb6a 1905EFIAPI\r
28a00297 1906CoreGetIoSpaceMap (\r
1907 OUT UINTN *NumberOfDescriptors,\r
1908 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
23c98c94 1909 );\r
28a00297 1910\r
162ed594 1911/**\r
1912 This is the main Dispatcher for DXE and it exits when there are no more\r
1913 drivers to run. Drain the mScheduledQueue and load and start a PE\r
1914 image for each driver. Search the mDiscoveredList to see if any driver can\r
1915 be placed on the mScheduledQueue. If no drivers are placed on the\r
1916 mScheduledQueue exit the function. On exit it is assumed the Bds()\r
1917 will be called, and when the Bds() exits the Dispatcher will be called\r
1918 again.\r
28a00297 1919\r
022c6d45 1920 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running\r
1921 @retval EFI_NOT_FOUND No DXE Drivers were dispatched\r
1922 @retval EFI_SUCCESS One or more DXE Drivers were dispatched\r
28a00297 1923\r
23c98c94 1924**/\r
28a00297 1925EFI_STATUS\r
1926EFIAPI\r
1927CoreDispatcher (\r
1928 VOID\r
23c98c94 1929 );\r
28a00297 1930\r
162ed594 1931/**\r
1932 Check every driver and locate a matching one. If the driver is found, the Unrequested\r
1933 state flag is cleared.\r
28a00297 1934\r
022c6d45 1935 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1936 the firmware file specified by DriverName.\r
1937 @param DriverName The Driver name to put in the Dependent state.\r
28a00297 1938\r
022c6d45 1939 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was\r
1940 cleared\r
1941 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was\r
1942 not set.\r
28a00297 1943\r
23c98c94 1944**/\r
28a00297 1945EFI_STATUS\r
1946EFIAPI\r
1947CoreSchedule (\r
1948 IN EFI_HANDLE FirmwareVolumeHandle,\r
1949 IN EFI_GUID *DriverName\r
23c98c94 1950 );\r
28a00297 1951\r
162ed594 1952/**\r
022c6d45 1953 Convert a driver from the Untrused back to the Scheduled state.\r
28a00297 1954\r
022c6d45 1955 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1956 the firmware file specified by DriverName.\r
1957 @param DriverName The Driver name to put in the Scheduled state\r
28a00297 1958\r
022c6d45 1959 @retval EFI_SUCCESS The file was found in the untrusted state, and it\r
1960 was promoted to the trusted state.\r
1961 @retval EFI_NOT_FOUND The file was not found in the untrusted state.\r
28a00297 1962\r
23c98c94 1963**/\r
28a00297 1964EFI_STATUS\r
1965EFIAPI\r
1966CoreTrust (\r
1967 IN EFI_HANDLE FirmwareVolumeHandle,\r
1968 IN EFI_GUID *DriverName\r
23c98c94 1969 );\r
28a00297 1970\r
162ed594 1971/**\r
1972 This routine is the driver initialization entry point. It initializes the\r
1973 libraries, and registers two notification functions. These notification\r
1974 functions are responsible for building the FV stack dynamically.\r
28a00297 1975\r
022c6d45 1976 @param ImageHandle The image handle.\r
1977 @param SystemTable The system table.\r
28a00297 1978\r
162ed594 1979 @retval EFI_SUCCESS Function successfully returned.\r
28a00297 1980\r
162ed594 1981**/\r
28a00297 1982EFI_STATUS\r
1983EFIAPI\r
1984FwVolDriverInit (\r
1436aea4
MK
1985 IN EFI_HANDLE ImageHandle,\r
1986 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 1987 );\r
28a00297 1988\r
162ed594 1989/**\r
1990 Entry point of the section extraction code. Initializes an instance of the\r
1991 section extraction interface and installs it on a new handle.\r
1992\r
1993 @param ImageHandle A handle for the image that is initializing this driver\r
1994 @param SystemTable A pointer to the EFI system table\r
28a00297 1995\r
162ed594 1996 @retval EFI_SUCCESS Driver initialized successfully\r
1997 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
1998\r
1999**/\r
28a00297 2000EFI_STATUS\r
2001EFIAPI\r
2002InitializeSectionExtraction (\r
1436aea4
MK
2003 IN EFI_HANDLE ImageHandle,\r
2004 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 2005 );\r
28a00297 2006\r
162ed594 2007/**\r
2008 This DXE service routine is used to process a firmware volume. In\r
2009 particular, it can be called by BDS to process a single firmware\r
2010 volume found in a capsule.\r
28a00297 2011\r
022c6d45 2012 @param FvHeader pointer to a firmware volume header\r
2013 @param Size the size of the buffer pointed to by FvHeader\r
2014 @param FVProtocolHandle the handle on which a firmware volume protocol\r
2015 was produced for the firmware volume passed in.\r
28a00297 2016\r
022c6d45 2017 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of\r
2018 system resources\r
2019 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted\r
2020 @retval EFI_SUCCESS a firmware volume protocol was produced for the\r
162ed594 2021 firmware volume\r
28a00297 2022\r
162ed594 2023**/\r
28a00297 2024EFI_STATUS\r
3b6ffb6a 2025EFIAPI\r
28a00297 2026CoreProcessFirmwareVolume (\r
1436aea4
MK
2027 IN VOID *FvHeader,\r
2028 IN UINTN Size,\r
2029 OUT EFI_HANDLE *FVProtocolHandle\r
23c98c94 2030 );\r
28a00297 2031\r
2032//\r
1436aea4 2033// Functions used during debug buils\r
28a00297 2034//\r
162ed594 2035\r
2036/**\r
2037 Displays Architectural protocols that were not loaded and are required for DXE\r
23c98c94 2038 core to function. Only used in Debug Builds.\r
162ed594 2039\r
2040**/\r
28a00297 2041VOID\r
2042CoreDisplayMissingArchProtocols (\r
2043 VOID\r
23c98c94 2044 );\r
022c6d45 2045\r
162ed594 2046/**\r
2047 Traverse the discovered list for any drivers that were discovered but not loaded\r
2048 because the dependency experessions evaluated to false.\r
28a00297 2049\r
162ed594 2050**/\r
28a00297 2051VOID\r
2052CoreDisplayDiscoveredNotDispatched (\r
2053 VOID\r
23c98c94 2054 );\r
28a00297 2055\r
162ed594 2056/**\r
23c98c94 2057 Place holder function until all the Boot Services and Runtime Services are\r
2058 available.\r
28a00297 2059\r
022c6d45 2060 @param Arg1 Undefined\r
28a00297 2061\r
162ed594 2062 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2063\r
162ed594 2064**/\r
28a00297 2065EFI_STATUS\r
2066EFIAPI\r
2067CoreEfiNotAvailableYetArg1 (\r
1436aea4 2068 UINTN Arg1\r
23c98c94 2069 );\r
28a00297 2070\r
162ed594 2071/**\r
2072 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2073\r
022c6d45 2074 @param Arg1 Undefined\r
2075 @param Arg2 Undefined\r
28a00297 2076\r
162ed594 2077 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2078\r
162ed594 2079**/\r
28a00297 2080EFI_STATUS\r
2081EFIAPI\r
2082CoreEfiNotAvailableYetArg2 (\r
1436aea4
MK
2083 UINTN Arg1,\r
2084 UINTN Arg2\r
23c98c94 2085 );\r
28a00297 2086\r
162ed594 2087/**\r
2088 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2089\r
022c6d45 2090 @param Arg1 Undefined\r
2091 @param Arg2 Undefined\r
2092 @param Arg3 Undefined\r
28a00297 2093\r
162ed594 2094 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2095\r
162ed594 2096**/\r
28a00297 2097EFI_STATUS\r
2098EFIAPI\r
2099CoreEfiNotAvailableYetArg3 (\r
1436aea4
MK
2100 UINTN Arg1,\r
2101 UINTN Arg2,\r
2102 UINTN Arg3\r
23c98c94 2103 );\r
28a00297 2104\r
162ed594 2105/**\r
2106 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2107\r
022c6d45 2108 @param Arg1 Undefined\r
2109 @param Arg2 Undefined\r
2110 @param Arg3 Undefined\r
2111 @param Arg4 Undefined\r
28a00297 2112\r
162ed594 2113 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2114\r
162ed594 2115**/\r
28a00297 2116EFI_STATUS\r
2117EFIAPI\r
2118CoreEfiNotAvailableYetArg4 (\r
1436aea4
MK
2119 UINTN Arg1,\r
2120 UINTN Arg2,\r
2121 UINTN Arg3,\r
2122 UINTN Arg4\r
23c98c94 2123 );\r
28a00297 2124\r
162ed594 2125/**\r
2126 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2127\r
022c6d45 2128 @param Arg1 Undefined\r
2129 @param Arg2 Undefined\r
2130 @param Arg3 Undefined\r
2131 @param Arg4 Undefined\r
2132 @param Arg5 Undefined\r
28a00297 2133\r
162ed594 2134 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2135\r
162ed594 2136**/\r
28a00297 2137EFI_STATUS\r
2138EFIAPI\r
2139CoreEfiNotAvailableYetArg5 (\r
1436aea4
MK
2140 UINTN Arg1,\r
2141 UINTN Arg2,\r
2142 UINTN Arg3,\r
2143 UINTN Arg4,\r
2144 UINTN Arg5\r
23c98c94 2145 );\r
28a00297 2146\r
162ed594 2147/**\r
2148 Given a compressed source buffer, this function retrieves the size of the\r
2149 uncompressed buffer and the size of the scratch buffer required to decompress\r
2150 the compressed source buffer.\r
2151\r
2152 The GetInfo() function retrieves the size of the uncompressed buffer and the\r
2153 temporary scratch buffer required to decompress the buffer specified by Source\r
2154 and SourceSize. If the size of the uncompressed buffer or the size of the\r
2155 scratch buffer cannot be determined from the compressed data specified by\r
2156 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the\r
2157 size of the uncompressed buffer is returned in DestinationSize, the size of\r
2158 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.\r
2159 The GetInfo() function does not have scratch buffer available to perform a\r
2160 thorough checking of the validity of the source data. It just retrieves the\r
2161 "Original Size" field from the beginning bytes of the source data and output\r
2162 it as DestinationSize. And ScratchSize is specific to the decompression\r
2163 implementation.\r
2164\r
2165 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2166 @param Source The source buffer containing the compressed data.\r
2167 @param SourceSize The size, in bytes, of the source buffer.\r
2168 @param DestinationSize A pointer to the size, in bytes, of the\r
2169 uncompressed buffer that will be generated when the\r
2170 compressed buffer specified by Source and\r
2171 SourceSize is decompressed.\r
2172 @param ScratchSize A pointer to the size, in bytes, of the scratch\r
2173 buffer that is required to decompress the\r
2174 compressed buffer specified by Source and\r
2175 SourceSize.\r
022c6d45 2176\r
162ed594 2177 @retval EFI_SUCCESS The size of the uncompressed data was returned in\r
2178 DestinationSize and the size of the scratch buffer\r
2179 was returned in ScratchSize.\r
2180 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of\r
2181 the scratch buffer cannot be determined from the\r
2182 compressed data specified by Source and\r
2183 SourceSize.\r
28a00297 2184\r
162ed594 2185**/\r
28a00297 2186EFI_STATUS\r
23c98c94 2187EFIAPI\r
28a00297 2188DxeMainUefiDecompressGetInfo (\r
1436aea4
MK
2189 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2190 IN VOID *Source,\r
2191 IN UINT32 SourceSize,\r
2192 OUT UINT32 *DestinationSize,\r
2193 OUT UINT32 *ScratchSize\r
28a00297 2194 );\r
2195\r
162ed594 2196/**\r
2197 Decompresses a compressed source buffer.\r
2198\r
2199 The Decompress() function extracts decompressed data to its original form.\r
2200 This protocol is designed so that the decompression algorithm can be\r
2201 implemented without using any memory services. As a result, the Decompress()\r
2202 Function is not allowed to call AllocatePool() or AllocatePages() in its\r
db405d1b 2203 implementation. It is the caller's responsibility to allocate and free the\r
162ed594 2204 Destination and Scratch buffers.\r
2205 If the compressed source data specified by Source and SourceSize is\r
2206 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If\r
2207 the compressed source data specified by Source and SourceSize is not in a\r
2208 valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
2209\r
2210 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2211 @param Source The source buffer containing the compressed data.\r
2212 @param SourceSize SourceSizeThe size of source data.\r
2213 @param Destination On output, the destination buffer that contains\r
2214 the uncompressed data.\r
2215 @param DestinationSize The size of the destination buffer. The size of\r
2216 the destination buffer needed is obtained from\r
2217 EFI_DECOMPRESS_PROTOCOL.GetInfo().\r
2218 @param Scratch A temporary scratch buffer that is used to perform\r
2219 the decompression.\r
2220 @param ScratchSize The size of scratch buffer. The size of the\r
2221 scratch buffer needed is obtained from GetInfo().\r
022c6d45 2222\r
162ed594 2223 @retval EFI_SUCCESS Decompression completed successfully, and the\r
2224 uncompressed buffer is returned in Destination.\r
2225 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and\r
2226 SourceSize is corrupted (not in a valid\r
2227 compressed format).\r
2228\r
2229**/\r
28a00297 2230EFI_STATUS\r
2231EFIAPI\r
2232DxeMainUefiDecompress (\r
1436aea4
MK
2233 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2234 IN VOID *Source,\r
2235 IN UINT32 SourceSize,\r
2236 IN OUT VOID *Destination,\r
2237 IN UINT32 DestinationSize,\r
2238 IN OUT VOID *Scratch,\r
2239 IN UINT32 ScratchSize\r
28a00297 2240 );\r
2241\r
162ed594 2242/**\r
2243 SEP member function. This function creates and returns a new section stream\r
2244 handle to represent the new section stream.\r
28a00297 2245\r
022c6d45 2246 @param SectionStreamLength Size in bytes of the section stream.\r
2247 @param SectionStream Buffer containing the new section stream.\r
2248 @param SectionStreamHandle A pointer to a caller allocated UINTN that on\r
2249 output contains the new section stream handle.\r
28a00297 2250\r
162ed594 2251 @retval EFI_SUCCESS The section stream is created successfully.\r
022c6d45 2252 @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r
2253 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2254 of last section.\r
28a00297 2255\r
162ed594 2256**/\r
797a9d67 2257EFI_STATUS\r
2258EFIAPI\r
2259OpenSectionStream (\r
1436aea4
MK
2260 IN UINTN SectionStreamLength,\r
2261 IN VOID *SectionStream,\r
2262 OUT UINTN *SectionStreamHandle\r
797a9d67 2263 );\r
2264\r
162ed594 2265/**\r
2266 SEP member function. Retrieves requested section from section stream.\r
2267\r
2268 @param SectionStreamHandle The section stream from which to extract the\r
2269 requested section.\r
2270 @param SectionType A pointer to the type of section to search for.\r
2271 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,\r
2272 then SectionDefinitionGuid indicates which of\r
2273 these types of sections to search for.\r
2274 @param SectionInstance Indicates which instance of the requested\r
2275 section to return.\r
2276 @param Buffer Double indirection to buffer. If *Buffer is\r
2277 non-null on input, then the buffer is caller\r
2278 allocated. If Buffer is NULL, then the buffer\r
2279 is callee allocated. In either case, the\r
2048c585 2280 required buffer size is returned in *BufferSize.\r
162ed594 2281 @param BufferSize On input, indicates the size of *Buffer if\r
2282 *Buffer is non-null on input. On output,\r
2283 indicates the required size (allocated size if\r
2284 callee allocated) of *Buffer.\r
2285 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
2286 indicates the authentication status of the\r
db405d1b 2287 output buffer. If the input section's\r
162ed594 2288 GuidedSectionHeader.Attributes field\r
2289 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
2290 bit as clear, AuthenticationStatus must return\r
2291 zero. Both local bits (19:16) and aggregate\r
2292 bits (3:0) in AuthenticationStatus are returned\r
2293 by ExtractSection(). These bits reflect the\r
2294 status of the extraction operation. The bit\r
2295 pattern in both regions must be the same, as\r
2296 the local and aggregate authentication statuses\r
2297 have equivalent meaning at this level. If the\r
2298 function returns anything other than\r
2299 EFI_SUCCESS, the value of *AuthenticationStatus\r
2300 is undefined.\r
6c85d162 2301 @param IsFfs3Fv Indicates the FV format.\r
162ed594 2302\r
2303 @retval EFI_SUCCESS Section was retrieved successfully\r
2304 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r
2305 section stream with its\r
2306 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r
2307 but there was no corresponding GUIDed Section\r
2308 Extraction Protocol in the handle database.\r
2309 *Buffer is unmodified.\r
2310 @retval EFI_NOT_FOUND An error was encountered when parsing the\r
2311 SectionStream. This indicates the SectionStream\r
2312 is not correctly formatted.\r
2313 @retval EFI_NOT_FOUND The requested section does not exist.\r
2314 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process\r
2315 the request.\r
2316 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
2317 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is\r
2318 insufficient to contain the requested section.\r
2319 The input buffer is filled and section contents\r
2320 are truncated.\r
2321\r
2322**/\r
797a9d67 2323EFI_STATUS\r
2324EFIAPI\r
2325GetSection (\r
1436aea4
MK
2326 IN UINTN SectionStreamHandle,\r
2327 IN EFI_SECTION_TYPE *SectionType,\r
2328 IN EFI_GUID *SectionDefinitionGuid,\r
2329 IN UINTN SectionInstance,\r
2330 IN VOID **Buffer,\r
2331 IN OUT UINTN *BufferSize,\r
2332 OUT UINT32 *AuthenticationStatus,\r
2333 IN BOOLEAN IsFfs3Fv\r
797a9d67 2334 );\r
2335\r
162ed594 2336/**\r
2337 SEP member function. Deletes an existing section stream\r
2338\r
022c6d45 2339 @param StreamHandleToClose Indicates the stream to close\r
eb1cace2
SZ
2340 @param FreeStreamBuffer TRUE - Need to free stream buffer;\r
2341 FALSE - No need to free stream buffer.\r
162ed594 2342\r
2343 @retval EFI_SUCCESS The section stream is closed sucessfully.\r
022c6d45 2344 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
2345 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2346 of last section.\r
2347\r
2348**/\r
797a9d67 2349EFI_STATUS\r
2350EFIAPI\r
2351CloseSectionStream (\r
1436aea4
MK
2352 IN UINTN StreamHandleToClose,\r
2353 IN BOOLEAN FreeStreamBuffer\r
797a9d67 2354 );\r
2355\r
ec90508b 2356/**\r
2357 Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
2358 table and registers it into the system table.\r
2359\r
2360 Note:\r
2361 This function allocates memory, frees it, and then allocates memory at an\r
2362 address within the initial allocation. Since this function is called early\r
2363 in DXE core initialization (before drivers are dispatched), this should not\r
2364 be a problem.\r
2365\r
2366**/\r
2367VOID\r
2368CoreInitializeDebugImageInfoTable (\r
2369 VOID\r
2370 );\r
2371\r
ec90508b 2372/**\r
2373 Update the CRC32 in the Debug Table.\r
2374 Since the CRC32 service is made available by the Runtime driver, we have to\r
2375 wait for the Runtime Driver to be installed before the CRC32 can be computed.\r
2376 This function is called elsewhere by the core when the runtime architectural\r
2377 protocol is produced.\r
2378\r
2379**/\r
2380VOID\r
2381CoreUpdateDebugTableCrc32 (\r
2382 VOID\r
2383 );\r
2384\r
ec90508b 2385/**\r
2386 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r
2387 the table if it's not large enough to accomidate another entry.\r
2388\r
2389 @param ImageInfoType type of debug image information\r
2390 @param LoadedImage pointer to the loaded image protocol for the image being\r
2391 loaded\r
2392 @param ImageHandle image handle for the image being loaded\r
2393\r
2394**/\r
2395VOID\r
2396CoreNewDebugImageInfoEntry (\r
1436aea4
MK
2397 IN UINT32 ImageInfoType,\r
2398 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2399 IN EFI_HANDLE ImageHandle\r
ec90508b 2400 );\r
2401\r
ec90508b 2402/**\r
2403 Removes and frees an entry from the DebugImageInfo Table.\r
2404\r
2405 @param ImageHandle image handle for the image being unloaded\r
2406\r
2407**/\r
2408VOID\r
2409CoreRemoveDebugImageInfoEntry (\r
1436aea4 2410 EFI_HANDLE ImageHandle\r
ec90508b 2411 );\r
2412\r
ec90508b 2413/**\r
2414 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
2415\r
2416 @param ImageHandle The image handle.\r
2417 @param SystemTable The system table.\r
2418\r
2419 @retval EFI_SUCCESS Successfully initialized firmware volume block\r
2420 driver.\r
2421\r
2422**/\r
2423EFI_STATUS\r
2424EFIAPI\r
2425FwVolBlockDriverInit (\r
1436aea4
MK
2426 IN EFI_HANDLE ImageHandle,\r
2427 IN EFI_SYSTEM_TABLE *SystemTable\r
ec90508b 2428 );\r
2429\r
0c3a1db4
SZ
2430/**\r
2431\r
2432 Get FVB authentication status\r
2433\r
2434 @param FvbProtocol FVB protocol.\r
2435\r
2436 @return Authentication status.\r
2437\r
2438**/\r
2439UINT32\r
2440GetFvbAuthenticationStatus (\r
1436aea4 2441 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol\r
0c3a1db4 2442 );\r
ec90508b 2443\r
2444/**\r
2445 This routine produces a firmware volume block protocol on a given\r
2446 buffer.\r
2447\r
2448 @param BaseAddress base address of the firmware volume image\r
2449 @param Length length of the firmware volume image\r
2450 @param ParentHandle handle of parent firmware volume, if this image\r
0c3a1db4 2451 came from an FV image file and section in another firmware\r
ec90508b 2452 volume (ala capsules)\r
0c3a1db4
SZ
2453 @param AuthenticationStatus Authentication status inherited, if this image\r
2454 came from an FV image file and section in another firmware volume.\r
ec90508b 2455 @param FvProtocol Firmware volume block protocol produced.\r
2456\r
2457 @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
2458 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r
2459 @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r
2460 buffer.\r
2461\r
2462**/\r
2463EFI_STATUS\r
2464ProduceFVBProtocolOnBuffer (\r
1436aea4
MK
2465 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
2466 IN UINT64 Length,\r
2467 IN EFI_HANDLE ParentHandle,\r
2468 IN UINT32 AuthenticationStatus,\r
2469 OUT EFI_HANDLE *FvProtocol OPTIONAL\r
ec90508b 2470 );\r
2471\r
ec90508b 2472/**\r
2473 Raising to the task priority level of the mutual exclusion\r
2474 lock, and then acquires ownership of the lock.\r
2475\r
2476 @param Lock The lock to acquire\r
2477\r
2478 @return Lock owned\r
2479\r
2480**/\r
2481VOID\r
2482CoreAcquireLock (\r
2483 IN EFI_LOCK *Lock\r
2484 );\r
2485\r
ec90508b 2486/**\r
2487 Initialize a basic mutual exclusion lock. Each lock\r
2488 provides mutual exclusion access at it's task priority\r
2489 level. Since there is no-premption (at any TPL) or\r
2490 multiprocessor support, acquiring the lock only consists\r
2491 of raising to the locks TPL.\r
2492\r
2493 @param Lock The EFI_LOCK structure to initialize\r
2494\r
2495 @retval EFI_SUCCESS Lock Owned.\r
2496 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r
2497\r
2498**/\r
2499EFI_STATUS\r
2500CoreAcquireLockOrFail (\r
2501 IN EFI_LOCK *Lock\r
2502 );\r
2503\r
ec90508b 2504/**\r
2505 Releases ownership of the mutual exclusion lock, and\r
2506 restores the previous task priority level.\r
2507\r
2508 @param Lock The lock to release\r
2509\r
2510 @return Lock unowned\r
2511\r
2512**/\r
2513VOID\r
2514CoreReleaseLock (\r
2515 IN EFI_LOCK *Lock\r
2516 );\r
2517\r
2fc46f86 2518/**\r
d1102dba 2519 Read data from Firmware Block by FVB protocol Read.\r
2fc46f86
LG
2520 The data may cross the multi block ranges.\r
2521\r
2522 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r
2523 @param StartLba Pointer to StartLba.\r
2524 On input, the start logical block index from which to read.\r
2525 On output,the end logical block index after reading.\r
2526 @param Offset Pointer to Offset\r
2527 On input, offset into the block at which to begin reading.\r
2528 On output, offset into the end block after reading.\r
2529 @param DataSize Size of data to be read.\r
2530 @param Data Pointer to Buffer that the data will be read into.\r
2531\r
2532 @retval EFI_SUCCESS Successfully read data from firmware block.\r
2533 @retval others\r
2534**/\r
2535EFI_STATUS\r
2536ReadFvbData (\r
1436aea4
MK
2537 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2538 IN OUT EFI_LBA *StartLba,\r
2539 IN OUT UINTN *Offset,\r
2540 IN UINTN DataSize,\r
2541 OUT UINT8 *Data\r
2fc46f86
LG
2542 );\r
2543\r
2544/**\r
2545 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
2546 copy the real length volume header into it.\r
2547\r
2548 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to\r
2549 read the volume header\r
2550 @param FwVolHeader Pointer to pointer to allocated buffer in which\r
2551 the volume header is returned.\r
2552\r
2553 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.\r
2554 @retval EFI_SUCCESS Successfully read volume header to the allocated\r
2555 buffer.\r
4888d15e
SZ
2556 @retval EFI_INVALID_PARAMETER The FV Header signature is not as expected or\r
2557 the file system could not be understood.\r
2fc46f86
LG
2558\r
2559**/\r
2560EFI_STATUS\r
2561GetFwVolHeader (\r
1436aea4
MK
2562 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2563 OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
2fc46f86
LG
2564 );\r
2565\r
2566/**\r
2567 Verify checksum of the firmware volume header.\r
2568\r
2569 @param FvHeader Points to the firmware volume header to be checked\r
2570\r
2571 @retval TRUE Checksum verification passed\r
2572 @retval FALSE Checksum verification failed\r
2573\r
2574**/\r
2575BOOLEAN\r
2576VerifyFvHeaderChecksum (\r
1436aea4 2577 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
2fc46f86
LG
2578 );\r
2579\r
84edd20b
SZ
2580/**\r
2581 Initialize memory profile.\r
2582\r
2583 @param HobStart The start address of the HOB.\r
2584\r
2585**/\r
2586VOID\r
2587MemoryProfileInit (\r
1436aea4 2588 IN VOID *HobStart\r
84edd20b
SZ
2589 );\r
2590\r
2591/**\r
2592 Install memory profile protocol.\r
2593\r
2594**/\r
2595VOID\r
2596MemoryProfileInstallProtocol (\r
2597 VOID\r
2598 );\r
2599\r
2600/**\r
2601 Register image to memory profile.\r
2602\r
2603 @param DriverEntry Image info.\r
2604 @param FileType Image file type.\r
2605\r
1d60fe96
SZ
2606 @return EFI_SUCCESS Register successfully.\r
2607 @return EFI_UNSUPPORTED Memory profile unsupported,\r
2608 or memory profile for the image is not required.\r
2609 @return EFI_OUT_OF_RESOURCES No enough resource for this register.\r
84edd20b
SZ
2610\r
2611**/\r
1d60fe96 2612EFI_STATUS\r
84edd20b
SZ
2613RegisterMemoryProfileImage (\r
2614 IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry,\r
2615 IN EFI_FV_FILETYPE FileType\r
2616 );\r
2617\r
2618/**\r
2619 Unregister image from memory profile.\r
2620\r
2621 @param DriverEntry Image info.\r
2622\r
1d60fe96
SZ
2623 @return EFI_SUCCESS Unregister successfully.\r
2624 @return EFI_UNSUPPORTED Memory profile unsupported,\r
2625 or memory profile for the image is not required.\r
2626 @return EFI_NOT_FOUND The image is not found.\r
84edd20b
SZ
2627\r
2628**/\r
1d60fe96 2629EFI_STATUS\r
84edd20b
SZ
2630UnregisterMemoryProfileImage (\r
2631 IN LOADED_IMAGE_PRIVATE_DATA *DriverEntry\r
2632 );\r
2633\r
2634/**\r
2635 Update memory profile information.\r
2636\r
2637 @param CallerAddress Address of caller who call Allocate or Free.\r
2638 @param Action This Allocate or Free action.\r
2639 @param MemoryType Memory type.\r
1d60fe96 2640 EfiMaxMemoryType means the MemoryType is unknown.\r
84edd20b
SZ
2641 @param Size Buffer size.\r
2642 @param Buffer Buffer address.\r
1d60fe96
SZ
2643 @param ActionString String for memory profile action.\r
2644 Only needed for user defined allocate action.\r
84edd20b 2645\r
1d60fe96
SZ
2646 @return EFI_SUCCESS Memory profile is updated.\r
2647 @return EFI_UNSUPPORTED Memory profile is unsupported,\r
2648 or memory profile for the image is not required,\r
2649 or memory profile for the memory type is not required.\r
2650 @return EFI_ACCESS_DENIED It is during memory profile data getting.\r
2651 @return EFI_ABORTED Memory profile recording is not enabled.\r
2652 @return EFI_OUT_OF_RESOURCES No enough resource to update memory profile for allocate action.\r
2653 @return EFI_NOT_FOUND No matched allocate info found for free action.\r
84edd20b
SZ
2654\r
2655**/\r
1d60fe96
SZ
2656EFI_STATUS\r
2657EFIAPI\r
84edd20b
SZ
2658CoreUpdateProfile (\r
2659 IN EFI_PHYSICAL_ADDRESS CallerAddress,\r
2660 IN MEMORY_PROFILE_ACTION Action,\r
dea0d6bf 2661 IN EFI_MEMORY_TYPE MemoryType,\r
84edd20b 2662 IN UINTN Size, // Valid for AllocatePages/FreePages/AllocatePool\r
1d60fe96
SZ
2663 IN VOID *Buffer,\r
2664 IN CHAR8 *ActionString OPTIONAL\r
84edd20b
SZ
2665 );\r
2666\r
771ee501
EC
2667/**\r
2668 Internal function. Converts a memory range to use new attributes.\r
2669\r
2670 @param Start The first address of the range Must be page\r
2671 aligned\r
2672 @param NumberOfPages The number of pages to convert\r
2673 @param NewAttributes The new attributes value for the range.\r
2674\r
771ee501
EC
2675**/\r
2676VOID\r
2677CoreUpdateMemoryAttributes (\r
2678 IN EFI_PHYSICAL_ADDRESS Start,\r
2679 IN UINT64 NumberOfPages,\r
2680 IN UINT64 NewAttributes\r
2681 );\r
2682\r
67ab389a
JY
2683/**\r
2684 Initialize MemoryAttrubutesTable support.\r
2685**/\r
2686VOID\r
2687EFIAPI\r
2688CoreInitializeMemoryAttributesTable (\r
2689 VOID\r
2690 );\r
2691\r
d0e92aad
JY
2692/**\r
2693 Initialize Memory Protection support.\r
2694**/\r
2695VOID\r
2696EFIAPI\r
2697CoreInitializeMemoryProtection (\r
2698 VOID\r
2699 );\r
2700\r
74a88770
SZ
2701/**\r
2702 Install MemoryAttributesTable on memory allocation.\r
2703\r
2704 @param[in] MemoryType EFI memory type.\r
2705**/\r
2706VOID\r
2707InstallMemoryAttributesTableOnMemoryAllocation (\r
1436aea4 2708 IN EFI_MEMORY_TYPE MemoryType\r
74a88770
SZ
2709 );\r
2710\r
03d486b2
JY
2711/**\r
2712 Insert image record.\r
2713\r
2714 @param RuntimeImage Runtime image information\r
2715**/\r
2716VOID\r
2717InsertImageRecord (\r
2718 IN EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage\r
2719 );\r
2720\r
2721/**\r
2722 Remove Image record.\r
2723\r
2724 @param RuntimeImage Runtime image information\r
2725**/\r
2726VOID\r
2727RemoveImageRecord (\r
2728 IN EFI_RUNTIME_IMAGE_ENTRY *RuntimeImage\r
2729 );\r
2730\r
d0e92aad
JY
2731/**\r
2732 Protect UEFI image.\r
2733\r
2734 @param[in] LoadedImage The loaded image protocol\r
2735 @param[in] LoadedImageDevicePath The loaded image device path protocol\r
2736**/\r
2737VOID\r
2738ProtectUefiImage (\r
1436aea4
MK
2739 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2740 IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath\r
d0e92aad
JY
2741 );\r
2742\r
2743/**\r
2744 Unprotect UEFI image.\r
2745\r
2746 @param[in] LoadedImage The loaded image protocol\r
2747 @param[in] LoadedImageDevicePath The loaded image device path protocol\r
2748**/\r
2749VOID\r
2750UnprotectUefiImage (\r
1436aea4
MK
2751 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2752 IN EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath\r
d0e92aad
JY
2753 );\r
2754\r
2755/**\r
2756 ExitBootServices Callback function for memory protection.\r
2757**/\r
2758VOID\r
2759MemoryProtectionExitBootServicesCallback (\r
2760 VOID\r
2761 );\r
2762\r
7eb927db
AB
2763/**\r
2764 Manage memory permission attributes on a memory range, according to the\r
2765 configured DXE memory protection policy.\r
2766\r
2767 @param OldType The old memory type of the range\r
2768 @param NewType The new memory type of the range\r
2769 @param Memory The base address of the range\r
2770 @param Length The size of the range (in bytes)\r
2771\r
2772 @return EFI_SUCCESS If the the CPU arch protocol is not installed yet\r
2773 @return EFI_SUCCESS If no DXE memory protection policy has been configured\r
2774 @return EFI_SUCCESS If OldType and NewType use the same permission attributes\r
2775 @return other Return value of gCpu->SetMemoryAttributes()\r
2776\r
2777**/\r
2778EFI_STATUS\r
2779EFIAPI\r
2780ApplyMemoryProtectionPolicy (\r
2781 IN EFI_MEMORY_TYPE OldType,\r
2782 IN EFI_MEMORY_TYPE NewType,\r
2783 IN EFI_PHYSICAL_ADDRESS Memory,\r
2784 IN UINT64 Length\r
2785 );\r
2786\r
646127c1
JW
2787/**\r
2788 Merge continous memory map entries whose have same attributes.\r
2789\r
2790 @param MemoryMap A pointer to the buffer in which firmware places\r
2791 the current memory map.\r
2792 @param MemoryMapSize A pointer to the size, in bytes, of the\r
2793 MemoryMap buffer. On input, this is the size of\r
2794 the current memory map. On output,\r
2795 it is the size of new memory map after merge.\r
2796 @param DescriptorSize Size, in bytes, of an individual EFI_MEMORY_DESCRIPTOR.\r
2797**/\r
2798VOID\r
2799MergeMemoryMap (\r
2800 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
2801 IN OUT UINTN *MemoryMapSize,\r
2802 IN UINTN DescriptorSize\r
2803 );\r
2804\r
28a00297 2805#endif\r