TianoCore EDK2 master
Loading...
Searching...
No Matches
DxeServicesLib.c
Go to the documentation of this file.
1
11#include <PiDxe.h>
12#include <Library/DebugLib.h>
16#include <Library/UefiLib.h>
20#include <Protocol/LoadFile2.h>
21#include <Protocol/LoadFile.h>
23#include <Guid/FileInfo.h>
24
43 EFI_HANDLE ImageHandle
44 )
45{
46 EFI_STATUS Status;
47 EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
48
49 ASSERT (ImageHandle != NULL);
50
51 Status = gBS->HandleProtocol (
52 ImageHandle,
53 &gEfiLoadedImageProtocolGuid,
54 (VOID **)&LoadedImage
55 );
56
57 ASSERT_EFI_ERROR (Status);
58
59 //
60 // The LoadedImage->DeviceHandle may be NULL.
61 // For example for DxeCore, there is LoadedImage protocol installed for it, but the
62 // LoadedImage->DeviceHandle could not be initialized before the FV2 (contain DxeCore)
63 // protocol is installed.
64 //
65 return LoadedImage->DeviceHandle;
66}
67
113 IN EFI_HANDLE FvHandle,
114 IN CONST EFI_GUID *NameGuid,
115 IN EFI_SECTION_TYPE SectionType,
116 IN UINTN SectionInstance,
117 OUT VOID **Buffer,
118 OUT UINTN *Size
119 )
120{
121 EFI_STATUS Status;
123 UINT32 AuthenticationStatus;
124
125 ASSERT (NameGuid != NULL);
126 ASSERT (Buffer != NULL);
127 ASSERT (Size != NULL);
128
129 if (FvHandle == NULL) {
130 //
131 // Return EFI_NOT_FOUND directly for NULL FvHandle.
132 //
133 return EFI_NOT_FOUND;
134 }
135
136 Status = gBS->HandleProtocol (
137 FvHandle,
138 &gEfiFirmwareVolume2ProtocolGuid,
139 (VOID **)&Fv
140 );
141 if (EFI_ERROR (Status)) {
142 return EFI_NOT_FOUND;
143 }
144
145 //
146 // Read desired section content in NameGuid file
147 //
148 *Buffer = NULL;
149 *Size = 0;
150 Status = Fv->ReadSection (
151 Fv,
152 NameGuid,
153 SectionType,
154 SectionInstance,
155 Buffer,
156 Size,
157 &AuthenticationStatus
158 );
159
160 if (EFI_ERROR (Status) && (SectionType == EFI_SECTION_TE)) {
161 //
162 // Try reading PE32 section, if the required section is TE type
163 //
164 *Buffer = NULL;
165 *Size = 0;
166 Status = Fv->ReadSection (
167 Fv,
168 NameGuid,
170 SectionInstance,
171 Buffer,
172 Size,
173 &AuthenticationStatus
174 );
175 }
176
177 return Status;
178}
179
229EFIAPI
231 IN EFI_FV_FILETYPE FileType,
232 IN UINTN FileInstance,
233 IN EFI_SECTION_TYPE SectionType,
234 IN UINTN SectionInstance,
235 OUT VOID **Buffer,
236 OUT UINTN *Size
237 )
238{
239 EFI_STATUS Status;
240 EFI_HANDLE *HandleBuffer;
241 UINTN HandleCount;
242 UINTN IndexFv;
243 UINTN IndexFile;
244 UINTN Key;
245 EFI_GUID NameGuid;
246 EFI_FV_FILE_ATTRIBUTES Attributes;
248
249 ASSERT (Buffer != NULL);
250 ASSERT (Size != NULL);
251
252 //
253 // Locate all available FVs.
254 //
255 HandleBuffer = NULL;
256 Status = gBS->LocateHandleBuffer (
258 &gEfiFirmwareVolume2ProtocolGuid,
259 NULL,
260 &HandleCount,
261 &HandleBuffer
262 );
263 if (EFI_ERROR (Status)) {
264 return Status;
265 }
266
267 //
268 // Go through FVs one by one to find the required section data.
269 //
270 for (IndexFv = 0; IndexFv < HandleCount; IndexFv++) {
271 Status = gBS->HandleProtocol (
272 HandleBuffer[IndexFv],
273 &gEfiFirmwareVolume2ProtocolGuid,
274 (VOID **)&Fv
275 );
276 if (EFI_ERROR (Status)) {
277 continue;
278 }
279
280 //
281 // Use Firmware Volume 2 Protocol to search for a file of type FileType in all FVs.
282 //
283 IndexFile = FileInstance + 1;
284 Key = 0;
285 do {
286 Status = Fv->GetNextFile (Fv, &Key, &FileType, &NameGuid, &Attributes, Size);
287 if (EFI_ERROR (Status)) {
288 break;
289 }
290
291 IndexFile--;
292 } while (IndexFile > 0);
293
294 //
295 // Fv File with the required FV file type is found.
296 // Search the section file in the found FV file.
297 //
298 if (IndexFile == 0) {
299 Status = InternalGetSectionFromFv (
300 HandleBuffer[IndexFv],
301 &NameGuid,
302 SectionType,
303 SectionInstance,
304 Buffer,
305 Size
306 );
307
308 if (!EFI_ERROR (Status)) {
309 goto Done;
310 }
311 }
312 }
313
314 //
315 // The required FFS section file is not found.
316 //
317 if (IndexFv == HandleCount) {
318 Status = EFI_NOT_FOUND;
319 }
320
321Done:
322 if (HandleBuffer != NULL) {
323 FreePool (HandleBuffer);
324 }
325
326 return Status;
327}
328
373EFIAPI
375 IN CONST EFI_GUID *NameGuid,
376 IN EFI_SECTION_TYPE SectionType,
377 IN UINTN SectionInstance,
378 OUT VOID **Buffer,
379 OUT UINTN *Size
380 )
381{
382 EFI_STATUS Status;
383 EFI_HANDLE *HandleBuffer;
384 UINTN HandleCount;
385 UINTN Index;
386 EFI_HANDLE FvHandle;
387
388 //
389 // Search the FV that contain the caller's FFS first.
390 // FV builder can choose to build FFS into the this FV
391 // so that this implementation of GetSectionFromAnyFv
392 // will locate the FFS faster.
393 //
395 Status = InternalGetSectionFromFv (
396 FvHandle,
397 NameGuid,
398 SectionType,
399 SectionInstance,
400 Buffer,
401 Size
402 );
403 if (!EFI_ERROR (Status)) {
404 return EFI_SUCCESS;
405 }
406
407 HandleBuffer = NULL;
408 Status = gBS->LocateHandleBuffer (
410 &gEfiFirmwareVolume2ProtocolGuid,
411 NULL,
412 &HandleCount,
413 &HandleBuffer
414 );
415 if (EFI_ERROR (Status)) {
416 goto Done;
417 }
418
419 for (Index = 0; Index < HandleCount; Index++) {
420 //
421 // Skip the FV that contain the caller's FFS
422 //
423 if (HandleBuffer[Index] != FvHandle) {
424 Status = InternalGetSectionFromFv (
425 HandleBuffer[Index],
426 NameGuid,
427 SectionType,
428 SectionInstance,
429 Buffer,
430 Size
431 );
432
433 if (!EFI_ERROR (Status)) {
434 goto Done;
435 }
436 }
437 }
438
439 if (Index == HandleCount) {
440 Status = EFI_NOT_FOUND;
441 }
442
443Done:
444
445 if (HandleBuffer != NULL) {
446 FreePool (HandleBuffer);
447 }
448
449 return Status;
450}
451
498EFIAPI
500 IN CONST EFI_GUID *NameGuid,
501 IN EFI_SECTION_TYPE SectionType,
502 IN UINTN SectionInstance,
503 OUT VOID **Buffer,
504 OUT UINTN *Size
505 )
506{
509 NameGuid,
510 SectionType,
511 SectionInstance,
512 Buffer,
513 Size
514 );
515}
516
560EFIAPI
562 IN EFI_SECTION_TYPE SectionType,
563 IN UINTN SectionInstance,
564 OUT VOID **Buffer,
565 OUT UINTN *Size
566 )
567{
570 &gEfiCallerIdGuid,
571 SectionType,
572 SectionInstance,
573 Buffer,
574 Size
575 );
576}
577
605VOID *
606EFIAPI
608 IN BOOLEAN BootPolicy,
610 OUT UINTN *FileSize,
611 OUT UINT32 *AuthenticationStatus
612 )
613{
614 EFI_DEVICE_PATH_PROTOCOL *DevicePathNode;
615 EFI_DEVICE_PATH_PROTOCOL *OrigDevicePathNode;
616 EFI_DEVICE_PATH_PROTOCOL *TempDevicePathNode;
617 EFI_HANDLE Handle;
618 EFI_GUID *FvNameGuid;
620 EFI_SECTION_TYPE SectionType;
621 UINT8 *ImageBuffer;
622 UINTN ImageBufferSize;
623 EFI_FV_FILETYPE Type;
626 EFI_FILE_HANDLE FileHandle;
627 EFI_FILE_HANDLE LastHandle;
629 UINTN FileInfoSize;
630 EFI_LOAD_FILE_PROTOCOL *LoadFile;
632 EFI_STATUS Status;
633
634 //
635 // Check input File device path.
636 //
637 if ((FilePath == NULL) || (FileSize == NULL) || (AuthenticationStatus == NULL)) {
638 return NULL;
639 }
640
641 //
642 // Init local variable
643 //
644 TempDevicePathNode = NULL;
645 FvNameGuid = NULL;
646 FileInfo = NULL;
647 FileHandle = NULL;
648 ImageBuffer = NULL;
649 ImageBufferSize = 0;
650 *AuthenticationStatus = 0;
651
652 //
653 // Copy File Device Path
654 //
655 OrigDevicePathNode = DuplicateDevicePath (FilePath);
656 if (OrigDevicePathNode == NULL) {
657 return NULL;
658 }
659
660 //
661 // Check whether this device path support FV2 protocol.
662 // Is so, this device path may contain a Image.
663 //
664 DevicePathNode = OrigDevicePathNode;
665 Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid, &DevicePathNode, &Handle);
666 if (!EFI_ERROR (Status)) {
667 //
668 // For FwVol File system there is only a single file name that is a GUID.
669 //
671 if (FvNameGuid == NULL) {
672 Status = EFI_INVALID_PARAMETER;
673 } else {
674 //
675 // Read image from the firmware file
676 //
677 Status = gBS->HandleProtocol (Handle, &gEfiFirmwareVolume2ProtocolGuid, (VOID **)&FwVol);
678 if (!EFI_ERROR (Status)) {
679 SectionType = EFI_SECTION_PE32;
680 ImageBuffer = NULL;
681 Status = FwVol->ReadSection (
682 FwVol,
683 FvNameGuid,
684 SectionType,
685 0,
686 (VOID **)&ImageBuffer,
687 &ImageBufferSize,
688 AuthenticationStatus
689 );
690 if (EFI_ERROR (Status)) {
691 //
692 // Try a raw file, since a PE32 SECTION does not exist
693 //
694 if (ImageBuffer != NULL) {
695 FreePool (ImageBuffer);
696 *AuthenticationStatus = 0;
697 }
698
699 ImageBuffer = NULL;
700 Status = FwVol->ReadFile (
701 FwVol,
702 FvNameGuid,
703 (VOID **)&ImageBuffer,
704 &ImageBufferSize,
705 &Type,
706 &Attrib,
707 AuthenticationStatus
708 );
709 }
710 }
711 }
712
713 if (!EFI_ERROR (Status)) {
714 goto Finish;
715 }
716 }
717
718 //
719 // Attempt to access the file via a file system interface
720 //
721 DevicePathNode = OrigDevicePathNode;
722 Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid, &DevicePathNode, &Handle);
723 if (!EFI_ERROR (Status)) {
724 Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Volume);
725 if (!EFI_ERROR (Status)) {
726 //
727 // Open the Volume to get the File System handle
728 //
729 Status = Volume->OpenVolume (Volume, &FileHandle);
730 if (!EFI_ERROR (Status)) {
731 //
732 // Duplicate the device path to avoid the access to unaligned device path node.
733 // Because the device path consists of one or more FILE PATH MEDIA DEVICE PATH
734 // nodes, It assures the fields in device path nodes are 2 byte aligned.
735 //
736 TempDevicePathNode = DuplicateDevicePath (DevicePathNode);
737 if (TempDevicePathNode == NULL) {
738 FileHandle->Close (FileHandle);
739 //
740 // Setting Status to an EFI_ERROR value will cause the rest of
741 // the file system support below to be skipped.
742 //
743 Status = EFI_OUT_OF_RESOURCES;
744 }
745
746 //
747 // Parse each MEDIA_FILEPATH_DP node. There may be more than one, since the
748 // directory information and filename can be separate. The goal is to inch
749 // our way down each device path node and close the previous node
750 //
751 DevicePathNode = TempDevicePathNode;
752 while (!EFI_ERROR (Status) && !IsDevicePathEnd (DevicePathNode)) {
753 if ((DevicePathType (DevicePathNode) != MEDIA_DEVICE_PATH) ||
754 (DevicePathSubType (DevicePathNode) != MEDIA_FILEPATH_DP))
755 {
756 Status = EFI_UNSUPPORTED;
757 break;
758 }
759
760 LastHandle = FileHandle;
761 FileHandle = NULL;
762
763 Status = LastHandle->Open (
764 LastHandle,
765 &FileHandle,
766 ((FILEPATH_DEVICE_PATH *)DevicePathNode)->PathName,
767 EFI_FILE_MODE_READ,
768 0
769 );
770
771 //
772 // Close the previous node
773 //
774 LastHandle->Close (LastHandle);
775
776 DevicePathNode = NextDevicePathNode (DevicePathNode);
777 }
778
779 if (!EFI_ERROR (Status)) {
780 //
781 // We have found the file. Now we need to read it. Before we can read the file we need to
782 // figure out how big the file is.
783 //
784 FileInfo = NULL;
785 FileInfoSize = 0;
786 Status = FileHandle->GetInfo (
787 FileHandle,
788 &gEfiFileInfoGuid,
789 &FileInfoSize,
791 );
792
793 if (Status == EFI_BUFFER_TOO_SMALL) {
794 FileInfo = AllocatePool (FileInfoSize);
795 if (FileInfo == NULL) {
796 Status = EFI_OUT_OF_RESOURCES;
797 } else {
798 Status = FileHandle->GetInfo (
799 FileHandle,
800 &gEfiFileInfoGuid,
801 &FileInfoSize,
803 );
804 }
805 }
806
807 if (!EFI_ERROR (Status) && (FileInfo != NULL)) {
808 if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == 0) {
809 //
810 // Allocate space for the file
811 //
812 ImageBuffer = AllocatePool ((UINTN)FileInfo->FileSize);
813 if (ImageBuffer == NULL) {
814 Status = EFI_OUT_OF_RESOURCES;
815 } else {
816 //
817 // Read the file into the buffer we allocated
818 //
819 ImageBufferSize = (UINTN)FileInfo->FileSize;
820 Status = FileHandle->Read (FileHandle, &ImageBufferSize, ImageBuffer);
821 }
822 }
823 }
824 }
825
826 //
827 // Close the file and Free FileInfo and TempDevicePathNode since we are done
828 //
829 if (FileInfo != NULL) {
831 }
832
833 if (FileHandle != NULL) {
834 FileHandle->Close (FileHandle);
835 }
836
837 if (TempDevicePathNode != NULL) {
838 FreePool (TempDevicePathNode);
839 }
840 }
841 }
842
843 if (!EFI_ERROR (Status)) {
844 goto Finish;
845 }
846 }
847
848 //
849 // Attempt to access the file via LoadFile2 interface
850 //
851 if (!BootPolicy) {
852 DevicePathNode = OrigDevicePathNode;
853 Status = gBS->LocateDevicePath (&gEfiLoadFile2ProtocolGuid, &DevicePathNode, &Handle);
854 if (!EFI_ERROR (Status)) {
855 Status = gBS->HandleProtocol (Handle, &gEfiLoadFile2ProtocolGuid, (VOID **)&LoadFile2);
856 if (!EFI_ERROR (Status)) {
857 //
858 // Call LoadFile2 with the correct buffer size
859 //
860 ImageBufferSize = 0;
861 ImageBuffer = NULL;
862 Status = LoadFile2->LoadFile (
863 LoadFile2,
864 DevicePathNode,
865 FALSE,
866 &ImageBufferSize,
867 ImageBuffer
868 );
869 if (Status == EFI_BUFFER_TOO_SMALL) {
870 ImageBuffer = AllocatePool (ImageBufferSize);
871 if (ImageBuffer == NULL) {
872 Status = EFI_OUT_OF_RESOURCES;
873 } else {
874 Status = LoadFile2->LoadFile (
875 LoadFile2,
876 DevicePathNode,
877 FALSE,
878 &ImageBufferSize,
879 ImageBuffer
880 );
881 }
882 }
883 }
884
885 if (!EFI_ERROR (Status)) {
886 goto Finish;
887 }
888 }
889 }
890
891 //
892 // Attempt to access the file via LoadFile interface
893 //
894 DevicePathNode = OrigDevicePathNode;
895 Status = gBS->LocateDevicePath (&gEfiLoadFileProtocolGuid, &DevicePathNode, &Handle);
896 if (!EFI_ERROR (Status)) {
897 Status = gBS->HandleProtocol (Handle, &gEfiLoadFileProtocolGuid, (VOID **)&LoadFile);
898 if (!EFI_ERROR (Status)) {
899 //
900 // Call LoadFile with the correct buffer size
901 //
902 ImageBufferSize = 0;
903 ImageBuffer = NULL;
904 Status = LoadFile->LoadFile (
905 LoadFile,
906 DevicePathNode,
907 BootPolicy,
908 &ImageBufferSize,
909 ImageBuffer
910 );
911 if (Status == EFI_BUFFER_TOO_SMALL) {
912 ImageBuffer = AllocatePool (ImageBufferSize);
913 if (ImageBuffer == NULL) {
914 Status = EFI_OUT_OF_RESOURCES;
915 } else {
916 Status = LoadFile->LoadFile (
917 LoadFile,
918 DevicePathNode,
919 BootPolicy,
920 &ImageBufferSize,
921 ImageBuffer
922 );
923 }
924 }
925 }
926 }
927
928Finish:
929
930 if (EFI_ERROR (Status)) {
931 if (ImageBuffer != NULL) {
932 FreePool (ImageBuffer);
933 ImageBuffer = NULL;
934 }
935
936 *FileSize = 0;
937 } else {
938 *FileSize = ImageBufferSize;
939 }
940
941 FreePool (OrigDevicePathNode);
942
943 return ImageBuffer;
944}
945
980EFIAPI
982 IN CONST EFI_GUID *NameGuid,
983 IN EFI_SECTION_TYPE SectionType,
984 IN UINTN SectionInstance,
985 OUT EFI_DEVICE_PATH_PROTOCOL **FvFileDevicePath
986 )
987{
988 EFI_STATUS Status;
989 EFI_HANDLE *HandleBuffer;
990 UINTN HandleCount;
991 UINTN Index;
992 EFI_HANDLE FvHandle;
993 EFI_DEVICE_PATH_PROTOCOL *FvDevicePath;
994 MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *TempFvFileDevicePath;
995 VOID *Buffer;
996 UINTN Size;
997
998 if (FvFileDevicePath == NULL) {
999 return EFI_INVALID_PARAMETER;
1000 }
1001
1002 HandleBuffer = NULL;
1003 FvDevicePath = NULL;
1004 TempFvFileDevicePath = NULL;
1005 Buffer = NULL;
1006 Size = 0;
1007
1008 //
1009 // Search the FV that contain the caller's FFS first.
1010 // FV builder can choose to build FFS into the this FV
1011 // so that this implementation of GetSectionFromAnyFv
1012 // will locate the FFS faster.
1013 //
1015 Status = InternalGetSectionFromFv (
1016 FvHandle,
1017 NameGuid,
1018 SectionType,
1019 SectionInstance,
1020 &Buffer,
1021 &Size
1022 );
1023 if (!EFI_ERROR (Status)) {
1024 goto Done;
1025 }
1026
1027 Status = gBS->LocateHandleBuffer (
1028 ByProtocol,
1029 &gEfiFirmwareVolume2ProtocolGuid,
1030 NULL,
1031 &HandleCount,
1032 &HandleBuffer
1033 );
1034 if (EFI_ERROR (Status)) {
1035 goto Done;
1036 }
1037
1038 for (Index = 0; Index < HandleCount; Index++) {
1039 //
1040 // Skip the FV that contain the caller's FFS
1041 //
1042 if (HandleBuffer[Index] != FvHandle) {
1043 Status = InternalGetSectionFromFv (
1044 HandleBuffer[Index],
1045 NameGuid,
1046 SectionType,
1047 SectionInstance,
1048 &Buffer,
1049 &Size
1050 );
1051
1052 if (!EFI_ERROR (Status)) {
1053 //
1054 // Update FvHandle to the current handle.
1055 //
1056 FvHandle = HandleBuffer[Index];
1057 goto Done;
1058 }
1059 }
1060 }
1061
1062 if (Index == HandleCount) {
1063 Status = EFI_NOT_FOUND;
1064 }
1065
1066Done:
1067 if (Status == EFI_SUCCESS) {
1068 //
1069 // Build a device path to the file in the FV to pass into gBS->LoadImage
1070 //
1071 Status = gBS->HandleProtocol (FvHandle, &gEfiDevicePathProtocolGuid, (VOID **)&FvDevicePath);
1072 if (EFI_ERROR (Status)) {
1073 *FvFileDevicePath = NULL;
1074 } else {
1075 TempFvFileDevicePath = AllocateZeroPool (sizeof (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH) + END_DEVICE_PATH_LENGTH);
1076 if (TempFvFileDevicePath == NULL) {
1077 *FvFileDevicePath = NULL;
1078 return EFI_OUT_OF_RESOURCES;
1079 }
1080
1081 EfiInitializeFwVolDevicepathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)TempFvFileDevicePath, NameGuid);
1082 SetDevicePathEndNode (NextDevicePathNode (TempFvFileDevicePath));
1083 *FvFileDevicePath = AppendDevicePath (
1084 FvDevicePath,
1085 (EFI_DEVICE_PATH_PROTOCOL *)TempFvFileDevicePath
1086 );
1087 FreePool (TempFvFileDevicePath);
1088 }
1089 }
1090
1091 if (Buffer != NULL) {
1092 FreePool (Buffer);
1093 }
1094
1095 if (HandleBuffer != NULL) {
1096 FreePool (HandleBuffer);
1097 }
1098
1099 return Status;
1100}
UINT64 UINTN
#define MEDIA_FILEPATH_DP
Definition: DevicePath.h:1098
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
BOOLEAN EFIAPI IsDevicePathEnd(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
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 InternalGetSectionFromFv(IN EFI_HANDLE FvHandle, IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
EFI_STATUS EFIAPI GetSectionFromFfs(IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
EFI_STATUS EFIAPI GetFileDevicePathFromAnyFv(IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT EFI_DEVICE_PATH_PROTOCOL **FvFileDevicePath)
EFI_STATUS EFIAPI GetSectionFromAnyFvByFileType(IN EFI_FV_FILETYPE FileType, IN UINTN FileInstance, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
VOID *EFIAPI GetFileBufferByFilePath(IN BOOLEAN BootPolicy, IN CONST EFI_DEVICE_PATH_PROTOCOL *FilePath, OUT UINTN *FileSize, OUT UINT32 *AuthenticationStatus)
EFI_STATUS EFIAPI GetSectionFromAnyFv(IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
EFI_STATUS EFIAPI GetSectionFromFv(IN CONST EFI_GUID *NameGuid, IN EFI_SECTION_TYPE SectionType, IN UINTN SectionInstance, OUT VOID **Buffer, OUT UINTN *Size)
EFI_HANDLE InternalImageHandleToFvHandle(EFI_HANDLE ImageHandle)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
EFI_STATUS EFIAPI LoadFile2(IN EFI_LOAD_FILE2_PROTOCOL *This, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN BOOLEAN BootPolicy, IN OUT UINTN *BufferSize, IN VOID *Buffer OPTIONAL)
#define EFI_SECTION_PE32
UINT32 EFI_FV_FILE_ATTRIBUTES
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_FILE_INFO * FileInfo(IN EFI_FILE_HANDLE FHand)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_HANDLE gImageHandle
EFI_BOOT_SERVICES * gBS
VOID EFIAPI EfiInitializeFwVolDevicepathNode(IN OUT MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode, IN CONST EFI_GUID *NameGuid)
Definition: UefiNotTiano.c:325
EFI_GUID *EFIAPI EfiGetNameGuidFromFwVolDevicePathNode(IN CONST MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvDevicePathNode)
Definition: UefiNotTiano.c:292
@ ByProtocol
Definition: UefiSpec.h:1518
UINT64 Attribute
Definition: FileInfo.h:47
UINT64 FileSize
Definition: FileInfo.h:27
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
Definition: LoadedImage.h:53
Definition: Base.h:213