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