]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/Dxe/FwVol/FwVolRead.c
1. According to PI errata 0000840 and PI 1.2c Vol 3 3.2.3, remove description rows...
[mirror_edk2.git] / MdeModulePkg / Core / Dxe / FwVol / FwVolRead.c
index 52f84919d132b5111be196c53b14eed5e40e69e3..fc1a2e5fae4aa7c29f9f8c53a03b08ce228f41ff 100644 (file)
@@ -19,9 +19,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 Required Alignment             Alignment Value in FFS         Alignment Value in\r
 (bytes)                        Attributes Field               Firmware Volume Interfaces\r
 1                                    0                                     0\r
-2                                    0                                     1\r
-4                                    0                                     2\r
-8                                    0                                     3\r
 16                                   1                                     4\r
 128                                  2                                     7\r
 512                                  3                                     9\r
@@ -32,8 +29,6 @@ Required Alignment             Alignment Value in FFS         Alignment Value in
 **/\r
 UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};\r
 \r
-\r
-\r
 /**\r
   Convert the FFS File Attributes to FV File Attributes\r
 \r
@@ -47,13 +42,20 @@ FfsAttributes2FvFileAttributes (
   IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes\r
   )\r
 {\r
-  FfsAttributes = (EFI_FFS_FILE_ATTRIBUTES)((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3);\r
-  ASSERT (FfsAttributes < 8);\r
+  UINT8                     DataAlignment;\r
+  EFI_FV_FILE_ATTRIBUTES    FileAttribute;\r
 \r
-  return (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[FfsAttributes];\r
-}\r
+  DataAlignment = (UINT8) ((FfsAttributes & FFS_ATTRIB_DATA_ALIGNMENT) >> 3);\r
+  ASSERT (DataAlignment < 8);\r
 \r
+  FileAttribute = (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[DataAlignment];\r
 \r
+  if ((FfsAttributes & FFS_ATTRIB_FIXED) == FFS_ATTRIB_FIXED) {\r
+    FileAttribute |= EFI_FV_FILE_ATTRIB_FIXED;\r
+  }\r
+\r
+  return FileAttribute;\r
+}\r
 \r
 /**\r
   Given the input key, search for the next matching file in the volume.\r
@@ -199,6 +201,9 @@ FvGetNextFile (
   *FileType = FfsFileHeader->Type;\r
   CopyGuid (NameGuid, &FfsFileHeader->Name);\r
   *Attributes = FfsAttributes2FvFileAttributes (FfsFileHeader->Attributes);\r
+  if ((FvDevice->FwVolHeader->Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {\r
+    *Attributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;\r
+  }\r
 \r
   //\r
   // we need to substract the header size\r
@@ -318,6 +323,9 @@ FvReadFile (
   //\r
   *FoundType = FfsHeader->Type;\r
   *FileAttributes = FfsAttributes2FvFileAttributes (FfsHeader->Attributes);\r
+   if ((FvDevice->FwVolHeader->Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {\r
+     *FileAttributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;\r
+   }\r
   *AuthenticationStatus = 0;\r
   *BufferSize = FileSize;\r
 \r