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