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