]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Core/Dxe/DxeMain.h
Update DXE Core so its own PE/COFF image is passed to the PeCoffExtraActionLib
[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 - 2010, 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
1302 **/
1303 EFI_STATUS
1304 EFIAPI
1305 CoreLoadImage (
1306 IN BOOLEAN BootPolicy,
1307 IN EFI_HANDLE ParentImageHandle,
1308 IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
1309 IN VOID *SourceBuffer OPTIONAL,
1310 IN UINTN SourceSize,
1311 OUT EFI_HANDLE *ImageHandle
1312 );
1313
1314
1315
1316 /**
1317 Unloads an image.
1318
1319 @param ImageHandle Handle that identifies the image to be
1320 unloaded.
1321
1322 @retval EFI_SUCCESS The image has been unloaded.
1323 @retval EFI_UNSUPPORTED The image has been sarted, and does not support
1324 unload.
1325 @retval EFI_INVALID_PARAMPETER ImageHandle is not a valid image handle.
1326
1327 **/
1328 EFI_STATUS
1329 EFIAPI
1330 CoreUnloadImage (
1331 IN EFI_HANDLE ImageHandle
1332 );
1333
1334
1335
1336 /**
1337 Transfer control to a loaded image's entry point.
1338
1339 @param ImageHandle Handle of image to be started.
1340 @param ExitDataSize Pointer of the size to ExitData
1341 @param ExitData Pointer to a pointer to a data buffer that
1342 includes a Null-terminated Unicode string,
1343 optionally followed by additional binary data.
1344 The string is a description that the caller may
1345 use to further indicate the reason for the
1346 image's exit.
1347
1348 @retval EFI_INVALID_PARAMETER Invalid parameter
1349 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1350 @retval EFI_SUCCESS Successfully transfer control to the image's
1351 entry point.
1352
1353 **/
1354 EFI_STATUS
1355 EFIAPI
1356 CoreStartImage (
1357 IN EFI_HANDLE ImageHandle,
1358 OUT UINTN *ExitDataSize,
1359 OUT CHAR16 **ExitData OPTIONAL
1360 );
1361
1362
1363
1364 /**
1365 Terminates the currently loaded EFI image and returns control to boot services.
1366
1367 @param ImageHandle Handle that identifies the image. This
1368 parameter is passed to the image on entry.
1369 @param Status The image's exit code.
1370 @param ExitDataSize The size, in bytes, of ExitData. Ignored if
1371 ExitStatus is EFI_SUCCESS.
1372 @param ExitData Pointer to a data buffer that includes a
1373 Null-terminated Unicode string, optionally
1374 followed by additional binary data. The string
1375 is a description that the caller may use to
1376 further indicate the reason for the image's
1377 exit.
1378
1379 @retval EFI_INVALID_PARAMETER Image handle is NULL or it is not current
1380 image.
1381 @retval EFI_SUCCESS Successfully terminates the currently loaded
1382 EFI image.
1383 @retval EFI_ACCESS_DENIED Should never reach there.
1384 @retval EFI_OUT_OF_RESOURCES Could not allocate pool
1385
1386 **/
1387 EFI_STATUS
1388 EFIAPI
1389 CoreExit (
1390 IN EFI_HANDLE ImageHandle,
1391 IN EFI_STATUS Status,
1392 IN UINTN ExitDataSize,
1393 IN CHAR16 *ExitData OPTIONAL
1394 );
1395
1396
1397
1398 /**
1399 Creates a general-purpose event structure.
1400
1401 @param Type The type of event to create and its mode and
1402 attributes
1403 @param NotifyTpl The task priority level of event notifications
1404 @param NotifyFunction Pointer to the events notification function
1405 @param NotifyContext Pointer to the notification functions context;
1406 corresponds to parameter "Context" in the
1407 notification function
1408 @param Event Pointer to the newly created event if the call
1409 succeeds; undefined otherwise
1410
1411 @retval EFI_SUCCESS The event structure was created
1412 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1413 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1414
1415 **/
1416 EFI_STATUS
1417 EFIAPI
1418 CoreCreateEvent (
1419 IN UINT32 Type,
1420 IN EFI_TPL NotifyTpl,
1421 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
1422 IN VOID *NotifyContext, OPTIONAL
1423 OUT EFI_EVENT *Event
1424 );
1425
1426
1427
1428 /**
1429 Creates a general-purpose event structure
1430
1431 @param Type The type of event to create and its mode and
1432 attributes
1433 @param NotifyTpl The task priority level of event notifications
1434 @param NotifyFunction Pointer to the events notification function
1435 @param NotifyContext Pointer to the notification functions context;
1436 corresponds to parameter "Context" in the
1437 notification function
1438 @param EventGroup GUID for EventGroup if NULL act the same as
1439 gBS->CreateEvent().
1440 @param Event Pointer to the newly created event if the call
1441 succeeds; undefined otherwise
1442
1443 @retval EFI_SUCCESS The event structure was created
1444 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value
1445 @retval EFI_OUT_OF_RESOURCES The event could not be allocated
1446
1447 **/
1448 EFI_STATUS
1449 EFIAPI
1450 CoreCreateEventEx (
1451 IN UINT32 Type,
1452 IN EFI_TPL NotifyTpl,
1453 IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
1454 IN CONST VOID *NotifyContext, OPTIONAL
1455 IN CONST EFI_GUID *EventGroup, OPTIONAL
1456 OUT EFI_EVENT *Event
1457 );
1458
1459
1460
1461 /**
1462 Sets the type of timer and the trigger time for a timer event.
1463
1464 @param UserEvent The timer event that is to be signaled at the
1465 specified time
1466 @param Type The type of time that is specified in
1467 TriggerTime
1468 @param TriggerTime The number of 100ns units until the timer
1469 expires
1470
1471 @retval EFI_SUCCESS The event has been set to be signaled at the
1472 requested time
1473 @retval EFI_INVALID_PARAMETER Event or Type is not valid
1474
1475 **/
1476 EFI_STATUS
1477 EFIAPI
1478 CoreSetTimer (
1479 IN EFI_EVENT UserEvent,
1480 IN EFI_TIMER_DELAY Type,
1481 IN UINT64 TriggerTime
1482 );
1483
1484
1485
1486 /**
1487 Signals the event. Queues the event to be notified if needed.
1488
1489 @param UserEvent The event to signal .
1490
1491 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1492 @retval EFI_SUCCESS The event was signaled.
1493
1494 **/
1495 EFI_STATUS
1496 EFIAPI
1497 CoreSignalEvent (
1498 IN EFI_EVENT UserEvent
1499 );
1500
1501
1502
1503 /**
1504 Stops execution until an event is signaled.
1505
1506 @param NumberOfEvents The number of events in the UserEvents array
1507 @param UserEvents An array of EFI_EVENT
1508 @param UserIndex Pointer to the index of the event which
1509 satisfied the wait condition
1510
1511 @retval EFI_SUCCESS The event indicated by Index was signaled.
1512 @retval EFI_INVALID_PARAMETER The event indicated by Index has a notification
1513 function or Event was not a valid type
1514 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION
1515
1516 **/
1517 EFI_STATUS
1518 EFIAPI
1519 CoreWaitForEvent (
1520 IN UINTN NumberOfEvents,
1521 IN EFI_EVENT *UserEvents,
1522 OUT UINTN *UserIndex
1523 );
1524
1525
1526
1527 /**
1528 Closes an event and frees the event structure.
1529
1530 @param UserEvent Event to close
1531
1532 @retval EFI_INVALID_PARAMETER Parameters are not valid.
1533 @retval EFI_SUCCESS The event has been closed
1534
1535 **/
1536 EFI_STATUS
1537 EFIAPI
1538 CoreCloseEvent (
1539 IN EFI_EVENT UserEvent
1540 );
1541
1542
1543
1544 /**
1545 Check the status of an event.
1546
1547 @param UserEvent The event to check
1548
1549 @retval EFI_SUCCESS The event is in the signaled state
1550 @retval EFI_NOT_READY The event is not in the signaled state
1551 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL
1552
1553 **/
1554 EFI_STATUS
1555 EFIAPI
1556 CoreCheckEvent (
1557 IN EFI_EVENT UserEvent
1558 );
1559
1560
1561 /**
1562 Adds reserved memory, system memory, or memory-mapped I/O resources to the
1563 global coherency domain of the processor.
1564
1565 @param GcdMemoryType Memory type of the memory space.
1566 @param BaseAddress Base address of the memory space.
1567 @param Length Length of the memory space.
1568 @param Capabilities alterable attributes of the memory space.
1569
1570 @retval EFI_SUCCESS Merged this memory space into GCD map.
1571
1572 **/
1573 EFI_STATUS
1574 EFIAPI
1575 CoreAddMemorySpace (
1576 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
1577 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1578 IN UINT64 Length,
1579 IN UINT64 Capabilities
1580 );
1581
1582
1583 /**
1584 Allocates nonexistent memory, reserved memory, system memory, or memorymapped
1585 I/O resources from the global coherency domain of the processor.
1586
1587 @param GcdAllocateType The type of allocate operation
1588 @param GcdMemoryType The desired memory type
1589 @param Alignment Align with 2^Alignment
1590 @param Length Length to allocate
1591 @param BaseAddress Base address to allocate
1592 @param ImageHandle The image handle consume the allocated space.
1593 @param DeviceHandle The device handle consume the allocated space.
1594
1595 @retval EFI_INVALID_PARAMETER Invalid parameter.
1596 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1597 @retval EFI_SUCCESS Memory space successfully allocated.
1598
1599 **/
1600 EFI_STATUS
1601 EFIAPI
1602 CoreAllocateMemorySpace (
1603 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
1604 IN EFI_GCD_MEMORY_TYPE GcdMemoryType,
1605 IN UINTN Alignment,
1606 IN UINT64 Length,
1607 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
1608 IN EFI_HANDLE ImageHandle,
1609 IN EFI_HANDLE DeviceHandle OPTIONAL
1610 );
1611
1612
1613 /**
1614 Frees nonexistent memory, reserved memory, system memory, or memory-mapped
1615 I/O resources from the global coherency domain of the processor.
1616
1617 @param BaseAddress Base address of the memory space.
1618 @param Length Length of the memory space.
1619
1620 @retval EFI_SUCCESS Space successfully freed.
1621
1622 **/
1623 EFI_STATUS
1624 EFIAPI
1625 CoreFreeMemorySpace (
1626 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1627 IN UINT64 Length
1628 );
1629
1630
1631 /**
1632 Removes reserved memory, system memory, or memory-mapped I/O resources from
1633 the global coherency domain of the processor.
1634
1635 @param BaseAddress Base address of the memory space.
1636 @param Length Length of the memory space.
1637
1638 @retval EFI_SUCCESS Successfully remove a segment of memory space.
1639
1640 **/
1641 EFI_STATUS
1642 EFIAPI
1643 CoreRemoveMemorySpace (
1644 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1645 IN UINT64 Length
1646 );
1647
1648
1649 /**
1650 Retrieves the descriptor for a memory region containing a specified address.
1651
1652 @param BaseAddress Specified start address
1653 @param Descriptor Specified length
1654
1655 @retval EFI_INVALID_PARAMETER Invalid parameter
1656 @retval EFI_SUCCESS Successfully get memory space descriptor.
1657
1658 **/
1659 EFI_STATUS
1660 EFIAPI
1661 CoreGetMemorySpaceDescriptor (
1662 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1663 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR *Descriptor
1664 );
1665
1666
1667 /**
1668 Modifies the attributes for a memory region in the global coherency domain of the
1669 processor.
1670
1671 @param BaseAddress Specified start address
1672 @param Length Specified length
1673 @param Attributes Specified attributes
1674
1675 @retval EFI_SUCCESS Successfully set attribute of a segment of
1676 memory space.
1677
1678 **/
1679 EFI_STATUS
1680 EFIAPI
1681 CoreSetMemorySpaceAttributes (
1682 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1683 IN UINT64 Length,
1684 IN UINT64 Attributes
1685 );
1686
1687
1688 /**
1689 Returns a map of the memory resources in the global coherency domain of the
1690 processor.
1691
1692 @param NumberOfDescriptors Number of descriptors.
1693 @param MemorySpaceMap Descriptor array
1694
1695 @retval EFI_INVALID_PARAMETER Invalid parameter
1696 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1697 @retval EFI_SUCCESS Successfully get memory space map.
1698
1699 **/
1700 EFI_STATUS
1701 EFIAPI
1702 CoreGetMemorySpaceMap (
1703 OUT UINTN *NumberOfDescriptors,
1704 OUT EFI_GCD_MEMORY_SPACE_DESCRIPTOR **MemorySpaceMap
1705 );
1706
1707
1708 /**
1709 Adds reserved I/O or I/O resources to the global coherency domain of the processor.
1710
1711 @param GcdIoType IO type of the segment.
1712 @param BaseAddress Base address of the segment.
1713 @param Length Length of the segment.
1714
1715 @retval EFI_SUCCESS Merged this segment into GCD map.
1716 @retval EFI_INVALID_PARAMETER Parameter not valid
1717
1718 **/
1719 EFI_STATUS
1720 EFIAPI
1721 CoreAddIoSpace (
1722 IN EFI_GCD_IO_TYPE GcdIoType,
1723 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1724 IN UINT64 Length
1725 );
1726
1727
1728 /**
1729 Allocates nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1730 domain of the processor.
1731
1732 @param GcdAllocateType The type of allocate operation
1733 @param GcdIoType The desired IO type
1734 @param Alignment Align with 2^Alignment
1735 @param Length Length to allocate
1736 @param BaseAddress Base address to allocate
1737 @param ImageHandle The image handle consume the allocated space.
1738 @param DeviceHandle The device handle consume the allocated space.
1739
1740 @retval EFI_INVALID_PARAMETER Invalid parameter.
1741 @retval EFI_NOT_FOUND No descriptor contains the desired space.
1742 @retval EFI_SUCCESS IO space successfully allocated.
1743
1744 **/
1745 EFI_STATUS
1746 EFIAPI
1747 CoreAllocateIoSpace (
1748 IN EFI_GCD_ALLOCATE_TYPE GcdAllocateType,
1749 IN EFI_GCD_IO_TYPE GcdIoType,
1750 IN UINTN Alignment,
1751 IN UINT64 Length,
1752 IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
1753 IN EFI_HANDLE ImageHandle,
1754 IN EFI_HANDLE DeviceHandle OPTIONAL
1755 );
1756
1757
1758 /**
1759 Frees nonexistent I/O, reserved I/O, or I/O resources from the global coherency
1760 domain of the processor.
1761
1762 @param BaseAddress Base address of the segment.
1763 @param Length Length of the segment.
1764
1765 @retval EFI_SUCCESS Space successfully freed.
1766
1767 **/
1768 EFI_STATUS
1769 EFIAPI
1770 CoreFreeIoSpace (
1771 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1772 IN UINT64 Length
1773 );
1774
1775
1776 /**
1777 Removes reserved I/O or I/O resources from the global coherency domain of the
1778 processor.
1779
1780 @param BaseAddress Base address of the segment.
1781 @param Length Length of the segment.
1782
1783 @retval EFI_SUCCESS Successfully removed a segment of IO space.
1784
1785 **/
1786 EFI_STATUS
1787 EFIAPI
1788 CoreRemoveIoSpace (
1789 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1790 IN UINT64 Length
1791 );
1792
1793
1794 /**
1795 Retrieves the descriptor for an I/O region containing a specified address.
1796
1797 @param BaseAddress Specified start address
1798 @param Descriptor Specified length
1799
1800 @retval EFI_INVALID_PARAMETER Descriptor is NULL.
1801 @retval EFI_SUCCESS Successfully get the IO space descriptor.
1802
1803 **/
1804 EFI_STATUS
1805 EFIAPI
1806 CoreGetIoSpaceDescriptor (
1807 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1808 OUT EFI_GCD_IO_SPACE_DESCRIPTOR *Descriptor
1809 );
1810
1811
1812 /**
1813 Returns a map of the I/O resources in the global coherency domain of the processor.
1814
1815 @param NumberOfDescriptors Number of descriptors.
1816 @param IoSpaceMap Descriptor array
1817
1818 @retval EFI_INVALID_PARAMETER Invalid parameter
1819 @retval EFI_OUT_OF_RESOURCES No enough buffer to allocate
1820 @retval EFI_SUCCESS Successfully get IO space map.
1821
1822 **/
1823 EFI_STATUS
1824 EFIAPI
1825 CoreGetIoSpaceMap (
1826 OUT UINTN *NumberOfDescriptors,
1827 OUT EFI_GCD_IO_SPACE_DESCRIPTOR **IoSpaceMap
1828 );
1829
1830
1831 /**
1832 This is the main Dispatcher for DXE and it exits when there are no more
1833 drivers to run. Drain the mScheduledQueue and load and start a PE
1834 image for each driver. Search the mDiscoveredList to see if any driver can
1835 be placed on the mScheduledQueue. If no drivers are placed on the
1836 mScheduledQueue exit the function. On exit it is assumed the Bds()
1837 will be called, and when the Bds() exits the Dispatcher will be called
1838 again.
1839
1840 @retval EFI_ALREADY_STARTED The DXE Dispatcher is already running
1841 @retval EFI_NOT_FOUND No DXE Drivers were dispatched
1842 @retval EFI_SUCCESS One or more DXE Drivers were dispatched
1843
1844 **/
1845 EFI_STATUS
1846 EFIAPI
1847 CoreDispatcher (
1848 VOID
1849 );
1850
1851 /**
1852 Check every driver and locate a matching one. If the driver is found, the Unrequested
1853 state flag is cleared.
1854
1855 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1856 the firmware file specified by DriverName.
1857 @param DriverName The Driver name to put in the Dependent state.
1858
1859 @retval EFI_SUCCESS The DriverName was found and it's SOR bit was
1860 cleared
1861 @retval EFI_NOT_FOUND The DriverName does not exist or it's SOR bit was
1862 not set.
1863
1864 **/
1865 EFI_STATUS
1866 EFIAPI
1867 CoreSchedule (
1868 IN EFI_HANDLE FirmwareVolumeHandle,
1869 IN EFI_GUID *DriverName
1870 );
1871
1872
1873 /**
1874 Convert a driver from the Untrused back to the Scheduled state.
1875
1876 @param FirmwareVolumeHandle The handle of the Firmware Volume that contains
1877 the firmware file specified by DriverName.
1878 @param DriverName The Driver name to put in the Scheduled state
1879
1880 @retval EFI_SUCCESS The file was found in the untrusted state, and it
1881 was promoted to the trusted state.
1882 @retval EFI_NOT_FOUND The file was not found in the untrusted state.
1883
1884 **/
1885 EFI_STATUS
1886 EFIAPI
1887 CoreTrust (
1888 IN EFI_HANDLE FirmwareVolumeHandle,
1889 IN EFI_GUID *DriverName
1890 );
1891
1892
1893 /**
1894 This routine is the driver initialization entry point. It initializes the
1895 libraries, and registers two notification functions. These notification
1896 functions are responsible for building the FV stack dynamically.
1897
1898 @param ImageHandle The image handle.
1899 @param SystemTable The system table.
1900
1901 @retval EFI_SUCCESS Function successfully returned.
1902
1903 **/
1904 EFI_STATUS
1905 EFIAPI
1906 FwVolDriverInit (
1907 IN EFI_HANDLE ImageHandle,
1908 IN EFI_SYSTEM_TABLE *SystemTable
1909 );
1910
1911
1912 /**
1913 Entry point of the section extraction code. Initializes an instance of the
1914 section extraction interface and installs it on a new handle.
1915
1916 @param ImageHandle A handle for the image that is initializing this driver
1917 @param SystemTable A pointer to the EFI system table
1918
1919 @retval EFI_SUCCESS Driver initialized successfully
1920 @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
1921
1922 **/
1923 EFI_STATUS
1924 EFIAPI
1925 InitializeSectionExtraction (
1926 IN EFI_HANDLE ImageHandle,
1927 IN EFI_SYSTEM_TABLE *SystemTable
1928 );
1929
1930
1931 /**
1932 This DXE service routine is used to process a firmware volume. In
1933 particular, it can be called by BDS to process a single firmware
1934 volume found in a capsule.
1935
1936 @param FvHeader pointer to a firmware volume header
1937 @param Size the size of the buffer pointed to by FvHeader
1938 @param FVProtocolHandle the handle on which a firmware volume protocol
1939 was produced for the firmware volume passed in.
1940
1941 @retval EFI_OUT_OF_RESOURCES if an FVB could not be produced due to lack of
1942 system resources
1943 @retval EFI_VOLUME_CORRUPTED if the volume was corrupted
1944 @retval EFI_SUCCESS a firmware volume protocol was produced for the
1945 firmware volume
1946
1947 **/
1948 EFI_STATUS
1949 EFIAPI
1950 CoreProcessFirmwareVolume (
1951 IN VOID *FvHeader,
1952 IN UINTN Size,
1953 OUT EFI_HANDLE *FVProtocolHandle
1954 );
1955
1956 //
1957 //Functions used during debug buils
1958 //
1959
1960 /**
1961 Displays Architectural protocols that were not loaded and are required for DXE
1962 core to function. Only used in Debug Builds.
1963
1964 **/
1965 VOID
1966 CoreDisplayMissingArchProtocols (
1967 VOID
1968 );
1969
1970
1971 /**
1972 Traverse the discovered list for any drivers that were discovered but not loaded
1973 because the dependency experessions evaluated to false.
1974
1975 **/
1976 VOID
1977 CoreDisplayDiscoveredNotDispatched (
1978 VOID
1979 );
1980
1981
1982 /**
1983 Place holder function until all the Boot Services and Runtime Services are
1984 available.
1985
1986 @return EFI_NOT_AVAILABLE_YET
1987
1988 **/
1989 EFI_STATUS
1990 EFIAPI
1991 CoreEfiNotAvailableYetArg0 (
1992 VOID
1993 );
1994
1995
1996 /**
1997 Place holder function until all the Boot Services and Runtime Services are
1998 available.
1999
2000 @param Arg1 Undefined
2001
2002 @return EFI_NOT_AVAILABLE_YET
2003
2004 **/
2005 EFI_STATUS
2006 EFIAPI
2007 CoreEfiNotAvailableYetArg1 (
2008 UINTN Arg1
2009 );
2010
2011
2012 /**
2013 Place holder function until all the Boot Services and Runtime Services are available.
2014
2015 @param Arg1 Undefined
2016 @param Arg2 Undefined
2017
2018 @return EFI_NOT_AVAILABLE_YET
2019
2020 **/
2021 EFI_STATUS
2022 EFIAPI
2023 CoreEfiNotAvailableYetArg2 (
2024 UINTN Arg1,
2025 UINTN Arg2
2026 );
2027
2028
2029 /**
2030 Place holder function until all the Boot Services and Runtime Services are available.
2031
2032 @param Arg1 Undefined
2033 @param Arg2 Undefined
2034 @param Arg3 Undefined
2035
2036 @return EFI_NOT_AVAILABLE_YET
2037
2038 **/
2039 EFI_STATUS
2040 EFIAPI
2041 CoreEfiNotAvailableYetArg3 (
2042 UINTN Arg1,
2043 UINTN Arg2,
2044 UINTN Arg3
2045 );
2046
2047
2048 /**
2049 Place holder function until all the Boot Services and Runtime Services are available.
2050
2051 @param Arg1 Undefined
2052 @param Arg2 Undefined
2053 @param Arg3 Undefined
2054 @param Arg4 Undefined
2055
2056 @return EFI_NOT_AVAILABLE_YET
2057
2058 **/
2059 EFI_STATUS
2060 EFIAPI
2061 CoreEfiNotAvailableYetArg4 (
2062 UINTN Arg1,
2063 UINTN Arg2,
2064 UINTN Arg3,
2065 UINTN Arg4
2066 );
2067
2068
2069 /**
2070 Place holder function until all the Boot Services and Runtime Services are available.
2071
2072 @param Arg1 Undefined
2073 @param Arg2 Undefined
2074 @param Arg3 Undefined
2075 @param Arg4 Undefined
2076 @param Arg5 Undefined
2077
2078 @return EFI_NOT_AVAILABLE_YET
2079
2080 **/
2081 EFI_STATUS
2082 EFIAPI
2083 CoreEfiNotAvailableYetArg5 (
2084 UINTN Arg1,
2085 UINTN Arg2,
2086 UINTN Arg3,
2087 UINTN Arg4,
2088 UINTN Arg5
2089 );
2090
2091
2092 /**
2093 Given a compressed source buffer, this function retrieves the size of the
2094 uncompressed buffer and the size of the scratch buffer required to decompress
2095 the compressed source buffer.
2096
2097 The GetInfo() function retrieves the size of the uncompressed buffer and the
2098 temporary scratch buffer required to decompress the buffer specified by Source
2099 and SourceSize. If the size of the uncompressed buffer or the size of the
2100 scratch buffer cannot be determined from the compressed data specified by
2101 Source and SourceData, then EFI_INVALID_PARAMETER is returned. Otherwise, the
2102 size of the uncompressed buffer is returned in DestinationSize, the size of
2103 the scratch buffer is returned in ScratchSize, and EFI_SUCCESS is returned.
2104 The GetInfo() function does not have scratch buffer available to perform a
2105 thorough checking of the validity of the source data. It just retrieves the
2106 "Original Size" field from the beginning bytes of the source data and output
2107 it as DestinationSize. And ScratchSize is specific to the decompression
2108 implementation.
2109
2110 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2111 @param Source The source buffer containing the compressed data.
2112 @param SourceSize The size, in bytes, of the source buffer.
2113 @param DestinationSize A pointer to the size, in bytes, of the
2114 uncompressed buffer that will be generated when the
2115 compressed buffer specified by Source and
2116 SourceSize is decompressed.
2117 @param ScratchSize A pointer to the size, in bytes, of the scratch
2118 buffer that is required to decompress the
2119 compressed buffer specified by Source and
2120 SourceSize.
2121
2122 @retval EFI_SUCCESS The size of the uncompressed data was returned in
2123 DestinationSize and the size of the scratch buffer
2124 was returned in ScratchSize.
2125 @retval EFI_INVALID_PARAMETER The size of the uncompressed data or the size of
2126 the scratch buffer cannot be determined from the
2127 compressed data specified by Source and
2128 SourceSize.
2129
2130 **/
2131 EFI_STATUS
2132 EFIAPI
2133 DxeMainUefiDecompressGetInfo (
2134 IN EFI_DECOMPRESS_PROTOCOL *This,
2135 IN VOID *Source,
2136 IN UINT32 SourceSize,
2137 OUT UINT32 *DestinationSize,
2138 OUT UINT32 *ScratchSize
2139 );
2140
2141
2142 /**
2143 Decompresses a compressed source buffer.
2144
2145 The Decompress() function extracts decompressed data to its original form.
2146 This protocol is designed so that the decompression algorithm can be
2147 implemented without using any memory services. As a result, the Decompress()
2148 Function is not allowed to call AllocatePool() or AllocatePages() in its
2149 implementation. It is the caller's responsibility to allocate and free the
2150 Destination and Scratch buffers.
2151 If the compressed source data specified by Source and SourceSize is
2152 sucessfully decompressed into Destination, then EFI_SUCCESS is returned. If
2153 the compressed source data specified by Source and SourceSize is not in a
2154 valid compressed data format, then EFI_INVALID_PARAMETER is returned.
2155
2156 @param This A pointer to the EFI_DECOMPRESS_PROTOCOL instance.
2157 @param Source The source buffer containing the compressed data.
2158 @param SourceSize SourceSizeThe size of source data.
2159 @param Destination On output, the destination buffer that contains
2160 the uncompressed data.
2161 @param DestinationSize The size of the destination buffer. The size of
2162 the destination buffer needed is obtained from
2163 EFI_DECOMPRESS_PROTOCOL.GetInfo().
2164 @param Scratch A temporary scratch buffer that is used to perform
2165 the decompression.
2166 @param ScratchSize The size of scratch buffer. The size of the
2167 scratch buffer needed is obtained from GetInfo().
2168
2169 @retval EFI_SUCCESS Decompression completed successfully, and the
2170 uncompressed buffer is returned in Destination.
2171 @retval EFI_INVALID_PARAMETER The source buffer specified by Source and
2172 SourceSize is corrupted (not in a valid
2173 compressed format).
2174
2175 **/
2176 EFI_STATUS
2177 EFIAPI
2178 DxeMainUefiDecompress (
2179 IN EFI_DECOMPRESS_PROTOCOL *This,
2180 IN VOID *Source,
2181 IN UINT32 SourceSize,
2182 IN OUT VOID *Destination,
2183 IN UINT32 DestinationSize,
2184 IN OUT VOID *Scratch,
2185 IN UINT32 ScratchSize
2186 );
2187
2188 /**
2189 SEP member function. This function creates and returns a new section stream
2190 handle to represent the new section stream.
2191
2192 @param SectionStreamLength Size in bytes of the section stream.
2193 @param SectionStream Buffer containing the new section stream.
2194 @param SectionStreamHandle A pointer to a caller allocated UINTN that on
2195 output contains the new section stream handle.
2196
2197 @retval EFI_SUCCESS The section stream is created successfully.
2198 @retval EFI_OUT_OF_RESOURCES memory allocation failed.
2199 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2200 of last section.
2201
2202 **/
2203 EFI_STATUS
2204 EFIAPI
2205 OpenSectionStream (
2206 IN UINTN SectionStreamLength,
2207 IN VOID *SectionStream,
2208 OUT UINTN *SectionStreamHandle
2209 );
2210
2211
2212
2213 /**
2214 SEP member function. Retrieves requested section from section stream.
2215
2216 @param SectionStreamHandle The section stream from which to extract the
2217 requested section.
2218 @param SectionType A pointer to the type of section to search for.
2219 @param SectionDefinitionGuid If the section type is EFI_SECTION_GUID_DEFINED,
2220 then SectionDefinitionGuid indicates which of
2221 these types of sections to search for.
2222 @param SectionInstance Indicates which instance of the requested
2223 section to return.
2224 @param Buffer Double indirection to buffer. If *Buffer is
2225 non-null on input, then the buffer is caller
2226 allocated. If Buffer is NULL, then the buffer
2227 is callee allocated. In either case, the
2228 requried buffer size is returned in *BufferSize.
2229 @param BufferSize On input, indicates the size of *Buffer if
2230 *Buffer is non-null on input. On output,
2231 indicates the required size (allocated size if
2232 callee allocated) of *Buffer.
2233 @param AuthenticationStatus A pointer to a caller-allocated UINT32 that
2234 indicates the authentication status of the
2235 output buffer. If the input section's
2236 GuidedSectionHeader.Attributes field
2237 has the EFI_GUIDED_SECTION_AUTH_STATUS_VALID
2238 bit as clear, AuthenticationStatus must return
2239 zero. Both local bits (19:16) and aggregate
2240 bits (3:0) in AuthenticationStatus are returned
2241 by ExtractSection(). These bits reflect the
2242 status of the extraction operation. The bit
2243 pattern in both regions must be the same, as
2244 the local and aggregate authentication statuses
2245 have equivalent meaning at this level. If the
2246 function returns anything other than
2247 EFI_SUCCESS, the value of *AuthenticationStatus
2248 is undefined.
2249
2250 @retval EFI_SUCCESS Section was retrieved successfully
2251 @retval EFI_PROTOCOL_ERROR A GUID defined section was encountered in the
2252 section stream with its
2253 EFI_GUIDED_SECTION_PROCESSING_REQUIRED bit set,
2254 but there was no corresponding GUIDed Section
2255 Extraction Protocol in the handle database.
2256 *Buffer is unmodified.
2257 @retval EFI_NOT_FOUND An error was encountered when parsing the
2258 SectionStream. This indicates the SectionStream
2259 is not correctly formatted.
2260 @retval EFI_NOT_FOUND The requested section does not exist.
2261 @retval EFI_OUT_OF_RESOURCES The system has insufficient resources to process
2262 the request.
2263 @retval EFI_INVALID_PARAMETER The SectionStreamHandle does not exist.
2264 @retval EFI_WARN_TOO_SMALL The size of the caller allocated input buffer is
2265 insufficient to contain the requested section.
2266 The input buffer is filled and section contents
2267 are truncated.
2268
2269 **/
2270 EFI_STATUS
2271 EFIAPI
2272 GetSection (
2273 IN UINTN SectionStreamHandle,
2274 IN EFI_SECTION_TYPE *SectionType,
2275 IN EFI_GUID *SectionDefinitionGuid,
2276 IN UINTN SectionInstance,
2277 IN VOID **Buffer,
2278 IN OUT UINTN *BufferSize,
2279 OUT UINT32 *AuthenticationStatus
2280 );
2281
2282
2283 /**
2284 SEP member function. Deletes an existing section stream
2285
2286 @param StreamHandleToClose Indicates the stream to close
2287
2288 @retval EFI_SUCCESS The section stream is closed sucessfully.
2289 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
2290 @retval EFI_INVALID_PARAMETER Section stream does not end concident with end
2291 of last section.
2292
2293 **/
2294 EFI_STATUS
2295 EFIAPI
2296 CloseSectionStream (
2297 IN UINTN StreamHandleToClose
2298 );
2299
2300 /**
2301 Creates and initializes the DebugImageInfo Table. Also creates the configuration
2302 table and registers it into the system table.
2303
2304 Note:
2305 This function allocates memory, frees it, and then allocates memory at an
2306 address within the initial allocation. Since this function is called early
2307 in DXE core initialization (before drivers are dispatched), this should not
2308 be a problem.
2309
2310 **/
2311 VOID
2312 CoreInitializeDebugImageInfoTable (
2313 VOID
2314 );
2315
2316
2317 /**
2318 Update the CRC32 in the Debug Table.
2319 Since the CRC32 service is made available by the Runtime driver, we have to
2320 wait for the Runtime Driver to be installed before the CRC32 can be computed.
2321 This function is called elsewhere by the core when the runtime architectural
2322 protocol is produced.
2323
2324 **/
2325 VOID
2326 CoreUpdateDebugTableCrc32 (
2327 VOID
2328 );
2329
2330
2331 /**
2332 Adds a new DebugImageInfo structure to the DebugImageInfo Table. Re-Allocates
2333 the table if it's not large enough to accomidate another entry.
2334
2335 @param ImageInfoType type of debug image information
2336 @param LoadedImage pointer to the loaded image protocol for the image being
2337 loaded
2338 @param ImageHandle image handle for the image being loaded
2339
2340 **/
2341 VOID
2342 CoreNewDebugImageInfoEntry (
2343 IN UINT32 ImageInfoType,
2344 IN EFI_LOADED_IMAGE_PROTOCOL *LoadedImage,
2345 IN EFI_HANDLE ImageHandle
2346 );
2347
2348
2349 /**
2350 Removes and frees an entry from the DebugImageInfo Table.
2351
2352 @param ImageHandle image handle for the image being unloaded
2353
2354 **/
2355 VOID
2356 CoreRemoveDebugImageInfoEntry (
2357 EFI_HANDLE ImageHandle
2358 );
2359
2360
2361 /**
2362 This routine consumes FV hobs and produces instances of FW_VOL_BLOCK_PROTOCOL as appropriate.
2363
2364 @param ImageHandle The image handle.
2365 @param SystemTable The system table.
2366
2367 @retval EFI_SUCCESS Successfully initialized firmware volume block
2368 driver.
2369
2370 **/
2371 EFI_STATUS
2372 EFIAPI
2373 FwVolBlockDriverInit (
2374 IN EFI_HANDLE ImageHandle,
2375 IN EFI_SYSTEM_TABLE *SystemTable
2376 );
2377
2378
2379 /**
2380 This routine produces a firmware volume block protocol on a given
2381 buffer.
2382
2383 @param BaseAddress base address of the firmware volume image
2384 @param Length length of the firmware volume image
2385 @param ParentHandle handle of parent firmware volume, if this image
2386 came from an FV image file in another firmware
2387 volume (ala capsules)
2388 @param FvProtocol Firmware volume block protocol produced.
2389
2390 @retval EFI_VOLUME_CORRUPTED Volume corrupted.
2391 @retval EFI_OUT_OF_RESOURCES No enough buffer to be allocated.
2392 @retval EFI_SUCCESS Successfully produced a FVB protocol on given
2393 buffer.
2394
2395 **/
2396 EFI_STATUS
2397 ProduceFVBProtocolOnBuffer (
2398 IN EFI_PHYSICAL_ADDRESS BaseAddress,
2399 IN UINT64 Length,
2400 IN EFI_HANDLE ParentHandle,
2401 OUT EFI_HANDLE *FvProtocol OPTIONAL
2402 );
2403
2404
2405 /**
2406 Raising to the task priority level of the mutual exclusion
2407 lock, and then acquires ownership of the lock.
2408
2409 @param Lock The lock to acquire
2410
2411 @return Lock owned
2412
2413 **/
2414 VOID
2415 CoreAcquireLock (
2416 IN EFI_LOCK *Lock
2417 );
2418
2419
2420 /**
2421 Initialize a basic mutual exclusion lock. Each lock
2422 provides mutual exclusion access at it's task priority
2423 level. Since there is no-premption (at any TPL) or
2424 multiprocessor support, acquiring the lock only consists
2425 of raising to the locks TPL.
2426
2427 @param Lock The EFI_LOCK structure to initialize
2428
2429 @retval EFI_SUCCESS Lock Owned.
2430 @retval EFI_ACCESS_DENIED Reentrant Lock Acquisition, Lock not Owned.
2431
2432 **/
2433 EFI_STATUS
2434 CoreAcquireLockOrFail (
2435 IN EFI_LOCK *Lock
2436 );
2437
2438
2439 /**
2440 Releases ownership of the mutual exclusion lock, and
2441 restores the previous task priority level.
2442
2443 @param Lock The lock to release
2444
2445 @return Lock unowned
2446
2447 **/
2448 VOID
2449 CoreReleaseLock (
2450 IN EFI_LOCK *Lock
2451 );
2452
2453 #endif