]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/BootMonFs: Provide mechanism to get BootMonFS file information
authorHarry Liebel <Harry.Liebel@arm.com>
Tue, 26 Aug 2014 10:15:21 +0000 (10:15 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 26 Aug 2014 10:15:21 +0000 (10:15 +0000)
Add additional structure to get file meta-data information from BootMonFS
based files. AXF files are processed by the Flash loader and the ELF header
stripped. The relevant information is stored in the file-system.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <Harry.Liebel@arm.com>
Reviewed-By: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15902 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/ArmPlatformPkg.dec
ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h

index 555c9284bc1bfd158a95d4457e4c43cadc6cefc5..5b2e831412b7bdb32b03dc2d7b7fed0b04a4fc21 100644 (file)
@@ -40,6 +40,8 @@
   ## Include/Guid/ArmGlobalVariableHob.h\r
   gArmGlobalVariableGuid      = { 0xc3253c90, 0xa24f, 0x4599, { 0xa6, 0x64, 0x1f, 0x88, 0x13, 0x77, 0x8f, 0xc9} }\r
 \r
+  gArmBootMonFsFileInfoGuid   = { 0x41e26b9c, 0xada6, 0x45b3, { 0x80, 0x8e, 0x23, 0x57, 0xa3, 0x5b, 0x60, 0xd6 } }\r
+\r
 [Ppis]\r
   ## Include/Ppi/ArmGlobalVariable.h\r
   gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 0xcd, 0x92, 0x53, 0xe2, 0xe7} }\r
index d7770f0b962c03086d7a07e22d274798bb677eed..94e8916e1bba0a34ed08c0a667d66db9164a2310 100644 (file)
@@ -43,6 +43,7 @@
   UefiLib\r
 \r
 [Guids]\r
+  gArmBootMonFsFileInfoGuid\r
   gEfiFileSystemInfoGuid\r
   gEfiFileInfoGuid\r
   gEfiFileSystemVolumeLabelInfoIdGuid\r
index 7ef180f54a25d69857ccb9d0125482681c8392ab..835cdae18a3872c4530ebd5f3c54d239ed399721 100644 (file)
@@ -250,6 +250,53 @@ GetFileInfo (
   return EFI_SUCCESS;\r
 }\r
 \r
+STATIC\r
+EFI_STATUS\r
+GetBootMonFsFileInfo (\r
+  IN BOOTMON_FS_INSTANCE *Instance,\r
+  IN BOOTMON_FS_FILE     *File,\r
+  IN OUT UINTN           *BufferSize,\r
+  OUT VOID               *Buffer\r
+  )\r
+{\r
+  EFI_STATUS             Status;\r
+  BOOTMON_FS_FILE_INFO   *Info;\r
+  UINTN                  ResultSize;\r
+  UINTN                  Index;\r
+\r
+  if (File == Instance->RootFile) {\r
+    Status = EFI_UNSUPPORTED;\r
+  } else {\r
+    ResultSize = SIZE_OF_BOOTMON_FS_FILE_INFO;\r
+\r
+    if (*BufferSize < ResultSize) {\r
+      *BufferSize = ResultSize;\r
+      Status = EFI_BUFFER_TOO_SMALL;\r
+    } else {\r
+      Info = Buffer;\r
+\r
+      // Zero out the structure\r
+      ZeroMem (Info, ResultSize);\r
+\r
+      // Fill in the structure\r
+      Info->Size = ResultSize;\r
+\r
+      Info->EntryPoint  = File->HwDescription.EntryPoint;\r
+      Info->RegionCount = File->HwDescription.RegionCount;\r
+      for (Index = 0; Index < File->HwDescription.RegionCount; Index++) {\r
+        Info->Region[Index].LoadAddress = File->HwDescription.Region[Index].LoadAddress;\r
+        Info->Region[Index].Size        = File->HwDescription.Region[Index].Size;\r
+        Info->Region[Index].Offset      = File->HwDescription.Region[Index].Offset;\r
+        Info->Region[Index].Checksum    = File->HwDescription.Region[Index].Checksum;\r
+      }\r
+      *BufferSize = ResultSize;\r
+      Status = EFI_SUCCESS;\r
+    }\r
+  }\r
+\r
+  return Status;\r
+}\r
+\r
 STATIC\r
 EFI_STATUS\r
 SetFileName (\r
@@ -452,6 +499,8 @@ BootMonFsGetInfo (
       Status = GetFilesystemInfo (Instance, BufferSize, Buffer);\r
     } else if (CompareGuid (InformationType, &gEfiFileInfoGuid) != 0) {\r
       Status = GetFileInfo (Instance, File, BufferSize, Buffer);\r
+    } else if (CompareGuid (InformationType, &gArmBootMonFsFileInfoGuid) != 0) {\r
+      Status = GetBootMonFsFileInfo (Instance, File, BufferSize, Buffer);\r
     } else {\r
       Status = EFI_UNSUPPORTED;\r
     }\r
index 3167bba00ae830d4b3235db46fef583788754a2e..57343618abf3ce869b5e40ffcdb8576135c3bfa8 100644 (file)
@@ -26,6 +26,7 @@
 #include <Protocol/FirmwareVolumeBlock.h>\r
 #include <Protocol/SimpleFileSystem.h>\r
 \r
+#include <Guid/BootMonFsFileInfo.h>\r
 #include <Guid/FileInfo.h>\r
 #include <Guid/FileSystemInfo.h>\r
 #include <Guid/FileSystemVolumeLabelInfo.h>\r