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