IntelFsp2Pkg/Tools: Add BSF bit field support in GenCfgOpt tool
authorMaurice Ma <maurice.ma@intel.com>
Wed, 25 May 2016 18:21:18 +0000 (11:21 -0700)
committerMaurice Ma <maurice.ma@intel.com>
Fri, 27 May 2016 15:52:42 +0000 (08:52 -0700)
The current GenCfgOpt tool does not generate bit fields in BSF.
This change will allow bit fields to be created in BSF for a specific
FSP UPD item. The argument for the tool is also updated to be in sync
with the old usage model in IntelFspPkg.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Giri P Mudusuru <giri.p.mudusuru@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Giri P Mudusuru <giri.p.mudusuru@intel.com>
IntelFsp2Pkg/Tools/GenCfgOpt.py

index 4fd0562..e8cec95 100644 (file)
@@ -310,6 +310,7 @@ EndList
         self._BuidinOption  = {'$EN_DIS' : 'EN_DIS'}\r
 \r
         self._MacroDict   = {}\r
+        self._PcdsDict    = {}\r
         self._CfgBlkDict  = {}\r
         self._CfgPageDict = {}\r
         self._CfgItemList = []\r
@@ -374,8 +375,21 @@ EndList
                   Line = Line.replace(Each, Each[2:-1])\r
         return Line\r
 \r
+    def ExpandPcds (self, Input):\r
+        Line = Input\r
+        Match = re.findall("(\w+\.\w+)", Input)\r
+        if Match:\r
+            for PcdName in Match:\r
+              if PcdName in self._PcdsDict:\r
+                  Line = Line.replace(PcdName, self._PcdsDict[PcdName])\r
+              else:\r
+                  if self.Debug:\r
+                      print "WARN : %s is not defined" % PcdName\r
+        return Line\r
+\r
     def EvaluateExpress (self, Expr):\r
-        ExpExpr = self.ExpandMacros(Expr)\r
+        ExpExpr = self.ExpandPcds(Expr)\r
+        ExpExpr = self.ExpandMacros(ExpExpr)\r
         LogExpr = CLogicalExpression()\r
         Result  = LogExpr.evaluateExpress (ExpExpr)\r
         if self.Debug:\r
@@ -411,7 +425,7 @@ EndList
         ConfigDict['value'] = newvalue\r
         return ""\r
 \r
-    def ParseDscFile (self, DscFile, FvDir, ConfigDscFile, ExtConfigDscFile):\r
+    def ParseDscFile (self, DscFile, FvDir):\r
         self._CfgItemList = []\r
         self._CfgPageDict = {}\r
         self._CfgBlkDict  = {}\r
@@ -419,9 +433,9 @@ EndList
         self._FvDir       = FvDir\r
 \r
         IsDefSect       = False\r
+        IsPcdSect       = False\r
         IsUpdSect       = False\r
         IsVpdSect       = False\r
-        Found           = False\r
 \r
         IfStack         = []\r
         ElifStack       = []\r
@@ -437,10 +451,14 @@ EndList
             Handle   = False\r
             Match    = re.match("^\[(.+)\]", DscLine)\r
             if Match is not None:\r
+                IsDefSect = False\r
+                IsPcdSect = False\r
+                IsVpdSect = False\r
+                IsUpdSect = False\r
                 if  Match.group(1).lower() == "Defines".lower():\r
                     IsDefSect = True\r
-                    IsVpdSect = False\r
-                    IsUpdSect = False\r
+                if  Match.group(1).lower() == "PcdsFeatureFlag".lower():\r
+                    IsPcdSect = True\r
                 elif Match.group(1).lower() == "PcdsDynamicVpd.Upd".lower():\r
                     ConfigDict = {}\r
                     ConfigDict['header']  = 'ON'\r
@@ -453,16 +471,9 @@ EndList
                     ConfigDict['embed']   = ''\r
                     ConfigDict['comment'] = ''\r
                     ConfigDict['subreg']  = []\r
-                    IsDefSect = False\r
                     IsUpdSect = True\r
-                    IsVpdSect = False\r
-                    Found     = True\r
-                else:\r
-                    IsDefSect = False\r
-                    IsUpdSect = False\r
-                    IsVpdSect = False\r
             else:\r
