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