]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: extend FFS alignment to 16M
authorYonghong Zhu <yonghong.zhu@intel.com>
Wed, 20 Sep 2017 06:10:04 +0000 (14:10 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Mon, 25 Sep 2017 03:18:22 +0000 (11:18 +0800)
Current FFS only supports 64KiB alignment for data, Per PI 1.6
requirement, we extend FFS alignment to 16M.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
12 files changed:
BaseTools/Source/C/GenFfs/GenFfs.c
BaseTools/Source/C/GenFv/GenFvInternalLib.c
BaseTools/Source/C/GenSec/GenSec.c
BaseTools/Source/C/Include/Common/PiFirmwareFile.h
BaseTools/Source/Python/Common/FdfParserLite.py
BaseTools/Source/Python/GenFds/DataSection.py
BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools/Source/Python/GenFds/FdfParser.py
BaseTools/Source/Python/GenFds/FfsInfStatement.py
BaseTools/Source/Python/GenFds/Fv.py
BaseTools/Source/Python/GenFds/FvImageSection.py
BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py

index eaef8a2232286b6d20e29265814fd11196c3840c..cb16f385eec2f55f4d7226461371c47006b907f1 100644 (file)
@@ -50,14 +50,17 @@ STATIC CHAR8 *mFfsFileType[] = {
 \r
 STATIC CHAR8 *mAlignName[] = {\r
   "1", "2", "4", "8", "16", "32", "64", "128", "256", "512",\r
-  "1K", "2K", "4K", "8K", "16K", "32K", "64K"\r
+  "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K",\r
+  "512K", "1M", "2M", "4M", "8M", "16M"\r
  };\r
 \r
 STATIC CHAR8 *mFfsValidAlignName[] = {\r
-  "8", "16", "128", "512", "1K", "4K", "32K", "64K"\r
+  "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K","256K",\r
+  "512K", "1M", "2M", "4M", "8M", "16M"\r
  };\r
 \r
-STATIC UINT32 mFfsValidAlign[] = {0, 8, 16, 128, 512, 1024, 4096, 32768, 65536};\r
+STATIC UINT32 mFfsValidAlign[] = {0, 8, 16, 128, 512, 1024, 4096, 32768, 65536, 131072, 262144,\r
+                                  524288, 1048576, 2097152, 4194304, 8388608, 16777216};\r
 \r
 STATIC EFI_GUID mZeroGuid = {0};\r
 \r
@@ -144,12 +147,13 @@ Returns:
   fprintf (stdout, "  -s, --checksum        Indicates to calculate file checksum.\n");\r
   fprintf (stdout, "  -a FileAlign, --align FileAlign\n\\r
                         FileAlign points to file alignment, which only support\n\\r
-                        the following align: 1,2,4,8,16,128,512,1K,4K,32K,64K\n");\r
+                        the following align: 1,2,4,8,16,128,512,1K,4K,32K,64K\n\\r
+                        128K,256K,512K,1M,2M,4M,8M,16M\n");\r
   fprintf (stdout, "  -i SectionFile, --sectionfile SectionFile\n\\r
                         Section file will be contained in this FFS file.\n");\r
   fprintf (stdout, "  -n SectionAlign, --sectionalign SectionAlign\n\\r
                         SectionAlign points to section alignment, which support\n\\r
-                        the alignment scope 1~64K. It is specified together\n\\r
+                        the alignment scope 1~16M. It is specified together\n\\r
                         with sectionfile to point its alignment in FFS file.\n");\r
   fprintf (stdout, "  -v, --verbose         Turn on verbose output with informational messages.\n");\r
   fprintf (stdout, "  -q, --quiet           Disable all messages except key message and fatal error\n");\r
@@ -168,7 +172,7 @@ StringtoAlignment (
 \r
 Routine Description:\r
 \r
-  Converts Align String to align value (1~64K). \r
+  Converts Align String to align value (1~16M).\r
 \r
 Arguments:\r
 \r
@@ -893,7 +897,12 @@ Returns:
   }\r
   VerboseMsg ("the size of the generated FFS file is %u bytes", (unsigned) FileSize);\r
 \r
-  FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3));\r
+  //FfsAlign larger than 7, set FFS_ATTRIB_DATA_ALIGNMENT2\r
+  if (FfsAlign < 8) {\r
+    FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3));\r
+  } else {\r
+    FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | ((FfsAlign & 0x7) << 3) | FFS_ATTRIB_DATA_ALIGNMENT2);\r
+  }\r
 \r
   //\r
   // Fill in checksums and state, these must be zero for checksumming\r
