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