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