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