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