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