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