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