-                if IsDefSect or IsUpdSect or IsVpdSect:\r
+                if IsDefSect or IsPcdSect or IsUpdSect or IsVpdSect:\r
                     if re.match("^!else($|\s+#.+)", DscLine):\r
                         if IfStack:\r
                             IfStack[-1] = not IfStack[-1]\r
@@ -490,41 +501,7 @@ EndList
                         else:\r
                             Match  = re.match("!(if|elseif)\s+(.+)", DscLine)\r
                             if Match:\r
-                                IsFoundInFile = False\r
-                                MatchPcdFormat = re.match("^\s*(.+)\.(.+)\s*==\s*(.+)", Match.group(2))\r
-                                if MatchPcdFormat:\r
-                                       ExtConfigDsc = open(ExtConfigDscFile, "r")\r
-                                       ExtConfigDscLines = ExtConfigDsc.readlines()\r
-                                       ExtConfigDsc.close()\r
-                                       \r
-                                       while len(ExtConfigDscLines):\r
-                                           ExtConfigDscLine  = ExtConfigDscLines.pop(0).strip()\r
-                                           MatchExtConfigPcd = re.match("^\s*(.+)\s*\|\s*(.+)", ExtConfigDscLine)\r
-                                           if MatchExtConfigPcd and IsFoundInFile == False:\r
-                                                 PcdFormatStr = str(str(MatchPcdFormat.group(1)) + "." + str(MatchPcdFormat.group(2)))\r
-                                                 ExtConfigPcd = str(MatchExtConfigPcd.group(1))\r
-                                                 Result = False\r
-                                                 if PcdFormatStr.strip() == ExtConfigPcd.strip():\r
-                                                       Result = self.EvaluateExpress(str(str(MatchExtConfigPcd.group(2)) + " == " + str(MatchPcdFormat.group(3))))\r
-                                                       IsFoundInFile = True\r
-                                                       break\r
-                                       if IsFoundInFile == False:\r
-                                           ConfigDsc = open(ConfigDscFile, "r")\r
-                                           ConfigDscLines = ConfigDsc.readlines()\r
-                                           ConfigDsc.close()\r
-                                           while len(ConfigDscLines):\r
-                                               ConfigDscLine  = ConfigDscLines.pop(0).strip()\r
-                                               MatchConfigPcd = re.match("^\s*(.+)\s*\|\s*(.+)", ConfigDscLine)\r
-                                               if MatchConfigPcd:\r
-                                                     PcdFormatStr = str(str(MatchPcdFormat.group(1)) + "." + str(MatchPcdFormat.group(2)))\r
-                                                     ConfigPcd = str(MatchConfigPcd.group(1))\r
-                                                     Result = False\r
-                                                     if PcdFormatStr.strip() == ConfigPcd.strip():\r
-                                                           Result = self.EvaluateExpress(str(str(MatchConfigPcd.group(2)) + " == " + str(MatchPcdFormat.group(3))))\r
-                                                           IsFoundInFile = True\r
-                                                           break\r
-                                else:\r
-                                       Result = self.EvaluateExpress(Match.group(2))\r
+                                Result = self.EvaluateExpress(Match.group(2))\r
                                 if Match.group(1) == "if":\r
                                     ElifStack.append(0)\r
                                     IfStack.append(Result)\r
@@ -571,6 +548,14 @@ EndList
                     self._MacroDict[Match.group(1)] = Match.group(2)\r
                     if self.Debug:\r
                         print "INFO : DEFINE %s = [ %s ]" % (Match.group(1), Match.group(2))\r
+            elif IsPcdSect:\r
+                #gSiPkgTokenSpaceGuid.PcdTxtEnable|FALSE\r
+                #gSiPkgTokenSpaceGuid.PcdOverclockEnable|TRUE\r
+                Match = re.match("^\s*([\w\.]+)\s*\|\s*(\w+)", DscLine)\r
+                if Match:\r
+                    self._PcdsDict[Match.group(1)] = Match.group(2)\r
+                    if self.Debug:\r
+                        print "INFO : PCD %s = [ %s ]" % (Match.group(1), Match.group(2))\r
             else:\r
                 Match = re.match("^\s*#\s+(!BSF|@Bsf|!HDR)\s+(.+)", DscLine)\r
                 if Match:\r
