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