X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=BaseTools%2FSource%2FPython%2FEot%2FFvImage.py;h=472ae400506d510a19cc42fa48896fda7aa503ec;hb=1563349a967d7e02c43492ba853babb9c660a083;hp=f668a17c09c819ed96730d2625765b10e794643f;hpb=f51461c829c124288a930829a78e2a5a799f4039;p=mirror_edk2.git
diff --git a/BaseTools/Source/Python/Eot/FvImage.py b/BaseTools/Source/Python/Eot/FvImage.py
index f668a17c09..472ae40050 100644
--- a/BaseTools/Source/Python/Eot/FvImage.py
+++ b/BaseTools/Source/Python/Eot/FvImage.py
@@ -1,7 +1,7 @@
## @file
# Parse FV image
#
-# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2008 - 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,7 +13,7 @@
## Import Modules
#
-import os
+import Common.LongFilePathOs as os
import re
import sys
import uuid
@@ -24,7 +24,7 @@ import copy
from UserDict import IterableUserDict
from cStringIO import StringIO
from array import array
-
+from Common.LongFilePathSupport import OpenLongFilePath as open
from CommonDataClass import *
from Common.Misc import sdict, GuidStructureStringToGuidString
@@ -52,7 +52,7 @@ class Image(array):
return array.__new__(cls, 'B')
def __init__(m, ID=None):
- if ID == None:
+ if ID is None:
m._ID_ = str(uuid.uuid1()).upper()
else:
m._ID_ = ID
@@ -138,7 +138,6 @@ class FirmwareVolume(Image):
self.FfsDict = sdict()
self.OrderedFfsDict = sdict()
self.UnDispatchedFfsDict = sdict()
- self.NoDepexFfsDict = sdict()
self.ProtocolList = sdict()
def CheckArchProtocol(self):
@@ -208,7 +207,7 @@ class FirmwareVolume(Image):
return (CouldBeLoaded, DepexString, FileDepex)
def Dispatch(self, Db = None):
- if Db == None:
+ if Db is None:
return False
self.UnDispatchedFfsDict = copy.copy(self.FfsDict)
# Find PeiCore, DexCore, PeiPriori, DxePriori first
@@ -236,15 +235,15 @@ class FirmwareVolume(Image):
continue
# Parse SEC_CORE first
- if FfsSecCoreGuid != None:
+ if FfsSecCoreGuid is not None:
self.OrderedFfsDict[FfsSecCoreGuid] = self.UnDispatchedFfsDict.pop(FfsSecCoreGuid)
self.LoadPpi(Db, FfsSecCoreGuid)
# Parse PEI first
- if FfsPeiCoreGuid != None:
+ if FfsPeiCoreGuid is not None:
self.OrderedFfsDict[FfsPeiCoreGuid] = self.UnDispatchedFfsDict.pop(FfsPeiCoreGuid)
self.LoadPpi(Db, FfsPeiCoreGuid)
- if FfsPeiPrioriGuid != None:
+ if FfsPeiPrioriGuid is not None:
# Load PEIM described in priori file
FfsPeiPriori = self.UnDispatchedFfsDict.pop(FfsPeiPrioriGuid)
if len(FfsPeiPriori.Sections) == 1:
@@ -263,10 +262,10 @@ class FirmwareVolume(Image):
self.DisPatchPei(Db)
# Parse DXE then
- if FfsDxeCoreGuid != None:
+ if FfsDxeCoreGuid is not None:
self.OrderedFfsDict[FfsDxeCoreGuid] = self.UnDispatchedFfsDict.pop(FfsDxeCoreGuid)
self.LoadProtocol(Db, FfsDxeCoreGuid)
- if FfsDxePrioriGuid != None:
+ if FfsDxePrioriGuid is not None:
# Load PEIM described in priori file
FfsDxePriori = self.UnDispatchedFfsDict.pop(FfsDxePrioriGuid)
if len(FfsDxePriori.Sections) == 1:
@@ -284,26 +283,6 @@ class FirmwareVolume(Image):
self.DisPatchDxe(Db)
- def DisPatchNoDepexFfs(self, Db):
- # Last Load Drivers without Depex
- for FfsID in self.NoDepexFfsDict:
- NewFfs = self.NoDepexFfsDict.pop(FfsID)
- self.OrderedFfsDict[FfsID] = NewFfs
- self.LoadProtocol(Db, FfsID)
-
- return True
-
- def LoadCallbackProtocol(self):
- IsLoad = True
- for Protocol in self.ProtocolList:
- for Callback in self.ProtocolList[Protocol][1]:
- if Callback[0] not in self.OrderedFfsDict.keys():
- IsLoad = False
- continue
- if IsLoad:
- EotGlobalData.gProtocolList[Protocol.lower()] = self.ProtocolList[Protocol][0]
- self.ProtocolList.pop(Protocol)
-
def LoadProtocol(self, Db, ModuleGuid):
SqlCommand = """select GuidValue from Report
where SourceFileFullPath in
@@ -383,7 +362,7 @@ class FirmwareVolume(Image):
IsInstalled = True
NewFfs = self.UnDispatchedFfsDict.pop(FfsID)
NewFfs.Depex = DepexString
- if FileDepex != None:
+ if FileDepex is not None:
ScheduleList.insert.insert(FileDepex[1], FfsID, NewFfs, FileDepex[0])
else:
ScheduleList[FfsID] = NewFfs
@@ -471,7 +450,7 @@ class FirmwareVolume(Image):
FfsId = repr(FfsObj)
if ((self.Attributes & 0x00000800) != 0 and len(FfsObj) == 0xFFFFFF) \
or ((self.Attributes & 0x00000800) == 0 and len(FfsObj) == 0):
- if LastFfsObj != None:
+ if LastFfsObj is not None:
LastFfsObj.FreeSpace = EndOfFv - LastFfsObj._OFF_ - len(LastFfsObj)
else:
if FfsId in self.FfsDict:
@@ -480,7 +459,7 @@ class FirmwareVolume(Image):
% (FfsObj.Guid, FfsObj.Offset,
self.FfsDict[FfsId].Guid, self.FfsDict[FfsId].Offset))
self.FfsDict[FfsId] = FfsObj
- if LastFfsObj != None:
+ if LastFfsObj is not None:
LastFfsObj.FreeSpace = FfsStartAddress - LastFfsObj._OFF_ - len(LastFfsObj)
FfsStartAddress += len(FfsObj)
@@ -527,11 +506,11 @@ class CompressedImage(Image):
def __init__(m, CompressedData=None, CompressionType=None, UncompressedLength=None):
Image.__init__(m)
- if UncompressedLength != None:
+ if UncompressedLength is not None:
m.UncompressedLength = UncompressedLength
- if CompressionType != None:
+ if CompressionType is not None:
m.CompressionType = CompressionType
- if CompressedData != None:
+ if CompressedData is not None:
m.Data = CompressedData
def __str__(m):
@@ -607,13 +586,13 @@ class GuidDefinedImage(Image):
def __init__(m, SectionDefinitionGuid=None, DataOffset=None, Attributes=None, Data=None):
Image.__init__(m)
- if SectionDefinitionGuid != None:
+ if SectionDefinitionGuid is not None:
m.SectionDefinitionGuid = SectionDefinitionGuid
- if DataOffset != None:
+ if DataOffset is not None:
m.DataOffset = DataOffset
- if Attributes != None:
+ if Attributes is not None:
m.Attributes = Attributes
- if Data != None:
+ if Data is not None:
m.Data = Data
def __str__(m):
@@ -791,7 +770,7 @@ class Depex(Image):
else:
CurrentData = m._OPCODE_
m._ExprList.append(Token)
- if CurrentData == None:
+ if CurrentData is None:
break
return m._ExprList
@@ -867,9 +846,9 @@ class Section(Image):
def __init__(m, Type=None, Size=None):
Image.__init__(m)
m._Alignment = 1
- if Type != None:
+ if Type is not None:
m.Type = Type
- if Size != None:
+ if Size is not None:
m.Size = Size
def __str__(m):
@@ -999,6 +978,8 @@ class Ffs(Image):
0x0B : "FIRMWARE_VOLUME_IMAGE",
0x0C : "COMBINED_SMM_DXE",
0x0D : "SMM_CORE",
+ 0x0E : "MM_STANDALONE",
+ 0x0F : "MM_CORE_STANDALONE",
0xc0 : "OEM_MIN",
0xdf : "OEM_MAX",
0xe0 : "DEBUG_MIN",
@@ -1281,7 +1262,7 @@ class LinkMap:
for Line in MapFile:
Line = Line.strip()
if not MappingStart:
- if MappingTitle.match(Line) != None:
+ if MappingTitle.match(Line) is not None:
MappingStart = True
continue
ResultList = MappingFormat.findall(Line)