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