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