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