X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FGenDepex.py;h=9acea8f6bfed17d02246f5179f07c1419acd52c1;hp=f80824b744fbdd8a70dad48c0b03fd3ad3c0c3d1;hb=4231a8193ec0d52df7e0a101d96c51b1a2b7a996;hpb=14c48571ae607277d11132c5e085d3ec1f12d236 diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source/Python/AutoGen/GenDepex.py index f80824b744..9acea8f6bf 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -1,7 +1,7 @@ ## @file # This file is used to generate DEPEX file for module's dependency expression # -# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -13,17 +13,17 @@ ## Import Modules # import sys -import os +import Common.LongFilePathOs as os import re import traceback - +from Common.LongFilePathSupport import OpenLongFilePath as open from StringIO import StringIO from struct import pack from Common.BuildToolError import * from Common.Misc import SaveFileOnChange from Common.Misc import GuidStructureStringToGuidString from Common import EdkLogger as EdkLogger - +from Common.BuildVersion import gBUILD_VERSION ## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END" gStartClosePattern = re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*", re.S) @@ -42,6 +42,8 @@ gType2Phase = { "UEFI_DRIVER" : "DXE", "UEFI_APPLICATION" : "DXE", "SMM_CORE" : "DXE", + "MM_STANDALONE" : "MM", + "MM_CORE_STANDALONE" : "MM", } ## Convert dependency expression string into EFI internal representation @@ -98,6 +100,19 @@ class DependencyExpression: "FALSE" : 0x07, "END" : 0x08, "SOR" : 0x09 + }, + + "MM" : { + "BEFORE": 0x00, + "AFTER" : 0x01, + "PUSH" : 0x02, + "AND" : 0x03, + "OR" : 0x04, + "NOT" : 0x05, + "TRUE" : 0x06, + "FALSE" : 0x07, + "END" : 0x08, + "SOR" : 0x09 } } @@ -286,10 +301,10 @@ class DependencyExpression: # don't generate depex if only TRUE operand left if self.ModuleType == 'PEIM' and len(NewOperand) == 1 and NewOperand[0] == 'TRUE': self.PostfixNotation = [] - return + return # don't generate depex if all operands are architecture protocols - if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER'] and \ + if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'MM_STANDALONE'] and \ Op == 'AND' and \ self.ArchProtocols == set([GuidStructureStringToGuidString(Guid) for Guid in AllOperand]): self.PostfixNotation = [] @@ -345,7 +360,7 @@ class DependencyExpression: FilePath = "" FileChangeFlag = True - if File == None: + if File is None: sys.stdout.write(Buffer.getvalue()) FilePath = "STDOUT" else: @@ -354,7 +369,7 @@ class DependencyExpression: Buffer.close() return FileChangeFlag -versionNumber = "0.04" +versionNumber = ("0.04" + " " + gBUILD_VERSION) __version__ = "%prog Version " + versionNumber __copyright__ = "Copyright (c) 2007-2010, Intel Corporation All rights reserved." __usage__ = "%prog [options] [dependency_expression_file]" @@ -399,13 +414,13 @@ def Main(): EdkLogger.SetLevel(EdkLogger.QUIET) elif Option.verbose: EdkLogger.SetLevel(EdkLogger.VERBOSE) - elif Option.debug != None: + elif Option.debug is not None: EdkLogger.SetLevel(Option.debug + 1) else: EdkLogger.SetLevel(EdkLogger.INFO) try: - if Option.ModuleType == None or Option.ModuleType not in gType2Phase: + if Option.ModuleType is None or Option.ModuleType not in gType2Phase: EdkLogger.error("GenDepex", OPTION_MISSING, "Module type is not specified or supported") DxsFile = '' @@ -422,9 +437,9 @@ def Main(): EdkLogger.error("GenDepex", OPTION_MISSING, "No expression string or file given") Dpx = DependencyExpression(DxsString, Option.ModuleType, Option.Optimize) - if Option.OutputFile != None: + if Option.OutputFile is not None: FileChangeFlag = Dpx.Generate(Option.OutputFile) - if not FileChangeFlag and DxsFile: + if not FileChangeFlag and DxsFile: # # Touch the output file if its time stamp is older than the original # DXS file to avoid re-invoke this tool for the dependency check in build rule. @@ -435,7 +450,7 @@ def Main(): Dpx.Generate() except BaseException, X: EdkLogger.quiet("") - if Option != None and Option.debug != None: + if Option is not None and Option.debug is not None: EdkLogger.quiet(traceback.format_exc()) else: EdkLogger.quiet(str(X))