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