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