]>
git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/Tools/GenCfgOpt.py
3 # Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
4 # SPDX-License-Identifier: BSD-2-Clause-Patent
12 from datetime
import date
14 # Generated file copyright header
16 __copyright_txt__
= """## @file
18 # THIS IS AUTO-GENERATED FILE BY BUILD TOOLS AND PLEASE DO NOT MAKE MODIFICATION.
20 # This file lists all VPD informations for a platform collected by build.exe.
22 # Copyright (c) %4d, Intel Corporation. All rights reserved.<BR>
23 # This program and the accompanying materials
24 # are licensed and made available under the terms and conditions of the BSD License
25 # which accompanies this distribution. The full text of the license may be found at
26 # http://opensource.org/licenses/bsd-license.php
28 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
29 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
33 __copyright_bsf__
= """/** @file
35 Boot Setting File for Platform Configuration.
37 Copyright (c) %4d, Intel Corporation. All rights reserved.<BR>
38 This program and the accompanying materials
39 are licensed and made available under the terms and conditions of the BSD License
40 which accompanies this distribution. The full text of the license may be found at
41 http://opensource.org/licenses/bsd-license.php
43 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
44 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
46 This file is automatically generated. Please do NOT modify !!!
52 __copyright_h__
= """/** @file
54 Copyright (c) %4d, Intel Corporation. All rights reserved.<BR>
56 Redistribution and use in source and binary forms, with or without modification,
57 are permitted provided that the following conditions are met:
59 * Redistributions of source code must retain the above copyright notice, this
60 list of conditions and the following disclaimer.
61 * Redistributions in binary form must reproduce the above copyright notice, this
62 list of conditions and the following disclaimer in the documentation and/or
63 other materials provided with the distribution.
64 * Neither the name of Intel Corporation nor the names of its contributors may
65 be used to endorse or promote products derived from this software without
66 specific prior written permission.
68 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
69 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
70 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
71 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
72 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
73 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
74 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
75 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
76 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
77 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
78 THE POSSIBILITY OF SUCH DAMAGE.
80 This file is automatically generated. Please do NOT modify !!!
85 def UpdateMemSiUpdInitOffsetValue ( DscFile
):
86 DscFd
= open ( DscFile
, "r" )
87 DscLines
= DscFd
. readlines ()
93 MemUpdInitOffsetValue
= 0
94 SiUpdInitOffsetValue
= 0
97 DscLine
= DscLines
. pop ( 0 )
98 DscContent
. append ( DscLine
)
99 DscLine
= DscLine
. strip ()
100 Match
= re
. match ( "^([_a-zA-Z0-9]+).(MemoryInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)" , DscLine
)
102 MemUpdInitOffsetValue
= int ( Match
. group ( 5 ), 0 )
103 Match
= re
. match ( "^\s*([_a-zA-Z0-9]+).(SiliconInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)" , DscLine
)
105 SiUpdInitOffsetValue
= int ( Match
. group ( 5 ), 0 )
106 Match
= re
. match ( "^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(0x244450554D454D24)" , DscLine
)
108 MemUpdInitOffset
= int ( Match
. group ( 3 ), 0 )
109 Match
= re
. match ( "^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(0x244450555F495324)" , DscLine
)
111 SiUpdInitOffset
= int ( Match
. group ( 3 ), 0 )
113 if MemUpdInitOffsetValue
!= MemUpdInitOffset
or SiUpdInitOffsetValue
!= SiUpdInitOffset
:
114 MemUpdInitOffsetStr
= "0x %0 8X" % MemUpdInitOffset
115 SiUpdInitOffsetStr
= "0x %0 8X" % SiUpdInitOffset
116 DscFd
= open ( DscFile
, "w" )
117 for DscLine
in DscContent
:
118 Match
= re
. match ( "^\s*([_a-zA-Z0-9]+).(MemoryInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)" , DscLine
)
120 DscLine
= re
. sub ( r
'(?:[^\s]+\s*$)' , MemUpdInitOffsetStr
+ ' \n ' , DscLine
)
121 Match
= re
. match ( "^\s*([_a-zA-Z0-9]+).(SiliconInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)" , DscLine
)
123 DscLine
= re
. sub ( r
'(?:[^\s]+\s*$)' , SiUpdInitOffsetStr
+ ' \n ' , line
)
124 DscFd
. writelines ( DscLine
)
127 class CLogicalExpression
:
132 def errExit ( self
, err
= '' ):
133 print "ERROR: Express parsing for:"
134 print " %s " % self
. string
135 print " %s ^" % ( ' ' * self
. index
)
137 print "INFO : %s " % err
140 def getNonNumber ( self
, n1
, n2
):
147 def getCurr ( self
, lens
= 1 ):
150 return self
. string
[ self
. index
:]
152 if self
. index
+ lens
> len ( self
. string
):
153 lens
= len ( self
. string
) - self
. index
154 return self
. string
[ self
. index
: self
. index
+ lens
]
159 return self
. index
== len ( self
. string
)
161 def moveNext ( self
, len = 1 ):
165 while not self
. isLast ():
166 if self
. getCurr () in ' \t ' :
171 def normNumber ( self
, val
):
172 return True if val
else False
174 def getNumber ( self
, var
):
176 if re
. match ( '^0x[a-fA-F0-9]+$' , var
):
178 elif re
. match ( '^[+-]?\d+$' , var
):
184 def parseValue ( self
):
187 while not self
. isLast ():
188 char
= self
. getCurr ()
189 if re
. match ( '^[\w.]' , char
):
194 val
= self
. getNumber ( var
)
201 def parseSingleOp ( self
):
203 if re
. match ( '^NOT\W' , self
. getCurr (- 1 )):
205 op
= self
. parseBrace ()
206 val
= self
. getNumber ( op
)
208 self
. errExit ( "' %s ' is not a number" % op
)
209 return " %d " % ( not self
. normNumber ( int ( op
)))
211 return self
. parseValue ()
213 def parseBrace ( self
):
215 char
= self
. getCurr ()
218 value
= self
. parseExpr ()
220 if self
. getCurr () != ')' :
221 self
. errExit ( "Expecting closing brace or operator" )
225 value
= self
. parseSingleOp ()
228 def parseCompare ( self
):
229 value
= self
. parseBrace ()
232 char
= self
. getCurr ()
233 if char
in [ '<' , '>' ]:
235 next
= self
. getCurr ()
241 result
= self
. parseBrace ()
242 test
= self
. getNonNumber ( result
, value
)
244 value
= " %d " % self
. normNumber ( eval ( value
+ op
+ result
))
246 self
. errExit ( "' %s ' is not a valid number for comparision" % test
)
247 elif char
in [ '=' , '!' ]:
249 if op
in [ '==' , '!=' ]:
251 result
= self
. parseBrace ()
252 test
= self
. getNonNumber ( result
, value
)
254 value
= " %d " % self
. normNumber (( eval ( value
+ op
+ result
)))
256 value
= " %d " % self
. normNumber ( eval ( "'" + value
+ "'" + op
+ "'" + result
+ "'" ))
264 value
= self
. parseCompare ()
267 if re
. match ( '^AND\W' , self
. getCurr (- 1 )):
269 result
= self
. parseCompare ()
270 test
= self
. getNonNumber ( result
, value
)
272 value
= " %d " % self
. normNumber ( int ( value
) & int ( result
))
274 self
. errExit ( "' %s ' is not a valid op number for AND" % test
)
279 def parseOrXor ( self
):
280 value
= self
. parseAnd ()
285 if re
. match ( '^XOR\W' , self
. getCurr (- 1 )):
288 elif re
. match ( '^OR\W' , self
. getCurr (- 1 )):
294 result
= self
. parseAnd ()
295 test
= self
. getNonNumber ( result
, value
)
297 value
= " %d " % self
. normNumber ( eval ( value
+ op
+ result
))
299 self
. errExit ( "' %s ' is not a valid op number for XOR/OR" % test
)
303 return self
. parseOrXor ()
306 value
= self
. parseExpr ()
308 if not self
. isLast ():
309 self
. errExit ( "Unexpected character found ' %s '" % self
. getCurr ())
310 test
= self
. getNumber ( value
)
312 self
. errExit ( "Result ' %s ' is not a number" % value
)
315 def evaluateExpress ( self
, Expr
):
329 self
._ GlobalDataDef
= """
335 self
._ BuidinOptionTxt
= """
337 Selection 0x1 , "Enabled"
338 Selection 0x0 , "Disabled"
343 self
._ BsfKeyList
= [ 'FIND' , 'NAME' , 'HELP' , 'TYPE' , 'PAGE' , 'OPTION' , 'ORDER' ]
344 self
._ HdrKeyList
= [ 'HEADER' , 'STRUCT' , 'EMBED' ]
345 self
._ BuidinOption
= { '$EN_DIS' : 'EN_DIS' }
348 self
._ CfgBlkDict
= {}
349 self
._ CfgPageDict
= {}
350 self
._ CfgItemList
= []
355 def ParseMacros ( self
, MacroDefStr
):
356 # ['-DABC=1', '-D', 'CFG_DEBUG=1', '-D', 'CFG_OUTDIR=Build']
359 for Macro
in MacroDefStr
:
360 if Macro
. startswith ( '-D' ):
368 Match
= re
. match ( "(\w+)=(.+)" , Macro
)
370 self
._ MacroDict
[ Match
. group ( 1 )] = Match
. group ( 2 )
372 Match
= re
. match ( "(\w+)" , Macro
)
374 self
._ MacroDict
[ Match
. group ( 1 )] = ''
375 if len ( self
._ MacroDict
) == 0 :
380 print "INFO : Macro dictionary:"
381 for Each
in self
._ MacroDict
:
382 print " $( %s ) = [ %s ]" % ( Each
, self
._ MacroDict
[ Each
])
385 def EvaulateIfdef ( self
, Macro
):
386 Result
= Macro
in self
._ MacroDict
388 print "INFO : Eval Ifdef [ %s ] : %s " % ( Macro
, Result
)
391 def ExpandMacros ( self
, Input
):
393 Match
= re
. findall ( "\$\(\w+\)" , Input
)
396 Variable
= Each
[ 2 :- 1 ]
397 if Variable
in self
._ MacroDict
:
398 Line
= Line
. replace ( Each
, self
._ MacroDict
[ Variable
])
401 print "WARN : %s is not defined" % Each
402 Line
= Line
. replace ( Each
, Each
[ 2 :- 1 ])
405 def EvaluateExpress ( self
, Expr
):
406 ExpExpr
= self
. ExpandMacros ( Expr
)
407 LogExpr
= CLogicalExpression ()
408 Result
= LogExpr
. evaluateExpress ( ExpExpr
)
410 print "INFO : Eval Express [ %s ] : %s " % ( Expr
, Result
)
413 def FormatListValue ( self
, ConfigDict
):
414 Struct
= ConfigDict
[ 'struct' ]
415 if Struct
not in [ 'UINT8' , 'UINT16' , 'UINT32' , 'UINT64' ]:
419 binlist
= ConfigDict
[ 'value' ][ 1 :- 1 ]. split ( ',' )
422 if each
. startswith ( '0x' ):
423 value
= int ( each
, 16 )
426 dataarray
. append ( value
)
428 unit
= int ( Struct
[ 4 :]) / 8
429 if int ( ConfigDict
[ 'length' ]) != unit
* len ( dataarray
):
430 raise Exception ( "Array size is not proper for ' %s ' !" % ConfigDict
[ 'cname' ])
433 for each
in dataarray
:
435 for loop
in xrange ( unit
):
436 bytearray
. append ( "0x %0 2X" % ( value
& 0xFF ))
438 newvalue
= '{' + ',' . join ( bytearray
) + '}'
439 ConfigDict
[ 'value' ] = newvalue
442 def ParseDscFile ( self
, DscFile
, FvDir
):
443 self
._ CfgItemList
= []
444 self
._ CfgPageDict
= {}
445 self
._ CfgBlkDict
= {}
446 self
._ DscFile
= DscFile
459 DscFd
= open ( DscFile
, "r" )
460 DscLines
= DscFd
. readlines ()
464 DscLine
= DscLines
. pop ( 0 ). strip ()
466 Match
= re
. match ( "^\[(.+)\]" , DscLine
)
467 if Match
is not None :
468 if Match
. group ( 1 ). lower () == "Defines" . lower ():
472 elif Match
. group ( 1 ). lower () == "PcdsDynamicVpd" . lower ():
474 ConfigDict
[ 'header' ] = 'ON'
475 ConfigDict
[ 'region' ] = 'VPD'
476 ConfigDict
[ 'order' ] = - 1
477 ConfigDict
[ 'page' ] = ''
478 ConfigDict
[ 'name' ] = ''
479 ConfigDict
[ 'find' ] = ''
480 ConfigDict
[ 'struct' ] = ''
481 ConfigDict
[ 'embed' ] = ''
482 ConfigDict
[ 'subreg' ] = []
486 elif Match
. group ( 1 ). lower () == "PcdsDynamicVpd.Upd" . lower ():
488 ConfigDict
[ 'header' ] = 'ON'
489 ConfigDict
[ 'region' ] = 'UPD'
490 ConfigDict
[ 'order' ] = - 1
491 ConfigDict
[ 'page' ] = ''
492 ConfigDict
[ 'name' ] = ''
493 ConfigDict
[ 'find' ] = ''
494 ConfigDict
[ 'struct' ] = ''
495 ConfigDict
[ 'embed' ] = ''
496 ConfigDict
[ 'subreg' ] = []
506 if IsDefSect
or IsUpdSect
or IsVpdSect
:
507 if re
. match ( "^!else($|\s+#.+)" , DscLine
):
509 IfStack
[- 1 ] = not IfStack
[- 1 ]
511 print ( "ERROR: No paired '!if' found for '!else' for line ' %s '" % DscLine
)
513 elif re
. match ( "^!endif($|\s+#.+)" , DscLine
):
516 Level
= ElifStack
. pop ()
520 print ( "ERROR: No paired '!if' found for '!endif' for line ' %s '" % DscLine
)
524 Match
= re
. match ( "!(ifdef|ifndef)\s+(.+)" , DscLine
)
526 Result
= self
. EvaulateIfdef ( Match
. group ( 2 ))
527 if Match
. group ( 1 ) == 'ifndef' :
529 IfStack
. append ( Result
)
532 Match
= re
. match ( "!(if|elseif)\s+(.+)" , DscLine
)
534 Result
= self
. EvaluateExpress ( Match
. group ( 2 ))
535 if Match
. group ( 1 ) == "if" :
537 IfStack
. append ( Result
)
540 IfStack
[- 1 ] = not IfStack
[- 1 ]
541 IfStack
. append ( Result
)
542 ElifStack
[- 1 ] = ElifStack
[- 1 ] + 1
544 print ( "ERROR: No paired '!if' found for '!elif' for line ' %s '" % DscLine
)
548 Handle
= reduce ( lambda x
, y
: x
and y
, IfStack
)
552 Match
= re
. match ( "!include\s+(.+)" , DscLine
)
554 IncludeFilePath
= Match
. group ( 1 )
555 IncludeFilePath
= self
. ExpandMacros ( IncludeFilePath
)
557 IncludeDsc
= open ( IncludeFilePath
, "r" )
559 print ( "ERROR: Cannot open file ' %s '" % IncludeFilePath
)
561 NewDscLines
= IncludeDsc
. readlines ()
563 DscLines
= NewDscLines
+ DscLines
565 if DscLine
. startswith ( '!' ):
566 print ( "ERROR: Unrecoginized directive for line ' %s '" % DscLine
)
572 #DEFINE UPD_TOOL_GUID = 8C3D856A-9BE6-468E-850A-24F7A8D38E09
573 Match
= re
. match ( "^\s*(?:DEFINE\s+)*(\w+)\s*=\s*([-.\w]+)" , DscLine
)
575 self
._ MacroDict
[ Match
. group ( 1 )] = Match
. group ( 2 )
577 print "INFO : DEFINE %s = [ %s ]" % ( Match
. group ( 1 ), Match
. group ( 2 ))
579 Match
= re
. match ( "^\s*#\s+!(BSF|HDR)\s+(.+)" , DscLine
)
581 Remaining
= Match
. group ( 2 )
582 if Match
. group ( 1 ) == 'BSF' :
583 Match
= re
. match ( "(?:^|.+\s+)PAGES:{(.+?)}" , Remaining
)
585 # !BSF PAGES:{HSW:"Haswell System Agent", LPT:"Lynx Point PCH"}
586 PageList
= Match
. group ( 1 ). split ( ',' )
587 for Page
in PageList
:
589 Match
= re
. match ( "(\w+): \" (.+) \" " , Page
)
590 self
._ CfgPageDict
[ Match
. group ( 1 )] = Match
. group ( 2 )
592 Match
= re
. match ( "(?:^|.+\s+)BLOCK:{NAME: \" (.+) \" \s*,\s*VER: \" (.+) \" \s*}" , Remaining
)
594 self
._ CfgBlkDict
[ 'name' ] = Match
. group ( 1 )
595 self
._ CfgBlkDict
[ 'ver' ] = Match
. group ( 2 )
597 for Key
in self
._ BsfKeyList
:
598 Match
= re
. match ( "(?:^|.+\s+) %s :{(.+?)}" % Key
, Remaining
)
600 if Key
in [ 'NAME' , 'HELP' , 'OPTION' ] and Match
. group ( 1 ). startswith ( '+' ):
601 ConfigDict
[ Key
. lower ()] += Match
. group ( 1 )[ 1 :]
603 ConfigDict
[ Key
. lower ()] = Match
. group ( 1 )
605 for Key
in self
._ HdrKeyList
:
606 Match
= re
. match ( "(?:^|.+\s+) %s :{(.+?)}" % Key
, Remaining
)
608 ConfigDict
[ Key
. lower ()] = Match
. group ( 1 )
612 Match
= re
. match ( "^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)" , DscLine
)
614 Match
= re
. match ( "^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)(?:\s*\|\s*(.+))?" , DscLine
)
616 ConfigDict
[ 'space' ] = Match
. group ( 1 )
617 ConfigDict
[ 'cname' ] = Match
. group ( 2 )
618 ConfigDict
[ 'offset' ] = int ( Match
. group ( 3 ), 16 )
619 if ConfigDict
[ 'order' ] == - 1 :
620 ConfigDict
[ 'order' ] = ConfigDict
[ 'offset' ] << 8
622 ( Major
, Minor
) = ConfigDict
[ 'order' ]. split ( '.' )
623 ConfigDict
[ 'order' ] = ( int ( Major
, 16 ) << 8 ) + int ( Minor
, 16 )
625 Value
= Match
. group ( 5 ). strip ()
626 if Match
. group ( 4 ). startswith ( "0x" ):
627 Length
= int ( Match
. group ( 4 ), 16 )
629 Length
= int ( Match
. group ( 4 ))
631 Value
= Match
. group ( 4 )
634 Value
= Value
. strip ()
636 Match
= re
. match ( "^.+\s*\|\s*(.+)" , Value
)
638 Value
= Match
. group ( 1 )
641 ConfigDict
[ 'length' ] = Length
642 Match
= re
. match ( "\$\((\w+)\)" , Value
)
644 if Match
. group ( 1 ) in self
._ MacroDict
:
645 Value
= self
._ MacroDict
[ Match
. group ( 1 )]
647 ConfigDict
[ 'value' ] = Value
648 if ( len ( Value
) > 0 ) and ( Value
[ 0 ] == '{' ):
649 Value
= self
. FormatListValue ( ConfigDict
)
651 if ConfigDict
[ 'name' ] == '' :
652 # Clear BSF specific items
653 ConfigDict
[ 'bsfname' ] = ''
654 ConfigDict
[ 'help' ] = ''
655 ConfigDict
[ 'type' ] = ''
656 ConfigDict
[ 'option' ] = ''
658 self
._ CfgItemList
. append ( ConfigDict
. copy ())
659 ConfigDict
[ 'name' ] = ''
660 ConfigDict
[ 'find' ] = ''
661 ConfigDict
[ 'struct' ] = ''
662 ConfigDict
[ 'embed' ] = ''
663 ConfigDict
[ 'order' ] = - 1
664 ConfigDict
[ 'subreg' ] = []
666 # It could be a virtual item as below
667 # !BSF FIELD:{1:SerialDebugPortAddress0}
668 Match
= re
. match ( "^\s*#\s+!BSF\s+FIELD:{(.+):(\d+)}" , DscLine
)
670 SubCfgDict
= ConfigDict
671 SubCfgDict
[ 'cname' ] = Match
. group ( 1 )
672 SubCfgDict
[ 'length' ] = int ( Match
. group ( 2 ))
673 if SubCfgDict
[ 'length' ] > 0 :
674 LastItem
= self
._ CfgItemList
[- 1 ]
675 if len ( LastItem
[ 'subreg' ]) == 0 :
678 SubOffset
+= LastItem
[ 'subreg' ][- 1 ][ 'length' ]
679 SubCfgDict
[ 'offset' ] = SubOffset
680 LastItem
[ 'subreg' ]. append ( SubCfgDict
. copy ())
681 ConfigDict
[ 'name' ] = ''
684 def UpdateSubRegionDefaultValue ( self
):
686 for Item
in self
._ CfgItemList
:
687 if len ( Item
[ 'subreg' ]) == 0 :
690 if Item
[ 'value' ][ 0 ] == '{' :
691 binlist
= Item
[ 'value' ][ 1 :- 1 ]. split ( ',' )
694 if each
. startswith ( '0x' ):
695 value
= int ( each
, 16 )
698 bytearray
. append ( value
)
700 if Item
[ 'value' ]. startswith ( '0x' ):
701 value
= int ( Item
[ 'value' ], 16 )
703 value
= int ( Item
[ 'value' ])
705 while idx
< Item
[ 'length' ]:
706 bytearray
. append ( value
& 0xFF )
709 for SubItem
in Item
[ 'subreg' ]:
710 if SubItem
[ 'length' ] in ( 1 , 2 , 4 , 8 ):
711 valuelist
= [ b
for b
in bytearray
[ SubItem
[ 'offset' ]: SubItem
[ 'offset' ]+ SubItem
[ 'length' ]]]
713 valuestr
= "" . join ( ' %0 2X' % b
for b
in valuelist
)
714 SubItem
[ 'value' ] = '0x %s ' % valuestr
716 valuestr
= "," . join ( '0x %0 2X' % b
for b
in bytearray
[ SubItem
[ 'offset' ]: SubItem
[ 'offset' ]+ SubItem
[ 'length' ]])
717 SubItem
[ 'value' ] = '{ %s }' % valuestr
720 def UpdateVpdSizeField ( self
):
723 if 'VPD_TOOL_GUID' not in self
._ MacroDict
:
724 self
. Error
= "VPD_TOOL_GUID definition is missing in DSC file"
727 VpdMapFile
= os
. path
. join ( FvDir
, self
._ MacroDict
[ 'VPD_TOOL_GUID' ] + '.map' )
728 if not os
. path
. exists ( VpdMapFile
):
729 self
. Error
= "VPD MAP file ' %s ' does not exist" % VpdMapFile
732 MapFd
= open ( VpdMapFile
, "r" )
733 MapLines
= MapFd
. readlines ()
738 for MapLine
in MapLines
:
739 #gPlatformFspPkgTokenSpaceGuid.PcdVpdRegionSign | DEFAULT | 0x0000 | 8 | 0x534450565F425346
740 #gPlatformFspPkgTokenSpaceGuid.PcdVpdRegionSign | 0x0000 | 8 | 0x534450565F425346
741 #gPlatformFspPkgTokenSpaceGuid.PcdTest | 0x0008 | 5 | {0x01,0x02,0x03,0x04,0x05}
742 Match
= re
. match ( "([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)(\s\|\sDEFAULT)?\s\|\s(0x[0-9A-F] {4} )\s\|\s(\d+|0x[0-9a-fA-F]+)\s\|\s(\{?[x0-9a-fA-F,\s]+\}?)" , MapLine
)
744 Space
= Match
. group ( 1 )
745 Name
= Match
. group ( 2 )
746 if ( self
._ MapVer
== 0 ) and ( Match
. group ( 3 ) != None ):
748 Offset
= int ( Match
. group ( 4 ), 16 )
749 if Match
. group ( 5 ). startswith ( "0x" ):
750 Length
= int ( Match
. group ( 5 ), 16 )
752 Length
= int ( Match
. group ( 5 ))
753 PcdDict
[ "len" ] = Length
754 PcdDict
[ "value" ] = Match
. group ( 6 )
755 VpdDict
[ Space
+ '.' + Name
] = dict ( PcdDict
)
757 for Item
in self
._ CfgItemList
:
758 if Item
[ 'value' ] == '' :
759 Item
[ 'value' ] = VpdDict
[ Item
[ 'space' ]+ '.' + Item
[ 'cname' ]][ 'value' ]
760 if Item
[ 'length' ] == - 1 :
761 Item
[ 'length' ] = VpdDict
[ Item
[ 'space' ]+ '.' + Item
[ 'cname' ]][ 'len' ]
762 if Item
[ 'struct' ] != '' :
763 Type
= Item
[ 'struct' ]. strip ()
764 if Type
. endswith ( '*' ) and ( Item
[ 'length' ] != 4 ):
765 self
. Error
= "Struct pointer ' %s ' has invalid size" % Type
770 def CreateUpdTxtFile ( self
, UpdTxtFile
):
772 if 'UPD_TOOL_GUID' not in self
._ MacroDict
:
773 self
. Error
= "UPD_TOOL_GUID definition is missing in DSC file"
777 UpdTxtFile
= os
. path
. join ( FvDir
, self
._ MacroDict
[ 'UPD_TOOL_GUID' ] + '.txt' )
780 if not os
. path
. exists ( UpdTxtFile
):
783 DscTime
= os
. path
. getmtime ( self
._ DscFile
)
784 TxtTime
= os
. path
. getmtime ( UpdTxtFile
)
785 if DscTime
> TxtTime
:
789 # DSC has not been modified yet
790 # So don't have to re-generate other files
791 self
. Error
= 'No DSC file change, skip to create UPD TXT file'
794 TxtFd
= open ( UpdTxtFile
, "w" )
795 TxtFd
. write ( " %s \n " % ( __copyright_txt__
% date
. today (). year
))
799 if self
._ MapVer
== 1 :
803 for Item
in self
._ CfgItemList
:
804 if Item
[ 'region' ] != 'UPD' :
806 Offset
= Item
[ 'offset' ]
807 if NextOffset
< Offset
:
809 TxtFd
. write ( " %s .UnusedUpdSpace %d | %s0x%0 4X|0x %0 4X| {0} \n " % ( Item
[ 'space' ], SpaceIdx
, Default
, NextOffset
, Offset
- NextOffset
))
810 SpaceIdx
= SpaceIdx
+ 1
811 NextOffset
= Offset
+ Item
[ 'length' ]
812 TxtFd
. write ( " %s . %s | %s0x%0 4X| %s | %s \n " % ( Item
[ 'space' ], Item
[ 'cname' ], Default
, Item
[ 'offset' ], Item
[ 'length' ], Item
[ 'value' ]))
816 def CreateField ( self
, Item
, Name
, Length
, Offset
, Struct
, BsfName
, Help
):
823 if Length
in [ 1 , 2 , 4 , 8 ]:
824 Type
= "UINT %d " % ( Length
* 8 )
829 if Item
and Item
[ 'value' ]. startswith ( '{' ):
835 if Struct
in [ 'UINT8' , 'UINT16' , 'UINT32' , 'UINT64' ]:
837 Unit
= int ( Type
[ 4 :]) / 8
838 Length
= Length
/ Unit
843 Name
= Name
+ '[ %d ]' % Length
845 if len ( Type
) < PosName
:
846 Space1
= PosName
- len ( Type
)
851 NameLine
= " %s \n " % BsfName
854 HelpLine
= " %s \n " % Help
859 OffsetStr
= '0x %0 4X' % Offset
861 return "/** Offset %s \n %s%s **/ \n %s%s%s ; \n " % ( OffsetStr
, NameLine
, HelpLine
, Type
, ' ' * Space1
, Name
,)
863 def PostProcessBody ( self
, TextBody
):
869 for Line
in TextBody
:
870 Match
= re
. match ( "^/\*\sEMBED_STRUCT:(\w+):(\w+):(START|END)\s\*/\s([\s\S]*)" , Line
)
872 Line
= Match
. group ( 4 )
874 if Match
and Match
. group ( 3 ) == 'START' :
875 NewTextBody
. append ( 'typedef struct { \n ' )
876 StructName
= Match
. group ( 1 )
877 VariableName
= Match
. group ( 2 )
878 MatchOffset
= re
. search ( '/\*\*\sOffset\s0x([a-fA-F0-9]+)' , Line
)
880 Offset
= int ( MatchOffset
. group ( 1 ), 16 )
885 OldTextBody
. append ( self
. CreateField ( None , VariableName
, 0 , Offset
, StructName
, '' , '' ))
887 NewTextBody
. append ( Line
)
889 OldTextBody
. append ( Line
)
891 if Match
and Match
. group ( 3 ) == 'END' :
892 if ( StructName
!= Match
. group ( 1 )) or ( VariableName
!= Match
. group ( 2 )):
893 print "Unmatched struct name ' %s ' and ' %s ' !" % ( StructName
, Match
. group ( 1 ))
895 NewTextBody
. append ( '} %s ; \n\n ' % StructName
)
897 NewTextBody
. extend ( OldTextBody
)
900 def CreateHeaderFile ( self
, InputHeaderFile
, IsInternal
):
904 HeaderFile
= os
. path
. join ( FvDir
, 'FspUpdVpdInternal.h' )
906 HeaderFile
= os
. path
. join ( FvDir
, 'FspUpdVpd.h' )
908 # Check if header needs to be recreated
911 if not os
. path
. exists ( HeaderFile
):
914 DscTime
= os
. path
. getmtime ( self
._ DscFile
)
915 HeadTime
= os
. path
. getmtime ( HeaderFile
)
916 if not os
. path
. exists ( InputHeaderFile
):
919 InpTime
= os
. path
. getmtime ( InputHeaderFile
)
920 if DscTime
> HeadTime
or InpTime
> HeadTime
:
924 self
. Error
= "No DSC or input header file is changed, skip the header file generating"
928 for Item
in self
._ CfgItemList
:
929 if str ( Item
[ 'cname' ]) == 'Signature' and Item
[ 'length' ] == 8 :
930 Value
= int ( Item
[ 'value' ], 16 )
933 Chars
. append ( chr ( Value
& 0xFF ))
935 SignatureStr
= '' . join ( Chars
)
936 if int ( Item
[ 'offset' ]) == 0 :
937 TxtBody
. append ( "#define FSP_UPD_SIGNATURE %s /* ' %s ' */ \n " % ( Item
[ 'value' ], SignatureStr
))
938 elif 'MEM' in SignatureStr
:
939 TxtBody
. append ( "#define FSP_MEMORY_INIT_UPD_SIGNATURE %s /* ' %s ' */ \n " % ( Item
[ 'value' ], SignatureStr
))
941 TxtBody
. append ( "#define FSP_SILICON_INIT_UPD_SIGNATURE %s /* ' %s ' */ \n " % ( Item
[ 'value' ], SignatureStr
))
944 for Region
in [ 'UPD' , 'VPD' ]:
946 # Write PcdVpdRegionSign and PcdImageRevision
948 if 'VPD_TOOL_GUID' not in self
._ MacroDict
:
949 self
. Error
= "VPD_TOOL_GUID definition is missing in DSC file"
952 BinFile
= os
. path
. join ( FvDir
, self
._ MacroDict
[ 'VPD_TOOL_GUID' ] + ".bin" )
953 if not os
. path
. exists ( BinFile
):
954 self
. Error
= "VPD binary file ' %s ' does not exist" % BinFile
957 BinFd
= open ( BinFile
, "rb" )
958 IdStr
= BinFd
. read ( 0x08 )
959 ImageId
= struct
. unpack ( '<Q' , IdStr
)
960 ImageRev
= struct
. unpack ( '<I' , BinFd
. read ( 0x04 ))
963 TxtBody
. append ( "#define FSP_IMAGE_ID 0x %0 16X /* ' %s ' */ \n " % ( ImageId
[ 0 ], IdStr
))
964 TxtBody
. append ( "#define FSP_IMAGE_REV 0x %0 8X \n\n " % ImageRev
[ 0 ])
966 TxtBody
. append ( "typedef struct _" + Region
[ 0 ] + "PD_DATA_REGION { \n " )
975 for Item
in self
._ CfgItemList
:
976 if Item
[ 'region' ] != Region
:
979 NextVisible
= LastVisible
981 if LastVisible
and ( Item
[ 'header' ] == 'OFF' ):
983 ResvOffset
= Item
[ 'offset' ]
984 elif ( not LastVisible
) and Item
[ 'header' ] == 'ON' :
986 Name
= "Reserved" + Region
[ 0 ] + "pdSpace %d " % ResvIdx
987 ResvIdx
= ResvIdx
+ 1
988 TxtBody
. append ( self
. CreateField ( Item
, Name
, Item
[ "offset" ] - ResvOffset
, ResvOffset
, '' , '' , '' ))
990 if Offset
< Item
[ "offset" ]:
991 if IsInternal
or LastVisible
:
992 Name
= "Unused" + Region
[ 0 ] + "pdSpace %d " % SpaceIdx
993 LineBuffer
. append ( self
. CreateField ( Item
, Name
, Item
[ "offset" ] - Offset
, Offset
, '' , '' , '' ))
994 SpaceIdx
= SpaceIdx
+ 1
995 Offset
= Item
[ "offset" ]
997 if Offset
!= Item
[ "offset" ]:
998 self
. Error
= "Unsorted offset 0x %0 4X \n " % Item
[ "offset" ]
1001 LastVisible
= NextVisible
1003 Offset
= Offset
+ Item
[ "length" ]
1004 if IsInternal
or LastVisible
:
1005 for Each
in LineBuffer
:
1006 TxtBody
. append ( Each
)
1008 Embed
= Item
[ "embed" ]. upper ()
1009 if Embed
. endswith ( ':START' ) or Embed
. endswith ( ':END' ):
1010 Marker
= '/* EMBED_STRUCT: %s */ ' % Item
[ "embed" ]
1015 self
. Error
= "Invalid embedded structure format ' %s '! \n " % Item
[ "embed" ]
1017 Line
= Marker
+ self
. CreateField ( Item
, Item
[ "cname" ], Item
[ "length" ], Item
[ "offset" ], Item
[ 'struct' ], Item
[ 'name' ], Item
[ 'help' ])
1018 TxtBody
. append ( Line
)
1020 TxtBody
. append ( "} " + Region
[ 0 ] + "PD_DATA_REGION; \n\n " )
1022 # Handle the embedded data structure
1023 TxtBody
= self
. PostProcessBody ( TxtBody
)
1025 HeaderFd
= open ( HeaderFile
, "w" )
1026 FileBase
= os
. path
. basename ( HeaderFile
)
1027 FileName
= FileBase
. replace ( "." , "_" ). upper ()
1028 HeaderFd
. write ( " %s \n " % ( __copyright_h__
% date
. today (). year
))
1029 HeaderFd
. write ( "#ifndef __ %s __ \n " % FileName
)
1030 HeaderFd
. write ( "#define __ %s __ \n\n " % FileName
)
1031 HeaderFd
. write ( "#pragma pack(1) \n\n " )
1033 if InputHeaderFile
!= '' :
1034 if not os
. path
. exists ( InputHeaderFile
):
1035 self
. Error
= "Input header file ' %s ' does not exist" % InputHeaderFile
1038 InFd
= open ( InputHeaderFile
, "r" )
1039 IncLines
= InFd
. readlines ()
1043 for Line
in IncLines
:
1044 Match
= re
. search ( "!EXPORT\s+EXTERNAL_BOOTLOADER_STRUCT_(BEGIN|END)\s+" , Line
)
1046 if Match
. group ( 1 ) == "BEGIN" :
1053 HeaderFd
. write ( Line
)
1054 HeaderFd
. write ( " \n\n " )
1056 for Line
in TxtBody
:
1057 HeaderFd
. write ( Line
)
1058 HeaderFd
. write ( "#pragma pack() \n\n " )
1059 HeaderFd
. write ( "#endif \n " )
1064 def WriteBsfStruct ( self
, BsfFd
, Item
):
1065 if Item
[ 'type' ] == "None" :
1066 Space
= "gPlatformFspPkgTokenSpaceGuid"
1068 Space
= Item
[ 'space' ]
1069 Line
= " $ %s _ %s " % ( Space
, Item
[ 'cname' ])
1070 Match
= re
. match ( "\s*\{([x0-9a-fA-F,\s]+)\}\s*" , Item
[ 'value' ])
1072 DefaultValue
= Match
. group ( 1 ). strip ()
1074 DefaultValue
= Item
[ 'value' ]. strip ()
1075 BsfFd
. write ( " %s%s% 4d bytes $_DEFAULT_ = %s \n " % ( Line
, ' ' * ( 64 - len ( Line
)), Item
[ 'length' ], DefaultValue
))
1077 if Item
[ 'type' ] == "Combo" :
1078 if not Item
[ 'option' ] in self
._ BuidinOption
:
1079 OptList
= Item
[ 'option' ]. split ( ',' )
1080 for Option
in OptList
:
1081 Option
= Option
. strip ()
1082 ( OpVal
, OpStr
) = Option
. split ( ':' )
1083 TmpList
. append (( OpVal
, OpStr
))
1086 def WriteBsfOption ( self
, BsfFd
, Item
):
1087 PcdName
= Item
[ 'space' ] + '_' + Item
[ 'cname' ]
1089 if Item
[ 'type' ] == "Combo" :
1090 if Item
[ 'option' ] in self
._ BuidinOption
:
1091 Options
= self
._ BuidinOption
[ Item
[ 'option' ]]
1094 BsfFd
. write ( ' %s $ %s , " %s ", & %s , \n ' % ( Item
[ 'type' ], PcdName
, Item
[ 'name' ], Options
));
1096 elif Item
[ 'type' ]. startswith ( "EditNum" ):
1097 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' ])
1099 BsfFd
. write ( ' EditNum $ %s , " %s ", %s , \n ' % ( PcdName
, Item
[ 'name' ], Match
. group ( 1 )));
1101 elif Item
[ 'type' ]. startswith ( "EditText" ):
1102 BsfFd
. write ( ' %s $ %s , " %s ", \n ' % ( Item
[ 'type' ], PcdName
, Item
[ 'name' ]));
1104 elif Item
[ 'type' ] == "Table" :
1105 Columns
= Item
[ 'option' ]. split ( ',' )
1106 if len ( Columns
) != 0 :
1107 BsfFd
. write ( ' %s $ %s " %s ",' % ( Item
[ 'type' ], PcdName
, Item
[ 'name' ]));
1109 Fmt
= Col
. split ( ':' )
1111 raise Exception ( "Column format ' %s ' is invalid !" % Fmt
)
1113 Dtype
= int ( Fmt
[ 1 ]. strip ())
1115 raise Exception ( "Column size ' %s ' is invalid !" % Fmt
[ 1 ])
1116 BsfFd
. write ( ' \n Column " %s ", %d bytes, %s ' % ( Fmt
[ 0 ]. strip (), Dtype
, Fmt
[ 2 ]. strip ()))
1121 HelpLines
= Item
[ 'help' ]. split ( ' \\ n \\ r' )
1123 for HelpLine
in HelpLines
:
1126 BsfFd
. write ( ' Help " %s " \n ' % ( HelpLine
));
1128 BsfFd
. write ( ' " %s " \n ' % ( HelpLine
));
1130 BsfFd
. write ( ' "Valid range: %s ~ %s " \n ' % ( Match
. group ( 2 ), Match
. group ( 3 )));
1132 def GenerateBsfFile ( self
, BsfFile
):
1135 self
. Error
= "BSF output file ' %s ' is invalid" % BsfFile
1140 BsfFd
= open ( BsfFile
, "w" )
1141 BsfFd
. write ( " %s \n " % ( __copyright_bsf__
% date
. today (). year
))
1142 BsfFd
. write ( " %s \n " % self
._ GlobalDataDef
);
1143 BsfFd
. write ( "StructDef \n " )
1145 for Item
in self
._ CfgItemList
:
1146 if Item
[ 'find' ] != '' :
1147 BsfFd
. write ( ' \n Find " %s " \n ' % Item
[ 'find' ])
1148 NextOffset
= Item
[ 'offset' ] + Item
[ 'length' ]
1149 if Item
[ 'name' ] != '' :
1150 if NextOffset
!= Item
[ 'offset' ]:
1151 BsfFd
. write ( " Skip %d bytes \n " % ( Item
[ 'offset' ] - NextOffset
))
1152 if len ( Item
[ 'subreg' ]) > 0 :
1153 NextOffset
= Item
[ 'offset' ]
1154 for SubItem
in Item
[ 'subreg' ]:
1155 NextOffset
+= SubItem
[ 'length' ]
1156 if SubItem
[ 'name' ] == '' :
1157 BsfFd
. write ( " Skip %d bytes \n " % ( SubItem
[ 'length' ]))
1159 Options
= self
. WriteBsfStruct ( BsfFd
, SubItem
)
1160 if len ( Options
) > 0 :
1161 OptionDict
[ SubItem
[ 'space' ]+ '_' + SubItem
[ 'cname' ]] = Options
1162 if ( Item
[ 'offset' ] + Item
[ 'length' ]) < NextOffset
:
1163 self
. Error
= "BSF sub region ' %s ' length does not match" % ( Item
[ 'space' ]+ '.' + Item
[ 'cname' ])
1166 NextOffset
= Item
[ 'offset' ] + Item
[ 'length' ]
1167 Options
= self
. WriteBsfStruct ( BsfFd
, Item
)
1168 if len ( Options
) > 0 :
1169 OptionDict
[ Item
[ 'space' ]+ '_' + Item
[ 'cname' ]] = Options
1170 BsfFd
. write ( " \n EndStruct \n\n " )
1172 BsfFd
. write ( " %s " % self
._ BuidinOptionTxt
);
1174 for Each
in OptionDict
:
1175 BsfFd
. write ( "List & %s \n " % Each
);
1176 for Item
in OptionDict
[ Each
]:
1177 BsfFd
. write ( ' Selection %s , " %s " \n ' % ( Item
[ 0 ], Item
[ 1 ]));
1178 BsfFd
. write ( "EndList \n\n " );
1180 BsfFd
. write ( "BeginInfoBlock \n " );
1181 BsfFd
. write ( ' PPVer " %s " \n ' % ( self
._ CfgBlkDict
[ 'ver' ]));
1182 BsfFd
. write ( ' Description " %s " \n ' % ( self
._ CfgBlkDict
[ 'name' ]));
1183 BsfFd
. write ( "EndInfoBlock \n\n " );
1185 for Each
in self
._ CfgPageDict
:
1186 BsfFd
. write ( 'Page " %s " \n ' % self
._ CfgPageDict
[ Each
]);
1188 for Item
in self
._ CfgItemList
:
1189 if Item
[ 'name' ] != '' :
1190 if Item
[ 'page' ] != Each
:
1192 if len ( Item
[ 'subreg' ]) > 0 :
1193 for SubItem
in Item
[ 'subreg' ]:
1194 if SubItem
[ 'name' ] != '' :
1195 BsfItems
. append ( SubItem
)
1197 BsfItems
. append ( Item
)
1199 BsfItems
. sort ( key
= lambda x
: x
[ 'order' ])
1201 for Item
in BsfItems
:
1202 self
. WriteBsfOption ( BsfFd
, Item
)
1203 BsfFd
. write ( "EndPage \n\n " );
1210 print "GenCfgOpt Version 0.50"
1212 print " GenCfgOpt UPDTXT PlatformDscFile BuildFvDir [TxtOutFile] [-D Macros]"
1213 print " GenCfgOpt HEADER PlatformDscFile BuildFvDir [InputHFile] [-D Macros]"
1214 print " GenCfgOpt GENBSF PlatformDscFile BuildFvDir BsfOutFile [-D Macros]"
1218 # Parse the options and args
1220 GenCfgOpt
= CGenCfgOpt ()
1221 argc
= len ( sys
. argv
)
1226 DscFile
= sys
. argv
[ 2 ]
1227 if not os
. path
. exists ( DscFile
):
1228 print "ERROR: Cannot open DSC file ' %s ' !" % DscFile
1231 UpdateMemSiUpdInitOffsetValue ( DscFile
)
1235 if sys
. argv
[ 4 ][ 0 ] == '-' :
1238 OutFile
= sys
. argv
[ 4 ]
1240 if GenCfgOpt
. ParseMacros ( sys
. argv
[ Start
:]) != 0 :
1241 print "ERROR: Macro parsing failed !"
1245 if not os
. path
. isdir ( FvDir
):
1246 print "ERROR: FV folder ' %s ' is invalid !" % FvDir
1249 if GenCfgOpt
. ParseDscFile ( DscFile
, FvDir
) != 0 :
1250 print "ERROR: %s !" % GenCfgOpt
. Error
1253 if GenCfgOpt
. UpdateVpdSizeField () != 0 :
1254 print "ERROR: %s !" % GenCfgOpt
. Error
1257 if GenCfgOpt
. UpdateSubRegionDefaultValue () != 0 :
1258 print "ERROR: %s !" % GenCfgOpt
. Error
1261 if sys
. argv
[ 1 ] == "UPDTXT" :
1262 Ret
= GenCfgOpt
. CreateUpdTxtFile ( OutFile
)
1264 # No change is detected
1266 print "INFO: %s !" % ( GenCfgOpt
. Error
)
1268 print "ERROR: %s !" % ( GenCfgOpt
. Error
)
1270 elif sys
. argv
[ 1 ] == "HEADER" :
1271 Ret
= GenCfgOpt
. CreateHeaderFile ( OutFile
, True )
1273 # No change is detected
1275 print "INFO: %s !" % ( GenCfgOpt
. Error
)
1277 print "ERROR: %s !" % ( GenCfgOpt
. Error
)
1279 if GenCfgOpt
. CreateHeaderFile ( OutFile
, False ) != 0 :
1280 print "ERROR: %s !" % GenCfgOpt
. Error
1282 elif sys
. argv
[ 1 ] == "GENBSF" :
1283 if GenCfgOpt
. GenerateBsfFile ( OutFile
) != 0 :
1284 print "ERROR: %s !" % GenCfgOpt
. Error
1290 print "ERROR: Unknown command ' %s ' !" % sys
. argv
[ 1 ]
1297 if __name__
== '__main__' :