index 8072c014faddc0d5e99641cf3322bc4f4bcecdbb..01c862e89a393d74b8e004b4cce661fe22f2b9fa 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 This file contains the internal functions required to generate a Firmware Volume.\r
 \r
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
 Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.<BR>\r
 Portions Copyright (c) 2016 HP Development Company, L.P.<BR>\r
 This program and the accompanying materials                          \r
@@ -464,57 +464,97 @@ Returns:
   case 0:\r
     //\r
     // 1 byte alignment\r
+    //if bit 1 have set, 128K byte alignmnet\r
     //\r
-    *Alignment = 0;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 17;\r
+    } else {\r
+      *Alignment = 0;\r
+    }\r
     break;\r
 \r
   case 1:\r
     //\r
     // 16 byte alignment\r
+    //if bit 1 have set, 256K byte alignment\r
     //\r
-    *Alignment = 4;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 18;\r
+    } else {\r
+      *Alignment = 4;\r
+    }\r
     break;\r
 \r
   case 2:\r
     //\r
     // 128 byte alignment\r
+    //if bit 1 have set, 512K byte alignment\r
     //\r
-    *Alignment = 7;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 19;\r
+    } else {\r
+      *Alignment = 7;\r
+    }\r
     break;\r
 \r
   case 3:\r
     //\r
     // 512 byte alignment\r
+    //if bit 1 have set, 1M byte alignment\r
     //\r
-    *Alignment = 9;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 20;\r
+    } else {\r
+      *Alignment = 9;\r
+    }\r
     break;\r
 \r
   case 4:\r
     //\r
     // 1K byte alignment\r
+    //if bit 1 have set, 2M byte alignment\r
     //\r
-    *Alignment = 10;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 21;\r
+    } else {\r
+      *Alignment = 10;\r
+    }\r
     break;\r
 \r
   case 5:\r
     //\r
     // 4K byte alignment\r
+    //if bit 1 have set, 4M byte alignment\r
     //\r
-    *Alignment = 12;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 22;\r
+    } else {\r
+      *Alignment = 12;\r
+    }\r
     break;\r
 \r
   case 6:\r
     //\r
     // 32K byte alignment\r
+    //if bit 1 have set , 8M byte alignment\r
     //\r
-    *Alignment = 15;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 23;\r
+    } else {\r
+      *Alignment = 15;\r
+    }\r
     break;\r
 \r
   case 7:\r
     //\r
     // 64K byte alignment\r
+    //if bit 1 have set, 16M alignment\r
     //\r
-    *Alignment = 16;\r
+    if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) {\r
+      *Alignment = 24;\r
+    } else {\r
+      *Alignment = 16;\r
+    }\r
     break;\r
 \r
   default:\r
@@ -1060,7 +1100,7 @@ Returns:
   // Clear the alignment bits: these have become meaningless now that we have\r
   // adjusted the padding section.\r
   //\r
-  FfsFile->Attributes &= ~FFS_ATTRIB_DATA_ALIGNMENT;\r
+  FfsFile->Attributes &= ~(FFS_ATTRIB_DATA_ALIGNMENT | FFS_ATTRIB_DATA_ALIGNMENT2);\r
 \r
   //\r
   // Recalculate the FFS header checksum. Instead of setting Header and State\r
