]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. According to PI errata 0000840 and PI 1.2c Vol 3 3.2.3, remove description rows...
authorlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 25 Nov 2011 01:56:58 +0000 (01:56 +0000)
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 25 Nov 2011 01:56:58 +0000 (01:56 +0000)
2. In PeiFfsFvPpiGetFileInfo(), FileHeader->Attributes needs to be converted to EFI_FV_FILE_ATTRIBUTES from EFI_FFS_FILE_ATTRIBUTES before it is assigned to FileInfo->FileAttributes.
3. Set EFI_FV_FILE_ATTRIB_FIXED and EFI_FV_FILE_ATTRIB_MEMORY_MAPPED bits for EFI_FV_FILE_ATTRIBUTES based on the FFS file and FV image.

Signed-off-by: lzeng14
Reviewed-by: lgao4
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12776 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolRead.c

index 5a26e11e2e378e62f4d495bf9cd7b4c784151278..1e8ba91581fe2a8ab3626e68cea5217af91be9f3 100644 (file)
 \r
 #include "FwVolDriver.h"\r
 \r
-UINT8 mFvAttributes[]  = { 0, 4, 7, 9, 10, 12, 15, 16 };\r
+/**\r
+Required Alignment             Alignment Value in FFS         Alignment Value in\r
+(bytes)                        Attributes Field               Firmware Volume Interfaces\r
+1                                    0                                     0\r
+16                                   1                                     4\r
+128                                  2                                     7\r
+512                                  3                                     9\r
+1 KB                                 4                                     10\r
+4 KB                                 5                                     12\r
+32 KB                                6                                     15\r
+64 KB                                7                                     16\r
+**/\r
+UINT8 mFvAttributes[] = {0, 4, 7, 9, 10, 12, 15, 16};\r
 \r
 /**\r
   Convert the FFS File Attributes to FV File Attributes.\r
@@ -31,9 +43,19 @@ 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
-  return (EFI_FV_FILE_ATTRIBUTES) mFvAttributes[FfsAttributes];\r
+  UINT8                     DataAlignment;\r
+  EFI_FV_FILE_ATTRIBUTES    FileAttribute;\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
@@ -200,6 +222,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
@@ -377,6 +402,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
 \r
   //\r