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