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