@@ -693,25 +678,43 @@ EndList
                     ConfigDict['option'] = ''\r
                 else:\r
                     # It could be a virtual item as below\r
-                    # !BSF FIELD:{1:SerialDebugPortAddress0}\r
+                    # !BSF FIELD:{SerialDebugPortAddress0:1}\r
                     # or\r
-                    # @Bsf FIELD:{1:SerialDebugPortAddress0}\r
-                    Match = re.match("^\s*#\s+(!BSF|@Bsf)\s+FIELD:{(.+):(\d+)}", DscLine)\r
+                    # @Bsf FIELD:{SerialDebugPortAddress0:1b}\r
+                    Match = re.match("^\s*#\s+(!BSF|@Bsf)\s+FIELD:{(.+):(\d+)([Bb])?}", DscLine)\r
                     if Match:\r
-                        SubCfgDict = ConfigDict\r
+                        SubCfgDict = ConfigDict.copy()\r
+                        if (Match.group(4) == None) or (Match.group(4) == 'B'):\r
+                          UnitBitLen = 8\r
+                        elif Match.group(4) == 'b':\r
+                          UnitBitLen = 1\r
+                        else:\r
+                          print("ERROR: Invalide BSF FIELD length for line '%s'" % DscLine)\r
+                          raise SystemExit\r
                         SubCfgDict['cname']  = Match.group(2)\r
-                        SubCfgDict['length'] = int (Match.group(3))\r
-                        if SubCfgDict['length'] > 0:\r
+                        SubCfgDict['bitlength'] = int (Match.group(3)) * UnitBitLen\r
+                        if SubCfgDict['bitlength'] > 0:\r
                             LastItem =  self._CfgItemList[-1]\r
                             if len(LastItem['subreg']) == 0:\r
                                 SubOffset  = 0\r
                             else:\r
-                                SubOffset += LastItem['subreg'][-1]['length']\r
-                            SubCfgDict['offset'] = SubOffset\r
+                                SubOffset  = LastItem['subreg'][-1]['bitoffset'] + LastItem['subreg'][-1]['bitlength']\r
+                            SubCfgDict['bitoffset'] = SubOffset\r
                             LastItem['subreg'].append (SubCfgDict.copy())\r
                         ConfigDict['name']   = ''\r
         return Error\r
 \r
+    def GetBsfBitFields (self, subitem, bytes):\r
+        start = subitem['bitoffset']\r
+        end   = start + subitem['bitlength']\r
+        bitsvalue = ''.join('{0:08b}'.format(i) for i in bytes[::-1])\r
+        bitsvalue = bitsvalue[::-1]\r
+        bitslen   = len(bitsvalue)\r
+        if start > bitslen or end > bitslen:\r
+            print "Invalid bits offset [%d,%d] for %s" % (start, end, subitem['name'])\r
+            raise SystemExit\r
+        return hex(int(bitsvalue[start:end][::-1], 2))\r
+\r
     def UpdateSubRegionDefaultValue (self):\r
         Error = 0\r
         for Item in self._CfgItemList:\r
@@ -732,20 +735,14 @@ EndList
                     value = int(Item['value'], 16)\r
                 else:\r
                     value = int(Item['value'])\r
-                idx = 0;\r
+                idx = 0\r
                 while  idx < Item['length']:\r
                     bytearray.append(value & 0xFF)\r
                     value = value >> 8\r
                     idx = idx + 1\r
             for SubItem in Item['subreg']:\r
-                if SubItem['length'] in (1,2,4,8):\r
-                    valuelist = [b for b in bytearray[SubItem['offset']:SubItem['offset']+SubItem['length']]]\r
-                    valuelist.reverse()\r
-                    valuestr = "".join('%02X' % b for b in valuelist)\r
-                    SubItem['value'] = '0x%s' % valuestr\r
-                else:\r
-                    valuestr = ",".join('0x%02X' % b for b in bytearray[SubItem['offset']:SubItem['offset']+SubItem['length']])\r
-                    SubItem['value'] = '{%s}' % valuestr\r
+                valuestr = self.GetBsfBitFields(SubItem, bytearray)\r
+                SubItem['value'] = valuestr\r
         return Error\r
 \r
     def CreateSplitUpdTxt (self, UpdTxtFile):\r
@@ -969,7 +966,7 @@ EndList
            else:\r
                OldTextBody.append (Line)\r
 \r
