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