index c0e4de254b9809972a9e422ed495cd4fc6d4bc10..d9cdc1f6319c29deed758a4b71b6dbc72664a697 100644 (file)
@@ -74,7 +74,8 @@ STATIC CHAR8      *mGUIDedSectionAttribue[]  = { "NONE", "PROCESSING_REQUIRED",
 \r
 STATIC CHAR8 *mAlignName[] = {\r
   "1", "2", "4", "8", "16", "32", "64", "128", "256", "512",\r
-  "1K", "2K", "4K", "8K", "16K", "32K", "64K"\r
+  "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K",\r
+  "512K", "1M", "2M", "4M", "8M", "16M"\r
 };\r
 \r
 //\r
@@ -184,7 +185,7 @@ Returns:
                         used in Ver section.\n");\r
   fprintf (stdout, "  --sectionalign SectionAlign\n\\r
                         SectionAlign points to section alignment, which support\n\\r
-                        the alignment scope 1~64K. It is specified in same\n\\r
+                        the alignment scope 1~16M. It is specified in same\n\\r
                         order that the section file is input.\n");\r
   fprintf (stdout, "  -v, --verbose         Turn on verbose output with informational messages.\n");\r
   fprintf (stdout, "  -q, --quiet           Disable all messages except key message and fatal error\n");\r
@@ -356,7 +357,7 @@ StringtoAlignment (
 \r
 Routine Description:\r
 \r
-  Converts Align String to align value (1~64K). \r
+  Converts Align String to align value (1~16M).\r
 \r
 Arguments:\r
 \r
index 8c54021393b5f742969071437dc5dd0da20478da..133c88c56e3c45d5cd3e2b2da901c7926d8b4e5c 100644 (file)
@@ -4,7 +4,7 @@
   @par Revision Reference:\r
   Version 1.4.\r
 \r
-  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials are licensed and made available\r
   under the terms and conditions of the BSD License which accompanies this\r
@@ -65,6 +65,7 @@ typedef UINT8 EFI_FFS_FILE_STATE;
 // FFS File Attributes.\r
 // \r
 #define FFS_ATTRIB_LARGE_FILE         0x01\r
+#define FFS_ATTRIB_DATA_ALIGNMENT2    0x02\r
 #define FFS_ATTRIB_FIXED              0x04\r
 #define FFS_ATTRIB_DATA_ALIGNMENT     0x38\r
 #define FFS_ATTRIB_CHECKSUM           0x40\r
index 8e68a67e44d8c8d5d03d95764f1bc064a2f9fe37..7d129bfcab5909d77e4bd81918e5beea89580f62 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # parse FDF file\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, 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 of the BSD License\r
@@ -2340,7 +2340,8 @@ class FdfParser(object):
         \r
         AlignValue = None\r
         if self.__GetAlignment():\r
-            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             AlignValue = self.__Token\r
             \r
@@ -2608,7 +2609,8 @@ class FdfParser(object):
         \r
         AlignValue = None\r
         if self.__GetAlignment():\r
-            if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             AlignValue = self.__Token\r
             \r
@@ -2924,7 +2926,8 @@ class FdfParser(object):
             \r
         AlignValue = ""\r
         if self.__GetAlignment():\r
-            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)\r
             AlignValue = self.__Token\r
 \r
@@ -2988,7 +2991,8 @@ class FdfParser(object):
                 CheckSum = True\r
     \r
             if self.__GetAlignment():\r
-                if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+                if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                        "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                     raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)\r
                 if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):\r
                     raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)\r
@@ -3062,7 +3066,8 @@ class FdfParser(object):
                 FvImageSectionObj.FvFileType = self.__Token\r
                 \r
                 if self.__GetAlignment():\r
-                    if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+                    if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                            "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                         raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)\r
                     FvImageSectionObj.Alignment = self.__Token\r
                 \r
@@ -3129,7 +3134,8 @@ class FdfParser(object):
                 EfiSectionObj.BuildNum = self.__Token\r
                 \r
         if self.__GetAlignment():\r
-            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):\r
                 raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)\r
index ba3677ed89db77ad558166a24f1dac74eaaf78df..78c0af4db1ab2c4e9e8a6782f5831ad4ef1e1a78 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process data section generation\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, 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 of the BSD License\r
@@ -79,8 +79,10 @@ class DataSection (DataSectionClassObject):
             ImageObj = PeImageClass (Filename)\r
             if ImageObj.SectionAlignment < 0x400:\r
                 self.Alignment = str (ImageObj.SectionAlignment)\r
-            else:\r
+            elif ImageObj.SectionAlignment < 0x100000:\r
                 self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
