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