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