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