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