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