-           if Match and Match.group(3) == 'END':  \r
+           if Match and Match.group(3) == 'END':\r
                if (StructName != Match.group(1)) or (VariableName != Match.group(2)):\r
                    print "Unmatched struct name '%s' and '%s' !"  % (StructName, Match.group(1))\r
                else:\r
@@ -1086,7 +1083,7 @@ EndList
                                Marker = '/* EMBED_STRUCT:%s */ ' % Item["embed"]\r
                         else:\r
                             if Embed == '':\r
-                                Marker = '';\r
+                                Marker = ''\r
                             else:\r
                                 self.Error = "Invalid embedded structure format '%s'!\n" % Item["embed"]\r
                                 return 4\r
@@ -1095,7 +1092,7 @@ EndList
                     if Item['cname'] == 'UpdTerminator':\r
                         break\r
                 TxtBody.append("} " + UpdStructure[UpdIdx] + ";\n\n")\r
-        \r
+\r
         # Handle the embedded data structure\r
         TxtBody = self.PostProcessBody (TxtBody)\r
 \r
@@ -1242,7 +1239,10 @@ EndList
             DefaultValue = Match.group(1).strip()\r
         else:\r
             DefaultValue = Item['value'].strip()\r
-        BsfFd.write("    %s%s%4d bytes    $_DEFAULT_ = %s\n" % (Line, ' ' * (64 - len(Line)), Item['length'], DefaultValue))\r
+        if 'bitlength' in Item:\r
+            BsfFd.write("    %s%s%4d bits     $_DEFAULT_ = %s\n" % (Line, ' ' * (64 - len(Line)), Item['bitlength'], DefaultValue))\r
+        else:\r
+            BsfFd.write("    %s%s%4d bytes    $_DEFAULT_ = %s\n" % (Line, ' ' * (64 - len(Line)), Item['length'], DefaultValue))\r
         TmpList = []\r
         if  Item['type'] == "Combo":\r
             if not Item['option'] in self._BuidinOption:\r
@@ -1261,20 +1261,20 @@ EndList
                 Options = self._BuidinOption[Item['option']]\r
             else:\r
                 Options = PcdName\r
-            BsfFd.write('    %s $%s, "%s", &%s,\n' % (Item['type'], PcdName, Item['name'], Options));\r
+            BsfFd.write('    %s $%s, "%s", &%s,\n' % (Item['type'], PcdName, Item['name'], Options))\r
             WriteHelp = 1\r
         elif Item['type'].startswith("EditNum"):\r
             Match = re.match("EditNum\s*,\s*(HEX|DEC)\s*,\s*\((\d+|0x[0-9A-Fa-f]+)\s*,\s*(\d+|0x[0-9A-Fa-f]+)\)", Item['type'])\r
             if Match:\r
-                BsfFd.write('    EditNum $%s, "%s", %s,\n' % (PcdName, Item['name'], Match.group(1)));\r
+                BsfFd.write('    EditNum $%s, "%s", %s,\n' % (PcdName, Item['name'], Match.group(1)))\r
                 WriteHelp = 2\r
         elif Item['type'].startswith("EditText"):\r
-            BsfFd.write('    %s $%s, "%s",\n' % (Item['type'], PcdName, Item['name']));\r
+            BsfFd.write('    %s $%s, "%s",\n' % (Item['type'], PcdName, Item['name']))\r
             WriteHelp = 1\r
         elif Item['type'] == "Table":\r
             Columns = Item['option'].split(',')\r
             if len(Columns) != 0:\r
-                BsfFd.write('    %s $%s "%s",' % (Item['type'], PcdName, Item['name']));\r
+                BsfFd.write('    %s $%s "%s",' % (Item['type'], PcdName, Item['name']))\r
                 for Col in Columns:\r
                     Fmt = Col.split(':')\r
                     if len(Fmt) != 3:\r
@@ -1286,18 +1286,18 @@ EndList
                     BsfFd.write('\n        Column "%s", %d bytes, %s' % (Fmt[0].strip(), Dtype, Fmt[2].strip()))\r
                 BsfFd.write(',\n')\r
                 WriteHelp = 1\r
