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