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