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