-            \r
+\r
         if WriteHelp  > 0:\r
             HelpLines = Item['help'].split('\\n\\r')\r
             FirstLine = True\r
             for HelpLine in HelpLines:\r
                 if FirstLine:\r
                     FirstLine = False\r
-                    BsfFd.write('        Help "%s"\n' % (HelpLine));\r
+                    BsfFd.write('        Help "%s"\n' % (HelpLine))\r
                 else:\r
-                    BsfFd.write('             "%s"\n' % (HelpLine));\r
+                    BsfFd.write('             "%s"\n' % (HelpLine))\r
             if WriteHelp == 2:\r
-                    BsfFd.write('             "Valid range: %s ~ %s"\n' % (Match.group(2), Match.group(3)));\r
+                    BsfFd.write('             "Valid range: %s ~ %s"\n' % (Match.group(2), Match.group(3)))\r
 \r
     def GenerateBsfFile (self, BsfFile):\r
 \r
@@ -1309,7 +1309,7 @@ EndList
         OptionDict = {}\r
         BsfFd      = open(BsfFile, "w")\r
         BsfFd.write("%s\n" % (__copyright_bsf__ % date.today().year))\r
-        BsfFd.write("%s\n" % self._GlobalDataDef);\r
+        BsfFd.write("%s\n" % self._GlobalDataDef)\r
         BsfFd.write("StructDef\n")\r
         NextOffset = -1\r
         for Item in self._CfgItemList:\r
@@ -1321,17 +1321,30 @@ EndList
                     BsfFd.write("        Skip %d bytes\n" % (Item['offset'] - NextOffset))\r
                 if len(Item['subreg']) > 0:\r
                     NextOffset =  Item['offset']\r
+                    BitsOffset =  NextOffset * 8\r
                     for SubItem in Item['subreg']:\r
-                        NextOffset += SubItem['length']\r
+                        BitsOffset += SubItem['bitlength']\r
                         if SubItem['name'] == '':\r
-                            BsfFd.write("        Skip %d bytes\n" % (SubItem['length']))\r
+                            if 'bitlength' in SubItem:\r
+                                BsfFd.write("        Skip %d bits\n" % (SubItem['bitlength']))\r
+                            else:\r
+                                BsfFd.write("        Skip %d bytes\n" % (SubItem['length']))\r
                         else:\r
                             Options = self.WriteBsfStruct(BsfFd, SubItem)\r
                             if len(Options) > 0:\r
                                 OptionDict[SubItem['space']+'_'+SubItem['cname']] = Options\r
-                    if (Item['offset'] + Item['length']) <  NextOffset:\r
-                        self.Error = "BSF sub region '%s' length does not match" % (Item['space']+'.'+Item['cname'])\r
-                        return 2\r
+\r
+                    NextBitsOffset = (Item['offset'] + Item['length']) * 8\r
+                    if NextBitsOffset > BitsOffset:\r
+                        BitsGap     = NextBitsOffset - BitsOffset\r
+                        BitsRemain  = BitsGap % 8\r
+                        if BitsRemain:\r
+                            BsfFd.write("        Skip %d bits\n" % BitsRemain)\r
+                            BitsGap -= BitsRemain\r
+                        BytesRemain = BitsGap / 8\r
+                        if BytesRemain:\r
+                            BsfFd.write("        Skip %d bytes\n" % BytesRemain)\r
+                    NextOffset = Item['offset'] + Item['length']\r
                 else:\r
                     NextOffset = Item['offset'] + Item['length']\r
                     Options = self.WriteBsfStruct(BsfFd, Item)\r
@@ -1339,21 +1352,21 @@ EndList
                         OptionDict[Item['space']+'_'+Item['cname']] = Options\r
         BsfFd.write("\nEndStruct\n\n")\r
 \r
-        BsfFd.write("%s" % self._BuidinOptionTxt);\r
+        BsfFd.write("%s" % self._BuidinOptionTxt)\r
 \r
         for Each in OptionDict:\r
-            BsfFd.write("List &%s\n" % Each);\r
+            BsfFd.write("List &%s\n" % Each)\r
             for Item in OptionDict[Each]:\r
-                BsfFd.write('    Selection %s , "%s"\n' % (Item[0], Item[1]));\r
-            BsfFd.write("EndList\n\n");\r
+                BsfFd.write('    Selection %s , "%s"\n' % (Item[0], Item[1]))\r
+            BsfFd.write("EndList\n\n")\r
 \r
