]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/FirmwareVolume/FwVolDxe/FwVolWrite.c
IntelFrameworkModulePkg: Clean up source files
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / FirmwareVolume / FwVolDxe / FwVolWrite.c
index 7f23b51d8337a3e70e7c71bfd8a74e75804eebda..adb910e9602e6dd0a858495536dd9b614498b2a8 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Implements write firmware file.\r
 \r
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions\r
@@ -202,9 +202,11 @@ FvFileAttrib2FfsFileAttrib (
 {\r
   UINT8 FvFileAlignment;\r
   UINT8 FfsFileAlignment;\r
+  UINT8 FfsFileAlignment2;\r
 \r
   FvFileAlignment   = (UINT8) (FvFileAttrib & EFI_FV_FILE_ATTRIB_ALIGNMENT);\r
   FfsFileAlignment  = 0;\r
+  FfsFileAlignment2 = 0;\r
 \r
   switch (FvFileAlignment) {\r
   case 0:\r
@@ -289,9 +291,42 @@ FvFileAttrib2FfsFileAttrib (
   case 16:\r
     FfsFileAlignment = 7;\r
     break;\r
+\r
+  case 17:\r
+    FfsFileAlignment = 0;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
+  case 18:\r
+    FfsFileAlignment = 1;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
+  case 19:\r
+    FfsFileAlignment = 2;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
+  case 20:\r
+    FfsFileAlignment = 3;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
+  case 21:\r
+    FfsFileAlignment = 4;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
+  case 22:\r
+    FfsFileAlignment = 5;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
+  case 23:\r
+    FfsFileAlignment = 6;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
+  case 24:\r
+    FfsFileAlignment = 7;\r
+    FfsFileAlignment2 = 1;\r
+    break;\r
   }\r
 \r
-  *FfsFileAttrib = (UINT8) (FfsFileAlignment << 3);\r
+  *FfsFileAttrib = (UINT8) ((FfsFileAlignment << 3) | (FfsFileAlignment2 << 1));\r
 \r
   return ;\r
 }\r
@@ -675,7 +710,7 @@ FvcWrite (
   UINTN                               RemainingLength;\r
   UINTN                               WriteLength;\r
   UINT8                               *TmpBuffer;\r
-  \r
+\r
   LOffset = 0;\r
   RemainingLength = CalculateRemainingLength (FvDevice, Offset, &Lba, &LOffset);\r
   if ((UINTN) (*NumBytes) > RemainingLength) {\r
@@ -782,7 +817,7 @@ FvCreateNewFile (
 \r
   //\r
   // First find a free space that can hold this image.\r
-  // Check alignment, FFS at least must be aligned at 8-byte boundry\r
+  // Check alignment, FFS at least must be aligned at 8-byte boundary\r
   //\r
   RequiredAlignment = GetRequiredAlignment (FileAttributes);\r
 \r
@@ -1428,8 +1463,8 @@ FvWriteFile (
 \r
     if (FileData[Index1].Type == EFI_FV_FILETYPE_FFS_PAD) {\r
       //\r
-      // According to PI spec, on EFI_FV_FILETYPE_FFS_PAD: \r
-      // "Standard firmware file system services will not return the handle of any pad files, \r
+      // According to PI spec, on EFI_FV_FILETYPE_FFS_PAD:\r
+      // "Standard firmware file system services will not return the handle of any pad files,\r
       // nor will they permit explicit creation of such files."\r
       //\r
       return EFI_INVALID_PARAMETER;\r
@@ -1513,7 +1548,7 @@ FvWriteFile (
 \r
   for (Index1 = 0; Index1 < NumberOfFiles; Index1++) {\r
     //\r
-    // Making Buffersize QWORD boundry, and add file tail.\r
+    // Making Buffersize QWORD boundary, and add file tail.\r
     //\r
     HeaderSize = sizeof (EFI_FFS_FILE_HEADER);\r
     ActualSize = FileData[Index1].BufferSize + HeaderSize;\r