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