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