Revision: 15902
          http://sourceforge.net/p/edk2/code/15902
Author:   oliviermartin
Date:     2014-08-26 10:15:21 +0000 (Tue, 26 Aug 2014)
Log Message:
-----------
ArmPlatformPkg/BootMonFs: Provide mechanism to get BootMonFS file information

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 <[email protected]>
Reviewed-By: Olivier Martin <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec
    trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
    trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
    trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h

Modified: trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec
===================================================================
--- trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec        2014-08-26 10:14:17 UTC 
(rev 15901)
+++ trunk/edk2/ArmPlatformPkg/ArmPlatformPkg.dec        2014-08-26 10:15:21 UTC 
(rev 15902)
@@ -40,6 +40,8 @@
   ## Include/Guid/ArmGlobalVariableHob.h
   gArmGlobalVariableGuid      = { 0xc3253c90, 0xa24f, 0x4599, { 0xa6, 0x64, 
0x1f, 0x88, 0x13, 0x77, 0x8f, 0xc9} }
 
+  gArmBootMonFsFileInfoGuid   = { 0x41e26b9c, 0xada6, 0x45b3, { 0x80, 0x8e, 
0x23, 0x57, 0xa3, 0x5b, 0x60, 0xd6 } }
+
 [Ppis]
   ## Include/Ppi/ArmGlobalVariable.h
   gArmGlobalVariablePpiGuid = { 0xab1c1816, 0xd542, 0x4e6f, {0x9b, 0x1e, 0x8e, 
0xcd, 0x92, 0x53, 0xe2, 0xe7} }

Modified: trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf
===================================================================
--- trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf        
2014-08-26 10:14:17 UTC (rev 15901)
+++ trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFs.inf        
2014-08-26 10:15:21 UTC (rev 15902)
@@ -43,6 +43,7 @@
   UefiLib
 
 [Guids]
+  gArmBootMonFsFileInfoGuid
   gEfiFileSystemInfoGuid
   gEfiFileInfoGuid
   gEfiFileSystemVolumeLabelInfoIdGuid

Modified: trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c
===================================================================
--- trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c       
2014-08-26 10:14:17 UTC (rev 15901)
+++ trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsDir.c       
2014-08-26 10:15:21 UTC (rev 15902)
@@ -252,6 +252,53 @@
 
 STATIC
 EFI_STATUS
+GetBootMonFsFileInfo (
+  IN BOOTMON_FS_INSTANCE *Instance,
+  IN BOOTMON_FS_FILE     *File,
+  IN OUT UINTN           *BufferSize,
+  OUT VOID               *Buffer
+  )
+{
+  EFI_STATUS             Status;
+  BOOTMON_FS_FILE_INFO   *Info;
+  UINTN                  ResultSize;
+  UINTN                  Index;
+
+  if (File == Instance->RootFile) {
+    Status = EFI_UNSUPPORTED;
+  } else {
+    ResultSize = SIZE_OF_BOOTMON_FS_FILE_INFO;
+
+    if (*BufferSize < ResultSize) {
+      *BufferSize = ResultSize;
+      Status = EFI_BUFFER_TOO_SMALL;
+    } else {
+      Info = Buffer;
+
+      // Zero out the structure
+      ZeroMem (Info, ResultSize);
+
+      // Fill in the structure
+      Info->Size = ResultSize;
+
+      Info->EntryPoint  = File->HwDescription.EntryPoint;
+      Info->RegionCount = File->HwDescription.RegionCount;
+      for (Index = 0; Index < File->HwDescription.RegionCount; Index++) {
+        Info->Region[Index].LoadAddress = 
File->HwDescription.Region[Index].LoadAddress;
+        Info->Region[Index].Size        = 
File->HwDescription.Region[Index].Size;
+        Info->Region[Index].Offset      = 
File->HwDescription.Region[Index].Offset;
+        Info->Region[Index].Checksum    = 
File->HwDescription.Region[Index].Checksum;
+      }
+      *BufferSize = ResultSize;
+      Status = EFI_SUCCESS;
+    }
+  }
+
+  return Status;
+}
+
+STATIC
+EFI_STATUS
 SetFileName (
   IN  BOOTMON_FS_FILE *File,
   IN  CHAR16          *FileNameUnicode
@@ -452,6 +499,8 @@
       Status = GetFilesystemInfo (Instance, BufferSize, Buffer);
     } else if (CompareGuid (InformationType, &gEfiFileInfoGuid) != 0) {
       Status = GetFileInfo (Instance, File, BufferSize, Buffer);
+    } else if (CompareGuid (InformationType, &gArmBootMonFsFileInfoGuid) != 0) 
{
+      Status = GetBootMonFsFileInfo (Instance, File, BufferSize, Buffer);
     } else {
       Status = EFI_UNSUPPORTED;
     }

Modified: trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h
===================================================================
--- trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h  
2014-08-26 10:14:17 UTC (rev 15901)
+++ trunk/edk2/ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h  
2014-08-26 10:15:21 UTC (rev 15902)
@@ -26,6 +26,7 @@
 #include <Protocol/FirmwareVolumeBlock.h>
 #include <Protocol/SimpleFileSystem.h>
 
+#include <Guid/BootMonFsFileInfo.h>
 #include <Guid/FileInfo.h>
 #include <Guid/FileSystemInfo.h>
 #include <Guid/FileSystemVolumeLabelInfo.h>

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to