TianoCore EDK2 master
Loading...
Searching...
No Matches
QemuKernelLoaderFsDxe.c
Go to the documentation of this file.
1
11#include <PiDxe.h>
12
13#include <Guid/FileInfo.h>
14#include <Guid/FileSystemInfo.h>
18#include <Library/BaseLib.h>
21#include <Library/DebugLib.h>
27#include <Protocol/DevicePath.h>
28#include <Protocol/LoadFile2.h>
30
31//
32// Static data that hosts the fw_cfg blobs and serves file requests.
33//
34typedef enum {
35 KernelBlobTypeKernel,
36 KernelBlobTypeInitrd,
37 KernelBlobTypeCommandLine,
38 KernelBlobTypeMax
39} KERNEL_BLOB_TYPE;
40
41typedef struct {
42 CONST CHAR16 Name[8];
43 struct {
44 FIRMWARE_CONFIG_ITEM CONST SizeKey;
45 FIRMWARE_CONFIG_ITEM CONST DataKey;
46 UINT32 Size;
47 } FwCfgItem[2];
48 UINT32 Size;
49 UINT8 *Data;
51
52STATIC KERNEL_BLOB mKernelBlob[KernelBlobTypeMax] = {
53 {
54 L"kernel",
55 {
56 { QemuFwCfgItemKernelSetupSize, QemuFwCfgItemKernelSetupData, },
57 { QemuFwCfgItemKernelSize, QemuFwCfgItemKernelData, },
58 }
59 }, {
60 L"initrd",
61 {
62 { QemuFwCfgItemInitrdSize, QemuFwCfgItemInitrdData, },
63 }
64 }, {
65 L"cmdline",
66 {
67 { QemuFwCfgItemCommandLineSize, QemuFwCfgItemCommandLineData, },
68 }
69 }
70};
71
72STATIC UINT64 mTotalBlobBytes;
73
74//
75// Device path for the handle that incorporates our "EFI stub filesystem".
76//
77#pragma pack (1)
78typedef struct {
79 VENDOR_DEVICE_PATH VenMediaNode;
82#pragma pack ()
83
84STATIC CONST SINGLE_VENMEDIA_NODE_DEVPATH mFileSystemDevicePath = {
85 {
86 {
87 MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,
88 { sizeof (VENDOR_DEVICE_PATH) }
89 },
90 QEMU_KERNEL_LOADER_FS_MEDIA_GUID
91 }, {
92 END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
93 { sizeof (EFI_DEVICE_PATH_PROTOCOL) }
94 }
95};
96
97STATIC CONST SINGLE_VENMEDIA_NODE_DEVPATH mInitrdDevicePath = {
98 {
99 {
100 MEDIA_DEVICE_PATH, MEDIA_VENDOR_DP,
101 { sizeof (VENDOR_DEVICE_PATH) }
102 },
103 LINUX_EFI_INITRD_MEDIA_GUID
104 }, {
105 END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE,
106 { sizeof (EFI_DEVICE_PATH_PROTOCOL) }
107 }
108};
109
110//
111// The "file in the EFI stub filesystem" abstraction.
112//
113STATIC EFI_TIME mInitTime;
114
115#define STUB_FILE_SIG SIGNATURE_64 ('S', 'T', 'U', 'B', 'F', 'I', 'L', 'E')
116
117typedef struct {
118 UINT64 Signature; // Carries STUB_FILE_SIG.
119
120 KERNEL_BLOB_TYPE BlobType; // Index into mKernelBlob. KernelBlobTypeMax
121 // denotes the root directory of the filesystem.
122
123 UINT64 Position; // Byte position for regular files;
124 // next directory entry to return for the root
125 // directory.
126
127 EFI_FILE_PROTOCOL File; // Standard protocol interface.
128} STUB_FILE;
129
130#define STUB_FILE_FROM_FILE(FilePointer) \
131 CR (FilePointer, STUB_FILE, File, STUB_FILE_SIG)
132
133//
134// Protocol member functions for File.
135//
136
177STATIC
179EFIAPI
181 IN EFI_FILE_PROTOCOL *This,
182 OUT EFI_FILE_PROTOCOL **NewHandle,
183 IN CHAR16 *FileName,
184 IN UINT64 OpenMode,
185 IN UINT64 Attributes
186 );
187
196STATIC
198EFIAPI
201 )
202{
203 FreePool (STUB_FILE_FROM_FILE (This));
204 return EFI_SUCCESS;
205}
206
219STATIC
221EFIAPI
224 )
225{
226 FreePool (STUB_FILE_FROM_FILE (This));
227 return EFI_WARN_DELETE_FAILURE;
228}
229
258STATIC
261 IN KERNEL_BLOB_TYPE BlobType,
262 IN OUT UINTN *BufferSize,
263 OUT VOID *Buffer
264 )
265{
266 CONST CHAR16 *Name;
267 UINT64 FileSize;
268 UINT64 Attribute;
269
270 UINTN NameSize;
271 UINTN FileInfoSize;
273 UINTN OriginalBufferSize;
274
275 if (BlobType == KernelBlobTypeMax) {
276 //
277 // getting file info about the root directory
278 //
279 Name = L"\\";
280 FileSize = KernelBlobTypeMax;
281 Attribute = EFI_FILE_READ_ONLY | EFI_FILE_DIRECTORY;
282 } else {
283 CONST KERNEL_BLOB *Blob;
284
285 Blob = &mKernelBlob[BlobType];
286 Name = Blob->Name;
287 FileSize = Blob->Size;
288 Attribute = EFI_FILE_READ_ONLY;
289 }
290
291 NameSize = (StrLen (Name) + 1) * 2;
292 FileInfoSize = OFFSET_OF (EFI_FILE_INFO, FileName) + NameSize;
293 ASSERT (FileInfoSize >= sizeof *FileInfo);
294
295 OriginalBufferSize = *BufferSize;
296 *BufferSize = FileInfoSize;
297 if (OriginalBufferSize < *BufferSize) {
298 return EFI_BUFFER_TOO_SMALL;
299 }
300
301 FileInfo = (EFI_FILE_INFO *)Buffer;
302 FileInfo->Size = FileInfoSize;
303 FileInfo->FileSize = FileSize;
304 FileInfo->PhysicalSize = FileSize;
305 FileInfo->Attribute = Attribute;
306
307 CopyMem (&FileInfo->CreateTime, &mInitTime, sizeof mInitTime);
308 CopyMem (&FileInfo->LastAccessTime, &mInitTime, sizeof mInitTime);
309 CopyMem (&FileInfo->ModificationTime, &mInitTime, sizeof mInitTime);
310 CopyMem (FileInfo->FileName, Name, NameSize);
311
312 return EFI_SUCCESS;
313}
314
349STATIC
351EFIAPI
353 IN EFI_FILE_PROTOCOL *This,
354 IN OUT UINTN *BufferSize,
355 OUT VOID *Buffer
356 )
357{
358 STUB_FILE *StubFile;
359 CONST KERNEL_BLOB *Blob;
360 UINT64 Left;
361
362 StubFile = STUB_FILE_FROM_FILE (This);
363
364 //
365 // Scanning the root directory?
366 //
367 if (StubFile->BlobType == KernelBlobTypeMax) {
368 EFI_STATUS Status;
369
370 if (StubFile->Position == KernelBlobTypeMax) {
371 //
372 // Scanning complete.
373 //
374 *BufferSize = 0;
375 return EFI_SUCCESS;
376 }
377
379 (KERNEL_BLOB_TYPE)StubFile->Position,
380 BufferSize,
381 Buffer
382 );
383 if (EFI_ERROR (Status)) {
384 return Status;
385 }
386
387 ++StubFile->Position;
388 return EFI_SUCCESS;
389 }
390
391 //
392 // Reading a file.
393 //
394 Blob = &mKernelBlob[StubFile->BlobType];
395 if (StubFile->Position > Blob->Size) {
396 return EFI_DEVICE_ERROR;
397 }
398
399 Left = Blob->Size - StubFile->Position;
400 if (*BufferSize > Left) {
401 *BufferSize = (UINTN)Left;
402 }
403
404 if (Blob->Data != NULL) {
405 CopyMem (Buffer, Blob->Data + StubFile->Position, *BufferSize);
406 }
407
408 StubFile->Position += *BufferSize;
409 return EFI_SUCCESS;
410}
411
435STATIC
437EFIAPI
439 IN EFI_FILE_PROTOCOL *This,
440 IN OUT UINTN *BufferSize,
441 IN VOID *Buffer
442 )
443{
444 STUB_FILE *StubFile;
445
446 StubFile = STUB_FILE_FROM_FILE (This);
447 return (StubFile->BlobType == KernelBlobTypeMax) ?
448 EFI_UNSUPPORTED :
449 EFI_WRITE_PROTECTED;
450}
451
466STATIC
468EFIAPI
470 IN EFI_FILE_PROTOCOL *This,
471 OUT UINT64 *Position
472 )
473{
474 STUB_FILE *StubFile;
475
476 StubFile = STUB_FILE_FROM_FILE (This);
477 if (StubFile->BlobType == KernelBlobTypeMax) {
478 return EFI_UNSUPPORTED;
479 }
480
481 *Position = StubFile->Position;
482 return EFI_SUCCESS;
483}
484
501STATIC
503EFIAPI
505 IN EFI_FILE_PROTOCOL *This,
506 IN UINT64 Position
507 )
508{
509 STUB_FILE *StubFile;
510 KERNEL_BLOB *Blob;
511
512 StubFile = STUB_FILE_FROM_FILE (This);
513
514 if (StubFile->BlobType == KernelBlobTypeMax) {
515 if (Position == 0) {
516 //
517 // rewinding a directory scan is allowed
518 //
519 StubFile->Position = 0;
520 return EFI_SUCCESS;
521 }
522
523 return EFI_UNSUPPORTED;
524 }
525
526 //
527 // regular file seek
528 //
529 Blob = &mKernelBlob[StubFile->BlobType];
530 if (Position == MAX_UINT64) {
531 //
532 // seek to end
533 //
534 StubFile->Position = Blob->Size;
535 } else {
536 //
537 // absolute seek from beginning -- seeking past the end is allowed
538 //
539 StubFile->Position = Position;
540 }
541
542 return EFI_SUCCESS;
543}
544
583STATIC
585EFIAPI
587 IN EFI_FILE_PROTOCOL *This,
588 IN EFI_GUID *InformationType,
589 IN OUT UINTN *BufferSize,
590 OUT VOID *Buffer
591 )
592{
593 CONST STUB_FILE *StubFile;
594 UINTN OriginalBufferSize;
595
596 StubFile = STUB_FILE_FROM_FILE (This);
597
598 if (CompareGuid (InformationType, &gEfiFileInfoGuid)) {
600 StubFile->BlobType,
601 BufferSize,
602 Buffer
603 );
604 }
605
606 OriginalBufferSize = *BufferSize;
607
608 if (CompareGuid (InformationType, &gEfiFileSystemInfoGuid)) {
609 EFI_FILE_SYSTEM_INFO *FileSystemInfo;
610
611 *BufferSize = sizeof *FileSystemInfo;
612 if (OriginalBufferSize < *BufferSize) {
613 return EFI_BUFFER_TOO_SMALL;
614 }
615
616 FileSystemInfo = (EFI_FILE_SYSTEM_INFO *)Buffer;
617 FileSystemInfo->Size = sizeof *FileSystemInfo;
618 FileSystemInfo->ReadOnly = TRUE;
619 FileSystemInfo->VolumeSize = mTotalBlobBytes;
620 FileSystemInfo->FreeSpace = 0;
621 FileSystemInfo->BlockSize = 1;
622 FileSystemInfo->VolumeLabel[0] = L'\0';
623
624 return EFI_SUCCESS;
625 }
626
627 if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) {
628 EFI_FILE_SYSTEM_VOLUME_LABEL *FileSystemVolumeLabel;
629
630 *BufferSize = sizeof *FileSystemVolumeLabel;
631 if (OriginalBufferSize < *BufferSize) {
632 return EFI_BUFFER_TOO_SMALL;
633 }
634
635 FileSystemVolumeLabel = (EFI_FILE_SYSTEM_VOLUME_LABEL *)Buffer;
636 FileSystemVolumeLabel->VolumeLabel[0] = L'\0';
637
638 return EFI_SUCCESS;
639 }
640
641 return EFI_UNSUPPORTED;
642}
643
685STATIC
687EFIAPI
689 IN EFI_FILE_PROTOCOL *This,
690 IN EFI_GUID *InformationType,
691 IN UINTN BufferSize,
692 IN VOID *Buffer
693 )
694{
695 return EFI_WRITE_PROTECTED;
696}
697
712STATIC
714EFIAPI
717 )
718{
719 return EFI_WRITE_PROTECTED;
720}
721
722//
723// External definition of the file protocol template.
724//
725STATIC CONST EFI_FILE_PROTOCOL mEfiFileProtocolTemplate = {
726 EFI_FILE_PROTOCOL_REVISION, // revision 1
737 NULL, // OpenEx, revision 2
738 NULL, // ReadEx, revision 2
739 NULL, // WriteEx, revision 2
740 NULL // FlushEx, revision 2
741};
742
743STATIC
745EFIAPI
747 IN EFI_FILE_PROTOCOL *This,
748 OUT EFI_FILE_PROTOCOL **NewHandle,
749 IN CHAR16 *FileName,
750 IN UINT64 OpenMode,
751 IN UINT64 Attributes
752 )
753{
754 CONST STUB_FILE *StubFile;
755 UINTN BlobType;
756 STUB_FILE *NewStubFile;
757
758 //
759 // We're read-only.
760 //
761 switch (OpenMode) {
762 case EFI_FILE_MODE_READ:
763 break;
764
765 case EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE:
766 case EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE:
767 return EFI_WRITE_PROTECTED;
768
769 default:
770 return EFI_INVALID_PARAMETER;
771 }
772
773 //
774 // Only the root directory supports opening files in it.
775 //
776 StubFile = STUB_FILE_FROM_FILE (This);
777 if (StubFile->BlobType != KernelBlobTypeMax) {
778 return EFI_UNSUPPORTED;
779 }
780
781 //
782 // Locate the file.
783 //
784 for (BlobType = 0; BlobType < KernelBlobTypeMax; ++BlobType) {
785 if (StrCmp (FileName, mKernelBlob[BlobType].Name) == 0) {
786 break;
787 }
788 }
789
790 if (BlobType == KernelBlobTypeMax) {
791 return EFI_NOT_FOUND;
792 }
793
794 //
795 // Found it.
796 //
797 NewStubFile = AllocatePool (sizeof *NewStubFile);
798 if (NewStubFile == NULL) {
799 return EFI_OUT_OF_RESOURCES;
800 }
801
802 NewStubFile->Signature = STUB_FILE_SIG;
803 NewStubFile->BlobType = (KERNEL_BLOB_TYPE)BlobType;
804 NewStubFile->Position = 0;
805 CopyMem (
806 &NewStubFile->File,
807 &mEfiFileProtocolTemplate,
808 sizeof mEfiFileProtocolTemplate
809 );
810 *NewHandle = &NewStubFile->File;
811
812 return EFI_SUCCESS;
813}
814
815//
816// Protocol member functions for SimpleFileSystem.
817//
818
842STATIC
844EFIAPI
848 )
849{
850 STUB_FILE *StubFile;
851
852 StubFile = AllocatePool (sizeof *StubFile);
853 if (StubFile == NULL) {
854 return EFI_OUT_OF_RESOURCES;
855 }
856
857 StubFile->Signature = STUB_FILE_SIG;
858 StubFile->BlobType = KernelBlobTypeMax;
859 StubFile->Position = 0;
860 CopyMem (
861 &StubFile->File,
862 &mEfiFileProtocolTemplate,
863 sizeof mEfiFileProtocolTemplate
864 );
865 *Root = &StubFile->File;
866
867 return EFI_SUCCESS;
868}
869
871 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION,
873};
874
875STATIC
877EFIAPI
878InitrdLoadFile2 (
881 IN BOOLEAN BootPolicy,
882 IN OUT UINTN *BufferSize,
883 OUT VOID *Buffer OPTIONAL
884 )
885{
886 CONST KERNEL_BLOB *InitrdBlob = &mKernelBlob[KernelBlobTypeInitrd];
887
888 ASSERT (InitrdBlob->Size > 0);
889
890 if (BootPolicy) {
891 return EFI_UNSUPPORTED;
892 }
893
894 if ((BufferSize == NULL) || !IsDevicePathValid (FilePath, 0)) {
895 return EFI_INVALID_PARAMETER;
896 }
897
898 if ((FilePath->Type != END_DEVICE_PATH_TYPE) ||
899 (FilePath->SubType != END_ENTIRE_DEVICE_PATH_SUBTYPE))
900 {
901 return EFI_NOT_FOUND;
902 }
903
904 if ((Buffer == NULL) || (*BufferSize < InitrdBlob->Size)) {
905 *BufferSize = InitrdBlob->Size;
906 return EFI_BUFFER_TOO_SMALL;
907 }
908
909 CopyMem (Buffer, InitrdBlob->Data, InitrdBlob->Size);
910
911 *BufferSize = InitrdBlob->Size;
912 return EFI_SUCCESS;
913}
914
915STATIC CONST EFI_LOAD_FILE2_PROTOCOL mInitrdLoadFile2 = {
916 InitrdLoadFile2,
917};
918
919//
920// Utility functions.
921//
922
935STATIC
938 IN OUT KERNEL_BLOB *Blob
939 )
940{
941 UINT32 Left;
942 UINTN Idx;
943 UINT8 *ChunkData;
944
945 //
946 // Read blob size.
947 //
948 Blob->Size = 0;
949 for (Idx = 0; Idx < ARRAY_SIZE (Blob->FwCfgItem); Idx++) {
950 if (Blob->FwCfgItem[Idx].SizeKey == 0) {
951 break;
952 }
953
954 QemuFwCfgSelectItem (Blob->FwCfgItem[Idx].SizeKey);
955 Blob->FwCfgItem[Idx].Size = QemuFwCfgRead32 ();
956 Blob->Size += Blob->FwCfgItem[Idx].Size;
957 }
958
959 if (Blob->Size == 0) {
960 return EFI_SUCCESS;
961 }
962
963 //
964 // Read blob.
965 //
966 Blob->Data = AllocatePool (Blob->Size);
967 if (Blob->Data == NULL) {
968 DEBUG ((
969 DEBUG_ERROR,
970 "%a: failed to allocate %Ld bytes for \"%s\"\n",
971 __func__,
972 (INT64)Blob->Size,
973 Blob->Name
974 ));
975 return EFI_OUT_OF_RESOURCES;
976 }
977
978 DEBUG ((
979 DEBUG_INFO,
980 "%a: loading %Ld bytes for \"%s\"\n",
981 __func__,
982 (INT64)Blob->Size,
983 Blob->Name
984 ));
985
986 ChunkData = Blob->Data;
987 for (Idx = 0; Idx < ARRAY_SIZE (Blob->FwCfgItem); Idx++) {
988 if (Blob->FwCfgItem[Idx].DataKey == 0) {
989 break;
990 }
991
992 QemuFwCfgSelectItem (Blob->FwCfgItem[Idx].DataKey);
993
994 Left = Blob->FwCfgItem[Idx].Size;
995 while (Left > 0) {
996 UINT32 Chunk;
997
998 Chunk = (Left < SIZE_1MB) ? Left : SIZE_1MB;
999 QemuFwCfgReadBytes (Chunk, ChunkData + Blob->FwCfgItem[Idx].Size - Left);
1000 Left -= Chunk;
1001 DEBUG ((
1002 DEBUG_VERBOSE,
1003 "%a: %Ld bytes remaining for \"%s\" (%d)\n",
1004 __func__,
1005 (INT64)Left,
1006 Blob->Name,
1007 (INT32)Idx
1008 ));
1009 }
1010
1011 ChunkData += Blob->FwCfgItem[Idx].Size;
1012 }
1013
1014 return EFI_SUCCESS;
1015}
1016
1017//
1018// The entry point of the feature.
1019//
1020
1035EFIAPI
1037 IN EFI_HANDLE ImageHandle,
1038 IN EFI_SYSTEM_TABLE *SystemTable
1039 )
1040{
1041 UINTN BlobType;
1042 KERNEL_BLOB *CurrentBlob;
1043 KERNEL_BLOB *KernelBlob;
1044 EFI_STATUS Status;
1045 EFI_STATUS FetchStatus;
1046 EFI_HANDLE FileSystemHandle;
1047 EFI_HANDLE InitrdLoadFile2Handle;
1048
1049 if (!QemuFwCfgIsAvailable ()) {
1050 return EFI_NOT_FOUND;
1051 }
1052
1053 Status = gRT->GetTime (&mInitTime, NULL /* Capabilities */);
1054 if (EFI_ERROR (Status)) {
1055 DEBUG ((DEBUG_ERROR, "%a: GetTime(): %r\n", __func__, Status));
1056 return Status;
1057 }
1058
1059 //
1060 // Fetch all blobs.
1061 //
1062 for (BlobType = 0; BlobType < KernelBlobTypeMax; ++BlobType) {
1063 CurrentBlob = &mKernelBlob[BlobType];
1064 FetchStatus = FetchBlob (CurrentBlob);
1065
1066 Status = VerifyBlob (
1067 CurrentBlob->Name,
1068 CurrentBlob->Data,
1069 CurrentBlob->Size,
1070 FetchStatus
1071 );
1072 if (EFI_ERROR (Status)) {
1073 goto FreeBlobs;
1074 }
1075
1076 mTotalBlobBytes += CurrentBlob->Size;
1077 }
1078
1079 KernelBlob = &mKernelBlob[KernelBlobTypeKernel];
1080
1081 if (KernelBlob->Data == NULL) {
1082 Status = EFI_NOT_FOUND;
1083 goto FreeBlobs;
1084 }
1085
1086 //
1087 // Create a new handle with a single VenMedia() node device path protocol on
1088 // it, plus a custom SimpleFileSystem protocol on it.
1089 //
1090 FileSystemHandle = NULL;
1091 Status = gBS->InstallMultipleProtocolInterfaces (
1092 &FileSystemHandle,
1093 &gEfiDevicePathProtocolGuid,
1094 &mFileSystemDevicePath,
1095 &gEfiSimpleFileSystemProtocolGuid,
1096 &mFileSystem,
1097 NULL
1098 );
1099 if (EFI_ERROR (Status)) {
1100 DEBUG ((
1101 DEBUG_ERROR,
1102 "%a: InstallMultipleProtocolInterfaces(): %r\n",
1103 __func__,
1104 Status
1105 ));
1106 goto FreeBlobs;
1107 }
1108
1109 if (KernelBlob[KernelBlobTypeInitrd].Size > 0) {
1110 InitrdLoadFile2Handle = NULL;
1111 Status = gBS->InstallMultipleProtocolInterfaces (
1112 &InitrdLoadFile2Handle,
1113 &gEfiDevicePathProtocolGuid,
1114 &mInitrdDevicePath,
1115 &gEfiLoadFile2ProtocolGuid,
1116 &mInitrdLoadFile2,
1117 NULL
1118 );
1119 if (EFI_ERROR (Status)) {
1120 DEBUG ((
1121 DEBUG_ERROR,
1122 "%a: InstallMultipleProtocolInterfaces(): %r\n",
1123 __func__,
1124 Status
1125 ));
1126 goto UninstallFileSystemHandle;
1127 }
1128 }
1129
1130 return EFI_SUCCESS;
1131
1132UninstallFileSystemHandle:
1133 Status = gBS->UninstallMultipleProtocolInterfaces (
1134 FileSystemHandle,
1135 &gEfiDevicePathProtocolGuid,
1136 &mFileSystemDevicePath,
1137 &gEfiSimpleFileSystemProtocolGuid,
1138 &mFileSystem,
1139 NULL
1140 );
1141 ASSERT_EFI_ERROR (Status);
1142
1143FreeBlobs:
1144 while (BlobType > 0) {
1145 CurrentBlob = &mKernelBlob[--BlobType];
1146 if (CurrentBlob->Data != NULL) {
1147 FreePool (CurrentBlob->Data);
1148 CurrentBlob->Size = 0;
1149 CurrentBlob->Data = NULL;
1150 }
1151 }
1152
1153 return Status;
1154}
UINT64 UINTN
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
Definition: String.c:109
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
Definition: MemLibGuid.c:73
EFI_STATUS EFIAPI VerifyBlob(IN CONST CHAR16 *BlobName, IN CONST VOID *Buf, IN UINT32 BufSize, IN EFI_STATUS FetchStatus)
#define MEDIA_VENDOR_DP
Media vendor device path subtype.
Definition: DevicePath.h:1093
BOOLEAN EFIAPI IsDevicePathValid(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN UINTN MaxSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_RUNTIME_SERVICES * gRT
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define STATIC
Definition: Base.h:264
#define TRUE
Definition: Base.h:301
#define ARRAY_SIZE(Array)
Definition: Base.h:1393
#define IN
Definition: Base.h:279
#define OFFSET_OF(TYPE, Field)
Definition: Base.h:758
#define OUT
Definition: Base.h:284
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
UINT32 EFIAPI QemuFwCfgRead32(VOID)
Definition: QemuFwCfgLib.c:205
VOID EFIAPI QemuFwCfgReadBytes(IN UINTN Size, IN VOID *Buffer OPTIONAL)
Definition: QemuFwCfgNull.c:66
VOID EFIAPI QemuFwCfgSelectItem(IN FIRMWARE_CONFIG_ITEM QemuFwCfgItem)
Definition: QemuFwCfgLib.c:33
BOOLEAN EFIAPI QemuFwCfgIsAvailable(VOID)
Definition: QemuFwCfgDxe.c:44
STATIC EFI_STATUS EFIAPI StubFileWrite(IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
STATIC EFI_STATUS EFIAPI StubFileSystemOpenVolume(IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **Root)
STATIC EFI_STATUS EFIAPI StubFileClose(IN EFI_FILE_PROTOCOL *This)
STATIC EFI_STATUS EFIAPI StubFileOpen(IN EFI_FILE_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **NewHandle, IN CHAR16 *FileName, IN UINT64 OpenMode, IN UINT64 Attributes)
STATIC EFI_STATUS EFIAPI StubFileSetPosition(IN EFI_FILE_PROTOCOL *This, IN UINT64 Position)
STATIC EFI_STATUS EFIAPI StubFileGetInfo(IN EFI_FILE_PROTOCOL *This, IN EFI_GUID *InformationType, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
STATIC EFI_STATUS EFIAPI StubFileDelete(IN EFI_FILE_PROTOCOL *This)
STATIC EFI_STATUS EFIAPI StubFileGetPosition(IN EFI_FILE_PROTOCOL *This, OUT UINT64 *Position)
STATIC EFI_STATUS EFIAPI StubFileRead(IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
STATIC EFI_STATUS EFIAPI StubFileFlush(IN EFI_FILE_PROTOCOL *This)
STATIC EFI_STATUS ConvertKernelBlobTypeToFileInfo(IN KERNEL_BLOB_TYPE BlobType, IN OUT UINTN *BufferSize, OUT VOID *Buffer)
STATIC EFI_STATUS EFIAPI StubFileSetInfo(IN EFI_FILE_PROTOCOL *This, IN EFI_GUID *InformationType, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS EFIAPI QemuKernelLoaderFsDxeEntrypoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC EFI_STATUS FetchBlob(IN OUT KERNEL_BLOB *Blob)
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_BOOT_SERVICES * gBS
EFI_TIME ModificationTime
Definition: FileInfo.h:43
UINT64 PhysicalSize
Definition: FileInfo.h:31
EFI_TIME CreateTime
Definition: FileInfo.h:35
UINT64 Size
Definition: FileInfo.h:23
UINT64 Attribute
Definition: FileInfo.h:47
CHAR16 FileName[1]
Definition: FileInfo.h:52
EFI_TIME LastAccessTime
Definition: FileInfo.h:39
UINT64 FileSize
Definition: FileInfo.h:27
Definition: Base.h:213