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