Enhance Guided section to support multiple guid attribute setting.
authorlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 4 Jan 2010 08:01:40 +0000 (08:01 +0000)
committerlgao4 <lgao4@7335b38e-4728-0410-8992-fb3ffe349368>
Mon, 4 Jan 2010 08:01:40 +0000 (08:01 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1791 7335b38e-4728-0410-8992-fb3ffe349368

Source/C/GenSec/GenSec.c
Source/Python/GenFds/GenFdsGlobalVariable.py
Source/Python/GenFds/GuidSection.py

index 9210246..dfc0b48 100644 (file)
@@ -1223,7 +1223,7 @@ Returns:
       //\r
       // NONE attribute, clear attribute value.\r
       //\r
-      SectGuidAttribute = 0;\r
+      SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;\r
     }\r
     VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", \r
                 (unsigned) VendorGuid.Data1,\r
index 5eb5bef..e9af852 100644 (file)
@@ -168,8 +168,10 @@ class GenFdsGlobalVariable:
             Cmd += ["-g", Guid]
         if GuidHdrLen not in [None, '']:
             Cmd += ["-l", GuidHdrLen]
-        if GuidAttr not in [None, '']:
-            Cmd += ["-r", GuidAttr]
+        if GuidAttr != None:
+            #Add each guided attribute
+            for Attr in GuidAttr:
+                Cmd += ["-r", Attr]
         if InputAlign != None:
             #Section Align is only for dummy section without section type
             for SecAlign in InputAlign:
index a1c2ba2..ef0cfe8 100755 (executable)
@@ -119,14 +119,14 @@ class GuidSection(GuidSectionClassObject) :
         elif ExternalTool == None:\r
             EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % self.NameGuid)\r
         else:\r
+            DummyFile = OutputFile+".dummy"\r
             #\r
             # Call GenSection with DUMMY section type.\r
             #\r
-            GenFdsGlobalVariable.GenerateSection(OutputFile+".dummy", SectFile, InputAlign=SectAlign)\r
+            GenFdsGlobalVariable.GenerateSection(DummyFile, SectFile, InputAlign=SectAlign)\r
             #\r
             # Use external tool process the Output\r
             #\r
-            InputFile = OutputFile+".dummy"\r
             TempFile = OutputPath + \\r
                        os.sep     + \\r
                        ModuleName + \\r
@@ -138,9 +138,9 @@ class GuidSection(GuidSectionClassObject) :
             #\r
             # Call external tool\r
             #\r
-            GenFdsGlobalVariable.GuidTool(TempFile, [InputFile], ExternalTool, '-e')\r
+            GenFdsGlobalVariable.GuidTool(TempFile, [DummyFile], ExternalTool, '-e')\r
 \r
-            FileHandleIn = open(InputFile,'rb')\r
+            FileHandleIn = open(DummyFile,'rb')\r
             FileHandleIn.seek(0,2)\r
             InputFileSize = FileHandleIn.tell()\r
             \r
@@ -148,6 +148,7 @@ class GuidSection(GuidSectionClassObject) :
             FileHandleOut.seek(0,2)\r
             TempFileSize = FileHandleOut.tell()\r
 \r
+            Attribute = []\r
             HeaderLength = None\r
             if TempFileSize > InputFileSize and TempFileSize % 4 == 0:\r
                 FileHandleIn.seek(0)\r
@@ -158,7 +159,7 @@ class GuidSection(GuidSectionClassObject) :
                     HeaderLength = str(TempFileSize - InputFileSize)\r
             #auto sec guided attribute with process required\r
             if HeaderLength == None:\r
-                Attribute = 'PROCESSING_REQUIRED'\r
+                Attribute.append('PROCESSING_REQUIRED')\r
 \r
             FileHandleIn.close()\r
             FileHandleOut.close()\r
@@ -166,16 +167,19 @@ class GuidSection(GuidSectionClassObject) :
             #\r
             # Call Gensection Add Section Header\r
             #\r
-            Attribute = 'NONE'\r
             if self.ProcessRequired in ("TRUE", "1"):\r
-                Attribute = 'PROCESSING_REQUIRED'\r
+                if 'PROCESSING_REQUIRED' not in Attribute:\r
+                    Attribute.append('PROCESSING_REQUIRED')\r
                 HeaderLength = None\r
             if self.AuthStatusValid in ("TRUE", "1"):\r
-                Attribute = 'AUTH_STATUS_VALID'\r
+                Attribute.append('AUTH_STATUS_VALID')\r
             GenFdsGlobalVariable.GenerateSection(OutputFile, [TempFile], Section.Section.SectionType['GUIDED'],\r
                                                  Guid=self.NameGuid, GuidAttr=Attribute, GuidHdrLen=HeaderLength)\r
             OutputFileList = []\r
             OutputFileList.append(OutputFile)\r
+            if 'PROCESSING_REQUIRED' in Attribute:\r
+                # reset guided section alignment to none for the processed required guided data\r
+                self.Alignment = None\r
             return OutputFileList, self.Alignment\r
 \r
     ## __FindExtendTool()\r