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