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