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