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