-        BsfFd.write("BeginInfoBlock\n");\r
-        BsfFd.write('    PPVer       "%s"\n' % (self._CfgBlkDict['ver']));\r
-        BsfFd.write('    Description "%s"\n' % (self._CfgBlkDict['name']));\r
-        BsfFd.write("EndInfoBlock\n\n");\r
+        BsfFd.write("BeginInfoBlock\n")\r
+        BsfFd.write('    PPVer       "%s"\n' % (self._CfgBlkDict['ver']))\r
+        BsfFd.write('    Description "%s"\n' % (self._CfgBlkDict['name']))\r
+        BsfFd.write("EndInfoBlock\n\n")\r
 \r
         for Each in self._CfgPageDict:\r
-            BsfFd.write('Page "%s"\n' % self._CfgPageDict[Each]);\r
+            BsfFd.write('Page "%s"\n' % self._CfgPageDict[Each])\r
             BsfItems = []\r
             for Item in self._CfgItemList:\r
                 if Item['name'] != '':\r
@@ -1370,21 +1383,18 @@ EndList
 \r
             for Item in BsfItems:\r
                 self.WriteBsfOption (BsfFd, Item)\r
-            BsfFd.write("EndPage\n\n");\r
+            BsfFd.write("EndPage\n\n")\r
 \r
         BsfFd.close()\r
         return  Error\r
 \r
 \r
 def Usage():\r
-    print "GenCfgOpt Version 0.51"\r
+    print "GenCfgOpt Version 0.52"\r
     print "Usage:"\r
-    print " GenCfgOpt  UPDTXT  PlatformDscFile BuildFvDir  ConfigDscFile  ExtConfigDscFile"\r
-    print "                        [-D Macros]"\r
-    print " GenCfgOpt  HEADER  PlatformDscFile BuildFvDir  ConfigDscFile  ExtConfigDscFile"\r
-    print "            InputHFile  [-D Macros]"\r
-    print " GenCfgOpt  GENBSF  PlatformDscFile BuildFvDir  ConfigDscFile  ExtConfigDscFile"\r
-    print "            BsfOutFile  [-D Macros]"\r
+    print "    GenCfgOpt  UPDTXT  PlatformDscFile BuildFvDir                 [-D Macros]"\r
+    print "    GenCfgOpt  HEADER  PlatformDscFile BuildFvDir  InputHFile     [-D Macros]"\r
+    print "    GenCfgOpt  GENBSF  PlatformDscFile BuildFvDir  BsfOutFile     [-D Macros]"\r
 \r
 def Main():\r
     #\r
@@ -1400,21 +1410,13 @@ def Main():
         if not os.path.exists(DscFile):\r
             print "ERROR: Cannot open DSC file '%s' !" % DscFile\r
             return 2\r
-        ConfigDscFile = sys.argv[4]\r
-        if not os.path.exists(ConfigDscFile):\r
-            print "ERROR: Cannot open Config DSC file '%s' !" % ConfigDscFile\r
-            return 2\r
-        ExtConfigDscFile = sys.argv[5]\r
-        if not os.path.exists(ExtConfigDscFile):\r
-            print "ERROR: Cannot open Ext Config DSC file '%s' !" % ExtConfigDscFile\r
-            return 2\r
 \r
         OutFile = ''\r
         if argc > 4:\r
-            if sys.argv[6][0] == '-':\r
+            if sys.argv[4][0] == '-':\r
                 Start = 4\r
             else:\r
-                OutFile = sys.argv[6]\r
+                OutFile = sys.argv[4]\r
                 Start = 5\r
             GenCfgOpt.ParseBuildMode(sys.argv[3])\r
             if GenCfgOpt.ParseMacros(sys.argv[Start:]) != 0:\r
@@ -1425,7 +1427,7 @@ def Main():
         if not os.path.exists(FvDir):\r
             os.makedirs(FvDir)\r
 \r
-        if GenCfgOpt.ParseDscFile(DscFile, FvDir, ConfigDscFile, ExtConfigDscFile) != 0:\r
+        if GenCfgOpt.ParseDscFile(DscFile, FvDir) != 0:\r
             print "ERROR: %s !" % GenCfgOpt.Error\r
             return 5\r
 \r