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