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