Clean up DEC files:
[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
b695e7ff 5Copyright (c) 2006 - 2011, 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
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
b695e7ff
LG
1301 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not\r
1302 understood.\r
1303 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.\r
1304 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the \r
1305 image from being loaded. NULL is returned in *ImageHandle.\r
1306 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a \r
1307 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current \r
1308 platform policy specifies that the image should not be started.\r
28a00297 1309\r
162ed594 1310**/\r
28a00297 1311EFI_STATUS\r
1312EFIAPI\r
1313CoreLoadImage (\r
23c98c94 1314 IN BOOLEAN BootPolicy,\r
1315 IN EFI_HANDLE ParentImageHandle,\r
1316 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,\r
1317 IN VOID *SourceBuffer OPTIONAL,\r
1318 IN UINTN SourceSize,\r
1319 OUT EFI_HANDLE *ImageHandle\r
1320 );\r
28a00297 1321\r
28a00297 1322\r
28a00297 1323\r
162ed594 1324/**\r
1325 Unloads an image.\r
28a00297 1326\r
022c6d45 1327 @param ImageHandle Handle that identifies the image to be\r
1328 unloaded.\r
28a00297 1329\r
022c6d45 1330 @retval EFI_SUCCESS The image has been unloaded.\r
1331 @retval EFI_UNSUPPORTED The image has been sarted, and does not support\r
1332 unload.\r
162ed594 1333 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.\r
28a00297 1334\r
162ed594 1335**/\r
28a00297 1336EFI_STATUS\r
1337EFIAPI\r
1338CoreUnloadImage (\r
1339 IN EFI_HANDLE ImageHandle\r
23c98c94 1340 );\r
28a00297 1341\r
28a00297 1342\r
28a00297 1343\r
162ed594 1344/**\r
1345 Transfer control to a loaded image's entry point.\r
28a00297 1346\r
022c6d45 1347 @param ImageHandle Handle of image to be started.\r
1348 @param ExitDataSize Pointer of the size to ExitData\r
1349 @param ExitData Pointer to a pointer to a data buffer that\r
b695e7ff 1350 includes a Null-terminated string,\r
022c6d45 1351 optionally followed by additional binary data.\r
1352 The string is a description that the caller may\r
1353 use to further indicate the reason for the\r
1354 image's exit.\r
1355\r
1356 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1357 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
1358 @retval EFI_SUCCESS Successfully transfer control to the image's\r
162ed594 1359 entry point.\r
28a00297 1360\r
162ed594 1361**/\r
28a00297 1362EFI_STATUS\r
1363EFIAPI\r
1364CoreStartImage (\r
23c98c94 1365 IN EFI_HANDLE ImageHandle,\r
1366 OUT UINTN *ExitDataSize,\r
1367 OUT CHAR16 **ExitData OPTIONAL\r
1368 );\r
28a00297 1369\r
28a00297 1370\r
28a00297 1371\r
162ed594 1372/**\r
1373 Terminates the currently loaded EFI image and returns control to boot services.\r
28a00297 1374\r
022c6d45 1375 @param ImageHandle Handle that identifies the image. This\r
1376 parameter is passed to the image on entry.\r
1377 @param Status The image's exit code.\r
1378 @param ExitDataSize The size, in bytes, of ExitData. Ignored if\r
1379 ExitStatus is EFI_SUCCESS.\r
1380 @param ExitData Pointer to a data buffer that includes a\r
1381 Null-terminated Unicode string, optionally\r
1382 followed by additional binary data. The string\r
1383 is a description that the caller may use to\r
1384 further indicate the reason for the image's\r
1385 exit.\r
1386\r
1387 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current\r
1388 image.\r
1389 @retval EFI_SUCCESS Successfully terminates the currently loaded\r
1390 EFI image.\r
1391 @retval EFI_ACCESS_DENIED Should never reach there.\r
162ed594 1392 @retval EFI_OUT_OF_RESOURCES Could not allocate pool\r
28a00297 1393\r
162ed594 1394**/\r
28a00297 1395EFI_STATUS\r
1396EFIAPI\r
1397CoreExit (\r
1398 IN EFI_HANDLE ImageHandle,\r
1399 IN EFI_STATUS Status,\r
1400 IN UINTN ExitDataSize,\r
1401 IN CHAR16 *ExitData OPTIONAL\r
23c98c94 1402 );\r
28a00297 1403\r
28a00297 1404\r
28a00297 1405\r
162ed594 1406/**\r
1407 Creates a general-purpose event structure.\r
28a00297 1408\r
022c6d45 1409 @param Type The type of event to create and its mode and\r
1410 attributes\r
1411 @param NotifyTpl The task priority level of event notifications\r
1412 @param NotifyFunction Pointer to the events notification function\r
1413 @param NotifyContext Pointer to the notification functions context;\r
1414 corresponds to parameter "Context" in the\r
1415 notification function\r
1416 @param Event Pointer to the newly created event if the call\r
1417 succeeds; undefined otherwise\r
1418\r
1419 @retval EFI_SUCCESS The event structure was created\r
1420 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
162ed594 1421 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
28a00297 1422\r
162ed594 1423**/\r
28a00297 1424EFI_STATUS\r
1425EFIAPI\r
1426CoreCreateEvent (\r
23c98c94 1427 IN UINT32 Type,\r
1428 IN EFI_TPL NotifyTpl,\r
1429 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1430 IN VOID *NotifyContext, OPTIONAL\r
1431 OUT EFI_EVENT *Event\r
1432 );\r
28a00297 1433\r
28a00297 1434\r
28a00297 1435\r
162ed594 1436/**\r
1437 Creates a general-purpose event structure\r
28a00297 1438\r
022c6d45 1439 @param Type The type of event to create and its mode and\r
1440 attributes\r
1441 @param NotifyTpl The task priority level of event notifications\r
1442 @param NotifyFunction Pointer to the events notification function\r
1443 @param NotifyContext Pointer to the notification functions context;\r
1444 corresponds to parameter "Context" in the\r
1445 notification function\r
1446 @param EventGroup GUID for EventGroup if NULL act the same as\r
1447 gBS->CreateEvent().\r
1448 @param Event Pointer to the newly created event if the call\r
1449 succeeds; undefined otherwise\r
1450\r
1451 @retval EFI_SUCCESS The event structure was created\r
1452 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value\r
162ed594 1453 @retval EFI_OUT_OF_RESOURCES The event could not be allocated\r
28a00297 1454\r
162ed594 1455**/\r
28a00297 1456EFI_STATUS\r
1457EFIAPI\r
1458CoreCreateEventEx (\r
1459 IN UINT32 Type,\r
1460 IN EFI_TPL NotifyTpl,\r
1461 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL\r
1462 IN CONST VOID *NotifyContext, OPTIONAL\r
1463 IN CONST EFI_GUID *EventGroup, OPTIONAL\r
1464 OUT EFI_EVENT *Event\r
23c98c94 1465 );\r
28a00297 1466\r
28a00297 1467\r
28a00297 1468\r
162ed594 1469/**\r
1470 Sets the type of timer and the trigger time for a timer event.\r
28a00297 1471\r
022c6d45 1472 @param UserEvent The timer event that is to be signaled at the\r
1473 specified time\r
1474 @param Type The type of time that is specified in\r
1475 TriggerTime\r
1476 @param TriggerTime The number of 100ns units until the timer\r
1477 expires\r
28a00297 1478\r
022c6d45 1479 @retval EFI_SUCCESS The event has been set to be signaled at the\r
1480 requested time\r
162ed594 1481 @retval EFI_INVALID_PARAMETER Event or Type is not valid\r
28a00297 1482\r
162ed594 1483**/\r
28a00297 1484EFI_STATUS\r
1485EFIAPI\r
1486CoreSetTimer (\r
23c98c94 1487 IN EFI_EVENT UserEvent,\r
28a00297 1488 IN EFI_TIMER_DELAY Type,\r
1489 IN UINT64 TriggerTime\r
23c98c94 1490 );\r
28a00297 1491\r
28a00297 1492\r
28a00297 1493\r
162ed594 1494/**\r
022c6d45 1495 Signals the event. Queues the event to be notified if needed.\r
28a00297 1496\r
022c6d45 1497 @param UserEvent The event to signal .\r
28a00297 1498\r
022c6d45 1499 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1500 @retval EFI_SUCCESS The event was signaled.\r
28a00297 1501\r
162ed594 1502**/\r
28a00297 1503EFI_STATUS\r
1504EFIAPI\r
1505CoreSignalEvent (\r
23c98c94 1506 IN EFI_EVENT UserEvent\r
1507 );\r
28a00297 1508\r
28a00297 1509\r
28a00297 1510\r
162ed594 1511/**\r
1512 Stops execution until an event is signaled.\r
28a00297 1513\r
022c6d45 1514 @param NumberOfEvents The number of events in the UserEvents array\r
1515 @param UserEvents An array of EFI_EVENT\r
1516 @param UserIndex Pointer to the index of the event which\r
1517 satisfied the wait condition\r
28a00297 1518\r
022c6d45 1519 @retval EFI_SUCCESS The event indicated by Index was signaled.\r
1520 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification\r
1521 function or Event was not a valid type\r
162ed594 1522 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION\r
28a00297 1523\r
162ed594 1524**/\r
28a00297 1525EFI_STATUS\r
1526EFIAPI\r
1527CoreWaitForEvent (\r
23c98c94 1528 IN UINTN NumberOfEvents,\r
1529 IN EFI_EVENT *UserEvents,\r
1530 OUT UINTN *UserIndex\r
1531 );\r
28a00297 1532\r
28a00297 1533\r
28a00297 1534\r
162ed594 1535/**\r
1536 Closes an event and frees the event structure.\r
28a00297 1537\r
022c6d45 1538 @param UserEvent Event to close\r
28a00297 1539\r
022c6d45 1540 @retval EFI_INVALID_PARAMETER Parameters are not valid.\r
162ed594 1541 @retval EFI_SUCCESS The event has been closed\r
28a00297 1542\r
162ed594 1543**/\r
28a00297 1544EFI_STATUS\r
1545EFIAPI\r
1546CoreCloseEvent (\r
23c98c94 1547 IN EFI_EVENT UserEvent\r
1548 );\r
28a00297 1549\r
28a00297 1550\r
28a00297 1551\r
162ed594 1552/**\r
1553 Check the status of an event.\r
28a00297 1554\r
022c6d45 1555 @param UserEvent The event to check\r
28a00297 1556\r
022c6d45 1557 @retval EFI_SUCCESS The event is in the signaled state\r
1558 @retval EFI_NOT_READY The event is not in the signaled state\r
162ed594 1559 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL\r
28a00297 1560\r
162ed594 1561**/\r
28a00297 1562EFI_STATUS\r
1563EFIAPI\r
1564CoreCheckEvent (\r
23c98c94 1565 IN EFI_EVENT UserEvent\r
1566 );\r
28a00297 1567\r
28a00297 1568\r
162ed594 1569/**\r
1570 Adds reserved memory, system memory, or memory-mapped I/O resources to the\r
1571 global coherency domain of the processor.\r
28a00297 1572\r
022c6d45 1573 @param GcdMemoryType Memory type of the memory space.\r
1574 @param BaseAddress Base address of the memory space.\r
1575 @param Length Length of the memory space.\r
1576 @param Capabilities alterable attributes of the memory space.\r
28a00297 1577\r
162ed594 1578 @retval EFI_SUCCESS Merged this memory space into GCD map.\r
28a00297 1579\r
162ed594 1580**/\r
28a00297 1581EFI_STATUS\r
3b6ffb6a 1582EFIAPI\r
28a00297 1583CoreAddMemorySpace (\r
1584 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1585 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1586 IN UINT64 Length,\r
1587 IN UINT64 Capabilities\r
23c98c94 1588 );\r
28a00297 1589\r
28a00297 1590\r
162ed594 1591/**\r
1592 Allocates nonexistent memory, reserved memory, system memory, or memorymapped\r
1593 I/O resources from the global coherency domain of the processor.\r
28a00297 1594\r
022c6d45 1595 @param GcdAllocateType The type of allocate operation\r
1596 @param GcdMemoryType The desired memory type\r
1597 @param Alignment Align with 2^Alignment\r
1598 @param Length Length to allocate\r
1599 @param BaseAddress Base address to allocate\r
1600 @param ImageHandle The image handle consume the allocated space.\r
1601 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1602\r
022c6d45 1603 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1604 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1605 @retval EFI_SUCCESS Memory space successfully allocated.\r
28a00297 1606\r
162ed594 1607**/\r
28a00297 1608EFI_STATUS\r
3b6ffb6a 1609EFIAPI\r
28a00297 1610CoreAllocateMemorySpace (\r
1611 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1612 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,\r
1613 IN UINTN Alignment,\r
1614 IN UINT64 Length,\r
1615 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1616 IN EFI_HANDLE ImageHandle,\r
1617 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1618 );\r
28a00297 1619\r
28a00297 1620\r
162ed594 1621/**\r
1622 Frees nonexistent memory, reserved memory, system memory, or memory-mapped\r
1623 I/O resources from the global coherency domain of the processor.\r
28a00297 1624\r
022c6d45 1625 @param BaseAddress Base address of the memory space.\r
1626 @param Length Length of the memory space.\r
28a00297 1627\r
162ed594 1628 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1629\r
162ed594 1630**/\r
28a00297 1631EFI_STATUS\r
3b6ffb6a 1632EFIAPI\r
28a00297 1633CoreFreeMemorySpace (\r
1634 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1635 IN UINT64 Length\r
23c98c94 1636 );\r
28a00297 1637\r
28a00297 1638\r
162ed594 1639/**\r
1640 Removes reserved memory, system memory, or memory-mapped I/O resources from\r
1641 the global coherency domain of the processor.\r
28a00297 1642\r
022c6d45 1643 @param BaseAddress Base address of the memory space.\r
1644 @param Length Length of the memory space.\r
28a00297 1645\r
162ed594 1646 @retval EFI_SUCCESS Successfully remove a segment of memory space.\r
28a00297 1647\r
162ed594 1648**/\r
28a00297 1649EFI_STATUS\r
3b6ffb6a 1650EFIAPI\r
28a00297 1651CoreRemoveMemorySpace (\r
1652 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1653 IN UINT64 Length\r
23c98c94 1654 );\r
28a00297 1655\r
28a00297 1656\r
162ed594 1657/**\r
1658 Retrieves the descriptor for a memory region containing a specified address.\r
28a00297 1659\r
022c6d45 1660 @param BaseAddress Specified start address\r
1661 @param Descriptor Specified length\r
28a00297 1662\r
022c6d45 1663 @retval EFI_INVALID_PARAMETER Invalid parameter\r
162ed594 1664 @retval EFI_SUCCESS Successfully get memory space descriptor.\r
28a00297 1665\r
162ed594 1666**/\r
28a00297 1667EFI_STATUS\r
3b6ffb6a 1668EFIAPI\r
28a00297 1669CoreGetMemorySpaceDescriptor (\r
1670 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1671 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1672 );\r
28a00297 1673\r
28a00297 1674\r
162ed594 1675/**\r
1676 Modifies the attributes for a memory region in the global coherency domain of the\r
1677 processor.\r
28a00297 1678\r
022c6d45 1679 @param BaseAddress Specified start address\r
1680 @param Length Specified length\r
1681 @param Attributes Specified attributes\r
28a00297 1682\r
022c6d45 1683 @retval EFI_SUCCESS Successfully set attribute of a segment of\r
162ed594 1684 memory space.\r
28a00297 1685\r
162ed594 1686**/\r
28a00297 1687EFI_STATUS\r
3b6ffb6a 1688EFIAPI\r
28a00297 1689CoreSetMemorySpaceAttributes (\r
1690 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1691 IN UINT64 Length,\r
1692 IN UINT64 Attributes\r
23c98c94 1693 );\r
28a00297 1694\r
28a00297 1695\r
162ed594 1696/**\r
1697 Returns a map of the memory resources in the global coherency domain of the\r
1698 processor.\r
28a00297 1699\r
022c6d45 1700 @param NumberOfDescriptors Number of descriptors.\r
1701 @param MemorySpaceMap Descriptor array\r
28a00297 1702\r
022c6d45 1703 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1704 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1705 @retval EFI_SUCCESS Successfully get memory space map.\r
28a00297 1706\r
162ed594 1707**/\r
28a00297 1708EFI_STATUS\r
3b6ffb6a 1709EFIAPI\r
28a00297 1710CoreGetMemorySpaceMap (\r
1711 OUT UINTN *NumberOfDescriptors,\r
1712 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap\r
23c98c94 1713 );\r
28a00297 1714\r
28a00297 1715\r
162ed594 1716/**\r
1717 Adds reserved I/O or I/O resources to the global coherency domain of the processor.\r
28a00297 1718\r
022c6d45 1719 @param GcdIoType IO type of the segment.\r
1720 @param BaseAddress Base address of the segment.\r
1721 @param Length Length of the segment.\r
28a00297 1722\r
022c6d45 1723 @retval EFI_SUCCESS Merged this segment into GCD map.\r
162ed594 1724 @retval EFI_INVALID_PARAMETER Parameter not valid\r
28a00297 1725\r
162ed594 1726**/\r
28a00297 1727EFI_STATUS\r
3b6ffb6a 1728EFIAPI\r
28a00297 1729CoreAddIoSpace (\r
1730 IN EFI_GCD_IO_TYPE GcdIoType,\r
1731 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1732 IN UINT64 Length\r
23c98c94 1733 );\r
28a00297 1734\r
28a00297 1735\r
162ed594 1736/**\r
1737 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1738 domain of the processor.\r
28a00297 1739\r
022c6d45 1740 @param GcdAllocateType The type of allocate operation\r
1741 @param GcdIoType The desired IO type\r
1742 @param Alignment Align with 2^Alignment\r
1743 @param Length Length to allocate\r
1744 @param BaseAddress Base address to allocate\r
1745 @param ImageHandle The image handle consume the allocated space.\r
1746 @param DeviceHandle The device handle consume the allocated space.\r
28a00297 1747\r
022c6d45 1748 @retval EFI_INVALID_PARAMETER Invalid parameter.\r
1749 @retval EFI_NOT_FOUND No descriptor contains the desired space.\r
162ed594 1750 @retval EFI_SUCCESS IO space successfully allocated.\r
28a00297 1751\r
162ed594 1752**/\r
28a00297 1753EFI_STATUS\r
3b6ffb6a 1754EFIAPI\r
28a00297 1755CoreAllocateIoSpace (\r
1756 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,\r
1757 IN EFI_GCD_IO_TYPE GcdIoType,\r
1758 IN UINTN Alignment,\r
1759 IN UINT64 Length,\r
1760 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
1761 IN EFI_HANDLE ImageHandle,\r
1762 IN EFI_HANDLE DeviceHandle OPTIONAL\r
23c98c94 1763 );\r
28a00297 1764\r
28a00297 1765\r
162ed594 1766/**\r
1767 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency\r
1768 domain of the processor.\r
28a00297 1769\r
022c6d45 1770 @param BaseAddress Base address of the segment.\r
1771 @param Length Length of the segment.\r
28a00297 1772\r
162ed594 1773 @retval EFI_SUCCESS Space successfully freed.\r
28a00297 1774\r
162ed594 1775**/\r
28a00297 1776EFI_STATUS\r
3b6ffb6a 1777EFIAPI\r
28a00297 1778CoreFreeIoSpace (\r
1779 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1780 IN UINT64 Length\r
23c98c94 1781 );\r
28a00297 1782\r
28a00297 1783\r
162ed594 1784/**\r
1785 Removes reserved I/O or I/O resources from the global coherency domain of the\r
1786 processor.\r
28a00297 1787\r
022c6d45 1788 @param BaseAddress Base address of the segment.\r
1789 @param Length Length of the segment.\r
28a00297 1790\r
162ed594 1791 @retval EFI_SUCCESS Successfully removed a segment of IO space.\r
28a00297 1792\r
162ed594 1793**/\r
28a00297 1794EFI_STATUS\r
3b6ffb6a 1795EFIAPI\r
28a00297 1796CoreRemoveIoSpace (\r
1797 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1798 IN UINT64 Length\r
23c98c94 1799 );\r
28a00297 1800\r
28a00297 1801\r
162ed594 1802/**\r
1803 Retrieves the descriptor for an I/O region containing a specified address.\r
28a00297 1804\r
022c6d45 1805 @param BaseAddress Specified start address\r
1806 @param Descriptor Specified length\r
28a00297 1807\r
022c6d45 1808 @retval EFI_INVALID_PARAMETER Descriptor is NULL.\r
162ed594 1809 @retval EFI_SUCCESS Successfully get the IO space descriptor.\r
28a00297 1810\r
162ed594 1811**/\r
28a00297 1812EFI_STATUS\r
3b6ffb6a 1813EFIAPI\r
28a00297 1814CoreGetIoSpaceDescriptor (\r
1815 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
1816 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor\r
23c98c94 1817 );\r
28a00297 1818\r
28a00297 1819\r
162ed594 1820/**\r
1821 Returns a map of the I/O resources in the global coherency domain of the processor.\r
28a00297 1822\r
022c6d45 1823 @param NumberOfDescriptors Number of descriptors.\r
1824 @param IoSpaceMap Descriptor array\r
28a00297 1825\r
022c6d45 1826 @retval EFI_INVALID_PARAMETER Invalid parameter\r
1827 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate\r
162ed594 1828 @retval EFI_SUCCESS Successfully get IO space map.\r
28a00297 1829\r
162ed594 1830**/\r
28a00297 1831EFI_STATUS\r
3b6ffb6a 1832EFIAPI\r
28a00297 1833CoreGetIoSpaceMap (\r
1834 OUT UINTN *NumberOfDescriptors,\r
1835 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap\r
23c98c94 1836 );\r
28a00297 1837\r
28a00297 1838\r
162ed594 1839/**\r
1840 This is the main Dispatcher for DXE and it exits when there are no more\r
1841 drivers to run. Drain the mScheduledQueue and load and start a PE\r
1842 image for each driver. Search the mDiscoveredList to see if any driver can\r
1843 be placed on the mScheduledQueue. If no drivers are placed on the\r
1844 mScheduledQueue exit the function. On exit it is assumed the Bds()\r
1845 will be called, and when the Bds() exits the Dispatcher will be called\r
1846 again.\r
28a00297 1847\r
022c6d45 1848 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running\r
1849 @retval EFI_NOT_FOUND No DXE Drivers were dispatched\r
1850 @retval EFI_SUCCESS One or more DXE Drivers were dispatched\r
28a00297 1851\r
23c98c94 1852**/\r
28a00297 1853EFI_STATUS\r
1854EFIAPI\r
1855CoreDispatcher (\r
1856 VOID\r
23c98c94 1857 );\r
28a00297 1858\r
162ed594 1859/**\r
1860 Check every driver and locate a matching one. If the driver is found, the Unrequested\r
1861 state flag is cleared.\r
28a00297 1862\r
022c6d45 1863 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1864 the firmware file specified by DriverName.\r
1865 @param DriverName The Driver name to put in the Dependent state.\r
28a00297 1866\r
022c6d45 1867 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was\r
1868 cleared\r
1869 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was\r
1870 not set.\r
28a00297 1871\r
23c98c94 1872**/\r
28a00297 1873EFI_STATUS\r
1874EFIAPI\r
1875CoreSchedule (\r
1876 IN EFI_HANDLE FirmwareVolumeHandle,\r
1877 IN EFI_GUID *DriverName\r
23c98c94 1878 );\r
28a00297 1879\r
28a00297 1880\r
162ed594 1881/**\r
022c6d45 1882 Convert a driver from the Untrused back to the Scheduled state.\r
28a00297 1883\r
022c6d45 1884 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains\r
1885 the firmware file specified by DriverName.\r
1886 @param DriverName The Driver name to put in the Scheduled state\r
28a00297 1887\r
022c6d45 1888 @retval EFI_SUCCESS The file was found in the untrusted state, and it\r
1889 was promoted to the trusted state.\r
1890 @retval EFI_NOT_FOUND The file was not found in the untrusted state.\r
28a00297 1891\r
23c98c94 1892**/\r
28a00297 1893EFI_STATUS\r
1894EFIAPI\r
1895CoreTrust (\r
1896 IN EFI_HANDLE FirmwareVolumeHandle,\r
1897 IN EFI_GUID *DriverName\r
23c98c94 1898 );\r
28a00297 1899\r
28a00297 1900\r
162ed594 1901/**\r
1902 This routine is the driver initialization entry point. It initializes the\r
1903 libraries, and registers two notification functions. These notification\r
1904 functions are responsible for building the FV stack dynamically.\r
28a00297 1905\r
022c6d45 1906 @param ImageHandle The image handle.\r
1907 @param SystemTable The system table.\r
28a00297 1908\r
162ed594 1909 @retval EFI_SUCCESS Function successfully returned.\r
28a00297 1910\r
162ed594 1911**/\r
28a00297 1912EFI_STATUS\r
1913EFIAPI\r
1914FwVolDriverInit (\r
1915 IN EFI_HANDLE ImageHandle,\r
1916 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 1917 );\r
28a00297 1918\r
28a00297 1919\r
162ed594 1920/**\r
1921 Entry point of the section extraction code. Initializes an instance of the\r
1922 section extraction interface and installs it on a new handle.\r
1923\r
1924 @param ImageHandle A handle for the image that is initializing this driver\r
1925 @param SystemTable A pointer to the EFI system table\r
28a00297 1926\r
162ed594 1927 @retval EFI_SUCCESS Driver initialized successfully\r
1928 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources\r
1929\r
1930**/\r
28a00297 1931EFI_STATUS\r
1932EFIAPI\r
1933InitializeSectionExtraction (\r
1934 IN EFI_HANDLE ImageHandle,\r
1935 IN EFI_SYSTEM_TABLE *SystemTable\r
23c98c94 1936 );\r
28a00297 1937\r
28a00297 1938\r
162ed594 1939/**\r
1940 This DXE service routine is used to process a firmware volume. In\r
1941 particular, it can be called by BDS to process a single firmware\r
1942 volume found in a capsule.\r
28a00297 1943\r
022c6d45 1944 @param FvHeader pointer to a firmware volume header\r
1945 @param Size the size of the buffer pointed to by FvHeader\r
1946 @param FVProtocolHandle the handle on which a firmware volume protocol\r
1947 was produced for the firmware volume passed in.\r
28a00297 1948\r
022c6d45 1949 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of\r
1950 system resources\r
1951 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted\r
1952 @retval EFI_SUCCESS a firmware volume protocol was produced for the\r
162ed594 1953 firmware volume\r
28a00297 1954\r
162ed594 1955**/\r
28a00297 1956EFI_STATUS\r
3b6ffb6a 1957EFIAPI\r
28a00297 1958CoreProcessFirmwareVolume (\r
23c98c94 1959 IN VOID *FvHeader,\r
022c6d45 1960 IN UINTN Size,\r
23c98c94 1961 OUT EFI_HANDLE *FVProtocolHandle\r
1962 );\r
28a00297 1963\r
1964//\r
1965//Functions used during debug buils\r
1966//\r
162ed594 1967\r
1968/**\r
1969 Displays Architectural protocols that were not loaded and are required for DXE\r
23c98c94 1970 core to function. Only used in Debug Builds.\r
162ed594 1971\r
1972**/\r
28a00297 1973VOID\r
1974CoreDisplayMissingArchProtocols (\r
1975 VOID\r
23c98c94 1976 );\r
022c6d45 1977\r
28a00297 1978\r
162ed594 1979/**\r
1980 Traverse the discovered list for any drivers that were discovered but not loaded\r
1981 because the dependency experessions evaluated to false.\r
28a00297 1982\r
162ed594 1983**/\r
28a00297 1984VOID\r
1985CoreDisplayDiscoveredNotDispatched (\r
1986 VOID\r
23c98c94 1987 );\r
28a00297 1988\r
28a00297 1989\r
162ed594 1990/**\r
23c98c94 1991 Place holder function until all the Boot Services and Runtime Services are\r
1992 available.\r
28a00297 1993\r
162ed594 1994 @return EFI_NOT_AVAILABLE_YET\r
28a00297 1995\r
162ed594 1996**/\r
28a00297 1997EFI_STATUS\r
1998EFIAPI\r
1999CoreEfiNotAvailableYetArg0 (\r
2000 VOID\r
23c98c94 2001 );\r
28a00297 2002\r
28a00297 2003\r
162ed594 2004/**\r
23c98c94 2005 Place holder function until all the Boot Services and Runtime Services are\r
2006 available.\r
28a00297 2007\r
022c6d45 2008 @param Arg1 Undefined\r
28a00297 2009\r
162ed594 2010 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2011\r
162ed594 2012**/\r
28a00297 2013EFI_STATUS\r
2014EFIAPI\r
2015CoreEfiNotAvailableYetArg1 (\r
2016 UINTN Arg1\r
23c98c94 2017 );\r
28a00297 2018\r
28a00297 2019\r
162ed594 2020/**\r
2021 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2022\r
022c6d45 2023 @param Arg1 Undefined\r
2024 @param Arg2 Undefined\r
28a00297 2025\r
162ed594 2026 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2027\r
162ed594 2028**/\r
28a00297 2029EFI_STATUS\r
2030EFIAPI\r
2031CoreEfiNotAvailableYetArg2 (\r
2032 UINTN Arg1,\r
2033 UINTN Arg2\r
23c98c94 2034 );\r
28a00297 2035\r
28a00297 2036\r
162ed594 2037/**\r
2038 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2039\r
022c6d45 2040 @param Arg1 Undefined\r
2041 @param Arg2 Undefined\r
2042 @param Arg3 Undefined\r
28a00297 2043\r
162ed594 2044 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2045\r
162ed594 2046**/\r
28a00297 2047EFI_STATUS\r
2048EFIAPI\r
2049CoreEfiNotAvailableYetArg3 (\r
2050 UINTN Arg1,\r
2051 UINTN Arg2,\r
2052 UINTN Arg3\r
23c98c94 2053 );\r
28a00297 2054\r
28a00297 2055\r
162ed594 2056/**\r
2057 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2058\r
022c6d45 2059 @param Arg1 Undefined\r
2060 @param Arg2 Undefined\r
2061 @param Arg3 Undefined\r
2062 @param Arg4 Undefined\r
28a00297 2063\r
162ed594 2064 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2065\r
162ed594 2066**/\r
28a00297 2067EFI_STATUS\r
2068EFIAPI\r
2069CoreEfiNotAvailableYetArg4 (\r
2070 UINTN Arg1,\r
2071 UINTN Arg2,\r
2072 UINTN Arg3,\r
2073 UINTN Arg4\r
23c98c94 2074 );\r
28a00297 2075\r
28a00297 2076\r
162ed594 2077/**\r
2078 Place holder function until all the Boot Services and Runtime Services are available.\r
28a00297 2079\r
022c6d45 2080 @param Arg1 Undefined\r
2081 @param Arg2 Undefined\r
2082 @param Arg3 Undefined\r
2083 @param Arg4 Undefined\r
2084 @param Arg5 Undefined\r
28a00297 2085\r
162ed594 2086 @return EFI_NOT_AVAILABLE_YET\r
28a00297 2087\r
162ed594 2088**/\r
28a00297 2089EFI_STATUS\r
2090EFIAPI\r
2091CoreEfiNotAvailableYetArg5 (\r
2092 UINTN Arg1,\r
2093 UINTN Arg2,\r
2094 UINTN Arg3,\r
2095 UINTN Arg4,\r
2096 UINTN Arg5\r
23c98c94 2097 );\r
28a00297 2098\r
28a00297 2099\r
162ed594 2100/**\r
2101 Given a compressed source buffer, this function retrieves the size of the\r
2102 uncompressed buffer and the size of the scratch buffer required to decompress\r
2103 the compressed source buffer.\r
2104\r
2105 The GetInfo() function retrieves the size of the uncompressed buffer and the\r
2106 temporary scratch buffer required to decompress the buffer specified by Source\r
2107 and SourceSize. If the size of the uncompressed buffer or the size of the\r
2108 scratch buffer cannot be determined from the compressed data specified by\r
2109 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the\r
2110 size of the uncompressed buffer is returned in DestinationSize, the size of\r
2111 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.\r
2112 The GetInfo() function does not have scratch buffer available to perform a\r
2113 thorough checking of the validity of the source data. It just retrieves the\r
2114 "Original Size" field from the beginning bytes of the source data and output\r
2115 it as DestinationSize. And ScratchSize is specific to the decompression\r
2116 implementation.\r
2117\r
2118 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2119 @param Source The source buffer containing the compressed data.\r
2120 @param SourceSize The size, in bytes, of the source buffer.\r
2121 @param DestinationSize A pointer to the size, in bytes, of the\r
2122 uncompressed buffer that will be generated when the\r
2123 compressed buffer specified by Source and\r
2124 SourceSize is decompressed.\r
2125 @param ScratchSize A pointer to the size, in bytes, of the scratch\r
2126 buffer that is required to decompress the\r
2127 compressed buffer specified by Source and\r
2128 SourceSize.\r
022c6d45 2129\r
162ed594 2130 @retval EFI_SUCCESS The size of the uncompressed data was returned in\r
2131 DestinationSize and the size of the scratch buffer\r
2132 was returned in ScratchSize.\r
2133 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of\r
2134 the scratch buffer cannot be determined from the\r
2135 compressed data specified by Source and\r
2136 SourceSize.\r
28a00297 2137\r
162ed594 2138**/\r
28a00297 2139EFI_STATUS\r
23c98c94 2140EFIAPI\r
28a00297 2141DxeMainUefiDecompressGetInfo (\r
2142 IN EFI_DECOMPRESS_PROTOCOL *This,\r
2143 IN VOID *Source,\r
2144 IN UINT32 SourceSize,\r
2145 OUT UINT32 *DestinationSize,\r
2146 OUT UINT32 *ScratchSize\r
2147 );\r
2148\r
162ed594 2149\r
2150/**\r
2151 Decompresses a compressed source buffer.\r
2152\r
2153 The Decompress() function extracts decompressed data to its original form.\r
2154 This protocol is designed so that the decompression algorithm can be\r
2155 implemented without using any memory services. As a result, the Decompress()\r
2156 Function is not allowed to call AllocatePool() or AllocatePages() in its\r
db405d1b 2157 implementation. It is the caller's responsibility to allocate and free the\r
162ed594 2158 Destination and Scratch buffers.\r
2159 If the compressed source data specified by Source and SourceSize is\r
2160 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If\r
2161 the compressed source data specified by Source and SourceSize is not in a\r
2162 valid compressed data format, then EFI_INVALID_PARAMETER is returned.\r
2163\r
2164 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.\r
2165 @param Source The source buffer containing the compressed data.\r
2166 @param SourceSize SourceSizeThe size of source data.\r
2167 @param Destination On output, the destination buffer that contains\r
2168 the uncompressed data.\r
2169 @param DestinationSize The size of the destination buffer. The size of\r
2170 the destination buffer needed is obtained from\r
2171 EFI_DECOMPRESS_PROTOCOL.GetInfo().\r
2172 @param Scratch A temporary scratch buffer that is used to perform\r
2173 the decompression.\r
2174 @param ScratchSize The size of scratch buffer. The size of the\r
2175 scratch buffer needed is obtained from GetInfo().\r
022c6d45 2176\r
162ed594 2177 @retval EFI_SUCCESS Decompression completed successfully, and the\r
2178 uncompressed buffer is returned in Destination.\r
2179 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and\r
2180 SourceSize is corrupted (not in a valid\r
2181 compressed format).\r
2182\r
2183**/\r
28a00297 2184EFI_STATUS\r
2185EFIAPI\r
2186DxeMainUefiDecompress (\r
022c6d45 2187 IN EFI_DECOMPRESS_PROTOCOL *This,\r
28a00297 2188 IN VOID *Source,\r
2189 IN UINT32 SourceSize,\r
2190 IN OUT VOID *Destination,\r
2191 IN UINT32 DestinationSize,\r
2192 IN OUT VOID *Scratch,\r
2193 IN UINT32 ScratchSize\r
2194 );\r
2195\r
162ed594 2196/**\r
2197 SEP member function. This function creates and returns a new section stream\r
2198 handle to represent the new section stream.\r
28a00297 2199\r
022c6d45 2200 @param SectionStreamLength Size in bytes of the section stream.\r
2201 @param SectionStream Buffer containing the new section stream.\r
2202 @param SectionStreamHandle A pointer to a caller allocated UINTN that on\r
2203 output contains the new section stream handle.\r
28a00297 2204\r
162ed594 2205 @retval EFI_SUCCESS The section stream is created successfully.\r
022c6d45 2206 @retval EFI_OUT_OF_RESOURCES memory allocation failed.\r
2207 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2208 of last section.\r
28a00297 2209\r
162ed594 2210**/\r
797a9d67 2211EFI_STATUS\r
2212EFIAPI\r
2213OpenSectionStream (\r
2214 IN UINTN SectionStreamLength,\r
2215 IN VOID *SectionStream,\r
2216 OUT UINTN *SectionStreamHandle\r
2217 );\r
2218\r
162ed594 2219\r
2220\r
2221/**\r
2222 SEP member function. Retrieves requested section from section stream.\r
2223\r
2224 @param SectionStreamHandle The section stream from which to extract the\r
2225 requested section.\r
2226 @param SectionType A pointer to the type of section to search for.\r
2227 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,\r
2228 then SectionDefinitionGuid indicates which of\r
2229 these types of sections to search for.\r
2230 @param SectionInstance Indicates which instance of the requested\r
2231 section to return.\r
2232 @param Buffer Double indirection to buffer. If *Buffer is\r
2233 non-null on input, then the buffer is caller\r
2234 allocated. If Buffer is NULL, then the buffer\r
2235 is callee allocated. In either case, the\r
2236 requried buffer size is returned in *BufferSize.\r
2237 @param BufferSize On input, indicates the size of *Buffer if\r
2238 *Buffer is non-null on input. On output,\r
2239 indicates the required size (allocated size if\r
2240 callee allocated) of *Buffer.\r
2241 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that\r
2242 indicates the authentication status of the\r
db405d1b 2243 output buffer. If the input section's\r
162ed594 2244 GuidedSectionHeader.Attributes field\r
2245 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
2246 bit as clear, AuthenticationStatus must return\r
2247 zero. Both local bits (19:16) and aggregate\r
2248 bits (3:0) in AuthenticationStatus are returned\r
2249 by ExtractSection(). These bits reflect the\r
2250 status of the extraction operation. The bit\r
2251 pattern in both regions must be the same, as\r
2252 the local and aggregate authentication statuses\r
2253 have equivalent meaning at this level. If the\r
2254 function returns anything other than\r
2255 EFI_SUCCESS, the value of *AuthenticationStatus\r
2256 is undefined.\r
2257\r
2258 @retval EFI_SUCCESS Section was retrieved successfully\r
2259 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the\r
2260 section stream with its\r
2261 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,\r
2262 but there was no corresponding GUIDed Section\r
2263 Extraction Protocol in the handle database.\r
2264 *Buffer is unmodified.\r
2265 @retval EFI_NOT_FOUND An error was encountered when parsing the\r
2266 SectionStream. This indicates the SectionStream\r
2267 is not correctly formatted.\r
2268 @retval EFI_NOT_FOUND The requested section does not exist.\r
2269 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process\r
2270 the request.\r
2271 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.\r
2272 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is\r
2273 insufficient to contain the requested section.\r
2274 The input buffer is filled and section contents\r
2275 are truncated.\r
2276\r
2277**/\r
797a9d67 2278EFI_STATUS\r
2279EFIAPI\r
2280GetSection (\r
2281 IN UINTN SectionStreamHandle,\r
2282 IN EFI_SECTION_TYPE *SectionType,\r
2283 IN EFI_GUID *SectionDefinitionGuid,\r
2284 IN UINTN SectionInstance,\r
2285 IN VOID **Buffer,\r
2286 IN OUT UINTN *BufferSize,\r
2287 OUT UINT32 *AuthenticationStatus\r
2288 );\r
2289\r
162ed594 2290\r
2291/**\r
2292 SEP member function. Deletes an existing section stream\r
2293\r
022c6d45 2294 @param StreamHandleToClose Indicates the stream to close\r
162ed594 2295\r
2296 @retval EFI_SUCCESS The section stream is closed sucessfully.\r
022c6d45 2297 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
2298 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end\r
162ed594 2299 of last section.\r
2300\r
2301**/\r
797a9d67 2302EFI_STATUS\r
2303EFIAPI\r
2304CloseSectionStream (\r
23c98c94 2305 IN UINTN StreamHandleToClose\r
797a9d67 2306 );\r
2307\r
ec90508b 2308/**\r
2309 Creates and initializes the DebugImageInfo Table. Also creates the configuration\r
2310 table and registers it into the system table.\r
2311\r
2312 Note:\r
2313 This function allocates memory, frees it, and then allocates memory at an\r
2314 address within the initial allocation. Since this function is called early\r
2315 in DXE core initialization (before drivers are dispatched), this should not\r
2316 be a problem.\r
2317\r
2318**/\r
2319VOID\r
2320CoreInitializeDebugImageInfoTable (\r
2321 VOID\r
2322 );\r
2323\r
2324\r
2325/**\r
2326 Update the CRC32 in the Debug Table.\r
2327 Since the CRC32 service is made available by the Runtime driver, we have to\r
2328 wait for the Runtime Driver to be installed before the CRC32 can be computed.\r
2329 This function is called elsewhere by the core when the runtime architectural\r
2330 protocol is produced.\r
2331\r
2332**/\r
2333VOID\r
2334CoreUpdateDebugTableCrc32 (\r
2335 VOID\r
2336 );\r
2337\r
2338\r
2339/**\r
2340 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates\r
2341 the table if it's not large enough to accomidate another entry.\r
2342\r
2343 @param ImageInfoType type of debug image information\r
2344 @param LoadedImage pointer to the loaded image protocol for the image being\r
2345 loaded\r
2346 @param ImageHandle image handle for the image being loaded\r
2347\r
2348**/\r
2349VOID\r
2350CoreNewDebugImageInfoEntry (\r
2351 IN UINT32 ImageInfoType,\r
2352 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,\r
2353 IN EFI_HANDLE ImageHandle\r
2354 );\r
2355\r
2356\r
2357/**\r
2358 Removes and frees an entry from the DebugImageInfo Table.\r
2359\r
2360 @param ImageHandle image handle for the image being unloaded\r
2361\r
2362**/\r
2363VOID\r
2364CoreRemoveDebugImageInfoEntry (\r
2365 EFI_HANDLE ImageHandle\r
2366 );\r
2367\r
2368\r
2369/**\r
2370 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.\r
2371\r
2372 @param ImageHandle The image handle.\r
2373 @param SystemTable The system table.\r
2374\r
2375 @retval EFI_SUCCESS Successfully initialized firmware volume block\r
2376 driver.\r
2377\r
2378**/\r
2379EFI_STATUS\r
2380EFIAPI\r
2381FwVolBlockDriverInit (\r
2382 IN EFI_HANDLE ImageHandle,\r
2383 IN EFI_SYSTEM_TABLE *SystemTable\r
2384 );\r
2385\r
2386\r
2387/**\r
2388 This routine produces a firmware volume block protocol on a given\r
2389 buffer.\r
2390\r
2391 @param BaseAddress base address of the firmware volume image\r
2392 @param Length length of the firmware volume image\r
2393 @param ParentHandle handle of parent firmware volume, if this image\r
2394 came from an FV image file in another firmware\r
2395 volume (ala capsules)\r
2396 @param FvProtocol Firmware volume block protocol produced.\r
2397\r
2398 @retval EFI_VOLUME_CORRUPTED Volume corrupted.\r
2399 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.\r
2400 @retval EFI_SUCCESS Successfully produced a FVB protocol on given\r
2401 buffer.\r
2402\r
2403**/\r
2404EFI_STATUS\r
2405ProduceFVBProtocolOnBuffer (\r
2406 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
2407 IN UINT64 Length,\r
2408 IN EFI_HANDLE ParentHandle,\r
2409 OUT EFI_HANDLE *FvProtocol OPTIONAL\r
2410 );\r
2411\r
2412\r
2413/**\r
2414 Raising to the task priority level of the mutual exclusion\r
2415 lock, and then acquires ownership of the lock.\r
2416\r
2417 @param Lock The lock to acquire\r
2418\r
2419 @return Lock owned\r
2420\r
2421**/\r
2422VOID\r
2423CoreAcquireLock (\r
2424 IN EFI_LOCK *Lock\r
2425 );\r
2426\r
2427\r
2428/**\r
2429 Initialize a basic mutual exclusion lock. Each lock\r
2430 provides mutual exclusion access at it's task priority\r
2431 level. Since there is no-premption (at any TPL) or\r
2432 multiprocessor support, acquiring the lock only consists\r
2433 of raising to the locks TPL.\r
2434\r
2435 @param Lock The EFI_LOCK structure to initialize\r
2436\r
2437 @retval EFI_SUCCESS Lock Owned.\r
2438 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.\r
2439\r
2440**/\r
2441EFI_STATUS\r
2442CoreAcquireLockOrFail (\r
2443 IN EFI_LOCK *Lock\r
2444 );\r
2445\r
2446\r
2447/**\r
2448 Releases ownership of the mutual exclusion lock, and\r
2449 restores the previous task priority level.\r
2450\r
2451 @param Lock The lock to release\r
2452\r
2453 @return Lock unowned\r
2454\r
2455**/\r
2456VOID\r
2457CoreReleaseLock (\r
2458 IN EFI_LOCK *Lock\r
2459 );\r
2460\r
28a00297 2461#endif\r