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
**/\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
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
*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
//\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
&gEfiFirmwareFileSystem3Guid,\r
&mPeiFfs3FwVol.Fv\r
};\r
- \r
+\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
+\r
+ @param FfsAttributes The attributes of UINT8 type.\r
+\r
+ @return The attributes of EFI_FV_FILE_ATTRIBUTES\r
+\r
+**/\r
+EFI_FV_FILE_ATTRIBUTES\r
+FfsAttributes2FvFileAttributes (\r
+ IN EFI_FFS_FILE_ATTRIBUTES FfsAttributes\r
+ )\r
+{\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
Returns the file state set by the highest zero bit in the State field\r
\r
FileHeader = (EFI_FFS_FILE_HEADER *)FileHandle;\r
CopyMem (&FileInfo->FileName, &FileHeader->Name, sizeof(EFI_GUID));\r
FileInfo->FileType = FileHeader->Type;\r
- FileInfo->FileAttributes = FileHeader->Attributes;\r
+ FileInfo->FileAttributes = FfsAttributes2FvFileAttributes (FileHeader->Attributes);\r
+ if ((CoreFvHandle->FvHeader->Attributes & EFI_FVB2_MEMORY_MAPPED) == EFI_FVB2_MEMORY_MAPPED) {\r
+ FileInfo->FileAttributes |= EFI_FV_FILE_ATTRIB_MEMORY_MAPPED;\r
+ }\r
if (IS_FFS_FILE2 (FileHeader)) {\r
ASSERT (FFS_FILE2_SIZE (FileHeader) > 0x00FFFFFF);\r
if (!FwVolInstance->IsFfs3Fv) {\r