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