+            else:\r
+                self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'\r
 \r
         NoStrip = True\r
         if self.SecType in ('TE', 'PE32'):\r
index 09fb28f32d78c227895af41176c2594e1b6a8c27..7da3c1e7b0c88e1a84446d0665c832e31a2c7fa8 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process rule section generation\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, 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 of the BSD License\r
@@ -231,8 +231,10 @@ class EfiSection (EfiSectionClassObject):
                         ImageObj = PeImageClass (File)\r
                         if ImageObj.SectionAlignment < 0x400:\r
                             Align = str (ImageObj.SectionAlignment)\r
-                        else:\r
+                        elif ImageObj.SectionAlignment < 0x100000:\r
                             Align = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
+                        else:\r
+                            Align = str (ImageObj.SectionAlignment / 0x100000) + 'M'\r
 \r
                     if File[(len(File)-4):] == '.efi':\r
                         MapFile = File.replace('.efi', '.map')\r
index 8f49f9faad7a4c7cd564ac260f82a9052c3aa3a0..499d0a6f053c407210a279a931cbb8af68c3d21b 100644 (file)
@@ -2767,7 +2767,8 @@ class FdfParser:
         while True:\r
             AlignValue = None\r
             if self.__GetAlignment():\r
-                if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+                if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                        "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                     raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
                 #For FFS, Auto is default option same to ""\r
                 if not self.__Token == "Auto":\r
@@ -2826,7 +2827,8 @@ class FdfParser:
             FfsFileObj.CheckSum = True\r
 \r
         if self.__GetAlignment():\r
-            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             #For FFS, Auto is default option same to ""\r
             if not self.__Token == "Auto":\r
@@ -2897,7 +2899,8 @@ class FdfParser:
 \r
         AlignValue = None\r
         if self.__GetAlignment():\r
-            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             AlignValue = self.__Token\r
 \r
@@ -3186,7 +3189,8 @@ class FdfParser:
 \r
         AlignValue = None\r
         if self.__GetAlignment():\r
-            if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             AlignValue = self.__Token\r
 \r
@@ -3777,7 +3781,8 @@ class FdfParser:
 \r
         AlignValue = ""\r
         if self.__GetAlignment():\r
-            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             #For FFS, Auto is default option same to ""\r
             if not self.__Token == "Auto":\r
@@ -3826,7 +3831,8 @@ class FdfParser:
 \r
             SectAlignment = ""\r
             if self.__GetAlignment():\r
-                if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+                if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                        "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                     raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
                 if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):\r
                     raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)\r
@@ -3905,7 +3911,8 @@ class FdfParser:
                 FvImageSectionObj.FvFileType = self.__Token\r
 \r
                 if self.__GetAlignment():\r
-                    if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+                    if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                            "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                         raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
                     FvImageSectionObj.Alignment = self.__Token\r
 \r
@@ -3972,7 +3979,8 @@ class FdfParser:
                 EfiSectionObj.BuildNum = self.__Token\r
 \r
         if self.__GetAlignment():\r
-            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):\r
+            if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K",\r
+                                    "256K", "512K", "1M", "2M", "4M", "8M", "16M"):\r
                 raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)\r
             if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):\r
                 raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)\r
index c61c227c99000df9926db44ada82b2c2e401e76c..958cecfad63e847b4ecf58acb45c946505ec3ee0 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process FFS generation from INF statement\r
 #\r
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #  Copyright (c) 2014-2016 Hewlett-Packard Development Company, L.P.<BR>\r
 #\r
 #  This program and the accompanying materials\r
@@ -731,8 +731,10 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     ImageObj = PeImageClass (File)\r
                     if ImageObj.SectionAlignment < 0x400:\r
                         self.Alignment = str (ImageObj.SectionAlignment)\r
-                    else:\r
+                    elif ImageObj.SectionAlignment < 0x100000:\r
                         self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
+                    else:\r
+                        self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'\r
 \r
                 if not NoStrip:\r
                     FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
@@ -770,8 +772,10 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 ImageObj = PeImageClass (GenSecInputFile)\r
                 if ImageObj.SectionAlignment < 0x400:\r
                     self.Alignment = str (ImageObj.SectionAlignment)\r
