]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Dxe/DxeMain.h
TempRam Done PPI definition in PI1.2.1
[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
5a7b9bbe 5Copyright (c) 2006 - 2013, 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
5a7b9bbe
SQ
676 @retval EFI_SUCCESS All the protocol interface was installed.\r
677 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.\r
678 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in\r
679 the handle database.\r
022c6d45 680 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
5a7b9bbe 681 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.\r
28a00297 682\r
162ed594 683**/\r
28a00297 684EFI_STATUS\r
685EFIAPI\r
686CoreInstallMultipleProtocolInterfaces (\r
687 IN OUT EFI_HANDLE *Handle,\r
688 ...\r
23c98c94 689 );\r
28a00297 690\r
28a00297 691\r
28a00297 692\r
162ed594 693/**\r
694 Uninstalls a list of protocol interface in the boot services environment.\r
695 This function calls UnisatllProtocolInterface() in a loop. This is\r
696 basically a lib function to save space.\r
28a00297 697\r
022c6d45 698 @param Handle The handle to uninstall the protocol\r
699 @param ... EFI_GUID followed by protocol instance. A NULL\r
700 terminates the list. The pairs are the\r
701 arguments to UninstallProtocolInterface(). All\r
702 the protocols are added to Handle.\r
28a00297 703\r
162ed594 704 @return Status code\r
28a00297 705\r
162ed594 706**/\r
28a00297 707EFI_STATUS\r
708EFIAPI\r
709CoreUninstallMultipleProtocolInterfaces (\r
710 IN EFI_HANDLE Handle,\r
711 ...\r
23c98c94 712 );\r
28a00297 713\r
28a00297 714\r
28a00297 715\r
162ed594 716/**\r
717 Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.\r
28a00297 718\r
022c6d45 719 @param UserHandle Handle on which the interface is to be\r
720 reinstalled\r
721 @param Protocol The numeric ID of the interface\r
722 @param OldInterface A pointer to the old interface\r
723 @param NewInterface A pointer to the new interface\r
28a00297 724\r
162ed594 725 @retval EFI_SUCCESS The protocol interface was installed\r
726 @retval EFI_NOT_FOUND The OldInterface on the handle was not found\r
727 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
28a00297 728\r
162ed594 729**/\r
28a00297 730EFI_STATUS\r
731EFIAPI\r
732CoreReinstallProtocolInterface (\r
733 IN EFI_HANDLE UserHandle,\r
734 IN EFI_GUID *Protocol,\r
735 IN VOID *OldInterface,\r
736 IN VOID *NewInterface\r
23c98c94 737 );\r
28a00297 738\r
739\r
28a00297 740\r
162ed594 741/**\r
742 Uninstalls all instances of a protocol:interfacer from a handle.\r
743 If the last protocol interface is remove from the handle, the\r
744 handle is freed.\r
28a00297 745\r
022c6d45 746 @param UserHandle The handle to remove the protocol handler from\r
747 @param Protocol The protocol, of protocol:interface, to remove\r
748 @param Interface The interface, of protocol:interface, to remove\r
28a00297 749\r
022c6d45 750 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
162ed594 751 @retval EFI_SUCCESS Protocol interface successfully uninstalled.\r
28a00297 752\r
162ed594 753**/\r
28a00297 754EFI_STATUS\r
755EFIAPI\r
756CoreUninstallProtocolInterface (\r
757 IN EFI_HANDLE UserHandle,\r
758 IN EFI_GUID *Protocol,\r
759 IN VOID *Interface\r
23c98c94 760 );\r
28a00297 761\r
28a00297 762\r
28a00297 763\r
162ed594 764/**\r
765 Queries a handle to determine if it supports a specified protocol.\r
28a00297 766\r
022c6d45 767 @param UserHandle The handle being queried.\r
768 @param Protocol The published unique identifier of the protocol.\r
769 @param Interface Supplies the address where a pointer to the\r
770 corresponding Protocol Interface is returned.\r
28a00297 771\r
162ed594 772 @return The requested protocol interface for the handle\r
28a00297 773\r
162ed594 774**/\r
28a00297 775EFI_STATUS\r
776EFIAPI\r
777CoreHandleProtocol (\r
23c98c94 778 IN EFI_HANDLE UserHandle,\r
779 IN EFI_GUID *Protocol,\r
780 OUT VOID **Interface\r
781 );\r
28a00297 782\r
28a00297 783\r
28a00297 784\r
162ed594 785/**\r
786 Locates the installed protocol handler for the handle, and\r
787 invokes it to obtain the protocol interface. Usage information\r
788 is registered in the protocol data base.\r
28a00297 789\r
022c6d45 790 @param UserHandle The handle to obtain the protocol interface on\r
791 @param Protocol The ID of the protocol\r
792 @param Interface The location to return the protocol interface\r
793 @param ImageHandle The handle of the Image that is opening the\r
794 protocol interface specified by Protocol and\r
795 Interface.\r
796 @param ControllerHandle The controller handle that is requiring this\r
797 interface.\r
798 @param Attributes The open mode of the protocol interface\r
799 specified by Handle and Protocol.\r
800\r
801 @retval EFI_INVALID_PARAMETER Protocol is NULL.\r
162ed594 802 @retval EFI_SUCCESS Get the protocol interface.\r
28a00297 803\r
162ed594 804**/\r
28a00297 805EFI_STATUS\r
806EFIAPI\r
807CoreOpenProtocol (\r
808 IN EFI_HANDLE UserHandle,\r
809 IN EFI_GUID *Protocol,\r
810 OUT VOID **Interface OPTIONAL,\r
811 IN EFI_HANDLE ImageHandle,\r
812 IN EFI_HANDLE ControllerHandle,\r
813 IN UINT32 Attributes\r
23c98c94 814 );\r
28a00297 815\r
28a00297 816\r
28a00297 817\r
162ed594 818/**\r
819 Return information about Opened protocols in the system\r
28a00297 820\r
022c6d45 821 @param UserHandle The handle to close the protocol interface on\r
822 @param Protocol The ID of the protocol\r
823 @param EntryBuffer A pointer to a buffer of open protocol\r
824 information in the form of\r
825 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.\r
162ed594 826 @param EntryCount Number of EntryBuffer entries\r
28a00297 827\r
162ed594 828**/\r
28a00297 829EFI_STATUS\r
830EFIAPI\r
831CoreOpenProtocolInformation (\r
832 IN EFI_HANDLE UserHandle,\r
833 IN EFI_GUID *Protocol,\r
834 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,\r
835 OUT UINTN *EntryCount\r
23c98c94 836 );\r
28a00297 837\r
28a00297 838\r
28a00297 839\r
162ed594 840/**\r
841 Closes a protocol on a handle that was opened using OpenProtocol().\r
28a00297 842\r
022c6d45 843 @param UserHandle The handle for the protocol interface that was\r
844 previously opened with OpenProtocol(), and is\r
845 now being closed.\r
846 @param Protocol The published unique identifier of the protocol.\r
847 It is the caller's responsibility to pass in a\r
848 valid GUID.\r
849 @param AgentHandle The handle of the agent that is closing the\r
850 protocol interface.\r
851 @param ControllerHandle If the agent that opened a protocol is a driver\r
852 that follows the EFI Driver Model, then this\r
853 parameter is the controller handle that required\r
854 the protocol interface. If the agent does not\r
855 follow the EFI Driver Model, then this parameter\r
856 is optional and may be NULL.\r
857\r
858 @retval EFI_SUCCESS The protocol instance was closed.\r
859 @retval EFI_INVALID_PARAMETER Handle, AgentHandle or ControllerHandle is not a\r
860 valid EFI_HANDLE.\r
861 @retval EFI_NOT_FOUND Can not find the specified protocol or\r
162ed594 862 AgentHandle.\r
28a00297 863\r
162ed594 864**/\r
28a00297 865EFI_STATUS\r
866EFIAPI\r
867CoreCloseProtocol (\r
868 IN EFI_HANDLE UserHandle,\r
869 IN EFI_GUID *Protocol,\r
162ed594 870 IN EFI_HANDLE AgentHandle,\r
022c6d45 871 IN EFI_HANDLE ControllerHandle\r
23c98c94 872 );\r
28a00297 873\r
28a00297 874\r
28a00297 875\r
162ed594 876/**\r
877 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated\r
878 from pool.\r
879\r
022c6d45 880 @param UserHandle The handle from which to retrieve the list of\r
881 protocol interface GUIDs.\r
882 @param ProtocolBuffer A pointer to the list of protocol interface GUID\r
883 pointers that are installed on Handle.\r
884 @param ProtocolBufferCount A pointer to the number of GUID pointers present\r
885 in ProtocolBuffer.\r
886\r
887 @retval EFI_SUCCESS The list of protocol interface GUIDs installed\r
888 on Handle was returned in ProtocolBuffer. The\r
889 number of protocol interface GUIDs was returned\r
890 in ProtocolBufferCount.\r
891 @retval EFI_INVALID_PARAMETER Handle is NULL.\r
892 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.\r
893 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.\r
894 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.\r
895 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
162ed594 896 results.\r
28a00297 897\r
162ed594 898**/\r
28a00297 899EFI_STATUS\r
900EFIAPI\r
901CoreProtocolsPerHandle (\r
23c98c94 902 IN EFI_HANDLE UserHandle,\r
903 OUT EFI_GUID ***ProtocolBuffer,\r
904 OUT UINTN *ProtocolBufferCount\r
905 );\r
28a00297 906\r
28a00297 907\r
28a00297 908\r
162ed594 909/**\r
910 Add a new protocol notification record for the request protocol.\r
28a00297 911\r
022c6d45 912 @param Protocol The requested protocol to add the notify\r
913 registration\r
914 @param Event The event to signal\r
915 @param Registration Returns the registration record\r
28a00297 916\r
022c6d45 917 @retval EFI_INVALID_PARAMETER Invalid parameter\r
918 @retval EFI_SUCCESS Successfully returned the registration record\r
162ed594 919 that has been added\r
28a00297 920\r
162ed594 921**/\r
28a00297 922EFI_STATUS\r
923EFIAPI\r
924CoreRegisterProtocolNotify (\r
23c98c94 925 IN EFI_GUID *Protocol,\r
926 IN EFI_EVENT Event,\r
022c6d45 927 OUT VOID **Registration\r
23c98c94 928 );\r
022c6d45 929\r
28a00297 930\r
ec90508b 931/**\r
932 Removes all the events in the protocol database that match Event.\r
933\r
934 @param Event The event to search for in the protocol\r
935 database.\r
936\r
937 @return EFI_SUCCESS when done searching the entire database.\r
938\r
939**/\r
940EFI_STATUS\r
941CoreUnregisterProtocolNotify (\r
942 IN EFI_EVENT Event\r
943 );\r
944\r
28a00297 945\r
162ed594 946/**\r
947 Locates the requested handle(s) and returns them in Buffer.\r
28a00297 948\r
022c6d45 949 @param SearchType The type of search to perform to locate the\r
950 handles\r
951 @param Protocol The protocol to search for\r
952 @param SearchKey Dependant on SearchType\r
953 @param BufferSize On input the size of Buffer. On output the\r
954 size of data returned.\r
955 @param Buffer The buffer to return the results in\r
28a00297 956\r
022c6d45 957 @retval EFI_BUFFER_TOO_SMALL Buffer too small, required buffer size is\r
958 returned in BufferSize.\r
959 @retval EFI_INVALID_PARAMETER Invalid parameter\r
960 @retval EFI_SUCCESS Successfully found the requested handle(s) and\r
162ed594 961 returns them in Buffer.\r
28a00297 962\r
162ed594 963**/\r
28a00297 964EFI_STATUS\r
965EFIAPI\r
966CoreLocateHandle (\r
23c98c94 967 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
968 IN EFI_GUID *Protocol OPTIONAL,\r
969 IN VOID *SearchKey OPTIONAL,\r
970 IN OUT UINTN *BufferSize,\r
971 OUT EFI_HANDLE *Buffer\r
972 );\r
022c6d45 973\r
28a00297 974\r
28a00297 975\r
162ed594 976/**\r
977 Locates the handle to a device on the device path that best matches the specified protocol.\r
28a00297 978\r
022c6d45 979 @param Protocol The protocol to search for.\r
980 @param DevicePath On input, a pointer to a pointer to the device\r
981 path. On output, the device path pointer is\r
982 modified to point to the remaining part of the\r
983 devicepath.\r
984 @param Device A pointer to the returned device handle.\r
28a00297 985\r
022c6d45 986 @retval EFI_SUCCESS The resulting handle was returned.\r
987 @retval EFI_NOT_FOUND No handles matched the search.\r
162ed594 988 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
28a00297 989\r
162ed594 990**/\r
28a00297 991EFI_STATUS\r
992EFIAPI\r
993CoreLocateDevicePath (\r
23c98c94 994 IN EFI_GUID *Protocol,\r
995 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
996 OUT EFI_HANDLE *Device\r
997 );\r
28a00297 998\r
022c6d45 999\r
28a00297 1000\r
162ed594 1001/**\r
1002 Function returns an array of handles that support the requested protocol\r
1003 in a buffer allocated from pool. This is a version of CoreLocateHandle()\r
1004 that allocates a buffer for the caller.\r
28a00297 1005\r
022c6d45 1006 @param SearchType Specifies which handle(s) are to be returned.\r
1007 @param Protocol Provides the protocol to search by. This\r
1008 parameter is only valid for SearchType\r
1009 ByProtocol.\r
1010 @param SearchKey Supplies the search key depending on the\r
1011 SearchType.\r
1012 @param NumberHandles The number of handles returned in Buffer.\r
1013 @param Buffer A pointer to the buffer to return the requested\r
1014 array of handles that support Protocol.\r
1015\r
1016 @retval EFI_SUCCESS The result array of handles was returned.\r
1017 @retval EFI_NOT_FOUND No handles match the search.\r
1018 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the\r
1019 matching results.\r
1020 @retval EFI_INVALID_PARAMETER One or more paramters are not valid.\r
28a00297 1021\r
162ed594 1022**/\r
28a00297 1023EFI_STATUS\r
1024EFIAPI\r
1025CoreLocateHandleBuffer (\r
23c98c94 1026 IN EFI_LOCATE_SEARCH_TYPE SearchType,\r
1027 IN EFI_GUID *Protocol OPTIONAL,\r
1028 IN VOID *SearchKey OPTIONAL,\r
1029 IN OUT UINTN *NumberHandles,\r
1030 OUT EFI_HANDLE **Buffer\r
1031 );\r
28a00297 1032\r
022c6d45 1033\r
28a00297 1034\r
162ed594 1035/**\r
1036 Return the first Protocol Interface that matches the Protocol GUID. If\r
8bc18cc6 1037 Registration is passed in, return a Protocol Instance that was just add\r
1038 to the system. If Registration is NULL return the first Protocol Interface\r
162ed594 1039 you find.\r
28a00297 1040\r
44310938 1041 @param Protocol The protocol to search for\r
1042 @param Registration Optional Registration Key returned from\r
1043 RegisterProtocolNotify()\r
1044 @param Interface Return the Protocol interface (instance).\r
28a00297 1045\r
44310938 1046 @retval EFI_SUCCESS If a valid Interface is returned\r
1047 @retval EFI_INVALID_PARAMETER Invalid parameter\r
162ed594 1048 @retval EFI_NOT_FOUND Protocol interface not found\r
28a00297 1049\r
162ed594 1050**/\r
28a00297 1051EFI_STATUS\r
1052EFIAPI\r
1053CoreLocateProtocol (\r
23c98c94 1054 IN EFI_GUID *Protocol,\r
1055 IN VOID *Registration OPTIONAL,\r
1056 OUT VOID **Interface\r
1057 );\r
28a00297 1058\r
28a00297 1059\r
162ed594 1060/**\r
1061 return handle database key.\r
28a00297 1062\r
28a00297 1063\r
162ed594 1064 @return Handle database key.\r
28a00297 1065\r
162ed594 1066**/\r
28a00297 1067UINT64\r
1068CoreGetHandleDatabaseKey (\r
1069 VOID\r
23c98c94 1070 );\r
28a00297 1071\r
28a00297 1072\r
162ed594 1073/**\r
1074 Go connect any handles that were created or modified while a image executed.\r
28a00297 1075\r
022c6d45 1076 @param Key The Key to show that the handle has been\r
162ed594 1077 created/modified\r
28a00297 1078\r
162ed594 1079**/\r
28a00297 1080VOID\r
1081CoreConnectHandlesByKey (\r
1082 UINT64 Key\r
23c98c94 1083 );\r
28a00297 1084\r
28a00297 1085\r
28a00297 1086\r
162ed594 1087/**\r
1088 Connects one or more drivers to a controller.\r
28a00297 1089\r
bc2dfdbc
LG
1090 @param ControllerHandle The handle of the controller to which driver(s) are to be connected.\r
1091 @param DriverImageHandle A pointer to an ordered list handles that support the\r
1092 EFI_DRIVER_BINDING_PROTOCOL.\r
1093 @param RemainingDevicePath A pointer to the device path that specifies a child of the\r
1094 controller specified by ControllerHandle.\r
1095 @param Recursive If TRUE, then ConnectController() is called recursively\r
1096 until the entire tree of controllers below the controller specified\r
1097 by ControllerHandle have been created. If FALSE, then\r
1098 the tree of controllers is only expanded one level.\r
1099\r
1100 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.\r
1101 2) No drivers were connected to ControllerHandle, but\r
1102 RemainingDevicePath is not NULL, and it is an End Device\r
1103 Path Node.\r
1104 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
1105 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances\r
1106 present in the system.\r
1107 2) No drivers were connected to ControllerHandle.\r
1108 @retval EFI_SECURITY_VIOLATION \r
1109 The user has no permission to start UEFI device drivers on the device path \r
1110 associated with the ControllerHandle or specified by the RemainingDevicePath.\r
28a00297 1111\r
162ed594 1112**/\r
022c6d45 1113EFI_STATUS\r
28a00297 1114EFIAPI\r
1115CoreConnectController (\r
1116 IN EFI_HANDLE ControllerHandle,\r
1117 IN EFI_HANDLE *DriverImageHandle OPTIONAL,\r
1118 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL,\r
1119 IN BOOLEAN Recursive\r
23c98c94 1120 );\r
28a00297 1121\r
28a00297 1122\r
28a00297 1123\r
162ed594 1124/**\r
1125 Disonnects a controller from a driver\r
28a00297 1126\r
022c6d45 1127 @param ControllerHandle ControllerHandle The handle of\r
1128 the controller from which\r
1129 driver(s) are to be\r
1130 disconnected.\r
1131 @param DriverImageHandle DriverImageHandle The driver to\r
1132 disconnect from ControllerHandle.\r
1133 @param ChildHandle ChildHandle The handle of the\r
1134 child to destroy.\r
1135\r
1136 @retval EFI_SUCCESS One or more drivers were\r
1137 disconnected from the controller.\r
1138 @retval EFI_SUCCESS On entry, no drivers are managing\r
1139 ControllerHandle.\r
1140 @retval EFI_SUCCESS DriverImageHandle is not NULL,\r
1141 and on entry DriverImageHandle is\r
1142 not managing ControllerHandle.\r
284ee2e8 1143 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
022c6d45 1144 @retval EFI_INVALID_PARAMETER DriverImageHandle is not NULL,\r
1145 and it is not a valid EFI_HANDLE.\r
1146 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL, and it\r
1147 is not a valid EFI_HANDLE.\r
1148 @retval EFI_OUT_OF_RESOURCES There are not enough resources\r
1149 available to disconnect any\r
1150 drivers from ControllerHandle.\r
1151 @retval EFI_DEVICE_ERROR The controller could not be\r
1152 disconnected because of a device\r
162ed594 1153 error.\r
28a00297 1154\r
162ed594 1155**/\r
022c6d45 1156EFI_STATUS\r
28a00297 1157EFIAPI\r
1158CoreDisconnectController (\r
23c98c94 1159 IN EFI_HANDLE ControllerHandle,\r
1160 IN EFI_HANDLE DriverImageHandle OPTIONAL,\r
1161 IN EFI_HANDLE ChildHandle OPTIONAL\r
1162 );\r
28a00297 1163\r
28a00297 1164\r
28a00297 1165\r
162ed594 1166/**\r
1167 Allocates pages from the memory map.\r
28a00297 1168\r
022c6d45 1169 @param Type The type of allocation to perform\r
1170 @param MemoryType The type of memory to turn the allocated pages\r
1171 into\r
1172 @param NumberOfPages The number of pages to allocate\r
1173 @param Memory A pointer to receive the base allocated memory\r
1174 address\r
28a00297 1175\r
162ed594 1176 @return Status. On success, Memory is filled in with the base address allocated\r
022c6d45 1177 @retval EFI_INVALID_PARAMETER Parameters violate checking rules defined in\r
1178 spec.\r
1179 @retval EFI_NOT_FOUND Could not allocate pages match the requirement.\r
1180 @retval EFI_OUT_OF_RESOURCES No enough pages to allocate.\r
162ed594 1181 @retval EFI_SUCCESS Pages successfully allocated.\r
28a00297 1182\r
162ed594 1183**/\r
28a00297 1184EFI_STATUS\r
1185EFIAPI\r
1186CoreAllocatePages (\r
23c98c94 1187 IN EFI_ALLOCATE_TYPE Type,\r
1188 IN EFI_MEMORY_TYPE MemoryType,\r
1189 IN UINTN NumberOfPages,\r
1190 IN OUT EFI_PHYSICAL_ADDRESS *Memory\r
1191 );\r
28a00297 1192\r
28a00297 1193\r
28a00297 1194\r
162ed594 1195/**\r
1196 Frees previous allocated pages.\r
28a00297 1197\r
022c6d45 1198 @param Memory Base address of memory being freed\r
1199 @param NumberOfPages The number of pages to free\r
28a00297 1200\r
022c6d45 1201 @retval EFI_NOT_FOUND Could not find the entry that covers the range\r
1202 @retval EFI_INVALID_PARAMETER Address not aligned\r
162ed594 1203 @return EFI_SUCCESS -Pages successfully freed.\r
28a00297 1204\r
162ed594 1205**/\r
022c6d45 1206EFI_STATUS\r
28a00297 1207EFIAPI\r
1208CoreFreePages (\r
1209 IN EFI_PHYSICAL_ADDRESS Memory,\r
1210 IN UINTN NumberOfPages\r
23c98c94 1211 );\r
28a00297 1212\r
28a00297 1213\r
28a00297 1214\r
162ed594 1215/**\r
1216 This function returns a copy of the current memory map. The map is an array of\r
1217 memory descriptors, each of which describes a contiguous block of memory.\r
28a00297 1218\r
022c6d45 1219 @param MemoryMapSize A pointer to the size, in bytes, of the\r
1220 MemoryMap buffer. On input, this is the size of\r
1221 the buffer allocated by the caller. On output,\r
1222 it is the size of the buffer returned by the\r
1223 firmware if the buffer was large enough, or the\r
1224 size of the buffer needed to contain the map if\r
1225 the buffer was too small.\r
1226 @param MemoryMap A pointer to the buffer in which firmware places\r
1227 the current memory map.\r
1228 @param MapKey A pointer to the location in which firmware\r
1229 returns the key for the current memory map.\r
1230 @param DescriptorSize A pointer to the location in which firmware\r
1231 returns the size, in bytes, of an individual\r
1232 EFI_MEMORY_DESCRIPTOR.\r
1233 @param DescriptorVersion A pointer to the location in which firmware\r
1234 returns the version number associated with the\r
1235 EFI_MEMORY_DESCRIPTOR.\r
1236\r
1237 @retval EFI_SUCCESS The memory map was returned in the MemoryMap\r
1238 buffer.\r
1239 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current\r
1240 buffer size needed to hold the memory map is\r
1241 returned in MemoryMapSize.\r
162ed594 1242 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
28a00297 1243\r
162ed594 1244**/\r
28a00297 1245EFI_STATUS\r
1246EFIAPI\r
1247CoreGetMemoryMap (\r
23c98c94 1248 IN OUT UINTN *MemoryMapSize,\r
1249 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,\r
1250 OUT UINTN *MapKey,\r
1251 OUT UINTN *DescriptorSize,\r
1252 OUT UINT32 *DescriptorVersion\r
1253 );\r
28a00297 1254\r
28a00297 1255\r
28a00297 1256\r
162ed594 1257/**\r
1258 Allocate pool of a particular type.\r
28a00297 1259\r
022c6d45 1260 @param PoolType Type of pool to allocate\r
1261 @param Size The amount of pool to allocate\r
1262 @param Buffer The address to return a pointer to the allocated\r
1263 pool\r
28a00297 1264\r
3e058701 1265 @retval EFI_INVALID_PARAMETER PoolType not valid or Buffer is NULL\r
022c6d45 1266 @retval EFI_OUT_OF_RESOURCES Size exceeds max pool size or allocation failed.\r
162ed594 1267 @retval EFI_SUCCESS Pool successfully allocated.\r
28a00297 1268\r
162ed594 1269**/\r
28a00297 1270EFI_STATUS\r
1271EFIAPI\r
1272CoreAllocatePool (\r
23c98c94 1273 IN EFI_MEMORY_TYPE PoolType,\r
1274 IN UINTN Size,\r
1275 OUT VOID **Buffer\r
1276 );\r
28a00297 1277\r
28a00297 1278\r
28a00297 1279\r
162ed594 1280/**\r
1281 Frees pool.\r
28a00297 1282\r
022c6d45 1283 @param Buffer The allocated pool entry to free\r
28a00297 1284\r
022c6d45 1285 @retval EFI_INVALID_PARAMETER Buffer is not a valid value.\r
162ed594 1286 @retval EFI_SUCCESS Pool successfully freed.\r
28a00297 1287\r
162ed594 1288**/\r
28a00297 1289EFI_STATUS\r
1290EFIAPI\r
1291CoreFreePool (\r
23c98c94 1292 IN VOID *Buffer\r
1293 );\r
28a00297 1294\r
28a00297 1295\r
28a00297 1296\r
162ed594 1297/**\r
1298 Loads an EFI image into memory and returns a handle to the image.\r
28a00297 1299\r
022c6d45 1300 @param BootPolicy If TRUE, indicates that the request originates\r
1301 from the boot manager, and that the boot\r
1302 manager is attempting to load FilePath as a\r
1303 boot selection.\r
1304 @param ParentImageHandle The caller's image handle.\r
1305 @param FilePath The specific file path from which the image is\r
1306 loaded.\r
1307 @param SourceBuffer If not NULL, a pointer to the memory location\r
1308 containing a copy of the image to be loaded.\r
1309 @param SourceSize The size in bytes of SourceBuffer.\r
1310 @param ImageHandle Pointer to the returned image handle that is\r
1311 created when the image is successfully loaded.\r
1312\r
1313 @retval EFI_SUCCESS The image was loaded into memory.\r
1314 @retval EFI_NOT_FOUND The FilePath was not found.\r
1315 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value.\r
1316 @retval EFI_UNSUPPORTED The image type is not supported, or the device\r
1317 path cannot be parsed to locate the proper\r
1318 protocol for loading the file.\r
1319 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient\r
162ed594 1320 resources.\r
b695e7ff
LG
1321 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
1322 understood.\r
1323 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
1324 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the \r
1325 image from being loaded. NULL is returned in *ImageHandle.\r
1326 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a \r
1327 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
1328 platform policy specifies that the image should not be started.\r
28a00297 1329\r
162ed594 1330**/\r
28a00297 1331EFI_STATUS\r
1332EFIAPI\r
1333CoreLoadImage (\r
23c98c94 1334 IN BOOLEAN BootPolicy,\r
1335 IN EFI_HANDLE ParentImageHandle,\r
1336 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
1337 IN VOID *SourceBuffer OPTIONAL,\r
1338 IN UINTN SourceSize,\r
1339 OUT EFI_HANDLE *ImageHandle\r
1340 );\r
28a00297 1341\r
28a00297 1342\r
28a00297 1343\r
162ed594 1344/**\r
1345 Unloads an image.\r
28a00297 1346\r
022c6d45 1347 @param ImageHandle Handle that identifies the image to be\r
1348 unloaded.\r
28a00297 1349\r
022c6d45 1350 @retval EFI_SUCCESS The image has been unloaded.\r
1351 @retval EFI_UNSUPPORTED The image has been sarted, and does not support\r
1352 unload.\r
162ed594 1353 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.\r
28a00297 1354\r
162ed594 1355**/\r
28a00297 1356EFI_STATUS\r
1357EFIAPI\r
1358CoreUnloadImage (\r
1359 IN EFI_HANDLE ImageHandle\r
23c98c94 1360 );\r
28a00297 1361\r
28a00297 1362\r
28a00297 1363\r
162ed594 1364/**\r
1365 Transfer control to a loaded image's entry point.\r
28a00297 1366\r
022c6d45 1367 @param ImageHandle Handle of image to be started.\r
1368 @param ExitDataSize Pointer of the size to ExitData\r
1369 @param ExitData Pointer to a pointer to a data buffer that\r
b695e7ff 1370 includes a Null-terminated string,\r
022c6d45 1371 optionally followed by additional binary data.\r
1372 The string is a description that the caller may\r
1373 use to further indicate the reason for the\r
1374 image's exit.\r
1375\r
1376 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1377 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
bc2dfdbc 1378 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.\r
022c6d45 1379 @retval EFI_SUCCESS Successfully transfer control to the image's\r
162ed594 1380 entry point.\r
28a00297 1381\r
162ed594 1382**/\r
28a00297 1383EFI_STATUS\r
1384EFIAPI\r
1385CoreStartImage (\r
23c98c94 1386 IN EFI_HANDLE ImageHandle,\r
1387 OUT UINTN *ExitDataSize,\r
1388 OUT CHAR16 **ExitData OPTIONAL\r
1389 );\r
28a00297 1390\r
28a00297 1391\r
28a00297 1392\r
162ed594 1393/**\r
1394 Terminates the currently loaded EFI image and returns control to boot services.\r
28a00297 1395\r
022c6d45 1396 @param ImageHandle Handle that identifies the image. This\r
1397 parameter is passed to the image on entry.\r
1398 @param Status The image's exit code.\r
1399 @param ExitDataSize The size, in bytes, of ExitData. Ignored if\r
1400 ExitStatus is EFI_SUCCESS.\r
1401 @param ExitData Pointer to a data buffer that includes a\r
1402 Null-terminated Unicode string, optionally\r
1403 followed by additional binary data. The string\r
1404 is a description that the caller may use to\r
1405 further indicate the reason for the image's\r
1406 exit.\r
1407\r
1408 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current\r
1409 image.\r
1410 @retval EFI_SUCCESS Successfully terminates the currently loaded\r
1411 EFI image.\r
1412 @retval EFI_ACCESS_DENIED Should never reach there.\r
162ed594 1413 @retval EFI_OUT_OF_RESOURCES Could not allocate pool\r
28a00297 1414\r
162ed594 1415**/\r
28a00297 1416EFI_STATUS\r
1417EFIAPI\r
1418CoreExit (\r
1419 IN EFI_HANDLE ImageHandle,\r
1420 IN EFI_STATUS Status,\r
1421 IN UINTN ExitDataSize,\r
1422 IN CHAR16 *ExitData OPTIONAL\r
23c98c94 1423 );\r
28a00297 1424\r
28a00297 1425\r
28a00297 1426\r
162ed594 1427/**\r
670d4d88 1428 Creates an event.\r
28a00297 1429\r
022c6d45 1430 @param Type The type of event to create and its mode and\r
1431 attributes\r
1432 @param NotifyTpl The task priority level of event notifications\r
1433 @param NotifyFunction Pointer to the events notification function\r
1434 @param NotifyContext Pointer to the notification functions context;\r
1435 corresponds to parameter "Context" in the\r
1436 notification function\r
1437 @param Event Pointer to the newly created event if the call\r
1438 succeeds; undefined otherwise\r
1439\r
1440 @retval EFI_SUCCESS The event structure was created\r
1441 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
162ed594 1442 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
28a00297 1443\r
162ed594 1444**/\r
28a00297 1445EFI_STATUS\r
1446EFIAPI\r
1447CoreCreateEvent (\r
23c98c94 1448 IN UINT32 Type,\r
1449 IN EFI_TPL NotifyTpl,\r
1450 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1451 IN VOID *NotifyContext, OPTIONAL\r
1452 OUT EFI_EVENT *Event\r
1453 );\r
28a00297 1454\r
28a00297 1455\r
28a00297 1456\r
162ed594 1457/**\r
670d4d88 1458 Creates an event in a group.\r
28a00297 1459\r
022c6d45 1460 @param Type The type of event to create and its mode and\r
1461 attributes\r
1462 @param NotifyTpl The task priority level of event notifications\r
1463 @param NotifyFunction Pointer to the events notification function\r
1464 @param NotifyContext Pointer to the notification functions context;\r
1465 corresponds to parameter "Context" in the\r
1466 notification function\r
1467 @param EventGroup GUID for EventGroup if NULL act the same as\r
1468 gBS->CreateEvent().\r
1469 @param Event Pointer to the newly created event if the call\r
1470 succeeds; undefined otherwise\r
1471\r
1472 @retval EFI_SUCCESS The event structure was created\r
1473 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
162ed594 1474 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
28a00297 1475\r
162ed594 1476**/\r
28a00297 1477EFI_STATUS\r
1478EFIAPI\r
1479CoreCreateEventEx (\r
1480 IN UINT32 Type,\r
1481 IN EFI_TPL NotifyTpl,\r
1482 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1483 IN CONST VOID *NotifyContext, OPTIONAL\r
1484 IN CONST EFI_GUID *EventGroup, OPTIONAL\r
1485 OUT EFI_EVENT *Event\r
23c98c94 1486 );\r
28a00297 1487\r
670d4d88
SZ
1488/**\r
1489 Creates a general-purpose event structure\r
1490\r
1491 @param Type The type of event to create and its mode and\r
1492 attributes\r
1493 @param NotifyTpl The task priority level of event notifications\r
1494 @param NotifyFunction Pointer to the events notification function\r
1495 @param NotifyContext Pointer to the notification functions context;\r
1496 corresponds to parameter "Context" in the\r
1497 notification function\r
1498 @param EventGroup GUID for EventGroup if NULL act the same as\r
1499 gBS->CreateEvent().\r
1500 @param Event Pointer to the newly created event if the call\r
1501 succeeds; undefined otherwise\r
28a00297 1502\r
670d4d88
SZ
1503 @retval EFI_SUCCESS The event structure was created\r
1504 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
1505 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
1506\r
1507**/\r
1508EFI_STATUS\r
1509EFIAPI\r
1510CoreCreateEventInternal (\r
1511 IN UINT32 Type,\r
1512 IN EFI_TPL NotifyTpl,\r
1513 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1514 IN CONST VOID *NotifyContext, OPTIONAL\r
1515 IN CONST EFI_GUID *EventGroup, OPTIONAL\r
1516 OUT EFI_EVENT *Event\r
1517 );\r
28a00297 1518\r
162ed594 1519/**\r
1520 Sets the type of timer and the trigger time for a timer event.\r
28a00297 1521\r
022c6d45 1522 @param UserEvent The timer event that is to be signaled at the\r
1523 specified time\r
1524 @param Type The type of time that is specified in\r
1525 TriggerTime\r
1526 @param TriggerTime The number of 100ns units until the timer\r
1527 expires\r
28a00297 1528\r
022c6d45 1529 @retval EFI_SUCCESS The event has been set to be signaled at the\r
1530 requested time\r
162ed594 1531 @retval EFI_INVALID_PARAMETER Event or Type is not valid\r
28a00297 1532\r
162ed594 1533**/\r
28a00297 1534EFI_STATUS\r
1535EFIAPI\r
1536CoreSetTimer (\r
23c98c94 1537 IN EFI_EVENT UserEvent,\r
28a00297 1538 IN EFI_TIMER_DELAY Type,\r
1539 IN UINT64 TriggerTime\r
23c98c94 1540 );\r
28a00297 1541\r
28a00297 1542\r
28a00297 1543\r
162ed594 1544/**\r
022c6d45 1545 Signals the event. Queues the event to be notified if needed.\r
28a00297 1546\r
022c6d45 1547 @param UserEvent The event to signal .\r
28a00297 1548\r
022c6d45 1549 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1550 @retval EFI_SUCCESS The event was signaled.\r
28a00297 1551\r
162ed594 1552**/\r
28a00297 1553EFI_STATUS\r
1554EFIAPI\r
1555CoreSignalEvent (\r
23c98c94 1556 IN EFI_EVENT UserEvent\r
1557 );\r
28a00297 1558\r
28a00297 1559\r
28a00297 1560\r
162ed594 1561/**\r
1562 Stops execution until an event is signaled.\r
28a00297 1563\r
022c6d45 1564 @param NumberOfEvents The number of events in the UserEvents array\r
1565 @param UserEvents An array of EFI_EVENT\r
1566 @param UserIndex Pointer to the index of the event which\r
1567 satisfied the wait condition\r
28a00297 1568\r
022c6d45 1569 @retval EFI_SUCCESS The event indicated by Index was signaled.\r
1570 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification\r
1571 function or Event was not a valid type\r
162ed594 1572 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION\r
28a00297 1573\r
162ed594 1574**/\r
28a00297 1575EFI_STATUS\r
1576EFIAPI\r
1577CoreWaitForEvent (\r
23c98c94 1578 IN UINTN NumberOfEvents,\r
1579 IN EFI_EVENT *UserEvents,\r
1580 OUT UINTN *UserIndex\r
1581 );\r
28a00297 1582\r
28a00297 1583\r
28a00297 1584\r
162ed594 1585/**\r
1586 Closes an event and frees the event structure.\r
28a00297 1587\r
022c6d45 1588 @param UserEvent Event to close\r
28a00297 1589\r
022c6d45 1590 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1591 @retval EFI_SUCCESS The event has been closed\r
28a00297 1592\r
162ed594 1593**/\r
28a00297 1594EFI_STATUS\r
1595EFIAPI\r
1596CoreCloseEvent (\r
23c98c94 1597 IN EFI_EVENT UserEvent\r
1598 );\r
28a00297 1599\r
28a00297 1600\r
28a00297 1601\r
162ed594 1602/**\r
1603 Check the status of an event.\r
28a00297 1604\r
022c6d45 1605 @param UserEvent The event to check\r
28a00297 1606\r
022c6d45 1607 @retval EFI_SUCCESS The event is in the signaled state\r
1608 @retval EFI_NOT_READY The event is not in the signaled state\r
162ed594 1609 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL\r
28a00297 1610\r
162ed594 1611**/\r
28a00297 1612EFI_STATUS\r
1613EFIAPI\r
1614CoreCheckEvent (\r
23c98c94 1615 IN EFI_EVENT UserEvent\r
1616 );\r
28a00297 1617\r
28a00297 1618\r
162ed594 1619/**\r
1620 Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
1621 global coherency domain of the processor.\r
28a00297 1622\r
022c6d45 1623 @param GcdMemoryType Memory type of the memory space.\r
1624 @param BaseAddress Base address of the memory space.\r
1625 @param Length Length of the memory space.\r
1626 @param Capabilities alterable attributes of the memory space.\r
28a00297 1627\r
162ed594 1628 @retval EFI_SUCCESS Merged this memory space into GCD map.\r
28a00297 1629\r
162ed594 1630**/\r
28a00297 1631EFI_STATUS\r
3b6ffb6a 1632EFIAPI\r
28a00297 1633CoreAddMemorySpace (\r
1634 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1635 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1636 IN UINT64 Length,\r
1637 IN UINT64 Capabilities\r
23c98c94 1638 );\r
28a00297 1639\r
28a00297 1640\r
162ed594 1641/**\r
1642 Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
1643 I/O resources from the global coherency domain of the processor.\r
28a00297 1644\r
022c6d45 1645 @param GcdAllocateType The type of allocate operation\r
1646 @param GcdMemoryType The desired memory type\r
1647 @param Alignment Align with 2^Alignment\r
1648 @param Length Length to allocate\r
1649 @param BaseAddress Base address to allocate\r
1650 @param ImageHandle The image handle consume the allocated space.\r
1651 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1652\r
022c6d45 1653 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1654 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1655 @retval EFI_SUCCESS Memory space successfully allocated.\r
28a00297 1656\r
162ed594 1657**/\r
28a00297 1658EFI_STATUS\r
3b6ffb6a 1659EFIAPI\r
28a00297 1660CoreAllocateMemorySpace (\r
1661 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1662 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1663 IN UINTN Alignment,\r
1664 IN UINT64 Length,\r
1665 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1666 IN EFI_HANDLE ImageHandle,\r
1667 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1668 );\r
28a00297 1669\r
28a00297 1670\r
162ed594 1671/**\r
1672 Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
1673 I/O resources from the global coherency domain of the processor.\r
28a00297 1674\r
022c6d45 1675 @param BaseAddress Base address of the memory space.\r
1676 @param Length Length of the memory space.\r
28a00297 1677\r
162ed594 1678 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1679\r
162ed594 1680**/\r
28a00297 1681EFI_STATUS\r
3b6ffb6a 1682EFIAPI\r
28a00297 1683CoreFreeMemorySpace (\r
1684 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1685 IN UINT64 Length\r
23c98c94 1686 );\r
28a00297 1687\r
28a00297 1688\r
162ed594 1689/**\r
1690 Removes reserved memory, system memory, or memory-mapped I/O resources from\r
1691 the global coherency domain of the processor.\r
28a00297 1692\r
022c6d45 1693 @param BaseAddress Base address of the memory space.\r
1694 @param Length Length of the memory space.\r
28a00297 1695\r
162ed594 1696 @retval EFI_SUCCESS Successfully remove a segment of memory space.\r
28a00297 1697\r
162ed594 1698**/\r
28a00297 1699EFI_STATUS\r
3b6ffb6a 1700EFIAPI\r
28a00297 1701CoreRemoveMemorySpace (\r
1702 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1703 IN UINT64 Length\r
23c98c94 1704 );\r
28a00297 1705\r
28a00297 1706\r
162ed594 1707/**\r
1708 Retrieves the descriptor for a memory region containing a specified address.\r
28a00297 1709\r
022c6d45 1710 @param BaseAddress Specified start address\r
1711 @param Descriptor Specified length\r
28a00297 1712\r
022c6d45 1713 @retval EFI_INVALID_PARAMETER Invalid parameter\r
162ed594 1714 @retval EFI_SUCCESS Successfully get memory space descriptor.\r
28a00297 1715\r
162ed594 1716**/\r
28a00297 1717EFI_STATUS\r
3b6ffb6a 1718EFIAPI\r
28a00297 1719CoreGetMemorySpaceDescriptor (\r
1720 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1721 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1722 );\r
28a00297 1723\r
28a00297 1724\r
162ed594 1725/**\r
1726 Modifies the attributes for a memory region in the global coherency domain of the\r
1727 processor.\r
28a00297 1728\r
022c6d45 1729 @param BaseAddress Specified start address\r
1730 @param Length Specified length\r
1731 @param Attributes Specified attributes\r
28a00297 1732\r
fc8ff20f 1733 @retval EFI_SUCCESS The attributes were set for the memory region.\r
1734 @retval EFI_INVALID_PARAMETER Length is zero. \r
1735 @retval EFI_UNSUPPORTED The processor does not support one or more bytes of the memory\r
1736 resource range specified by BaseAddress and Length.\r
1737 @retval EFI_UNSUPPORTED The bit mask of attributes is not support for the memory resource\r
1738 range specified by BaseAddress and Length.\r
1739 @retval EFI_ACCESS_DEFINED The attributes for the memory resource range specified by\r
1740 BaseAddress and Length cannot be modified.\r
1741 @retval EFI_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of\r
1742 the memory resource range.\r
1743 @retval EFI_NOT_AVAILABLE_YET The attributes cannot be set because CPU architectural protocol is\r
1744 not available yet.\r
28a00297 1745\r
162ed594 1746**/\r
28a00297 1747EFI_STATUS\r
3b6ffb6a 1748EFIAPI\r
28a00297 1749CoreSetMemorySpaceAttributes (\r
1750 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1751 IN UINT64 Length,\r
1752 IN UINT64 Attributes\r
23c98c94 1753 );\r
28a00297 1754\r
28a00297 1755\r
162ed594 1756/**\r
1757 Returns a map of the memory resources in the global coherency domain of the\r
1758 processor.\r
28a00297 1759\r
022c6d45 1760 @param NumberOfDescriptors Number of descriptors.\r
1761 @param MemorySpaceMap Descriptor array\r
28a00297 1762\r
022c6d45 1763 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1764 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1765 @retval EFI_SUCCESS Successfully get memory space map.\r
28a00297 1766\r
162ed594 1767**/\r
28a00297 1768EFI_STATUS\r
3b6ffb6a 1769EFIAPI\r
28a00297 1770CoreGetMemorySpaceMap (\r
1771 OUT UINTN *NumberOfDescriptors,\r
1772 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
23c98c94 1773 );\r
28a00297 1774\r
28a00297 1775\r
162ed594 1776/**\r
1777 Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
28a00297 1778\r
022c6d45 1779 @param GcdIoType IO type of the segment.\r
1780 @param BaseAddress Base address of the segment.\r
1781 @param Length Length of the segment.\r
28a00297 1782\r
022c6d45 1783 @retval EFI_SUCCESS Merged this segment into GCD map.\r
162ed594 1784 @retval EFI_INVALID_PARAMETER Parameter not valid\r
28a00297 1785\r
162ed594 1786**/\r
28a00297 1787EFI_STATUS\r
3b6ffb6a 1788EFIAPI\r
28a00297 1789CoreAddIoSpace (\r
1790 IN EFI_GCD_IO_TYPE GcdIoType,\r
1791 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1792 IN UINT64 Length\r
23c98c94 1793 );\r
28a00297 1794\r
28a00297 1795\r
162ed594 1796/**\r
1797 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1798 domain of the processor.\r
28a00297 1799\r
022c6d45 1800 @param GcdAllocateType The type of allocate operation\r
1801 @param GcdIoType The desired IO type\r
1802 @param Alignment Align with 2^Alignment\r
1803 @param Length Length to allocate\r
1804 @param BaseAddress Base address to allocate\r
1805 @param ImageHandle The image handle consume the allocated space.\r
1806 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1807\r
022c6d45 1808 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1809 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1810 @retval EFI_SUCCESS IO space successfully allocated.\r
28a00297 1811\r
162ed594 1812**/\r
28a00297 1813EFI_STATUS\r
3b6ffb6a 1814EFIAPI\r
28a00297 1815CoreAllocateIoSpace (\r
1816 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1817 IN EFI_GCD_IO_TYPE GcdIoType,\r
1818 IN UINTN Alignment,\r
1819 IN UINT64 Length,\r
1820 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1821 IN EFI_HANDLE ImageHandle,\r
1822 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1823 );\r
28a00297 1824\r
28a00297 1825\r
162ed594 1826/**\r
1827 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1828 domain of the processor.\r
28a00297 1829\r
022c6d45 1830 @param BaseAddress Base address of the segment.\r
1831 @param Length Length of the segment.\r
28a00297 1832\r
162ed594 1833 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1834\r
162ed594 1835**/\r
28a00297 1836EFI_STATUS\r
3b6ffb6a 1837EFIAPI\r
28a00297 1838CoreFreeIoSpace (\r
1839 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1840 IN UINT64 Length\r
23c98c94 1841 );\r
28a00297 1842\r
28a00297 1843\r
162ed594 1844/**\r
1845 Removes reserved I/O or I/O resources from the global coherency domain of the\r
1846 processor.\r
28a00297 1847\r
022c6d45 1848 @param BaseAddress Base address of the segment.\r
1849 @param Length Length of the segment.\r
28a00297 1850\r
162ed594 1851 @retval EFI_SUCCESS Successfully removed a segment of IO space.\r
28a00297 1852\r
162ed594 1853**/\r
28a00297 1854EFI_STATUS\r
3b6ffb6a 1855EFIAPI\r
28a00297 1856CoreRemoveIoSpace (\r
1857 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1858 IN UINT64 Length\r
23c98c94 1859 );\r
28a00297 1860\r
28a00297 1861\r
162ed594 1862/**\r
1863 Retrieves the descriptor for an I/O region containing a specified address.\r
28a00297 1864\r
022c6d45 1865 @param BaseAddress Specified start address\r
1866 @param Descriptor Specified length\r
28a00297 1867\r
022c6d45 1868 @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r
162ed594 1869 @retval EFI_SUCCESS Successfully get the IO space descriptor.\r
28a00297 1870\r
162ed594 1871**/\r
28a00297 1872EFI_STATUS\r
3b6ffb6a 1873EFIAPI\r
28a00297 1874CoreGetIoSpaceDescriptor (\r
1875 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1876 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1877 );\r
28a00297 1878\r
28a00297 1879\r
162ed594 1880/**\r
1881 Returns a map of the I/O resources in the global coherency domain of the processor.\r
28a00297 1882\r
022c6d45 1883 @param NumberOfDescriptors Number of descriptors.\r
1884 @param IoSpaceMap Descriptor array\r
28a00297 1885\r
022c6d45 1886 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1887 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1888 @retval EFI_SUCCESS Successfully get IO space map.\r
28a00297 1889\r
162ed594 1890**/\r
28a00297 1891EFI_STATUS\r
3b6ffb6a 1892EFIAPI\r
28a00297 1893CoreGetIoSpaceMap (\r
1894 OUT UINTN *NumberOfDescriptors,\r
1895 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
23c98c94 1896 );\r
28a00297 1897\r
28a00297 1898\r
162ed594 1899/**\r
1900 This is the main Dispatcher for DXE and it exits when there are no more\r
1901 drivers to run. Drain the mScheduledQueue and load and start a PE\r
1902 image for each driver. Search the mDiscoveredList to see if any driver can\r
1903 be placed on the mScheduledQueue. If no drivers are placed on the\r
1904 mScheduledQueue exit the function. On exit it is assumed the Bds()\r
1905 will be called, and when the Bds() exits the Dispatcher will be called\r
1906 again.\r
28a00297 1907\r
022c6d45 1908 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running\r
1909 @retval EFI_NOT_FOUND No DXE Drivers were dispatched\r
1910 @retval EFI_SUCCESS One or more DXE Drivers were dispatched\r
28a00297 1911\r
23c98c94 1912**/\r
28a00297 1913EFI_STATUS\r
1914EFIAPI\r
1915CoreDispatcher (\r
1916 VOID\r
23c98c94 1917 );\r
28a00297 1918\r
162ed594 1919/**\r
1920 Check every driver and locate a matching one. If the driver is found, the Unrequested\r
1921 state flag is cleared.\r
28a00297 1922\r
022c6d45 1923 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1924 the firmware file specified by DriverName.\r
1925 @param DriverName The Driver name to put in the Dependent state.\r
28a00297 1926\r
022c6d45 1927 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was\r
1928 cleared\r
1929 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was\r
1930 not set.\r
28a00297 1931\r
23c98c94 1932**/\r
28a00297 1933EFI_STATUS\r
1934EFIAPI\r
1935CoreSchedule (\r
1936 IN EFI_HANDLE FirmwareVolumeHandle,\r
1937 IN EFI_GUID *DriverName\r
23c98c94 1938 );\r
28a00297 1939\r
28a00297 1940\r
162ed594 1941/**\r
022c6d45 1942 Convert a driver from the Untrused back to the Scheduled state.\r
28a00297 1943\r
022c6d45 1944 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1945 the firmware file specified by DriverName.\r
1946 @param DriverName The Driver name to put in the Scheduled state\r
28a00297 1947\r
022c6d45 1948 @retval EFI_SUCCESS The file was found in the untrusted state, and it\r
1949 was promoted to the trusted state.\r
1950 @retval EFI_NOT_FOUND The file was not found in the untrusted state.\r
28a00297 1951\r
23c98c94 1952**/\r
28a00297 1953EFI_STATUS\r
1954EFIAPI\r
1955CoreTrust (\r
1956 IN EFI_HANDLE FirmwareVolumeHandle,\r
1957 IN EFI_GUID *DriverName\r
23c98c94 1958 );\r
28a00297 1959\r
28a00297 1960\r
162ed594 1961/**\r
1962 This routine is the driver initialization entry point. It initializes the\r
1963 libraries, and registers two notification functions. These notification\r
1964 functions are responsible for building the FV stack dynamically.\r
28a00297 1965\r
022c6d45 1966 @param ImageHandle The image handle.\r
1967 @param SystemTable The system table.\r
28a00297 1968\r
162ed594 1969 @retval EFI_SUCCESS Function successfully returned.\r
28a00297 1970\r
162ed594 1971**/\r
28a00297 1972EFI_STATUS\r
1973EFIAPI\r
1974FwVolDriverInit (\r
1975 IN EFI_HANDLE ImageHandle,\r
1976 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 1977 );\r
28a00297 1978\r
28a00297 1979\r
162ed594 1980/**\r
1981 Entry point of the section extraction code. Initializes an instance of the\r
1982 section extraction interface and installs it on a new handle.\r
1983\r
1984 @param ImageHandle A handle for the image that is initializing this driver\r
1985 @param SystemTable A pointer to the EFI system table\r
28a00297 1986\r
162ed594 1987 @retval EFI_SUCCESS Driver initialized successfully\r
1988 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
1989\r
1990**/\r
28a00297 1991EFI_STATUS\r
1992EFIAPI\r
1993InitializeSectionExtraction (\r
1994 IN EFI_HANDLE ImageHandle,\r
1995 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 1996 );\r
28a00297 1997\r
28a00297 1998\r
162ed594 1999/**\r
2000 This DXE service routine is used to process a firmware volume. In\r
2001 particular, it can be called by BDS to process a single firmware\r
2002 volume found in a capsule.\r
28a00297 2003\r
022c6d45 2004 @param FvHeader pointer to a firmware volume header\r
2005 @param Size the size of the buffer pointed to by FvHeader\r
2006 @param FVProtocolHandle the handle on which a firmware volume protocol\r
2007 was produced for the firmware volume passed in.\r
28a00297 2008\r
022c6d45 2009 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of\r
2010 system resources\r
2011 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted\r
2012 @retval EFI_SUCCESS a firmware volume protocol was produced for the\r
162ed594 2013 firmware volume\r
28a00297 2014\r
162ed594 2015**/\r
28a00297 2016EFI_STATUS\r
3b6ffb6a 2017EFIAPI\r
28a00297 2018CoreProcessFirmwareVolume (\r
23c98c94 2019 IN VOID *FvHeader,\r
022c6d45 2020 IN UINTN Size,\r
23c98c94 2021 OUT EFI_HANDLE *FVProtocolHandle\r
2022 );\r
28a00297 2023\r
2024//\r
2025//Functions used during debug buils\r
2026//\r
162ed594 2027\r
2028/**\r
2029 Displays Architectural protocols that were not loaded and are required for DXE\r
23c98c94 2030 core to function. Only used in Debug Builds.\r
162ed594 2031\r
2032**/\r
28a00297 2033VOID\r
2034CoreDisplayMissingArchProtocols (\r
2035 VOID\r
23c98c94 2036 );\r
022c6d45 2037\r
28a00297 2038\r
162ed594 2039/**\r
2040 Traverse the discovered list for any drivers that were discovered but not loaded\r
2041 because the dependency experessions evaluated to false.\r
28a00297 2042\r
162ed594 2043**/\r
28a00297 2044VOID\r
2045CoreDisplayDiscoveredNotDispatched (\r
2046 VOID\r
23c98c94 2047 );\r
28a00297 2048\r
28a00297 2049\r
162ed594 2050/**\r
23c98c94 2051 Place holder function until all the Boot Services and Runtime Services are\r
2052 available.\r
28a00297 2053\r
162ed594 2054 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2055\r
162ed594 2056**/\r
28a00297 2057EFI_STATUS\r
2058EFIAPI\r
2059CoreEfiNotAvailableYetArg0 (\r
2060 VOID\r
23c98c94 2061 );\r
28a00297 2062\r
28a00297 2063\r
162ed594 2064/**\r
23c98c94 2065 Place holder function until all the Boot Services and Runtime Services are\r
2066 available.\r
28a00297 2067\r
022c6d45 2068 @param Arg1 Undefined\r
28a00297 2069\r
162ed594 2070 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2071\r
162ed594 2072**/\r
28a00297 2073EFI_STATUS\r
2074EFIAPI\r
2075CoreEfiNotAvailableYetArg1 (\r
2076 UINTN Arg1\r
23c98c94 2077 );\r
28a00297 2078\r
28a00297 2079\r
162ed594 2080/**\r
2081 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2082\r
022c6d45 2083 @param Arg1 Undefined\r
2084 @param Arg2 Undefined\r
28a00297 2085\r
162ed594 2086 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2087\r
162ed594 2088**/\r
28a00297 2089EFI_STATUS\r
2090EFIAPI\r
2091CoreEfiNotAvailableYetArg2 (\r
2092 UINTN Arg1,\r
2093 UINTN Arg2\r
23c98c94 2094 );\r
28a00297 2095\r
28a00297 2096\r
162ed594 2097/**\r
2098 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2099\r
022c6d45 2100 @param Arg1 Undefined\r
2101 @param Arg2 Undefined\r
2102 @param Arg3 Undefined\r
28a00297 2103\r
162ed594 2104 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2105\r
162ed594 2106**/\r
28a00297 2107EFI_STATUS\r
2108EFIAPI\r
2109CoreEfiNotAvailableYetArg3 (\r
2110 UINTN Arg1,\r
2111 UINTN Arg2,\r
2112 UINTN Arg3\r
23c98c94 2113 );\r
28a00297 2114\r
28a00297 2115\r
162ed594 2116/**\r
2117 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2118\r
022c6d45 2119 @param Arg1 Undefined\r
2120 @param Arg2 Undefined\r
2121 @param Arg3 Undefined\r
2122 @param Arg4 Undefined\r
28a00297 2123\r
162ed594 2124 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2125\r
162ed594 2126**/\r
28a00297 2127EFI_STATUS\r
2128EFIAPI\r
2129CoreEfiNotAvailableYetArg4 (\r
2130 UINTN Arg1,\r
2131 UINTN Arg2,\r
2132 UINTN Arg3,\r
2133 UINTN Arg4\r
23c98c94 2134 );\r
28a00297 2135\r
28a00297 2136\r
162ed594 2137/**\r
2138 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2139\r
022c6d45 2140 @param Arg1 Undefined\r
2141 @param Arg2 Undefined\r
2142 @param Arg3 Undefined\r
2143 @param Arg4 Undefined\r
2144 @param Arg5 Undefined\r
28a00297 2145\r
162ed594 2146 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2147\r
162ed594 2148**/\r
28a00297 2149EFI_STATUS\r
2150EFIAPI\r
2151CoreEfiNotAvailableYetArg5 (\r
2152 UINTN Arg1,\r
2153 UINTN Arg2,\r
2154 UINTN Arg3,\r
2155 UINTN Arg4,\r
2156 UINTN Arg5\r
23c98c94 2157 );\r
28a00297 2158\r
28a00297 2159\r
162ed594 2160/**\r
2161 Given a compressed source buffer, this function retrieves the size of the\r
2162 uncompressed buffer and the size of the scratch buffer required to decompress\r
2163 the compressed source buffer.\r
2164\r
2165 The GetInfo() function retrieves the size of the uncompressed buffer and the\r
2166 temporary scratch buffer required to decompress the buffer specified by Source\r
2167 and SourceSize. If the size of the uncompressed buffer or the size of the\r
2168 scratch buffer cannot be determined from the compressed data specified by\r
2169 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the\r
2170 size of the uncompressed buffer is returned in DestinationSize, the size of\r
2171 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.\r
2172 The GetInfo() function does not have scratch buffer available to perform a\r
2173 thorough checking of the validity of the source data. It just retrieves the\r
2174 "Original Size" field from the beginning bytes of the source data and output\r
2175 it as DestinationSize. And ScratchSize is specific to the decompression\r
2176 implementation.\r
2177\r
2178 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2179 @param Source The source buffer containing the compressed data.\r
2180 @param SourceSize The size, in bytes, of the source buffer.\r
2181 @param DestinationSize A pointer to the size, in bytes, of the\r
2182 uncompressed buffer that will be generated when the\r
2183 compressed buffer specified by Source and\r
2184 SourceSize is decompressed.\r
2185 @param ScratchSize A pointer to the size, in bytes, of the scratch\r
2186 buffer that is required to decompress the\r
2187 compressed buffer specified by Source and\r
2188 SourceSize.\r
022c6d45 2189\r
162ed594 2190 @retval EFI_SUCCESS The size of the uncompressed data was returned in\r
2191 DestinationSize and the size of the scratch buffer\r
2192 was returned in ScratchSize.\r
2193 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of\r
2194 the scratch buffer cannot be determined from the\r
2195 compressed data specified by Source and\r
2196 SourceSize.\r
28a00297 2197\r
162ed594 2198**/\r
28a00297 2199EFI_STATUS\r
23c98c94 2200EFIAPI\r
28a00297 2201DxeMainUefiDecompressGetInfo (\r
2202 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2203 IN VOID *Source,\r
2204 IN UINT32 SourceSize,\r
2205 OUT UINT32 *DestinationSize,\r
2206 OUT UINT32 *ScratchSize\r
2207 );\r
2208\r
162ed594 2209\r
2210/**\r
2211 Decompresses a compressed source buffer.\r
2212\r
2213 The Decompress() function extracts decompressed data to its original form.\r
2214 This protocol is designed so that the decompression algorithm can be\r
2215 implemented without using any memory services. As a result, the Decompress()\r
2216 Function is not allowed to call AllocatePool() or AllocatePages() in its\r
db405d1b 2217 implementation. It is the caller's responsibility to allocate and free the\r
162ed594 2218 Destination and Scratch buffers.\r
2219 If the compressed source data specified by Source and SourceSize is\r
2220 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If\r
2221 the compressed source data specified by Source and SourceSize is not in a\r
2222 valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
2223\r
2224 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2225 @param Source The source buffer containing the compressed data.\r
2226 @param SourceSize SourceSizeThe size of source data.\r
2227 @param Destination On output, the destination buffer that contains\r
2228 the uncompressed data.\r
2229 @param DestinationSize The size of the destination buffer. The size of\r
2230 the destination buffer needed is obtained from\r
2231 EFI_DECOMPRESS_PROTOCOL.GetInfo().\r
2232 @param Scratch A temporary scratch buffer that is used to perform\r
2233 the decompression.\r
2234 @param ScratchSize The size of scratch buffer. The size of the\r
2235 scratch buffer needed is obtained from GetInfo().\r
022c6d45 2236\r
162ed594 2237 @retval EFI_SUCCESS Decompression completed successfully, and the\r
2238 uncompressed buffer is returned in Destination.\r
2239 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and\r
2240 SourceSize is corrupted (not in a valid\r
2241 compressed format).\r
2242\r
2243**/\r
28a00297 2244EFI_STATUS\r
2245EFIAPI\r
2246DxeMainUefiDecompress (\r
022c6d45 2247 IN EFI_DECOMPRESS_PROTOCOL *This,\r
28a00297 2248 IN VOID *Source,\r
2249 IN UINT32 SourceSize,\r
2250 IN OUT VOID *Destination,\r
2251 IN UINT32 DestinationSize,\r
2252 IN OUT VOID *Scratch,\r
2253 IN UINT32 ScratchSize\r
2254 );\r
2255\r
162ed594 2256/**\r
2257 SEP member function. This function creates and returns a new section stream\r
2258 handle to represent the new section stream.\r
28a00297 2259\r
022c6d45 2260 @param SectionStreamLength Size in bytes of the section stream.\r
2261 @param SectionStream Buffer containing the new section stream.\r
2262 @param SectionStreamHandle A pointer to a caller allocated UINTN that on\r
2263 output contains the new section stream handle.\r
28a00297 2264\r
162ed594 2265 @retval EFI_SUCCESS The section stream is created successfully.\r
022c6d45 2266 @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r
2267 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2268 of last section.\r
28a00297 2269\r
162ed594 2270**/\r
797a9d67 2271EFI_STATUS\r
2272EFIAPI\r
2273OpenSectionStream (\r
2274 IN UINTN SectionStreamLength,\r
2275 IN VOID *SectionStream,\r
2276 OUT UINTN *SectionStreamHandle\r
2277 );\r
2278\r
162ed594 2279\r
2280\r
2281/**\r
2282 SEP member function. Retrieves requested section from section stream.\r
2283\r
2284 @param SectionStreamHandle The section stream from which to extract the\r
2285 requested section.\r
2286 @param SectionType A pointer to the type of section to search for.\r
2287 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,\r
2288 then SectionDefinitionGuid indicates which of\r
2289 these types of sections to search for.\r
2290 @param SectionInstance Indicates which instance of the requested\r
2291 section to return.\r
2292 @param Buffer Double indirection to buffer. If *Buffer is\r
2293 non-null on input, then the buffer is caller\r
2294 allocated. If Buffer is NULL, then the buffer\r
2295 is callee allocated. In either case, the\r
2296 requried buffer size is returned in *BufferSize.\r
2297 @param BufferSize On input, indicates the size of *Buffer if\r
2298 *Buffer is non-null on input. On output,\r
2299 indicates the required size (allocated size if\r
2300 callee allocated) of *Buffer.\r
2301 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
2302 indicates the authentication status of the\r
db405d1b 2303 output buffer. If the input section's\r
162ed594 2304 GuidedSectionHeader.Attributes field\r
2305 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
2306 bit as clear, AuthenticationStatus must return\r
2307 zero. Both local bits (19:16) and aggregate\r
2308 bits (3:0) in AuthenticationStatus are returned\r
2309 by ExtractSection(). These bits reflect the\r
2310 status of the extraction operation. The bit\r
2311 pattern in both regions must be the same, as\r
2312 the local and aggregate authentication statuses\r
2313 have equivalent meaning at this level. If the\r
2314 function returns anything other than\r
2315 EFI_SUCCESS, the value of *AuthenticationStatus\r
2316 is undefined.\r
6c85d162 2317 @param IsFfs3Fv Indicates the FV format.\r
162ed594 2318\r
2319 @retval EFI_SUCCESS Section was retrieved successfully\r
2320 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r
2321 section stream with its\r
2322 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r
2323 but there was no corresponding GUIDed Section\r
2324 Extraction Protocol in the handle database.\r
2325 *Buffer is unmodified.\r
2326 @retval EFI_NOT_FOUND An error was encountered when parsing the\r
2327 SectionStream. This indicates the SectionStream\r
2328 is not correctly formatted.\r
2329 @retval EFI_NOT_FOUND The requested section does not exist.\r
2330 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process\r
2331 the request.\r
2332 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
2333 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is\r
2334 insufficient to contain the requested section.\r
2335 The input buffer is filled and section contents\r
2336 are truncated.\r
2337\r
2338**/\r
797a9d67 2339EFI_STATUS\r
2340EFIAPI\r
2341GetSection (\r
2342 IN UINTN SectionStreamHandle,\r
2343 IN EFI_SECTION_TYPE *SectionType,\r
2344 IN EFI_GUID *SectionDefinitionGuid,\r
2345 IN UINTN SectionInstance,\r
2346 IN VOID **Buffer,\r
2347 IN OUT UINTN *BufferSize,\r
6c85d162
SZ
2348 OUT UINT32 *AuthenticationStatus,\r
2349 IN BOOLEAN IsFfs3Fv\r
797a9d67 2350 );\r
2351\r
162ed594 2352\r
2353/**\r
2354 SEP member function. Deletes an existing section stream\r
2355\r
022c6d45 2356 @param StreamHandleToClose Indicates the stream to close\r
162ed594 2357\r
2358 @retval EFI_SUCCESS The section stream is closed sucessfully.\r
022c6d45 2359 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
2360 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2361 of last section.\r
2362\r
2363**/\r
797a9d67 2364EFI_STATUS\r
2365EFIAPI\r
2366CloseSectionStream (\r
23c98c94 2367 IN UINTN StreamHandleToClose\r
797a9d67 2368 );\r
2369\r
ec90508b 2370/**\r
2371 Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
2372 table and registers it into the system table.\r
2373\r
2374 Note:\r
2375 This function allocates memory, frees it, and then allocates memory at an\r
2376 address within the initial allocation. Since this function is called early\r
2377 in DXE core initialization (before drivers are dispatched), this should not\r
2378 be a problem.\r
2379\r
2380**/\r
2381VOID\r
2382CoreInitializeDebugImageInfoTable (\r
2383 VOID\r
2384 );\r
2385\r
2386\r
2387/**\r
2388 Update the CRC32 in the Debug Table.\r
2389 Since the CRC32 service is made available by the Runtime driver, we have to\r
2390 wait for the Runtime Driver to be installed before the CRC32 can be computed.\r
2391 This function is called elsewhere by the core when the runtime architectural\r
2392 protocol is produced.\r
2393\r
2394**/\r
2395VOID\r
2396CoreUpdateDebugTableCrc32 (\r
2397 VOID\r
2398 );\r
2399\r
2400\r
2401/**\r
2402 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r
2403 the table if it's not large enough to accomidate another entry.\r
2404\r
2405 @param ImageInfoType type of debug image information\r
2406 @param LoadedImage pointer to the loaded image protocol for the image being\r
2407 loaded\r
2408 @param ImageHandle image handle for the image being loaded\r
2409\r
2410**/\r
2411VOID\r
2412CoreNewDebugImageInfoEntry (\r
2413 IN UINT32 ImageInfoType,\r
2414 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2415 IN EFI_HANDLE ImageHandle\r
2416 );\r
2417\r
2418\r
2419/**\r
2420 Removes and frees an entry from the DebugImageInfo Table.\r
2421\r
2422 @param ImageHandle image handle for the image being unloaded\r
2423\r
2424**/\r
2425VOID\r
2426CoreRemoveDebugImageInfoEntry (\r
2427 EFI_HANDLE ImageHandle\r
2428 );\r
2429\r
2430\r
2431/**\r
2432 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
2433\r
2434 @param ImageHandle The image handle.\r
2435 @param SystemTable The system table.\r
2436\r
2437 @retval EFI_SUCCESS Successfully initialized firmware volume block\r
2438 driver.\r
2439\r
2440**/\r
2441EFI_STATUS\r
2442EFIAPI\r
2443FwVolBlockDriverInit (\r
2444 IN EFI_HANDLE ImageHandle,\r
2445 IN EFI_SYSTEM_TABLE *SystemTable\r
2446 );\r
2447\r
0c3a1db4
SZ
2448/**\r
2449\r
2450 Get FVB authentication status\r
2451\r
2452 @param FvbProtocol FVB protocol.\r
2453\r
2454 @return Authentication status.\r
2455\r
2456**/\r
2457UINT32\r
2458GetFvbAuthenticationStatus (\r
2459 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *FvbProtocol\r
2460 );\r
ec90508b 2461\r
2462/**\r
2463 This routine produces a firmware volume block protocol on a given\r
2464 buffer.\r
2465\r
2466 @param BaseAddress base address of the firmware volume image\r
2467 @param Length length of the firmware volume image\r
2468 @param ParentHandle handle of parent firmware volume, if this image\r
0c3a1db4 2469 came from an FV image file and section in another firmware\r
ec90508b 2470 volume (ala capsules)\r
0c3a1db4
SZ
2471 @param AuthenticationStatus Authentication status inherited, if this image\r
2472 came from an FV image file and section in another firmware volume.\r
ec90508b 2473 @param FvProtocol Firmware volume block protocol produced.\r
2474\r
2475 @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
2476 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r
2477 @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r
2478 buffer.\r
2479\r
2480**/\r
2481EFI_STATUS\r
2482ProduceFVBProtocolOnBuffer (\r
2483 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
2484 IN UINT64 Length,\r
2485 IN EFI_HANDLE ParentHandle,\r
0c3a1db4 2486 IN UINT32 AuthenticationStatus,\r
ec90508b 2487 OUT EFI_HANDLE *FvProtocol OPTIONAL\r
2488 );\r
2489\r
2490\r
2491/**\r
2492 Raising to the task priority level of the mutual exclusion\r
2493 lock, and then acquires ownership of the lock.\r
2494\r
2495 @param Lock The lock to acquire\r
2496\r
2497 @return Lock owned\r
2498\r
2499**/\r
2500VOID\r
2501CoreAcquireLock (\r
2502 IN EFI_LOCK *Lock\r
2503 );\r
2504\r
2505\r
2506/**\r
2507 Initialize a basic mutual exclusion lock. Each lock\r
2508 provides mutual exclusion access at it's task priority\r
2509 level. Since there is no-premption (at any TPL) or\r
2510 multiprocessor support, acquiring the lock only consists\r
2511 of raising to the locks TPL.\r
2512\r
2513 @param Lock The EFI_LOCK structure to initialize\r
2514\r
2515 @retval EFI_SUCCESS Lock Owned.\r
2516 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r
2517\r
2518**/\r
2519EFI_STATUS\r
2520CoreAcquireLockOrFail (\r
2521 IN EFI_LOCK *Lock\r
2522 );\r
2523\r
2524\r
2525/**\r
2526 Releases ownership of the mutual exclusion lock, and\r
2527 restores the previous task priority level.\r
2528\r
2529 @param Lock The lock to release\r
2530\r
2531 @return Lock unowned\r
2532\r
2533**/\r
2534VOID\r
2535CoreReleaseLock (\r
2536 IN EFI_LOCK *Lock\r
2537 );\r
2538\r
54cd17e9 2539\r
2540/**\r
2541 An empty function to pass error checking of CreateEventEx ().\r
2542\r
2543 @param Event Event whose notification function is being invoked.\r
2544 @param Context Pointer to the notification function's context,\r
2545 which is implementation-dependent.\r
2546\r
2547**/\r
2548VOID\r
2549EFIAPI\r
2550CoreEmptyCallbackFunction (\r
2551 IN EFI_EVENT Event,\r
2552 IN VOID *Context\r
2553 );\r
2554\r
2fc46f86
LG
2555/**\r
2556 Read data from Firmware Block by FVB protocol Read. \r
2557 The data may cross the multi block ranges.\r
2558\r
2559 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to read data.\r
2560 @param StartLba Pointer to StartLba.\r
2561 On input, the start logical block index from which to read.\r
2562 On output,the end logical block index after reading.\r
2563 @param Offset Pointer to Offset\r
2564 On input, offset into the block at which to begin reading.\r
2565 On output, offset into the end block after reading.\r
2566 @param DataSize Size of data to be read.\r
2567 @param Data Pointer to Buffer that the data will be read into.\r
2568\r
2569 @retval EFI_SUCCESS Successfully read data from firmware block.\r
2570 @retval others\r
2571**/\r
2572EFI_STATUS\r
2573ReadFvbData (\r
2574 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2575 IN OUT EFI_LBA *StartLba,\r
2576 IN OUT UINTN *Offset,\r
2577 IN UINTN DataSize,\r
2578 OUT UINT8 *Data\r
2579 );\r
2580\r
2581/**\r
2582 Given the supplied FW_VOL_BLOCK_PROTOCOL, allocate a buffer for output and\r
2583 copy the real length volume header into it.\r
2584\r
2585 @param Fvb The FW_VOL_BLOCK_PROTOCOL instance from which to\r
2586 read the volume header\r
2587 @param FwVolHeader Pointer to pointer to allocated buffer in which\r
2588 the volume header is returned.\r
2589\r
2590 @retval EFI_OUT_OF_RESOURCES No enough buffer could be allocated.\r
2591 @retval EFI_SUCCESS Successfully read volume header to the allocated\r
2592 buffer.\r
2593\r
2594**/\r
2595EFI_STATUS\r
2596GetFwVolHeader (\r
2597 IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb,\r
2598 OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader\r
2599 );\r
2600\r
2601/**\r
2602 Verify checksum of the firmware volume header.\r
2603\r
2604 @param FvHeader Points to the firmware volume header to be checked\r
2605\r
2606 @retval TRUE Checksum verification passed\r
2607 @retval FALSE Checksum verification failed\r
2608\r
2609**/\r
2610BOOLEAN\r
2611VerifyFvHeaderChecksum (\r
2612 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader\r
2613 );\r
2614\r
28a00297 2615#endif\r