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