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