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