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