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