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