TianoCore EDK2 master
Loading...
Searching...
No Matches
Dispatcher.c
Go to the documentation of this file.
1
34#include "DxeMain.h"
35
36//
37// The Driver List contains one copy of every driver that has been discovered.
38// Items are never removed from the driver list. List of EFI_CORE_DRIVER_ENTRY
39//
40LIST_ENTRY mDiscoveredList = INITIALIZE_LIST_HEAD_VARIABLE (mDiscoveredList);
41
42//
43// Queue of drivers that are ready to dispatch. This queue is a subset of the
44// mDiscoveredList.list of EFI_CORE_DRIVER_ENTRY.
45//
46LIST_ENTRY mScheduledQueue = INITIALIZE_LIST_HEAD_VARIABLE (mScheduledQueue);
47
48//
49// List of handles who's Fv's have been parsed and added to the mFwDriverList.
50//
51LIST_ENTRY mFvHandleList = INITIALIZE_LIST_HEAD_VARIABLE (mFvHandleList); // list of KNOWN_HANDLE
52
53//
54// Lock for mDiscoveredList, mScheduledQueue, gDispatcherRunning.
55//
56EFI_LOCK mDispatcherLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_HIGH_LEVEL);
57
58//
59// Flag for the DXE Dispacher. TRUE if dispatcher is execuing.
60//
61BOOLEAN gDispatcherRunning = FALSE;
62
63//
64// Module globals to manage the FwVol registration notification event
65//
66EFI_EVENT mFwVolEvent;
67VOID *mFwVolEventRegistration;
68
69//
70// List of file types supported by dispatcher
71//
72EFI_FV_FILETYPE mDxeFileTypes[] = {
73 EFI_FV_FILETYPE_DRIVER,
74 EFI_FV_FILETYPE_COMBINED_SMM_DXE,
75 EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,
76 EFI_FV_FILETYPE_DXE_CORE,
77 EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
78};
79
80typedef struct {
84
85FV_FILEPATH_DEVICE_PATH mFvDevicePath;
86
87//
88// Function Prototypes
89//
90
102VOID
104 IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry
105 );
106
124VOID
125EFIAPI
127 IN EFI_EVENT Event,
128 IN VOID *Context
129 );
130
147 IN EFI_HANDLE FvHandle,
148 IN EFI_GUID *DriverName
149 );
150
175 IN EFI_HANDLE FvHandle,
176 IN EFI_GUID *DriverName,
177 IN EFI_FV_FILETYPE Type
178 );
179
194 IN EFI_HANDLE FvHandle,
195 IN EFI_GUID *FileName
196 );
197
202VOID
204 VOID
205 )
206{
207 CoreAcquireLock (&mDispatcherLock);
208}
209
214VOID
216 VOID
217 )
218{
219 CoreReleaseLock (&mDispatcherLock);
220}
221
237 )
238{
239 EFI_STATUS Status;
240 EFI_SECTION_TYPE SectionType;
241 UINT32 AuthenticationStatus;
243
244 Fv = DriverEntry->Fv;
245
246 //
247 // Grab Depex info, it will never be free'ed.
248 //
249 SectionType = EFI_SECTION_DXE_DEPEX;
250 Status = Fv->ReadSection (
251 DriverEntry->Fv,
252 &DriverEntry->FileName,
253 SectionType,
254 0,
255 &DriverEntry->Depex,
256 (UINTN *)&DriverEntry->DepexSize,
257 &AuthenticationStatus
258 );
259 if (EFI_ERROR (Status)) {
260 if (Status == EFI_PROTOCOL_ERROR) {
261 //
262 // The section extraction protocol failed so set protocol error flag
263 //
264 DriverEntry->DepexProtocolError = TRUE;
265 } else {
266 //
267 // If no Depex assume UEFI 2.0 driver model
268 //
269 DriverEntry->Depex = NULL;
270 DriverEntry->Dependent = TRUE;
271 DriverEntry->DepexProtocolError = FALSE;
272 }
273 } else {
274 //
275 // Set Before, After, and Unrequested state information based on Depex
276 // Driver will be put in Dependent or Unrequested state
277 //
279 DriverEntry->DepexProtocolError = FALSE;
280 }
281
282 return Status;
283}
284
300EFIAPI
302 IN EFI_HANDLE FirmwareVolumeHandle,
303 IN EFI_GUID *DriverName
304 )
305{
306 LIST_ENTRY *Link;
308
309 //
310 // Check every driver
311 //
312 for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
313 DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
314 if ((DriverEntry->FvHandle == FirmwareVolumeHandle) &&
315 DriverEntry->Unrequested &&
316 CompareGuid (DriverName, &DriverEntry->FileName))
317 {
318 //
319 // Move the driver from the Unrequested to the Dependent state
320 //
322 DriverEntry->Unrequested = FALSE;
323 DriverEntry->Dependent = TRUE;
325
326 DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_SUCCESS\n", DriverName));
327
328 return EFI_SUCCESS;
329 }
330 }
331
332 DEBUG ((DEBUG_DISPATCH, "Schedule FFS(%g) - EFI_NOT_FOUND\n", DriverName));
333
334 return EFI_NOT_FOUND;
335}
336
350EFIAPI
352 IN EFI_HANDLE FirmwareVolumeHandle,
353 IN EFI_GUID *DriverName
354 )
355{
356 LIST_ENTRY *Link;
358
359 //
360 // Check every driver
361 //
362 for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
363 DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
364 if ((DriverEntry->FvHandle == FirmwareVolumeHandle) &&
365 DriverEntry->Untrusted &&
366 CompareGuid (DriverName, &DriverEntry->FileName))
367 {
368 //
369 // Transition driver from Untrusted to Scheduled state.
370 //
372 DriverEntry->Untrusted = FALSE;
373 DriverEntry->Scheduled = TRUE;
374 InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink);
376
377 return EFI_SUCCESS;
378 }
379 }
380
381 return EFI_NOT_FOUND;
382}
383
399EFIAPI
401 VOID
402 )
403{
404 EFI_STATUS Status;
405 EFI_STATUS ReturnStatus;
406 LIST_ENTRY *Link;
408 BOOLEAN ReadyToRun;
409 EFI_EVENT DxeDispatchEvent;
410
412
413 if (gDispatcherRunning) {
414 //
415 // If the dispatcher is running don't let it be restarted.
416 //
417 return EFI_ALREADY_STARTED;
418 }
419
420 gDispatcherRunning = TRUE;
421
422 Status = CoreCreateEventEx (
423 EVT_NOTIFY_SIGNAL,
424 TPL_NOTIFY,
426 NULL,
427 &gEfiEventDxeDispatchGuid,
428 &DxeDispatchEvent
429 );
430 if (EFI_ERROR (Status)) {
431 return Status;
432 }
433
434 ReturnStatus = EFI_NOT_FOUND;
435 do {
436 //
437 // Drain the Scheduled Queue
438 //
439 while (!IsListEmpty (&mScheduledQueue)) {
440 DriverEntry = CR (
441 mScheduledQueue.ForwardLink,
443 ScheduledLink,
444 EFI_CORE_DRIVER_ENTRY_SIGNATURE
445 );
446
447 //
448 // Load the DXE Driver image into memory. If the Driver was transitioned from
449 // Untrused to Scheduled it would have already been loaded so we may need to
450 // skip the LoadImage
451 //
452 if ((DriverEntry->ImageHandle == NULL) && !DriverEntry->IsFvImage) {
453 DEBUG ((DEBUG_INFO, "Loading driver %g\n", &DriverEntry->FileName));
454 Status = CoreLoadImage (
455 FALSE,
456 gDxeCoreImageHandle,
457 DriverEntry->FvFileDevicePath,
458 NULL,
459 0,
460 &DriverEntry->ImageHandle
461 );
462
463 //
464 // Update the driver state to reflect that it's been loaded
465 //
466 if (EFI_ERROR (Status)) {
468
469 if (Status == EFI_SECURITY_VIOLATION) {
470 //
471 // Take driver from Scheduled to Untrused state
472 //
473 DriverEntry->Untrusted = TRUE;
474 } else {
475 //
476 // The DXE Driver could not be loaded, and do not attempt to load or start it again.
477 // Take driver from Scheduled to Initialized.
478 //
479 // This case include the Never Trusted state if EFI_ACCESS_DENIED is returned
480 //
481 DriverEntry->Initialized = TRUE;
482 }
483
484 DriverEntry->Scheduled = FALSE;
485 RemoveEntryList (&DriverEntry->ScheduledLink);
486
488
489 //
490 // If it's an error don't try the StartImage
491 //
492 continue;
493 }
494 }
495
497
498 DriverEntry->Scheduled = FALSE;
499 DriverEntry->Initialized = TRUE;
500 RemoveEntryList (&DriverEntry->ScheduledLink);
501
503
504 if (DriverEntry->IsFvImage) {
505 //
506 // Produce a firmware volume block protocol for FvImage so it gets dispatched from.
507 //
508 Status = CoreProcessFvImageFile (DriverEntry->Fv, DriverEntry->FvHandle, &DriverEntry->FileName);
509 } else {
512 (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_BEGIN),
513 &DriverEntry->ImageHandle,
514 sizeof (DriverEntry->ImageHandle)
515 );
516 ASSERT (DriverEntry->ImageHandle != NULL);
517
518 Status = CoreStartImage (DriverEntry->ImageHandle, NULL, NULL);
519
522 (EFI_SOFTWARE_DXE_CORE | EFI_SW_PC_INIT_END),
523 &DriverEntry->ImageHandle,
524 sizeof (DriverEntry->ImageHandle)
525 );
526 }
527
528 ReturnStatus = EFI_SUCCESS;
529 }
530
531 //
532 // Now DXE Dispatcher finished one round of dispatch, signal an event group
533 // so that SMM Dispatcher get chance to dispatch SMM Drivers which depend
534 // on UEFI protocols
535 //
536 if (!EFI_ERROR (ReturnStatus)) {
537 CoreSignalEvent (DxeDispatchEvent);
538 }
539
540 //
541 // Search DriverList for items to place on Scheduled Queue
542 //
543 ReadyToRun = FALSE;
544 for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
545 DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
546
547 if (DriverEntry->DepexProtocolError) {
548 //
549 // If Section Extraction Protocol did not let the Depex be read before retry the read
550 //
552 }
553
554 if (DriverEntry->Dependent) {
557 ReadyToRun = TRUE;
558 }
559 } else {
560 if (DriverEntry->Unrequested) {
561 DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));
562 DEBUG ((DEBUG_DISPATCH, " SOR = Not Requested\n"));
563 DEBUG ((DEBUG_DISPATCH, " RESULT = FALSE\n"));
564 }
565 }
566 }
567 } while (ReadyToRun);
568
569 //
570 // Close DXE dispatch Event
571 //
572 CoreCloseEvent (DxeDispatchEvent);
573
574 gDispatcherRunning = FALSE;
575
577
578 return ReturnStatus;
579}
580
592VOID
594 IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry
595 )
596{
597 LIST_ENTRY *Link;
599
600 //
601 // Process Before Dependency
602 //
603 for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
604 DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
605 if (DriverEntry->Before && DriverEntry->Dependent && (DriverEntry != InsertedDriverEntry)) {
606 DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));
607 DEBUG ((DEBUG_DISPATCH, " BEFORE FFS(%g) = ", &DriverEntry->BeforeAfterGuid));
608 if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {
609 //
610 // Recursively process BEFORE
611 //
612 DEBUG ((DEBUG_DISPATCH, "TRUE\n END\n RESULT = TRUE\n"));
614 } else {
615 DEBUG ((DEBUG_DISPATCH, "FALSE\n END\n RESULT = FALSE\n"));
616 }
617 }
618 }
619
620 //
621 // Convert driver from Dependent to Scheduled state
622 //
624
625 InsertedDriverEntry->Dependent = FALSE;
626 InsertedDriverEntry->Scheduled = TRUE;
627 InsertTailList (&mScheduledQueue, &InsertedDriverEntry->ScheduledLink);
628
630
631 //
632 // Process After Dependency
633 //
634 for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
635 DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
636 if (DriverEntry->After && DriverEntry->Dependent && (DriverEntry != InsertedDriverEntry)) {
637 DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));
638 DEBUG ((DEBUG_DISPATCH, " AFTER FFS(%g) = ", &DriverEntry->BeforeAfterGuid));
639 if (CompareGuid (&InsertedDriverEntry->FileName, &DriverEntry->BeforeAfterGuid)) {
640 //
641 // Recursively process AFTER
642 //
643 DEBUG ((DEBUG_DISPATCH, "TRUE\n END\n RESULT = TRUE\n"));
645 } else {
646 DEBUG ((DEBUG_DISPATCH, "FALSE\n END\n RESULT = FALSE\n"));
647 }
648 }
649 }
650}
651
661BOOLEAN
663 IN EFI_HANDLE FvHandle
664 )
665{
666 LIST_ENTRY *Link;
667 KNOWN_HANDLE *KnownHandle;
668
669 for (Link = mFvHandleList.ForwardLink; Link != &mFvHandleList; Link = Link->ForwardLink) {
670 KnownHandle = CR (Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);
671 if (KnownHandle->Handle == FvHandle) {
672 return TRUE;
673 }
674 }
675
676 return FALSE;
677}
678
693 IN EFI_HANDLE FvHandle
694 )
695{
696 EFI_STATUS Status;
697 EFI_GUID FvNameGuid;
698 BOOLEAN FvNameGuidIsFound;
699 UINT32 ExtHeaderOffset;
701 EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader;
702 EFI_FV_BLOCK_MAP_ENTRY *BlockMap;
703 UINTN LbaOffset;
704 UINTN Index;
705 EFI_LBA LbaIndex;
706 LIST_ENTRY *Link;
707 KNOWN_HANDLE *KnownHandle;
708
709 FwVolHeader = NULL;
710
711 //
712 // Get the FirmwareVolumeBlock protocol on that handle
713 //
714 FvNameGuidIsFound = FALSE;
715 Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolumeBlockProtocolGuid, (VOID **)&Fvb);
716 if (!EFI_ERROR (Status)) {
717 //
718 // Get the full FV header based on FVB protocol.
719 //
720 ASSERT (Fvb != NULL);
721 Status = GetFwVolHeader (Fvb, &FwVolHeader);
722 if (!EFI_ERROR (Status)) {
723 ASSERT (FwVolHeader != NULL);
724 if (VerifyFvHeaderChecksum (FwVolHeader) && (FwVolHeader->ExtHeaderOffset != 0)) {
725 ExtHeaderOffset = (UINT32)FwVolHeader->ExtHeaderOffset;
726 BlockMap = FwVolHeader->BlockMap;
727 LbaIndex = 0;
728 LbaOffset = 0;
729 //
730 // Find LbaIndex and LbaOffset for FV extension header based on BlockMap.
731 //
732 while ((BlockMap->NumBlocks != 0) || (BlockMap->Length != 0)) {
733 for (Index = 0; Index < BlockMap->NumBlocks && ExtHeaderOffset >= BlockMap->Length; Index++) {
734 ExtHeaderOffset -= BlockMap->Length;
735 LbaIndex++;
736 }
737
738 //
739 // Check whether FvExtHeader is crossing the multi block range.
740 //
741 if (Index < BlockMap->NumBlocks) {
742 LbaOffset = ExtHeaderOffset;
743 break;
744 }
745
746 BlockMap++;
747 }
748
749 //
750 // Read FvNameGuid from FV extension header.
751 //
752 Status = ReadFvbData (Fvb, &LbaIndex, &LbaOffset, sizeof (FvNameGuid), (UINT8 *)&FvNameGuid);
753 if (!EFI_ERROR (Status)) {
754 FvNameGuidIsFound = TRUE;
755 }
756 }
757
758 CoreFreePool (FwVolHeader);
759 }
760 }
761
762 if (FvNameGuidIsFound) {
763 //
764 // Check whether the FV image with the found FvNameGuid has been processed.
765 //
766 for (Link = mFvHandleList.ForwardLink; Link != &mFvHandleList; Link = Link->ForwardLink) {
767 KnownHandle = CR (Link, KNOWN_HANDLE, Link, KNOWN_HANDLE_SIGNATURE);
768 if (CompareGuid (&FvNameGuid, &KnownHandle->FvNameGuid)) {
769 DEBUG ((DEBUG_ERROR, "FvImage on FvHandle %p and %p has the same FvNameGuid %g.\n", FvHandle, KnownHandle->Handle, &FvNameGuid));
770 return NULL;
771 }
772 }
773 }
774
775 KnownHandle = AllocateZeroPool (sizeof (KNOWN_HANDLE));
776 if (KnownHandle == NULL) {
777 ASSERT (KnownHandle != NULL);
778 return NULL;
779 }
780
781 KnownHandle->Signature = KNOWN_HANDLE_SIGNATURE;
782 KnownHandle->Handle = FvHandle;
783 if (FvNameGuidIsFound) {
784 CopyGuid (&KnownHandle->FvNameGuid, &FvNameGuid);
785 }
786
787 InsertTailList (&mFvHandleList, &KnownHandle->Link);
788 return KnownHandle;
789}
790
807 IN EFI_HANDLE FvHandle,
808 IN EFI_GUID *DriverName
809 )
810{
811 EFI_STATUS Status;
812 EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
813 EFI_DEVICE_PATH_PROTOCOL *FileNameDevicePath;
814
815 //
816 // Remember the device path of the FV
817 //
818 Status = CoreHandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
819 if (EFI_ERROR (Status)) {
820 FileNameDevicePath = NULL;
821 } else {
822 //
823 // Build a device path to the file in the FV to pass into gBS->LoadImage
824 //
825 EfiInitializeFwVolDevicepathNode (&mFvDevicePath.File, DriverName);
826 SetDevicePathEndNode (&mFvDevicePath.End);
827
828 FileNameDevicePath = AppendDevicePath (
829 FvDevicePath,
830 (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath
831 );
832 }
833
834 return FileNameDevicePath;
835}
836
862 IN EFI_HANDLE FvHandle,
863 IN EFI_GUID *DriverName,
864 IN EFI_FV_FILETYPE Type
865 )
866{
868
869 //
870 // Create the Driver Entry for the list. ZeroPool initializes lots of variables to
871 // NULL or FALSE.
872 //
874 if (DriverEntry == NULL) {
875 ASSERT (DriverEntry != NULL);
876 return EFI_OUT_OF_RESOURCES;
877 }
878
879 if (Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
880 DriverEntry->IsFvImage = TRUE;
881 }
882
883 DriverEntry->Signature = EFI_CORE_DRIVER_ENTRY_SIGNATURE;
884 CopyGuid (&DriverEntry->FileName, DriverName);
885 DriverEntry->FvHandle = FvHandle;
886 DriverEntry->Fv = Fv;
887 DriverEntry->FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, DriverName);
888
890
892
893 InsertTailList (&mDiscoveredList, &DriverEntry->Link);
894
896
897 return EFI_SUCCESS;
898}
899
912BOOLEAN
914 IN CONST EFI_GUID *FvNameGuid,
915 IN CONST EFI_GUID *DriverName
916 )
917{
919
920 HobFv2.Raw = GetHobList ();
921
922 while ((HobFv2.Raw = GetNextHob (EFI_HOB_TYPE_FV2, HobFv2.Raw)) != NULL) {
923 //
924 // Compare parent FvNameGuid and FileGuid both.
925 //
926 if (CompareGuid (DriverName, &HobFv2.FirmwareVolume2->FileName) &&
927 CompareGuid (FvNameGuid, &HobFv2.FirmwareVolume2->FvName))
928 {
929 return TRUE;
930 }
931
932 HobFv2.Raw = GET_NEXT_HOB (HobFv2);
933 }
934
935 return FALSE;
936}
937
952BOOLEAN
955 OUT UINT32 *FvUsedSize,
956 OUT UINT8 *EraseByte
957 )
958{
959 UINT16 ExtHeaderOffset;
961 EFI_FIRMWARE_VOLUME_EXT_ENTRY *ExtEntryList;
963
964 ExtHeaderOffset = ReadUnaligned16 (&FvHeader->ExtHeaderOffset);
965 if (ExtHeaderOffset != 0) {
966 ExtHeader = (EFI_FIRMWARE_VOLUME_EXT_HEADER *)((UINT8 *)FvHeader + ExtHeaderOffset);
967 ExtEntryList = (EFI_FIRMWARE_VOLUME_EXT_ENTRY *)(ExtHeader + 1);
968 while ((UINTN)ExtEntryList < ((UINTN)ExtHeader + ReadUnaligned32 (&ExtHeader->ExtHeaderSize))) {
969 if (ReadUnaligned16 (&ExtEntryList->ExtEntryType) == EFI_FV_EXT_TYPE_USED_SIZE_TYPE) {
970 //
971 // USED_SIZE FV_EXT_TYPE entry is found.
972 //
973 ExtEntryUsedSize = (EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE *)ExtEntryList;
974 *FvUsedSize = ReadUnaligned32 (&ExtEntryUsedSize->UsedSize);
975 if ((ReadUnaligned32 (&FvHeader->Attributes) & EFI_FVB2_ERASE_POLARITY) != 0) {
976 *EraseByte = 0xFF;
977 } else {
978 *EraseByte = 0;
979 }
980
981 DEBUG ((
982 DEBUG_INFO,
983 "FV at 0x%x has 0x%x used size, and erase byte is 0x%02x\n",
984 FvHeader,
985 *FvUsedSize,
986 *EraseByte
987 ));
988 return TRUE;
989 }
990
991 ExtEntryList = (EFI_FIRMWARE_VOLUME_EXT_ENTRY *)
992 ((UINT8 *)ExtEntryList + ReadUnaligned16 (&ExtEntryList->ExtEntrySize));
993 }
994 }
995
996 //
997 // No USED_SIZE FV_EXT_TYPE entry found.
998 //
999 return FALSE;
1000}
1001
1016 IN EFI_HANDLE FvHandle,
1017 IN EFI_GUID *FileName
1018 )
1019{
1020 EFI_STATUS Status;
1021 EFI_SECTION_TYPE SectionType;
1022 UINT32 AuthenticationStatus;
1023 VOID *Buffer;
1024 VOID *AlignedBuffer;
1025 UINTN BufferSize;
1027 UINT32 FvAlignment;
1028 EFI_DEVICE_PATH_PROTOCOL *FvFileDevicePath;
1029 UINT32 FvUsedSize;
1030 UINT8 EraseByte;
1031 UINTN Index;
1032
1033 //
1034 // Read firmware volume section(s)
1035 //
1036 SectionType = EFI_SECTION_FIRMWARE_VOLUME_IMAGE;
1037
1038 Index = 0;
1039 do {
1040 FvHeader = NULL;
1041 FvAlignment = 0;
1042 Buffer = NULL;
1043 BufferSize = 0;
1044 AlignedBuffer = NULL;
1045 Status = Fv->ReadSection (
1046 Fv,
1047 FileName,
1048 SectionType,
1049 Index,
1050 &Buffer,
1051 &BufferSize,
1052 &AuthenticationStatus
1053 );
1054 if (!EFI_ERROR (Status)) {
1055 //
1056 // Evaluate the authentication status of the Firmware Volume through
1057 // Security Architectural Protocol
1058 //
1059 if (gSecurity != NULL) {
1060 FvFileDevicePath = CoreFvToDevicePath (Fv, FvHandle, FileName);
1061 if (FvFileDevicePath != NULL) {
1062 Status = gSecurity->FileAuthenticationState (
1063 gSecurity,
1064 AuthenticationStatus,
1065 FvFileDevicePath
1066 );
1067 FreePool (FvFileDevicePath);
1068 } else {
1069 Status = EFI_OUT_OF_RESOURCES;
1070 }
1071
1072 if (Status != EFI_SUCCESS) {
1073 //
1074 // Security check failed. The firmware volume should not be used for any purpose.
1075 //
1076 if (Buffer != NULL) {
1077 FreePool (Buffer);
1078 }
1079
1080 break;
1081 }
1082 }
1083
1084 //
1085 // FvImage should be at its required alignment.
1086 //
1087 FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)Buffer;
1088 //
1089 // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first byte of the volume
1090 // can be aligned on any power-of-two boundary. A weakly aligned volume can not be moved from
1091 // its initial linked location and maintain its alignment.
1092 //
1093 if ((ReadUnaligned32 (&FvHeader->Attributes) & EFI_FVB2_WEAK_ALIGNMENT) != EFI_FVB2_WEAK_ALIGNMENT) {
1094 //
1095 // Get FvHeader alignment
1096 //
1097 FvAlignment = 1 << ((ReadUnaligned32 (&FvHeader->Attributes) & EFI_FVB2_ALIGNMENT) >> 16);
1098 //
1099 // FvAlignment must be greater than or equal to 8 bytes of the minimum FFS alignment value.
1100 //
1101 if (FvAlignment < 8) {
1102 FvAlignment = 8;
1103 }
1104
1105 DEBUG ((
1106 DEBUG_INFO,
1107 "%a() FV at 0x%x, FvAlignment required is 0x%x\n",
1108 __func__,
1109 FvHeader,
1110 FvAlignment
1111 ));
1112
1113 //
1114 // Check FvImage alignment.
1115 //
1116 if ((UINTN)FvHeader % FvAlignment != 0) {
1117 //
1118 // Allocate the aligned buffer for the FvImage.
1119 //
1120 AlignedBuffer = AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), (UINTN)FvAlignment);
1121 if (AlignedBuffer == NULL) {
1122 FreePool (Buffer);
1123 Status = EFI_OUT_OF_RESOURCES;
1124 break;
1125 } else {
1126 //
1127 // Move FvImage into the aligned buffer and release the original buffer.
1128 //
1129 if (GetFvUsedSize (FvHeader, &FvUsedSize, &EraseByte)) {
1130 //
1131 // Copy the used bytes and fill the rest with the erase value.
1132 //
1133 CopyMem (AlignedBuffer, FvHeader, (UINTN)FvUsedSize);
1134 SetMem (
1135 (UINT8 *)AlignedBuffer + FvUsedSize,
1136 (UINTN)(BufferSize - FvUsedSize),
1137 EraseByte
1138 );
1139 } else {
1140 CopyMem (AlignedBuffer, Buffer, BufferSize);
1141 }
1142
1143 FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *)AlignedBuffer;
1144 FreePool (Buffer);
1145 Buffer = NULL;
1146 }
1147 }
1148 }
1149
1150 //
1151 // Produce a FVB protocol for the file
1152 //
1154 (EFI_PHYSICAL_ADDRESS)(UINTN)FvHeader,
1155 (UINT64)BufferSize,
1156 FvHandle,
1157 AuthenticationStatus,
1158 NULL
1159 );
1160 }
1161
1162 if (EFI_ERROR (Status)) {
1163 //
1164 // ReadSection or Produce FVB failed, Free data buffer
1165 //
1166 if (Buffer != NULL) {
1167 FreePool (Buffer);
1168 }
1169
1170 if (AlignedBuffer != NULL) {
1171 FreeAlignedPages (AlignedBuffer, EFI_SIZE_TO_PAGES (BufferSize));
1172 }
1173
1174 break;
1175 } else {
1176 Index++;
1177 }
1178 } while (TRUE);
1179
1180 if (Index > 0) {
1181 //
1182 // At least one FvImage has been processed successfully.
1183 //
1184 return EFI_SUCCESS;
1185 } else {
1186 return Status;
1187 }
1188}
1189
1207VOID
1208EFIAPI
1210 IN EFI_EVENT Event,
1211 IN VOID *Context
1212 )
1213{
1214 EFI_STATUS Status;
1215 EFI_STATUS GetNextFileStatus;
1217 EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
1218 EFI_HANDLE FvHandle;
1219 UINTN BufferSize;
1220 EFI_GUID NameGuid;
1221 UINTN Key;
1222 EFI_FV_FILETYPE Type;
1223 EFI_FV_FILE_ATTRIBUTES Attributes;
1224 UINTN Size;
1226 EFI_GUID *AprioriFile;
1227 UINTN AprioriEntryCount;
1228 UINTN Index;
1229 LIST_ENTRY *Link;
1230 UINT32 AuthenticationStatus;
1231 UINTN SizeOfBuffer;
1232 VOID *DepexBuffer;
1233 KNOWN_HANDLE *KnownHandle;
1234
1235 FvHandle = NULL;
1236
1237 while (TRUE) {
1238 BufferSize = sizeof (EFI_HANDLE);
1239 Status = CoreLocateHandle (
1241 NULL,
1242 mFwVolEventRegistration,
1243 &BufferSize,
1244 &FvHandle
1245 );
1246 if (EFI_ERROR (Status)) {
1247 //
1248 // If no more notification events exit
1249 //
1250 return;
1251 }
1252
1253 if (FvHasBeenProcessed (FvHandle)) {
1254 //
1255 // This Fv has already been processed so lets skip it!
1256 //
1257 continue;
1258 }
1259
1260 //
1261 // Since we are about to process this Fv mark it as processed.
1262 //
1263 KnownHandle = FvIsBeingProcessed (FvHandle);
1264 if (KnownHandle == NULL) {
1265 //
1266 // The FV with the same FV name guid has already been processed.
1267 // So lets skip it!
1268 //
1269 continue;
1270 }
1271
1272 Status = CoreHandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&Fv);
1273 if (EFI_ERROR (Status) || (Fv == NULL)) {
1274 //
1275 // FvHandle must have Firmware Volume2 protocol thus we should never get here.
1276 //
1277 ASSERT (FALSE);
1278 continue;
1279 }
1280
1281 Status = CoreHandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
1282 if (EFI_ERROR (Status)) {
1283 //
1284 // The Firmware volume doesn't have device path, can't be dispatched.
1285 //
1286 continue;
1287 }
1288
1289 //
1290 // Discover Drivers in FV and add them to the Discovered Driver List.
1291 // Process EFI_FV_FILETYPE_DRIVER type and then EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
1292 // EFI_FV_FILETYPE_DXE_CORE is processed to produce a Loaded Image protocol for the core
1293 // EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE is processed to create a Fvb
1294 //
1295 for (Index = 0; Index < sizeof (mDxeFileTypes) / sizeof (EFI_FV_FILETYPE); Index++) {
1296 //
1297 // Initialize the search key
1298 //
1299 Key = 0;
1300 do {
1301 Type = mDxeFileTypes[Index];
1302 GetNextFileStatus = Fv->GetNextFile (
1303 Fv,
1304 &Key,
1305 &Type,
1306 &NameGuid,
1307 &Attributes,
1308 &Size
1309 );
1310 if (!EFI_ERROR (GetNextFileStatus)) {
1311 if (Type == EFI_FV_FILETYPE_DXE_CORE) {
1312 //
1313 // If this is the DXE core fill in it's DevicePath & DeviceHandle
1314 //
1315 if (gDxeCoreLoadedImage->FilePath == NULL) {
1316 if (CompareGuid (&NameGuid, gDxeCoreFileName)) {
1317 //
1318 // Maybe One specail Fv cantains only one DXE_CORE module, so its device path must
1319 // be initialized completely.
1320 //
1321 EfiInitializeFwVolDevicepathNode (&mFvDevicePath.File, &NameGuid);
1322 SetDevicePathEndNode (&mFvDevicePath.End);
1323
1324 gDxeCoreLoadedImage->FilePath = DuplicateDevicePath (
1325 (EFI_DEVICE_PATH_PROTOCOL *)&mFvDevicePath
1326 );
1327 gDxeCoreLoadedImage->DeviceHandle = FvHandle;
1328 }
1329 }
1330 } else if (Type == EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) {
1331 //
1332 // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has already
1333 // been extracted.
1334 //
1335 if (FvFoundInHobFv2 (&KnownHandle->FvNameGuid, &NameGuid)) {
1336 continue;
1337 }
1338
1339 //
1340 // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has SMM depex section.
1341 //
1342 DepexBuffer = NULL;
1343 SizeOfBuffer = 0;
1344 Status = Fv->ReadSection (
1345 Fv,
1346 &NameGuid,
1347 EFI_SECTION_SMM_DEPEX,
1348 0,
1349 &DepexBuffer,
1350 &SizeOfBuffer,
1351 &AuthenticationStatus
1352 );
1353 if (!EFI_ERROR (Status)) {
1354 //
1355 // If SMM depex section is found, this FV image is invalid to be supported.
1356 // ASSERT FALSE to report this FV image.
1357 //
1358 FreePool (DepexBuffer);
1359 ASSERT (FALSE);
1360 }
1361
1362 //
1363 // Check if this EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE file has DXE depex section.
1364 //
1365 DepexBuffer = NULL;
1366 SizeOfBuffer = 0;
1367 Status = Fv->ReadSection (
1368 Fv,
1369 &NameGuid,
1370 EFI_SECTION_DXE_DEPEX,
1371 0,
1372 &DepexBuffer,
1373 &SizeOfBuffer,
1374 &AuthenticationStatus
1375 );
1376 if (EFI_ERROR (Status)) {
1377 //
1378 // If no depex section, produce a firmware volume block protocol for it so it gets dispatched from.
1379 //
1380 CoreProcessFvImageFile (Fv, FvHandle, &NameGuid);
1381 } else {
1382 //
1383 // If depex section is found, this FV image will be dispatched until its depex is evaluated to TRUE.
1384 //
1385 FreePool (DepexBuffer);
1386 CoreAddToDriverList (Fv, FvHandle, &NameGuid, Type);
1387 }
1388 } else {
1389 //
1390 // Transition driver from Undiscovered to Discovered state
1391 //
1392 CoreAddToDriverList (Fv, FvHandle, &NameGuid, Type);
1393 }
1394 }
1395 } while (!EFI_ERROR (GetNextFileStatus));
1396 }
1397
1398 //
1399 // Read the array of GUIDs from the Apriori file if it is present in the firmware volume
1400 //
1401 AprioriFile = NULL;
1402 Status = Fv->ReadSection (
1403 Fv,
1404 &gAprioriGuid,
1405 EFI_SECTION_RAW,
1406 0,
1407 (VOID **)&AprioriFile,
1408 &SizeOfBuffer,
1409 &AuthenticationStatus
1410 );
1411 if (!EFI_ERROR (Status)) {
1412 AprioriEntryCount = SizeOfBuffer / sizeof (EFI_GUID);
1413 } else {
1414 AprioriEntryCount = 0;
1415 }
1416
1417 //
1418 // Put drivers on Apriori List on the Scheduled queue. The Discovered List includes
1419 // drivers not in the current FV and these must be skipped since the a priori list
1420 // is only valid for the FV that it resided in.
1421 //
1422
1423 for (Index = 0; Index < AprioriEntryCount; Index++) {
1424 for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
1425 DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
1426 if (CompareGuid (&DriverEntry->FileName, &AprioriFile[Index]) &&
1427 (FvHandle == DriverEntry->FvHandle))
1428 {
1430 DriverEntry->Dependent = FALSE;
1431 DriverEntry->Scheduled = TRUE;
1432 InsertTailList (&mScheduledQueue, &DriverEntry->ScheduledLink);
1434 DEBUG ((DEBUG_DISPATCH, "Evaluate DXE DEPEX for FFS(%g)\n", &DriverEntry->FileName));
1435 DEBUG ((DEBUG_DISPATCH, " RESULT = TRUE (Apriori)\n"));
1436 break;
1437 }
1438 }
1439 }
1440
1441 //
1442 // Free data allocated by Fv->ReadSection ()
1443 //
1444 CoreFreePool (AprioriFile);
1445 }
1446}
1447
1453VOID
1455 VOID
1456 )
1457{
1459
1460 mFwVolEvent = EfiCreateProtocolNotifyEvent (
1461 &gEfiFirmwareVolume2ProtocolGuid,
1462 TPL_CALLBACK,
1464 NULL,
1465 &mFwVolEventRegistration
1466 );
1467
1469}
1470
1471//
1472// Function only used in debug builds
1473//
1474
1480VOID
1482 VOID
1483 )
1484{
1485 LIST_ENTRY *Link;
1487
1488 for (Link = mDiscoveredList.ForwardLink; Link != &mDiscoveredList; Link = Link->ForwardLink) {
1489 DriverEntry = CR (Link, EFI_CORE_DRIVER_ENTRY, Link, EFI_CORE_DRIVER_ENTRY_SIGNATURE);
1490 if (DriverEntry->Dependent) {
1491 DEBUG ((DEBUG_LOAD, "Driver %g was discovered but not loaded!!\n", &DriverEntry->FileName));
1492 }
1493 }
1494}
UINT64 UINTN
VOID *EFIAPI GetNextHob(IN UINT16 Type, IN CONST VOID *HobStart)
Definition: HobLib.c:103
VOID *EFIAPI GetHobList(VOID)
Definition: HobLib.c:76
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
Definition: LinkedList.c:403
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
Definition: LinkedList.c:590
UINT32 EFIAPI ReadUnaligned32(IN CONST VOID *Buffer)
Definition: Unaligned.c:140
#define INITIALIZE_LIST_HEAD_VARIABLE(ListHead)
Definition: BaseLib.h:2884
UINT16 EFIAPI ReadUnaligned16(IN CONST VOID *Buffer)
Definition: Unaligned.c:36
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
Definition: LinkedList.c:259
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
Definition: SetMemWrapper.c:38
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID EFIAPI SetDevicePathEndNode(OUT VOID *Node)
EFI_STATUS EFIAPI CoreHandleProtocol(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT VOID **Interface)
Definition: Handle.c:1040
EFI_STATUS ProduceFVBProtocolOnBuffer(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN EFI_HANDLE ParentHandle, IN UINT32 AuthenticationStatus, OUT EFI_HANDLE *FvProtocol OPTIONAL)
Definition: FwVolBlock.c:432
VOID CoreAcquireLock(IN EFI_LOCK *Lock)
Definition: Library.c:59
EFI_STATUS ReadFvbData(IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb, IN OUT EFI_LBA *StartLba, IN OUT UINTN *Offset, IN UINTN DataSize, OUT UINT8 *Data)
Definition: FwVol.c:69
VOID CoreReleaseLock(IN EFI_LOCK *Lock)
Definition: Library.c:80
EFI_STATUS GetFwVolHeader(IN EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb, OUT EFI_FIRMWARE_VOLUME_HEADER **FwVolHeader)
Definition: FwVol.c:175
EFI_STATUS EFIAPI CoreSignalEvent(IN EFI_EVENT UserEvent)
Definition: Event.c:526
EFI_STATUS EFIAPI CoreStartImage(IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL)
Definition: Image.c:1605
BOOLEAN VerifyFvHeaderChecksum(IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader)
Definition: Ffs.c:92
EFI_STATUS EFIAPI CoreLocateHandle(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
Definition: Locate.c:269
EFI_STATUS EFIAPI CoreCreateEventEx(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN CONST VOID *NotifyContext OPTIONAL, IN CONST EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event)
Definition: Event.c:320
EFI_STATUS EFIAPI CoreCloseEvent(IN EFI_EVENT UserEvent)
Definition: Event.c:712
EFI_STATUS EFIAPI CoreLoadImage(IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle)
Definition: Image.c:1544
EFI_STATUS EFIAPI CoreFreePool(IN VOID *Buffer)
Definition: Pool.c:595
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID EFIAPI FreeAlignedPages(IN VOID *Buffer, IN UINTN Pages)
EFI_STATUS CorePreProcessDepex(IN EFI_CORE_DRIVER_ENTRY *DriverEntry)
Definition: Dependency.c:157
BOOLEAN CoreIsSchedulable(IN EFI_CORE_DRIVER_ENTRY *DriverEntry)
Definition: Dependency.c:197
VOID CoreInsertOnScheduledQueueWhileProcessingBeforeAndAfter(IN EFI_CORE_DRIVER_ENTRY *InsertedDriverEntry)
Definition: Dispatcher.c:593
VOID CoreDisplayDiscoveredNotDispatched(VOID)
Definition: Dispatcher.c:1481
EFI_STATUS EFIAPI CoreSchedule(IN EFI_HANDLE FirmwareVolumeHandle, IN EFI_GUID *DriverName)
Definition: Dispatcher.c:301
VOID CoreReleaseDispatcherLock(VOID)
Definition: Dispatcher.c:215
EFI_STATUS CoreGetDepexSectionAndPreProccess(IN EFI_CORE_DRIVER_ENTRY *DriverEntry)
Definition: Dispatcher.c:235
BOOLEAN FvFoundInHobFv2(IN CONST EFI_GUID *FvNameGuid, IN CONST EFI_GUID *DriverName)
Definition: Dispatcher.c:913
BOOLEAN GetFvUsedSize(IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader, OUT UINT32 *FvUsedSize, OUT UINT8 *EraseByte)
Definition: Dispatcher.c:953
VOID CoreAcquireDispatcherLock(VOID)
Definition: Dispatcher.c:203
EFI_STATUS CoreProcessFvImageFile(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *FileName)
Definition: Dispatcher.c:1014
VOID EFIAPI CoreFwVolEventProtocolNotify(IN EFI_EVENT Event, IN VOID *Context)
Definition: Dispatcher.c:1209
EFI_STATUS CoreAddToDriverList(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *DriverName, IN EFI_FV_FILETYPE Type)
Definition: Dispatcher.c:860
EFI_DEVICE_PATH_PROTOCOL * CoreFvToDevicePath(IN EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv, IN EFI_HANDLE FvHandle, IN EFI_GUID *DriverName)
Definition: Dispatcher.c:805
EFI_STATUS EFIAPI CoreDispatcher(VOID)
Definition: Dispatcher.c:400
EFI_STATUS EFIAPI CoreTrust(IN EFI_HANDLE FirmwareVolumeHandle, IN EFI_GUID *DriverName)
Definition: Dispatcher.c:351
VOID CoreInitializeDispatcher(VOID)
Definition: Dispatcher.c:1454
BOOLEAN FvHasBeenProcessed(IN EFI_HANDLE FvHandle)
Definition: Dispatcher.c:662
KNOWN_HANDLE * FvIsBeingProcessed(IN EFI_HANDLE FvHandle)
Definition: Dispatcher.c:692
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define VOID
Definition: Base.h:269
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:435
#define CR(Record, TYPE, Field, TestSignature)
Definition: DebugLib.h:660
#define REPORT_STATUS_CODE_WITH_EXTENDED_DATA(Type, Value, ExtendedData, ExtendedDataSize)
#define PERF_FUNCTION_END()
#define PERF_FUNCTION_BEGIN()
UINT32 EFI_FV_FILE_ATTRIBUTES
#define EFI_PROGRESS_CODE
Definition: PiStatusCode.h:44
VOID *EFIAPI AllocateAlignedPages(IN UINTN Pages, IN UINTN Alignment)
EFI_STATUS EFIAPI DriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
Definition: TdTcg2Dxe.c:2387
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
UINT64 EFI_LBA
Definition: UefiBaseType.h:45
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
GUID EFI_GUID
Definition: UefiBaseType.h:25
#define EFI_SIZE_TO_PAGES(Size)
Definition: UefiBaseType.h:200
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
#define EFI_INITIALIZE_LOCK_VARIABLE(Priority)
Definition: UefiLib.h:313
VOID EFIAPI EfiEventEmptyFunction(IN EFI_EVENT Event, IN VOID *Context)
Definition: UefiLib.c:350
VOID EFIAPI EfiInitializeFwVolDevicepathNode(IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode, IN CONST EFI_GUID *NameGuid)
Definition: UefiNotTiano.c:325
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
Definition: UefiLib.c:130
@ ByRegisterNotify
Definition: UefiSpec.h:1523
EFI_FV_BLOCK_MAP_ENTRY BlockMap[1]
EFI_FVB_ATTRIBUTES_2 Attributes
EFI_DEVICE_PATH_PROTOCOL * FilePath
Definition: LoadedImage.h:54
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
Definition: LoadedImage.h:53
Definition: Base.h:213