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