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