]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/DxeMain.h
Enhance code to more safely and follow coding style.
[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
022c6d45 1250 @retval EFI_INVALID_PARAMETER PoolType not valid\r
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
1412 Creates a general-purpose event structure.\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
1442 Creates a general-purpose event structure\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
28a00297 1472\r
28a00297 1473\r
162ed594 1474/**\r
1475 Sets the type of timer and the trigger time for a timer event.\r
28a00297 1476\r
022c6d45 1477 @param UserEvent The timer event that is to be signaled at the\r
1478 specified time\r
1479 @param Type The type of time that is specified in\r
1480 TriggerTime\r
1481 @param TriggerTime The number of 100ns units until the timer\r
1482 expires\r
28a00297 1483\r
022c6d45 1484 @retval EFI_SUCCESS The event has been set to be signaled at the\r
1485 requested time\r
162ed594 1486 @retval EFI_INVALID_PARAMETER Event or Type is not valid\r
28a00297 1487\r
162ed594 1488**/\r
28a00297 1489EFI_STATUS\r
1490EFIAPI\r
1491CoreSetTimer (\r
23c98c94 1492 IN EFI_EVENT UserEvent,\r
28a00297 1493 IN EFI_TIMER_DELAY Type,\r
1494 IN UINT64 TriggerTime\r
23c98c94 1495 );\r
28a00297 1496\r
28a00297 1497\r
28a00297 1498\r
162ed594 1499/**\r
022c6d45 1500 Signals the event. Queues the event to be notified if needed.\r
28a00297 1501\r
022c6d45 1502 @param UserEvent The event to signal .\r
28a00297 1503\r
022c6d45 1504 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1505 @retval EFI_SUCCESS The event was signaled.\r
28a00297 1506\r
162ed594 1507**/\r
28a00297 1508EFI_STATUS\r
1509EFIAPI\r
1510CoreSignalEvent (\r
23c98c94 1511 IN EFI_EVENT UserEvent\r
1512 );\r
28a00297 1513\r
28a00297 1514\r
28a00297 1515\r
162ed594 1516/**\r
1517 Stops execution until an event is signaled.\r
28a00297 1518\r
022c6d45 1519 @param NumberOfEvents The number of events in the UserEvents array\r
1520 @param UserEvents An array of EFI_EVENT\r
1521 @param UserIndex Pointer to the index of the event which\r
1522 satisfied the wait condition\r
28a00297 1523\r
022c6d45 1524 @retval EFI_SUCCESS The event indicated by Index was signaled.\r
1525 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification\r
1526 function or Event was not a valid type\r
162ed594 1527 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION\r
28a00297 1528\r
162ed594 1529**/\r
28a00297 1530EFI_STATUS\r
1531EFIAPI\r
1532CoreWaitForEvent (\r
23c98c94 1533 IN UINTN NumberOfEvents,\r
1534 IN EFI_EVENT *UserEvents,\r
1535 OUT UINTN *UserIndex\r
1536 );\r
28a00297 1537\r
28a00297 1538\r
28a00297 1539\r
162ed594 1540/**\r
1541 Closes an event and frees the event structure.\r
28a00297 1542\r
022c6d45 1543 @param UserEvent Event to close\r
28a00297 1544\r
022c6d45 1545 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1546 @retval EFI_SUCCESS The event has been closed\r
28a00297 1547\r
162ed594 1548**/\r
28a00297 1549EFI_STATUS\r
1550EFIAPI\r
1551CoreCloseEvent (\r
23c98c94 1552 IN EFI_EVENT UserEvent\r
1553 );\r
28a00297 1554\r
28a00297 1555\r
28a00297 1556\r
162ed594 1557/**\r
1558 Check the status of an event.\r
28a00297 1559\r
022c6d45 1560 @param UserEvent The event to check\r
28a00297 1561\r
022c6d45 1562 @retval EFI_SUCCESS The event is in the signaled state\r
1563 @retval EFI_NOT_READY The event is not in the signaled state\r
162ed594 1564 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL\r
28a00297 1565\r
162ed594 1566**/\r
28a00297 1567EFI_STATUS\r
1568EFIAPI\r
1569CoreCheckEvent (\r
23c98c94 1570 IN EFI_EVENT UserEvent\r
1571 );\r
28a00297 1572\r
28a00297 1573\r
162ed594 1574/**\r
1575 Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
1576 global coherency domain of the processor.\r
28a00297 1577\r
022c6d45 1578 @param GcdMemoryType Memory type of the memory space.\r
1579 @param BaseAddress Base address of the memory space.\r
1580 @param Length Length of the memory space.\r
1581 @param Capabilities alterable attributes of the memory space.\r
28a00297 1582\r
162ed594 1583 @retval EFI_SUCCESS Merged this memory space into GCD map.\r
28a00297 1584\r
162ed594 1585**/\r
28a00297 1586EFI_STATUS\r
3b6ffb6a 1587EFIAPI\r
28a00297 1588CoreAddMemorySpace (\r
1589 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1590 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1591 IN UINT64 Length,\r
1592 IN UINT64 Capabilities\r
23c98c94 1593 );\r
28a00297 1594\r
28a00297 1595\r
162ed594 1596/**\r
1597 Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
1598 I/O resources from the global coherency domain of the processor.\r
28a00297 1599\r
022c6d45 1600 @param GcdAllocateType The type of allocate operation\r
1601 @param GcdMemoryType The desired memory type\r
1602 @param Alignment Align with 2^Alignment\r
1603 @param Length Length to allocate\r
1604 @param BaseAddress Base address to allocate\r
1605 @param ImageHandle The image handle consume the allocated space.\r
1606 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1607\r
022c6d45 1608 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1609 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1610 @retval EFI_SUCCESS Memory space successfully allocated.\r
28a00297 1611\r
162ed594 1612**/\r
28a00297 1613EFI_STATUS\r
3b6ffb6a 1614EFIAPI\r
28a00297 1615CoreAllocateMemorySpace (\r
1616 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1617 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1618 IN UINTN Alignment,\r
1619 IN UINT64 Length,\r
1620 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1621 IN EFI_HANDLE ImageHandle,\r
1622 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1623 );\r
28a00297 1624\r
28a00297 1625\r
162ed594 1626/**\r
1627 Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
1628 I/O resources from the global coherency domain of the processor.\r
28a00297 1629\r
022c6d45 1630 @param BaseAddress Base address of the memory space.\r
1631 @param Length Length of the memory space.\r
28a00297 1632\r
162ed594 1633 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1634\r
162ed594 1635**/\r
28a00297 1636EFI_STATUS\r
3b6ffb6a 1637EFIAPI\r
28a00297 1638CoreFreeMemorySpace (\r
1639 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1640 IN UINT64 Length\r
23c98c94 1641 );\r
28a00297 1642\r
28a00297 1643\r
162ed594 1644/**\r
1645 Removes reserved memory, system memory, or memory-mapped I/O resources from\r
1646 the global coherency domain of the processor.\r
28a00297 1647\r
022c6d45 1648 @param BaseAddress Base address of the memory space.\r
1649 @param Length Length of the memory space.\r
28a00297 1650\r
162ed594 1651 @retval EFI_SUCCESS Successfully remove a segment of memory space.\r
28a00297 1652\r
162ed594 1653**/\r
28a00297 1654EFI_STATUS\r
3b6ffb6a 1655EFIAPI\r
28a00297 1656CoreRemoveMemorySpace (\r
1657 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1658 IN UINT64 Length\r
23c98c94 1659 );\r
28a00297 1660\r
28a00297 1661\r
162ed594 1662/**\r
1663 Retrieves the descriptor for a memory region containing a specified address.\r
28a00297 1664\r
022c6d45 1665 @param BaseAddress Specified start address\r
1666 @param Descriptor Specified length\r
28a00297 1667\r
022c6d45 1668 @retval EFI_INVALID_PARAMETER Invalid parameter\r
162ed594 1669 @retval EFI_SUCCESS Successfully get memory space descriptor.\r
28a00297 1670\r
162ed594 1671**/\r
28a00297 1672EFI_STATUS\r
3b6ffb6a 1673EFIAPI\r
28a00297 1674CoreGetMemorySpaceDescriptor (\r
1675 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1676 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1677 );\r
28a00297 1678\r
28a00297 1679\r
162ed594 1680/**\r
1681 Modifies the attributes for a memory region in the global coherency domain of the\r
1682 processor.\r
28a00297 1683\r
022c6d45 1684 @param BaseAddress Specified start address\r
1685 @param Length Specified length\r
1686 @param Attributes Specified attributes\r
28a00297 1687\r
fc8ff20f 1688 @retval EFI_SUCCESS The attributes were set for the memory region.\r
1689 @retval EFI_INVALID_PARAMETER Length is zero. \r
1690 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory\r
1691 resource range specified by BaseAddress and Length.\r
1692 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource\r
1693 range specified by BaseAddress and Length.\r
1694 @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by\r
1695 BaseAddress and Length cannot be modified.\r
1696 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of\r
1697 the memory resource range.\r
1698 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
1699 not available yet.\r
28a00297 1700\r
162ed594 1701**/\r
28a00297 1702EFI_STATUS\r
3b6ffb6a 1703EFIAPI\r
28a00297 1704CoreSetMemorySpaceAttributes (\r
1705 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1706 IN UINT64 Length,\r
1707 IN UINT64 Attributes\r
23c98c94 1708 );\r
28a00297 1709\r
28a00297 1710\r
162ed594 1711/**\r
1712 Returns a map of the memory resources in the global coherency domain of the\r
1713 processor.\r
28a00297 1714\r
022c6d45 1715 @param NumberOfDescriptors Number of descriptors.\r
1716 @param MemorySpaceMap Descriptor array\r
28a00297 1717\r
022c6d45 1718 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1719 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1720 @retval EFI_SUCCESS Successfully get memory space map.\r
28a00297 1721\r
162ed594 1722**/\r
28a00297 1723EFI_STATUS\r
3b6ffb6a 1724EFIAPI\r
28a00297 1725CoreGetMemorySpaceMap (\r
1726 OUT UINTN *NumberOfDescriptors,\r
1727 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
23c98c94 1728 );\r
28a00297 1729\r
28a00297 1730\r
162ed594 1731/**\r
1732 Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
28a00297 1733\r
022c6d45 1734 @param GcdIoType IO type of the segment.\r
1735 @param BaseAddress Base address of the segment.\r
1736 @param Length Length of the segment.\r
28a00297 1737\r
022c6d45 1738 @retval EFI_SUCCESS Merged this segment into GCD map.\r
162ed594 1739 @retval EFI_INVALID_PARAMETER Parameter not valid\r
28a00297 1740\r
162ed594 1741**/\r
28a00297 1742EFI_STATUS\r
3b6ffb6a 1743EFIAPI\r
28a00297 1744CoreAddIoSpace (\r
1745 IN EFI_GCD_IO_TYPE GcdIoType,\r
1746 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1747 IN UINT64 Length\r
23c98c94 1748 );\r
28a00297 1749\r
28a00297 1750\r
162ed594 1751/**\r
1752 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1753 domain of the processor.\r
28a00297 1754\r
022c6d45 1755 @param GcdAllocateType The type of allocate operation\r
1756 @param GcdIoType The desired IO type\r
1757 @param Alignment Align with 2^Alignment\r
1758 @param Length Length to allocate\r
1759 @param BaseAddress Base address to allocate\r
1760 @param ImageHandle The image handle consume the allocated space.\r
1761 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1762\r
022c6d45 1763 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1764 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1765 @retval EFI_SUCCESS IO space successfully allocated.\r
28a00297 1766\r
162ed594 1767**/\r
28a00297 1768EFI_STATUS\r
3b6ffb6a 1769EFIAPI\r
28a00297 1770CoreAllocateIoSpace (\r
1771 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1772 IN EFI_GCD_IO_TYPE GcdIoType,\r
1773 IN UINTN Alignment,\r
1774 IN UINT64 Length,\r
1775 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1776 IN EFI_HANDLE ImageHandle,\r
1777 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1778 );\r
28a00297 1779\r
28a00297 1780\r
162ed594 1781/**\r
1782 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1783 domain of the processor.\r
28a00297 1784\r
022c6d45 1785 @param BaseAddress Base address of the segment.\r
1786 @param Length Length of the segment.\r
28a00297 1787\r
162ed594 1788 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1789\r
162ed594 1790**/\r
28a00297 1791EFI_STATUS\r
3b6ffb6a 1792EFIAPI\r
28a00297 1793CoreFreeIoSpace (\r
1794 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1795 IN UINT64 Length\r
23c98c94 1796 );\r
28a00297 1797\r
28a00297 1798\r
162ed594 1799/**\r
1800 Removes reserved I/O or I/O resources from the global coherency domain of the\r
1801 processor.\r
28a00297 1802\r
022c6d45 1803 @param BaseAddress Base address of the segment.\r
1804 @param Length Length of the segment.\r
28a00297 1805\r
162ed594 1806 @retval EFI_SUCCESS Successfully removed a segment of IO space.\r
28a00297 1807\r
162ed594 1808**/\r
28a00297 1809EFI_STATUS\r
3b6ffb6a 1810EFIAPI\r
28a00297 1811CoreRemoveIoSpace (\r
1812 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1813 IN UINT64 Length\r
23c98c94 1814 );\r
28a00297 1815\r
28a00297 1816\r
162ed594 1817/**\r
1818 Retrieves the descriptor for an I/O region containing a specified address.\r
28a00297 1819\r
022c6d45 1820 @param BaseAddress Specified start address\r
1821 @param Descriptor Specified length\r
28a00297 1822\r
022c6d45 1823 @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r
162ed594 1824 @retval EFI_SUCCESS Successfully get the IO space descriptor.\r
28a00297 1825\r
162ed594 1826**/\r
28a00297 1827EFI_STATUS\r
3b6ffb6a 1828EFIAPI\r
28a00297 1829CoreGetIoSpaceDescriptor (\r
1830 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1831 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1832 );\r
28a00297 1833\r
28a00297 1834\r
162ed594 1835/**\r
1836 Returns a map of the I/O resources in the global coherency domain of the processor.\r
28a00297 1837\r
022c6d45 1838 @param NumberOfDescriptors Number of descriptors.\r
1839 @param IoSpaceMap Descriptor array\r
28a00297 1840\r
022c6d45 1841 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1842 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1843 @retval EFI_SUCCESS Successfully get IO space map.\r
28a00297 1844\r
162ed594 1845**/\r
28a00297 1846EFI_STATUS\r
3b6ffb6a 1847EFIAPI\r
28a00297 1848CoreGetIoSpaceMap (\r
1849 OUT UINTN *NumberOfDescriptors,\r
1850 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
23c98c94 1851 );\r
28a00297 1852\r
28a00297 1853\r
162ed594 1854/**\r
1855 This is the main Dispatcher for DXE and it exits when there are no more\r
1856 drivers to run. Drain the mScheduledQueue and load and start a PE\r
1857 image for each driver. Search the mDiscoveredList to see if any driver can\r
1858 be placed on the mScheduledQueue. If no drivers are placed on the\r
1859 mScheduledQueue exit the function. On exit it is assumed the Bds()\r
1860 will be called, and when the Bds() exits the Dispatcher will be called\r
1861 again.\r
28a00297 1862\r
022c6d45 1863 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running\r
1864 @retval EFI_NOT_FOUND No DXE Drivers were dispatched\r
1865 @retval EFI_SUCCESS One or more DXE Drivers were dispatched\r
28a00297 1866\r
23c98c94 1867**/\r
28a00297 1868EFI_STATUS\r
1869EFIAPI\r
1870CoreDispatcher (\r
1871 VOID\r
23c98c94 1872 );\r
28a00297 1873\r
162ed594 1874/**\r
1875 Check every driver and locate a matching one. If the driver is found, the Unrequested\r
1876 state flag is cleared.\r
28a00297 1877\r
022c6d45 1878 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1879 the firmware file specified by DriverName.\r
1880 @param DriverName The Driver name to put in the Dependent state.\r
28a00297 1881\r
022c6d45 1882 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was\r
1883 cleared\r
1884 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was\r
1885 not set.\r
28a00297 1886\r
23c98c94 1887**/\r
28a00297 1888EFI_STATUS\r
1889EFIAPI\r
1890CoreSchedule (\r
1891 IN EFI_HANDLE FirmwareVolumeHandle,\r
1892 IN EFI_GUID *DriverName\r
23c98c94 1893 );\r
28a00297 1894\r
28a00297 1895\r
162ed594 1896/**\r
022c6d45 1897 Convert a driver from the Untrused back to the Scheduled state.\r
28a00297 1898\r
022c6d45 1899 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1900 the firmware file specified by DriverName.\r
1901 @param DriverName The Driver name to put in the Scheduled state\r
28a00297 1902\r
022c6d45 1903 @retval EFI_SUCCESS The file was found in the untrusted state, and it\r
1904 was promoted to the trusted state.\r
1905 @retval EFI_NOT_FOUND The file was not found in the untrusted state.\r
28a00297 1906\r
23c98c94 1907**/\r
28a00297 1908EFI_STATUS\r
1909EFIAPI\r
1910CoreTrust (\r
1911 IN EFI_HANDLE FirmwareVolumeHandle,\r
1912 IN EFI_GUID *DriverName\r
23c98c94 1913 );\r
28a00297 1914\r
28a00297 1915\r
162ed594 1916/**\r
1917 This routine is the driver initialization entry point. It initializes the\r
1918 libraries, and registers two notification functions. These notification\r
1919 functions are responsible for building the FV stack dynamically.\r
28a00297 1920\r
022c6d45 1921 @param ImageHandle The image handle.\r
1922 @param SystemTable The system table.\r
28a00297 1923\r
162ed594 1924 @retval EFI_SUCCESS Function successfully returned.\r
28a00297 1925\r
162ed594 1926**/\r
28a00297 1927EFI_STATUS\r
1928EFIAPI\r
1929FwVolDriverInit (\r
1930 IN EFI_HANDLE ImageHandle,\r
1931 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 1932 );\r
28a00297 1933\r
28a00297 1934\r
162ed594 1935/**\r
1936 Entry point of the section extraction code. Initializes an instance of the\r
1937 section extraction interface and installs it on a new handle.\r
1938\r
1939 @param ImageHandle A handle for the image that is initializing this driver\r
1940 @param SystemTable A pointer to the EFI system table\r
28a00297 1941\r
162ed594 1942 @retval EFI_SUCCESS Driver initialized successfully\r
1943 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
1944\r
1945**/\r
28a00297 1946EFI_STATUS\r
1947EFIAPI\r
1948InitializeSectionExtraction (\r
1949 IN EFI_HANDLE ImageHandle,\r
1950 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 1951 );\r
28a00297 1952\r
28a00297 1953\r
162ed594 1954/**\r
1955 This DXE service routine is used to process a firmware volume. In\r
1956 particular, it can be called by BDS to process a single firmware\r
1957 volume found in a capsule.\r
28a00297 1958\r
022c6d45 1959 @param FvHeader pointer to a firmware volume header\r
1960 @param Size the size of the buffer pointed to by FvHeader\r
1961 @param FVProtocolHandle the handle on which a firmware volume protocol\r
1962 was produced for the firmware volume passed in.\r
28a00297 1963\r
022c6d45 1964 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of\r
1965 system resources\r
1966 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted\r
1967 @retval EFI_SUCCESS a firmware volume protocol was produced for the\r
162ed594 1968 firmware volume\r
28a00297 1969\r
162ed594 1970**/\r
28a00297 1971EFI_STATUS\r
3b6ffb6a 1972EFIAPI\r
28a00297 1973CoreProcessFirmwareVolume (\r
23c98c94 1974 IN VOID *FvHeader,\r
022c6d45 1975 IN UINTN Size,\r
23c98c94 1976 OUT EFI_HANDLE *FVProtocolHandle\r
1977 );\r
28a00297 1978\r
1979//\r
1980//Functions used during debug buils\r
1981//\r
162ed594 1982\r
1983/**\r
1984 Displays Architectural protocols that were not loaded and are required for DXE\r
23c98c94 1985 core to function. Only used in Debug Builds.\r
162ed594 1986\r
1987**/\r
28a00297 1988VOID\r
1989CoreDisplayMissingArchProtocols (\r
1990 VOID\r
23c98c94 1991 );\r
022c6d45 1992\r
28a00297 1993\r
162ed594 1994/**\r
1995 Traverse the discovered list for any drivers that were discovered but not loaded\r
1996 because the dependency experessions evaluated to false.\r
28a00297 1997\r
162ed594 1998**/\r
28a00297 1999VOID\r
2000CoreDisplayDiscoveredNotDispatched (\r
2001 VOID\r
23c98c94 2002 );\r
28a00297 2003\r
28a00297 2004\r
162ed594 2005/**\r
23c98c94 2006 Place holder function until all the Boot Services and Runtime Services are\r
2007 available.\r
28a00297 2008\r
162ed594 2009 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2010\r
162ed594 2011**/\r
28a00297 2012EFI_STATUS\r
2013EFIAPI\r
2014CoreEfiNotAvailableYetArg0 (\r
2015 VOID\r
23c98c94 2016 );\r
28a00297 2017\r
28a00297 2018\r
162ed594 2019/**\r
23c98c94 2020 Place holder function until all the Boot Services and Runtime Services are\r
2021 available.\r
28a00297 2022\r
022c6d45 2023 @param Arg1 Undefined\r
28a00297 2024\r
162ed594 2025 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2026\r
162ed594 2027**/\r
28a00297 2028EFI_STATUS\r
2029EFIAPI\r
2030CoreEfiNotAvailableYetArg1 (\r
2031 UINTN Arg1\r
23c98c94 2032 );\r
28a00297 2033\r
28a00297 2034\r
162ed594 2035/**\r
2036 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2037\r
022c6d45 2038 @param Arg1 Undefined\r
2039 @param Arg2 Undefined\r
28a00297 2040\r
162ed594 2041 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2042\r
162ed594 2043**/\r
28a00297 2044EFI_STATUS\r
2045EFIAPI\r
2046CoreEfiNotAvailableYetArg2 (\r
2047 UINTN Arg1,\r
2048 UINTN Arg2\r
23c98c94 2049 );\r
28a00297 2050\r
28a00297 2051\r
162ed594 2052/**\r
2053 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2054\r
022c6d45 2055 @param Arg1 Undefined\r
2056 @param Arg2 Undefined\r
2057 @param Arg3 Undefined\r
28a00297 2058\r
162ed594 2059 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2060\r
162ed594 2061**/\r
28a00297 2062EFI_STATUS\r
2063EFIAPI\r
2064CoreEfiNotAvailableYetArg3 (\r
2065 UINTN Arg1,\r
2066 UINTN Arg2,\r
2067 UINTN Arg3\r
23c98c94 2068 );\r
28a00297 2069\r
28a00297 2070\r
162ed594 2071/**\r
2072 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2073\r
022c6d45 2074 @param Arg1 Undefined\r
2075 @param Arg2 Undefined\r
2076 @param Arg3 Undefined\r
2077 @param Arg4 Undefined\r
28a00297 2078\r
162ed594 2079 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2080\r
162ed594 2081**/\r
28a00297 2082EFI_STATUS\r
2083EFIAPI\r
2084CoreEfiNotAvailableYetArg4 (\r
2085 UINTN Arg1,\r
2086 UINTN Arg2,\r
2087 UINTN Arg3,\r
2088 UINTN Arg4\r
23c98c94 2089 );\r
28a00297 2090\r
28a00297 2091\r
162ed594 2092/**\r
2093 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2094\r
022c6d45 2095 @param Arg1 Undefined\r
2096 @param Arg2 Undefined\r
2097 @param Arg3 Undefined\r
2098 @param Arg4 Undefined\r
2099 @param Arg5 Undefined\r
28a00297 2100\r
162ed594 2101 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2102\r
162ed594 2103**/\r
28a00297 2104EFI_STATUS\r
2105EFIAPI\r
2106CoreEfiNotAvailableYetArg5 (\r
2107 UINTN Arg1,\r
2108 UINTN Arg2,\r
2109 UINTN Arg3,\r
2110 UINTN Arg4,\r
2111 UINTN Arg5\r
23c98c94 2112 );\r
28a00297 2113\r
28a00297 2114\r
162ed594 2115/**\r
2116 Given a compressed source buffer, this function retrieves the size of the\r
2117 uncompressed buffer and the size of the scratch buffer required to decompress\r
2118 the compressed source buffer.\r
2119\r
2120 The GetInfo() function retrieves the size of the uncompressed buffer and the\r
2121 temporary scratch buffer required to decompress the buffer specified by Source\r
2122 and SourceSize. If the size of the uncompressed buffer or the size of the\r
2123 scratch buffer cannot be determined from the compressed data specified by\r
2124 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the\r
2125 size of the uncompressed buffer is returned in DestinationSize, the size of\r
2126 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.\r
2127 The GetInfo() function does not have scratch buffer available to perform a\r
2128 thorough checking of the validity of the source data. It just retrieves the\r
2129 "Original Size" field from the beginning bytes of the source data and output\r
2130 it as DestinationSize. And ScratchSize is specific to the decompression\r
2131 implementation.\r
2132\r
2133 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2134 @param Source The source buffer containing the compressed data.\r
2135 @param SourceSize The size, in bytes, of the source buffer.\r
2136 @param DestinationSize A pointer to the size, in bytes, of the\r
2137 uncompressed buffer that will be generated when the\r
2138 compressed buffer specified by Source and\r
2139 SourceSize is decompressed.\r
2140 @param ScratchSize A pointer to the size, in bytes, of the scratch\r
2141 buffer that is required to decompress the\r
2142 compressed buffer specified by Source and\r
2143 SourceSize.\r
022c6d45 2144\r
162ed594 2145 @retval EFI_SUCCESS The size of the uncompressed data was returned in\r
2146 DestinationSize and the size of the scratch buffer\r
2147 was returned in ScratchSize.\r
2148 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of\r
2149 the scratch buffer cannot be determined from the\r
2150 compressed data specified by Source and\r
2151 SourceSize.\r
28a00297 2152\r
162ed594 2153**/\r
28a00297 2154EFI_STATUS\r
23c98c94 2155EFIAPI\r
28a00297 2156DxeMainUefiDecompressGetInfo (\r
2157 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2158 IN VOID *Source,\r
2159 IN UINT32 SourceSize,\r
2160 OUT UINT32 *DestinationSize,\r
2161 OUT UINT32 *ScratchSize\r
2162 );\r
2163\r
162ed594 2164\r
2165/**\r
2166 Decompresses a compressed source buffer.\r
2167\r
2168 The Decompress() function extracts decompressed data to its original form.\r
2169 This protocol is designed so that the decompression algorithm can be\r
2170 implemented without using any memory services. As a result, the Decompress()\r
2171 Function is not allowed to call AllocatePool() or AllocatePages() in its\r
db405d1b 2172 implementation. It is the caller's responsibility to allocate and free the\r
162ed594 2173 Destination and Scratch buffers.\r
2174 If the compressed source data specified by Source and SourceSize is\r
2175 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If\r
2176 the compressed source data specified by Source and SourceSize is not in a\r
2177 valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
2178\r
2179 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2180 @param Source The source buffer containing the compressed data.\r
2181 @param SourceSize SourceSizeThe size of source data.\r
2182 @param Destination On output, the destination buffer that contains\r
2183 the uncompressed data.\r
2184 @param DestinationSize The size of the destination buffer. The size of\r
2185 the destination buffer needed is obtained from\r
2186 EFI_DECOMPRESS_PROTOCOL.GetInfo().\r
2187 @param Scratch A temporary scratch buffer that is used to perform\r
2188 the decompression.\r
2189 @param ScratchSize The size of scratch buffer. The size of the\r
2190 scratch buffer needed is obtained from GetInfo().\r
022c6d45 2191\r
162ed594 2192 @retval EFI_SUCCESS Decompression completed successfully, and the\r
2193 uncompressed buffer is returned in Destination.\r
2194 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and\r
2195 SourceSize is corrupted (not in a valid\r
2196 compressed format).\r
2197\r
2198**/\r
28a00297 2199EFI_STATUS\r
2200EFIAPI\r
2201DxeMainUefiDecompress (\r
022c6d45 2202 IN EFI_DECOMPRESS_PROTOCOL *This,\r
28a00297 2203 IN VOID *Source,\r
2204 IN UINT32 SourceSize,\r
2205 IN OUT VOID *Destination,\r
2206 IN UINT32 DestinationSize,\r
2207 IN OUT VOID *Scratch,\r
2208 IN UINT32 ScratchSize\r
2209 );\r
2210\r
162ed594 2211/**\r
2212 SEP member function. This function creates and returns a new section stream\r
2213 handle to represent the new section stream.\r
28a00297 2214\r
022c6d45 2215 @param SectionStreamLength Size in bytes of the section stream.\r
2216 @param SectionStream Buffer containing the new section stream.\r
2217 @param SectionStreamHandle A pointer to a caller allocated UINTN that on\r
2218 output contains the new section stream handle.\r
28a00297 2219\r
162ed594 2220 @retval EFI_SUCCESS The section stream is created successfully.\r
022c6d45 2221 @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r
2222 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2223 of last section.\r
28a00297 2224\r
162ed594 2225**/\r
797a9d67 2226EFI_STATUS\r
2227EFIAPI\r
2228OpenSectionStream (\r
2229 IN UINTN SectionStreamLength,\r
2230 IN VOID *SectionStream,\r
2231 OUT UINTN *SectionStreamHandle\r
2232 );\r
2233\r
162ed594 2234\r
2235\r
2236/**\r
2237 SEP member function. Retrieves requested section from section stream.\r
2238\r
2239 @param SectionStreamHandle The section stream from which to extract the\r
2240 requested section.\r
2241 @param SectionType A pointer to the type of section to search for.\r
2242 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,\r
2243 then SectionDefinitionGuid indicates which of\r
2244 these types of sections to search for.\r
2245 @param SectionInstance Indicates which instance of the requested\r
2246 section to return.\r
2247 @param Buffer Double indirection to buffer. If *Buffer is\r
2248 non-null on input, then the buffer is caller\r
2249 allocated. If Buffer is NULL, then the buffer\r
2250 is callee allocated. In either case, the\r
2251 requried buffer size is returned in *BufferSize.\r
2252 @param BufferSize On input, indicates the size of *Buffer if\r
2253 *Buffer is non-null on input. On output,\r
2254 indicates the required size (allocated size if\r
2255 callee allocated) of *Buffer.\r
2256 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
2257 indicates the authentication status of the\r
db405d1b 2258 output buffer. If the input section's\r
162ed594 2259 GuidedSectionHeader.Attributes field\r
2260 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
2261 bit as clear, AuthenticationStatus must return\r
2262 zero. Both local bits (19:16) and aggregate\r
2263 bits (3:0) in AuthenticationStatus are returned\r
2264 by ExtractSection(). These bits reflect the\r
2265 status of the extraction operation. The bit\r
2266 pattern in both regions must be the same, as\r
2267 the local and aggregate authentication statuses\r
2268 have equivalent meaning at this level. If the\r
2269 function returns anything other than\r
2270 EFI_SUCCESS, the value of *AuthenticationStatus\r
2271 is undefined.\r
6c85d162 2272 @param IsFfs3Fv Indicates the FV format.\r
162ed594 2273\r
2274 @retval EFI_SUCCESS Section was retrieved successfully\r
2275 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r
2276 section stream with its\r
2277 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r
2278 but there was no corresponding GUIDed Section\r
2279 Extraction Protocol in the handle database.\r
2280 *Buffer is unmodified.\r
2281 @retval EFI_NOT_FOUND An error was encountered when parsing the\r
2282 SectionStream. This indicates the SectionStream\r
2283 is not correctly formatted.\r
2284 @retval EFI_NOT_FOUND The requested section does not exist.\r
2285 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process\r
2286 the request.\r
2287 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
2288 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is\r
2289 insufficient to contain the requested section.\r
2290 The input buffer is filled and section contents\r
2291 are truncated.\r
2292\r
2293**/\r
797a9d67 2294EFI_STATUS\r
2295EFIAPI\r
2296GetSection (\r
2297 IN UINTN SectionStreamHandle,\r
2298 IN EFI_SECTION_TYPE *SectionType,\r
2299 IN EFI_GUID *SectionDefinitionGuid,\r
2300 IN UINTN SectionInstance,\r
2301 IN VOID **Buffer,\r
2302 IN OUT UINTN *BufferSize,\r
6c85d162
SZ
2303 OUT UINT32 *AuthenticationStatus,\r
2304 IN BOOLEAN IsFfs3Fv\r
797a9d67 2305 );\r
2306\r
162ed594 2307\r
2308/**\r
2309 SEP member function. Deletes an existing section stream\r
2310\r
022c6d45 2311 @param StreamHandleToClose Indicates the stream to close\r
162ed594 2312\r
2313 @retval EFI_SUCCESS The section stream is closed sucessfully.\r
022c6d45 2314 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
2315 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2316 of last section.\r
2317\r
2318**/\r
797a9d67 2319EFI_STATUS\r
2320EFIAPI\r
2321CloseSectionStream (\r
23c98c94 2322 IN UINTN StreamHandleToClose\r
797a9d67 2323 );\r
2324\r
ec90508b 2325/**\r
2326 Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
2327 table and registers it into the system table.\r
2328\r
2329 Note:\r
2330 This function allocates memory, frees it, and then allocates memory at an\r
2331 address within the initial allocation. Since this function is called early\r
2332 in DXE core initialization (before drivers are dispatched), this should not\r
2333 be a problem.\r
2334\r
2335**/\r
2336VOID\r
2337CoreInitializeDebugImageInfoTable (\r
2338 VOID\r
2339 );\r
2340\r
2341\r
2342/**\r
2343 Update the CRC32 in the Debug Table.\r
2344 Since the CRC32 service is made available by the Runtime driver, we have to\r
2345 wait for the Runtime Driver to be installed before the CRC32 can be computed.\r
2346 This function is called elsewhere by the core when the runtime architectural\r
2347 protocol is produced.\r
2348\r
2349**/\r
2350VOID\r
2351CoreUpdateDebugTableCrc32 (\r
2352 VOID\r
2353 );\r
2354\r
2355\r
2356/**\r
2357 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r
2358 the table if it's not large enough to accomidate another entry.\r
2359\r
2360 @param ImageInfoType type of debug image information\r
2361 @param LoadedImage pointer to the loaded image protocol for the image being\r
2362 loaded\r
2363 @param ImageHandle image handle for the image being loaded\r
2364\r
2365**/\r
2366VOID\r
2367CoreNewDebugImageInfoEntry (\r
2368 IN UINT32 ImageInfoType,\r
2369 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2370 IN EFI_HANDLE ImageHandle\r
2371 );\r
2372\r
2373\r
2374/**\r
2375 Removes and frees an entry from the DebugImageInfo Table.\r
2376\r
2377 @param ImageHandle image handle for the image being unloaded\r
2378\r
2379**/\r
2380VOID\r
2381CoreRemoveDebugImageInfoEntry (\r
2382 EFI_HANDLE ImageHandle\r
2383 );\r
2384\r
2385\r
2386/**\r
2387 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
2388\r
2389 @param ImageHandle The image handle.\r
2390 @param SystemTable The system table.\r
2391\r
2392 @retval EFI_SUCCESS Successfully initialized firmware volume block\r
2393 driver.\r
2394\r
2395**/\r
2396EFI_STATUS\r
2397EFIAPI\r
2398FwVolBlockDriverInit (\r
2399 IN EFI_HANDLE ImageHandle,\r
2400 IN EFI_SYSTEM_TABLE *SystemTable\r
2401 );\r
2402\r
2403\r
2404/**\r
2405 This routine produces a firmware volume block protocol on a given\r
2406 buffer.\r
2407\r
2408 @param BaseAddress base address of the firmware volume image\r
2409 @param Length length of the firmware volume image\r
2410 @param ParentHandle handle of parent firmware volume, if this image\r
2411 came from an FV image file in another firmware\r
2412 volume (ala capsules)\r
2413 @param FvProtocol Firmware volume block protocol produced.\r
2414\r
2415 @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
2416 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r
2417 @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r
2418 buffer.\r
2419\r
2420**/\r
2421EFI_STATUS\r
2422ProduceFVBProtocolOnBuffer (\r
2423 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
2424 IN UINT64 Length,\r
2425 IN EFI_HANDLE ParentHandle,\r
2426 OUT EFI_HANDLE *FvProtocol OPTIONAL\r
2427 );\r
2428\r
2429\r
2430/**\r
2431 Raising to the task priority level of the mutual exclusion\r
2432 lock, and then acquires ownership of the lock.\r
2433\r
2434 @param Lock The lock to acquire\r
2435\r
2436 @return Lock owned\r
2437\r
2438**/\r
2439VOID\r
2440CoreAcquireLock (\r
2441 IN EFI_LOCK *Lock\r
2442 );\r
2443\r
2444\r
2445/**\r
2446 Initialize a basic mutual exclusion lock. Each lock\r
2447 provides mutual exclusion access at it's task priority\r
2448 level. Since there is no-premption (at any TPL) or\r
2449 multiprocessor support, acquiring the lock only consists\r
2450 of raising to the locks TPL.\r
2451\r
2452 @param Lock The EFI_LOCK structure to initialize\r
2453\r
2454 @retval EFI_SUCCESS Lock Owned.\r
2455 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r
2456\r
2457**/\r
2458EFI_STATUS\r
2459CoreAcquireLockOrFail (\r
2460 IN EFI_LOCK *Lock\r
2461 );\r
2462\r
2463\r
2464/**\r
2465 Releases ownership of the mutual exclusion lock, and\r
2466 restores the previous task priority level.\r
2467\r
2468 @param Lock The lock to release\r
2469\r
2470 @return Lock unowned\r
2471\r
2472**/\r
2473VOID\r
2474CoreReleaseLock (\r
2475 IN EFI_LOCK *Lock\r
2476 );\r
2477\r
54cd17e9 2478\r
2479/**\r
2480 An empty function to pass error checking of CreateEventEx ().\r
2481\r
2482 @param Event Event whose notification function is being invoked.\r
2483 @param Context Pointer to the notification function's context,\r
2484 which is implementation-dependent.\r
2485\r
2486**/\r
2487VOID\r
2488EFIAPI\r
2489CoreEmptyCallbackFunction (\r
2490 IN EFI_EVENT Event,\r
2491 IN VOID *Context\r
2492 );\r
2493\r
2fc46f86
LG
2494/**\r
2495 Read data from Firmware Block by FVB protocol Read. \r
2496 The data may cross the multi block ranges.\r
2497\r
2498 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r
2499 @param StartLba Pointer to StartLba.\r
2500 On input, the start logical block index from which to read.\r
2501 On output,the end logical block index after reading.\r
2502 @param Offset Pointer to Offset\r
2503 On input, offset into the block at which to begin reading.\r
2504 On output, offset into the end block after reading.\r
2505 @param DataSize Size of data to be read.\r
2506 @param Data Pointer to Buffer that the data will be read into.\r
2507\r
2508 @retval EFI_SUCCESS Successfully read data from firmware block.\r
2509 @retval others\r
2510**/\r
2511EFI_STATUS\r
2512ReadFvbData (\r
2513 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2514 IN OUT EFI_LBA *StartLba,\r
2515 IN OUT UINTN *Offset,\r
2516 IN UINTN DataSize,\r
2517 OUT UINT8 *Data\r
2518 );\r
2519\r
2520/**\r
2521 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
2522 copy the real length volume header into it.\r
2523\r
2524 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to\r
2525 read the volume header\r
2526 @param FwVolHeader Pointer to pointer to allocated buffer in which\r
2527 the volume header is returned.\r
2528\r
2529 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.\r
2530 @retval EFI_SUCCESS Successfully read volume header to the allocated\r
2531 buffer.\r
2532\r
2533**/\r
2534EFI_STATUS\r
2535GetFwVolHeader (\r
2536 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2537 OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
2538 );\r
2539\r
2540/**\r
2541 Verify checksum of the firmware volume header.\r
2542\r
2543 @param FvHeader Points to the firmware volume header to be checked\r
2544\r
2545 @retval TRUE Checksum verification passed\r
2546 @retval FALSE Checksum verification failed\r
2547\r
2548**/\r
2549BOOLEAN\r
2550VerifyFvHeaderChecksum (\r
2551 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
2552 );\r
2553\r
28a00297 2554#endif\r