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