-                else:\r
+                elif ImageObj.SectionAlignment < 0x100000:\r
                     self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K'\r
+                else:\r
+                    self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M'\r
 \r
             if not NoStrip:\r
                 FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc')\r
index f6ccb59d7757b9d6150a29393b906db3a9f0cf31..4b03adc1c83a88063c4e3b11af0cf6d8af30b96c 100644 (file)
@@ -196,9 +196,12 @@ class FV (FvClassObject):
             FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)\r
             # FvAlignmentValue is larger than or equal to 1K\r
             if FvAlignmentValue >= 0x400:\r
-                if FvAlignmentValue >= 0x10000:\r
-                    #The max alignment supported by FFS is 64K.\r
-                    self.FvAlignment = "64K"\r
+                if FvAlignmentValue >= 0x100000:\r
+                    #The max alignment supported by FFS is 16M.\r
+                    if FvAlignmentValue >= 0x1000000:\r
+                        self.FvAlignment = "16M"\r
+                    else:\r
+                        self.FvAlignment = str(FvAlignmentValue / 0x100000) + "M"\r
                 else:\r
                     self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"\r
             else:\r
index 5989978a7c8d6c18d8d285918634fa3100eea70a..68f17c31e8be27207564e330435096b38b423b5c 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process FV image section generation\r
 #\r
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, 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 of the BSD License\r
@@ -80,9 +80,12 @@ class FvImageSection(FvImageSectionClassObject):
 \r
             # MaxFvAlignment is larger than or equal to 1K\r
             if MaxFvAlignment >= 0x400:\r
-                if MaxFvAlignment >= 0x10000:\r
-                    #The max alignment supported by FFS is 64K.\r
-                    self.Alignment = "64K"\r
+                if MaxFvAlignment >= 0x100000:\r
+                    #The max alignment supported by FFS is 16M.\r
+                    if MaxFvAlignment >=1000000:\r
+                        self.Alignment = "16M"\r
+                    else:\r
+                        self.Alignment = str(MaxFvAlignment / 0x100000) + "M"\r
                 else:\r
                     self.Alignment = str (MaxFvAlignment / 0x400) + "K"\r
             else:\r
@@ -117,9 +120,12 @@ class FvImageSection(FvImageSectionClassObject):
                         FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)\r
                         # FvAlignmentValue is larger than or equal to 1K\r
                         if FvAlignmentValue >= 0x400:\r
-                            if FvAlignmentValue >= 0x10000:\r
-                                #The max alignment supported by FFS is 64K.\r
-                                self.Alignment = "64K"\r
+                            if FvAlignmentValue >= 0x100000:\r
+                                #The max alignment supported by FFS is 16M.\r
+                                if FvAlignmentValue >= 0x1000000:\r
+                                    self.Alignment = "16M"\r
+                                else:\r
+                                    self.Alignment = str(FvAlignmentValue / 0x100000) + "M"\r
                             else:\r
                                 self.Alignment = str (FvAlignmentValue / 0x400) + "K"\r
                         else:\r
index d02befec1129b8a8c076fd5c91dc46b6486205dd..83996beeea958f8518430909fc4cf4f99503328c 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Global variables for GenFds\r
 #\r
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, 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 of the BSD License\r
@@ -420,8 +420,10 @@ class GenFdsGlobalVariable:
     def GetAlignment (AlignString):\r
         if AlignString == None:\r
             return 0\r
-        if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K"):\r
+        if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K"):\r
             return int (AlignString.rstrip('K')) * 1024\r
+        elif AlignString in ("1M", "2M", "4M", "8M", "16M"):\r
+            return int (AlignString.rstrip('M')) * 1024 * 1024\r
         else:\r
             return int (AlignString)\r
 \r
@@ -429,7 +431,7 @@ class GenFdsGlobalVariable:
     def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,\r
                     SectionAlign=None):\r
         Cmd = ["GenFfs", "-t", Type, "-g", Guid]\r
-        mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K"]\r
+        mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"]\r
         if Fixed == True:\r
             Cmd += ["-x"]\r
         if CheckSum:\r