mirror of https://github.com/acidanthera/audk.git
BaseTools: replace 'UINT8','UINT16','UINT32','UINT64','VOID*' with shared constants.
Cc: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
b491aa95ab
commit
656d2539be
|
@ -1394,7 +1394,7 @@ class PlatformAutoGen(AutoGen):
|
|||
|
||||
for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:
|
||||
# make sure that the "VOID*" kind of datum has MaxDatumSize set
|
||||
if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:
|
||||
if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:
|
||||
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))
|
||||
|
||||
# Check the PCD from Binary INF or Source INF
|
||||
|
@ -1471,7 +1471,7 @@ class PlatformAutoGen(AutoGen):
|
|||
ExtraData="\n\tExisted %s PCD %s in:\n\t\t%s\n"
|
||||
% (PcdFromModule.Type, PcdFromModule.TokenCName, InfName))
|
||||
# make sure that the "VOID*" kind of datum has MaxDatumSize set
|
||||
if PcdFromModule.DatumType == "VOID*" and PcdFromModule.MaxDatumSize in [None, '']:
|
||||
if PcdFromModule.DatumType == TAB_VOID and PcdFromModule.MaxDatumSize in [None, '']:
|
||||
NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))
|
||||
if M.ModuleType in ["PEIM", "PEI_CORE"]:
|
||||
PcdFromModule.Phase = "PEI"
|
||||
|
@ -1536,7 +1536,7 @@ class PlatformAutoGen(AutoGen):
|
|||
|
||||
for item in self._PlatformPcds:
|
||||
if self._PlatformPcds[item].DatumType and self._PlatformPcds[item].DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
|
||||
self._PlatformPcds[item].DatumType = "VOID*"
|
||||
self._PlatformPcds[item].DatumType = TAB_VOID
|
||||
|
||||
if (self.Workspace.ArchList[-1] == self.Arch):
|
||||
for Pcd in self._DynamicPcdList:
|
||||
|
@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
|
|||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
|
||||
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
|
||||
Pcd.DatumType = "VOID*"
|
||||
Pcd.DatumType = TAB_VOID
|
||||
|
||||
# if found PCD which datum value is unicode string the insert to left size of UnicodeIndex
|
||||
# if found HII type PCD then insert to right of UnicodeIndex
|
||||
|
@ -1697,7 +1697,7 @@ class PlatformAutoGen(AutoGen):
|
|||
SkuValueMap[PcdValue].append(Sku)
|
||||
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
|
||||
NeedProcessVpdMapFile = True
|
||||
if DscPcdEntry.DatumType == 'VOID*' and PcdValue.startswith("L"):
|
||||
if DscPcdEntry.DatumType == TAB_VOID and PcdValue.startswith("L"):
|
||||
UnicodePcdArray.add(DscPcdEntry)
|
||||
elif len(Sku.VariableName) > 0:
|
||||
HiiPcdArray.add(DscPcdEntry)
|
||||
|
@ -1744,10 +1744,10 @@ class PlatformAutoGen(AutoGen):
|
|||
Sku.VpdOffset = Sku.VpdOffset.strip()
|
||||
|
||||
if Pcd.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
|
||||
Pcd.DatumType = "VOID*"
|
||||
Pcd.DatumType = TAB_VOID
|
||||
|
||||
PcdValue = Sku.DefaultValue
|
||||
if Pcd.DatumType == 'VOID*' and PcdValue.startswith("L"):
|
||||
if Pcd.DatumType == TAB_VOID and PcdValue.startswith("L"):
|
||||
# if found PCD which datum value is unicode string the insert to left size of UnicodeIndex
|
||||
UnicodePcdArray.add(Pcd)
|
||||
elif len(Sku.VariableName) > 0:
|
||||
|
@ -2369,7 +2369,7 @@ class PlatformAutoGen(AutoGen):
|
|||
ToPcd.validlists = FromPcd.validlists
|
||||
ToPcd.expressions = FromPcd.expressions
|
||||
|
||||
if FromPcd is not None and ToPcd.DatumType == "VOID*" and ToPcd.MaxDatumSize in ['', None]:
|
||||
if FromPcd is not None and ToPcd.DatumType == TAB_VOID and ToPcd.MaxDatumSize in ['', None]:
|
||||
EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified for PCD %s.%s" \
|
||||
% (ToPcd.TokenSpaceGuidCName, TokenCName))
|
||||
Value = ToPcd.DefaultValue
|
||||
|
@ -2445,7 +2445,7 @@ class PlatformAutoGen(AutoGen):
|
|||
# use PCD value to calculate the MaxDatumSize when it is not specified
|
||||
for Name, Guid in Pcds:
|
||||
Pcd = Pcds[Name, Guid]
|
||||
if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]:
|
||||
if Pcd.DatumType == TAB_VOID and Pcd.MaxDatumSize in ['', None]:
|
||||
Pcd.MaxSizeUserSet = None
|
||||
Value = Pcd.DefaultValue
|
||||
if Value in [None, '']:
|
||||
|
@ -4113,13 +4113,13 @@ class ModuleAutoGen(AutoGen):
|
|||
elif BoolValue == 'FALSE':
|
||||
Pcd.DefaultValue = '0'
|
||||
|
||||
if Pcd.DatumType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
|
||||
if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
|
||||
HexFormat = '0x%02x'
|
||||
if Pcd.DatumType == 'UINT16':
|
||||
if Pcd.DatumType == TAB_UINT16:
|
||||
HexFormat = '0x%04x'
|
||||
elif Pcd.DatumType == 'UINT32':
|
||||
elif Pcd.DatumType == TAB_UINT32:
|
||||
HexFormat = '0x%08x'
|
||||
elif Pcd.DatumType == 'UINT64':
|
||||
elif Pcd.DatumType == TAB_UINT64:
|
||||
HexFormat = '0x%016x'
|
||||
PcdValue = HexFormat % int(Pcd.DefaultValue, 0)
|
||||
else:
|
||||
|
|
|
@ -41,8 +41,6 @@ gItemTypeStringDatabase = {
|
|||
TAB_PCDS_DYNAMIC_EX_HII : '',
|
||||
}
|
||||
|
||||
_NumericDataTypesList = ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']
|
||||
|
||||
## Dynamic PCD types
|
||||
gDynamicPcd = [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII]
|
||||
|
||||
|
@ -50,9 +48,9 @@ gDynamicPcd = [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNAMIC_VPD,
|
|||
gDynamicExPcd = [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII]
|
||||
|
||||
## Datum size
|
||||
gDatumSizeStringDatabase = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'BOOLEAN','VOID*':'8'}
|
||||
gDatumSizeStringDatabaseH = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'BOOL','VOID*':'PTR'}
|
||||
gDatumSizeStringDatabaseLib = {'UINT8':'8','UINT16':'16','UINT32':'32','UINT64':'64','BOOLEAN':'Bool','VOID*':'Ptr'}
|
||||
gDatumSizeStringDatabase = {TAB_UINT8:'8',TAB_UINT16:'16',TAB_UINT32:'32',TAB_UINT64:'64','BOOLEAN':'BOOLEAN',TAB_VOID:'8'}
|
||||
gDatumSizeStringDatabaseH = {TAB_UINT8:'8',TAB_UINT16:'16',TAB_UINT32:'32',TAB_UINT64:'64','BOOLEAN':'BOOL',TAB_VOID:'PTR'}
|
||||
gDatumSizeStringDatabaseLib = {TAB_UINT8:'8',TAB_UINT16:'16',TAB_UINT32:'32',TAB_UINT64:'64','BOOLEAN':'Bool',TAB_VOID:'Ptr'}
|
||||
|
||||
## AutoGen File Header Templates
|
||||
gAutoGenHeaderString = TemplateString("""\
|
||||
|
@ -871,7 +869,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH):
|
|||
TokenCNameList.add(TokenCName)
|
||||
|
||||
def GetPcdSize(Pcd):
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
Value = Pcd.DefaultValue
|
||||
if Value in [None, '']:
|
||||
return 1
|
||||
|
@ -881,13 +879,13 @@ def GetPcdSize(Pcd):
|
|||
return len(Value.split(','))
|
||||
else:
|
||||
return len(Value) - 1
|
||||
if Pcd.DatumType == 'UINT64':
|
||||
if Pcd.DatumType == TAB_UINT64:
|
||||
return 8
|
||||
if Pcd.DatumType == 'UINT32':
|
||||
if Pcd.DatumType == TAB_UINT32:
|
||||
return 4
|
||||
if Pcd.DatumType == 'UINT16':
|
||||
if Pcd.DatumType == TAB_UINT16:
|
||||
return 2
|
||||
if Pcd.DatumType == 'UINT8':
|
||||
if Pcd.DatumType == TAB_UINT8:
|
||||
return 1
|
||||
if Pcd.DatumType == 'BOOLEAN':
|
||||
return 1
|
||||
|
@ -955,11 +953,11 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
"Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
ExtraData="[%s]" % str(Info))
|
||||
|
||||
DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabase else gDatumSizeStringDatabase['VOID*']
|
||||
DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabaseLib else gDatumSizeStringDatabaseLib['VOID*']
|
||||
GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_' + TokenCName
|
||||
SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_' + TokenCName
|
||||
SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_S_' + TokenCName
|
||||
DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabase else gDatumSizeStringDatabase[TAB_VOID]
|
||||
DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabaseLib else gDatumSizeStringDatabaseLib[TAB_VOID]
|
||||
GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
|
||||
SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
|
||||
SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_S_' + TokenCName
|
||||
GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + TokenCName
|
||||
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
|
@ -982,7 +980,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('// #define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
|
@ -992,7 +990,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
|
@ -1011,7 +1009,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
else:
|
||||
AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetSize(%s)\n' % (GetModeSizeName, PcdTokenName))
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName))
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
|
||||
else:
|
||||
|
@ -1035,7 +1033,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
elif BoolValue == 'FALSE' or BoolValue == '0':
|
||||
Value = '0U'
|
||||
|
||||
if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']:
|
||||
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
|
||||
try:
|
||||
if Value.upper().endswith('L'):
|
||||
Value = Value[:-1]
|
||||
|
@ -1044,7 +1042,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"PCD value is not valid dec or hex number for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
ExtraData="[%s]" % str(Info))
|
||||
if Pcd.DatumType == 'UINT64':
|
||||
if Pcd.DatumType == TAB_UINT64:
|
||||
if ValueNumber < 0:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
|
@ -1055,7 +1053,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
ExtraData="[%s]" % str(Info))
|
||||
if not Value.endswith('ULL'):
|
||||
Value += 'ULL'
|
||||
elif Pcd.DatumType == 'UINT32':
|
||||
elif Pcd.DatumType == TAB_UINT32:
|
||||
if ValueNumber < 0:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
|
@ -1066,7 +1064,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
ExtraData="[%s]" % str(Info))
|
||||
if not Value.endswith('U'):
|
||||
Value += 'U'
|
||||
elif Pcd.DatumType == 'UINT16':
|
||||
elif Pcd.DatumType == TAB_UINT16:
|
||||
if ValueNumber < 0:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
|
@ -1077,7 +1075,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
ExtraData="[%s]" % str(Info))
|
||||
if not Value.endswith('U'):
|
||||
Value += 'U'
|
||||
elif Pcd.DatumType == 'UINT8':
|
||||
elif Pcd.DatumType == TAB_UINT8:
|
||||
if ValueNumber < 0:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
|
@ -1088,7 +1086,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
ExtraData="[%s]" % str(Info))
|
||||
if not Value.endswith('U'):
|
||||
Value += 'U'
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize == '':
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"Unknown [MaxDatumSize] of PCD [%s.%s]" % (Pcd.TokenSpaceGuidCName, TokenCName),
|
||||
|
@ -1126,10 +1124,10 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
# skip casting for fixed at build since it breaks ARM assembly.
|
||||
# Long term we need PCD macros that work in assembly
|
||||
#
|
||||
elif Pcd.Type != TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN', 'VOID*']:
|
||||
elif Pcd.Type != TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType in TAB_PCD_NUMERIC_TYPES_VOID:
|
||||
Value = "((%s)%s)" % (Pcd.DatumType, Value)
|
||||
|
||||
if Pcd.DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN', 'VOID*']:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES_VOID:
|
||||
# handle structure PCD
|
||||
if Pcd.MaxDatumSize is None or Pcd.MaxDatumSize == '':
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
|
@ -1144,7 +1142,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
else:
|
||||
PcdValueName = '_PCD_VALUE_' + TokenCName
|
||||
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
#
|
||||
# For unicode, UINT16 array will be generated, so the alignment of unicode is guaranteed.
|
||||
#
|
||||
|
@ -1191,7 +1189,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName))
|
||||
|
||||
if Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &_gPcd_BinaryPatch_Size_%s, (UINTN)_PCD_PATCHABLE_%s_SIZE, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, Pcd.TokenCName, Pcd.TokenCName, Pcd.TokenCName))
|
||||
else:
|
||||
|
@ -1254,16 +1252,16 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
ExtraData="[%s]" % str(Info))
|
||||
|
||||
DatumType = Pcd.DatumType
|
||||
DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabase else gDatumSizeStringDatabase['VOID*']
|
||||
DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabaseLib else gDatumSizeStringDatabaseLib['VOID*']
|
||||
GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_' + TokenCName
|
||||
SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_' + TokenCName
|
||||
SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_S_' + TokenCName
|
||||
DatumSize = gDatumSizeStringDatabase[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabase else gDatumSizeStringDatabase[TAB_VOID]
|
||||
DatumSizeLib = gDatumSizeStringDatabaseLib[Pcd.DatumType] if Pcd.DatumType in gDatumSizeStringDatabaseLib else gDatumSizeStringDatabaseLib[TAB_VOID]
|
||||
GetModeName = '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_GET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
|
||||
SetModeName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_' + TokenCName
|
||||
SetModeStatusName = '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd.DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDatabaseH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[TAB_VOID] + '_S_' + TokenCName
|
||||
GetModeSizeName = '_PCD_GET_MODE_SIZE' + '_' + TokenCName
|
||||
|
||||
Type = ''
|
||||
Array = ''
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
if Pcd.DefaultValue[0]== '{':
|
||||
Type = '(VOID *)'
|
||||
Array = '[]'
|
||||
|
@ -1291,7 +1289,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
AutoGenH.Append('// #define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('// #define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('// #define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('// #define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
|
@ -1301,7 +1299,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
AutoGenH.Append('#define %s %s\n' % (PcdTokenName, PcdExTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetEx%s(&%s, %s)\n' % (GetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetExSize(&%s, %s)\n' % (GetModeSizeName,Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%s(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSetEx%sS(&%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdTokenName))
|
||||
else:
|
||||
|
@ -1322,7 +1320,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
else:
|
||||
AutoGenH.Append('#define %s LibPcdGet%s(%s)\n' % (GetModeName, DatumSizeLib, PcdTokenName))
|
||||
AutoGenH.Append('#define %s LibPcdGetSize(%s)\n' % (GetModeSizeName, PcdTokenName))
|
||||
if DatumType not in _NumericDataTypesList:
|
||||
if DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%s(%s, (SizeOfBuffer), (Buffer))\n' %(SetModeName, DatumSizeLib, PcdTokenName))
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName))
|
||||
else:
|
||||
|
@ -1331,17 +1329,17 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE:
|
||||
GetModeMaxSizeName = '_PCD_GET_MODE_MAXSIZE' + '_' + TokenCName
|
||||
PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName
|
||||
if DatumType not in _NumericDataTypesList:
|
||||
if DatumType == 'VOID*' and Array == '[]':
|
||||
DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
|
||||
if DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
if DatumType == TAB_VOID and Array == '[]':
|
||||
DatumType = [TAB_UINT8, TAB_UINT16][Pcd.DefaultValue[0] == 'L']
|
||||
else:
|
||||
DatumType = 'UINT8'
|
||||
DatumType = TAB_UINT8
|
||||
AutoGenH.Append('extern %s _gPcd_BinaryPatch_%s%s;\n' %(DatumType, TokenCName, Array))
|
||||
else:
|
||||
AutoGenH.Append('extern volatile %s %s%s;\n' % (DatumType, PcdVariableName, Array))
|
||||
AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName))
|
||||
PcdDataSize = GetPcdSize(Pcd)
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, TokenCName, PatchPcdSizeVariableName, PatchPcdMaxSizeVariable))
|
||||
AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, TokenCName, PatchPcdSizeVariableName, PatchPcdMaxSizeVariable))
|
||||
AutoGenH.Append('#define %s %s\n' % (GetModeMaxSizeName, PatchPcdMaxSizeVariable))
|
||||
|
@ -1357,10 +1355,10 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD or PcdItemType == TAB_PCDS_FEATURE_FLAG:
|
||||
key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName))
|
||||
PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[Pcd.Type] + '_' + TokenCName
|
||||
if DatumType == 'VOID*' and Array == '[]':
|
||||
DatumType = ['UINT8', 'UINT16'][Pcd.DefaultValue[0] == 'L']
|
||||
if DatumType not in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN', 'VOID*']:
|
||||
DatumType = 'UINT8'
|
||||
if DatumType == TAB_VOID and Array == '[]':
|
||||
DatumType = [TAB_UINT8, TAB_UINT16][Pcd.DefaultValue[0] == 'L']
|
||||
if DatumType not in TAB_PCD_NUMERIC_TYPES_VOID:
|
||||
DatumType = TAB_UINT8
|
||||
AutoGenH.Append('extern const %s _gPcd_FixedAtBuild_%s%s;\n' %(DatumType, TokenCName, Array))
|
||||
AutoGenH.Append('#define %s %s_gPcd_FixedAtBuild_%s\n' %(GetModeName, Type, TokenCName))
|
||||
AutoGenH.Append('//#define %s ASSERT(FALSE) // It is not allowed to set value for a FIXED_AT_BUILD PCD\n' % SetModeName)
|
||||
|
@ -1370,13 +1368,13 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
|||
ConstFixedPcd = True
|
||||
if key in Info.ConstPcd:
|
||||
Pcd.DefaultValue = Info.ConstPcd[key]
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
AutoGenH.Append('#define _PCD_VALUE_%s %s%s\n' %(TokenCName, Type, PcdVariableName))
|
||||
else:
|
||||
AutoGenH.Append('#define _PCD_VALUE_%s %s\n' %(TokenCName, Pcd.DefaultValue))
|
||||
PcdDataSize = GetPcdSize(Pcd)
|
||||
if PcdItemType == TAB_PCDS_FIXED_AT_BUILD:
|
||||
if Pcd.DatumType not in _NumericDataTypesList:
|
||||
if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
if ConstFixedPcd:
|
||||
AutoGenH.Append('#define %s %s\n' % (FixPcdSizeTokenName, PcdDataSize))
|
||||
AutoGenH.Append('#define %s %s\n' % (GetModeSizeName,FixPcdSizeTokenName))
|
||||
|
|
|
@ -20,7 +20,7 @@ from ValidCheckingInfoObject import VAR_VALID_OBJECT_FACTORY
|
|||
from Common.VariableAttributes import VariableAttributes
|
||||
import copy
|
||||
from struct import unpack
|
||||
from Common.DataType import TAB_DEFAULT
|
||||
from Common.DataType import *
|
||||
|
||||
DATABASE_VERSION = 7
|
||||
|
||||
|
@ -1026,7 +1026,7 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform,Phase):
|
|||
new_pcd = copy.deepcopy(pcd)
|
||||
new_pcd.SkuInfoList = {skuname:pcd.SkuInfoList[skuname]}
|
||||
new_pcd.isinit = 'INIT'
|
||||
if new_pcd.DatumType in ['UINT8','UINT16','UINT32','UINT64']:
|
||||
if new_pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
|
||||
for skuobj in pcd.SkuInfoList.values():
|
||||
if skuobj.DefaultValue:
|
||||
defaultvalue = int(skuobj.DefaultValue,16) if skuobj.DefaultValue.upper().startswith("0X") else int(skuobj.DefaultValue,10)
|
||||
|
@ -1105,7 +1105,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
|
||||
Dict['PCD_INFO_FLAG'] = Platform.Platform.PcdInfoFlag
|
||||
|
||||
for DatumType in ['UINT64','UINT32','UINT16','UINT8','BOOLEAN', "VOID*"]:
|
||||
for DatumType in TAB_PCD_NUMERIC_TYPES_VOID:
|
||||
Dict['VARDEF_CNAME_' + DatumType] = []
|
||||
Dict['VARDEF_GUID_' + DatumType] = []
|
||||
Dict['VARDEF_SKUID_' + DatumType] = []
|
||||
|
@ -1177,7 +1177,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
ReorderedDynPcdList = GetOrderedDynamicPcdList(DynamicPcdList, Platform.PcdTokenNumber)
|
||||
for item in ReorderedDynPcdList:
|
||||
if item.DatumType not in [TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, TAB_VOID, "BOOLEAN"]:
|
||||
item.DatumType = "VOID*"
|
||||
item.DatumType = TAB_VOID
|
||||
for Pcd in ReorderedDynPcdList:
|
||||
VoidStarTypeCurrSize = []
|
||||
i += 1
|
||||
|
@ -1218,7 +1218,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
VariableDbValueList = []
|
||||
Pcd.InitString = 'UNINIT'
|
||||
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
if Pcd.Type not in ["DynamicVpd", "DynamicExVpd"]:
|
||||
Pcd.TokenTypeList = ['PCD_TYPE_STRING']
|
||||
else:
|
||||
|
@ -1322,9 +1322,9 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
#
|
||||
Dict['VARDEF_DB_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue)
|
||||
|
||||
if Pcd.DatumType == "UINT64":
|
||||
if Pcd.DatumType == TAB_UINT64:
|
||||
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "ULL")
|
||||
elif Pcd.DatumType in ("UINT32", "UINT16", "UINT8"):
|
||||
elif Pcd.DatumType in (TAB_UINT32, TAB_UINT16, TAB_UINT8):
|
||||
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue + "U")
|
||||
elif Pcd.DatumType == "BOOLEAN":
|
||||
if eval(Sku.HiiDefaultValue) in [1,0]:
|
||||
|
@ -1355,13 +1355,13 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
VpdHeadOffsetList.append(str(Sku.VpdOffset) + 'U')
|
||||
VpdDbOffsetList.append(Sku.VpdOffset)
|
||||
# Also add the VOID* string of VPD PCD to SizeTable
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
NumberOfSizeItems += 1
|
||||
# For VPD type of PCD, its current size is equal to its MAX size.
|
||||
VoidStarTypeCurrSize = [str(Pcd.MaxDatumSize) + 'U']
|
||||
continue
|
||||
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
Pcd.TokenTypeList += ['PCD_TYPE_STRING']
|
||||
Pcd.InitString = 'INIT'
|
||||
if Sku.HiiDefaultValue != '' and Sku.DefaultValue == '':
|
||||
|
@ -1420,9 +1420,9 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
# For UNIT64 type PCD's value, ULL should be append to avoid
|
||||
# warning under linux building environment.
|
||||
#
|
||||
if Pcd.DatumType == "UINT64":
|
||||
if Pcd.DatumType == TAB_UINT64:
|
||||
ValueList.append(Sku.DefaultValue + "ULL")
|
||||
elif Pcd.DatumType in ("UINT32", "UINT16", "UINT8"):
|
||||
elif Pcd.DatumType in (TAB_UINT32, TAB_UINT16, TAB_UINT8):
|
||||
ValueList.append(Sku.DefaultValue + "U")
|
||||
elif Pcd.DatumType == "BOOLEAN":
|
||||
if Sku.DefaultValue in ["1", "0"]:
|
||||
|
@ -1433,7 +1433,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, DynamicPcdList, Phase):
|
|||
DbValueList.append(Sku.DefaultValue)
|
||||
|
||||
Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
|
||||
if Pcd.DatumType == 'VOID*':
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
Dict['SIZE_TABLE_CNAME'].append(CName)
|
||||
Dict['SIZE_TABLE_GUID'].append(TokenSpaceGuid)
|
||||
Dict['SIZE_TABLE_MAXIMUM_LENGTH'].append(str(Pcd.MaxDatumSize) + 'U')
|
||||
|
|
|
@ -91,14 +91,14 @@ class VariableMgr(object):
|
|||
for item in sku_var_info_offset_list:
|
||||
data_type = item.data_type
|
||||
value_list = item.default_value.strip("{").strip("}").split(",")
|
||||
if data_type in ["BOOLEAN","UINT8","UINT16","UINT32","UINT64"]:
|
||||
if data_type == ["BOOLEAN","UINT8"]:
|
||||
if data_type in DataType.TAB_PCD_NUMERIC_TYPES:
|
||||
if data_type == ["BOOLEAN", DataType.TAB_UINT8]:
|
||||
data_flag = "=B"
|
||||
elif data_type == "UINT16":
|
||||
elif data_type == DataType.TAB_UINT16:
|
||||
data_flag = "=H"
|
||||
elif data_type == "UINT32":
|
||||
elif data_type == DataType.TAB_UINT32:
|
||||
data_flag = "=L"
|
||||
elif data_type == "UINT64":
|
||||
elif data_type == DataType.TAB_UINT64:
|
||||
data_flag = "=Q"
|
||||
data = value_list[0]
|
||||
value_list = []
|
||||
|
@ -110,7 +110,7 @@ class VariableMgr(object):
|
|||
except:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "Variable offset conflict in PCDs: %s \n" % (" and ".join([item.pcdname for item in sku_var_info_offset_list])))
|
||||
n = sku_var_info_offset_list[0]
|
||||
indexedvarinfo[key] = [var_info(n.pcdindex,n.pcdname,n.defaultstoragename,n.skuname,n.var_name, n.var_guid, "0x00",n.var_attribute,newvaluestr , newvaluestr , "VOID*")]
|
||||
indexedvarinfo[key] = [var_info(n.pcdindex,n.pcdname,n.defaultstoragename,n.skuname,n.var_name, n.var_guid, "0x00",n.var_attribute,newvaluestr , newvaluestr , DataType.TAB_VOID)]
|
||||
self.VarInfo = [item[0] for item in indexedvarinfo.values()]
|
||||
|
||||
def assemble_variable(self, valuelist):
|
||||
|
@ -144,7 +144,7 @@ class VariableMgr(object):
|
|||
tail = None
|
||||
default_sku_default = indexedvarinfo.get(index).get((DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEFAULT))
|
||||
|
||||
if default_sku_default.data_type not in ["UINT8","UINT16","UINT32","UINT64","BOOLEAN"]:
|
||||
if default_sku_default.data_type not in DataType.TAB_PCD_NUMERIC_TYPES:
|
||||
var_max_len = max([len(var_item.default_value.split(",")) for var_item in sku_var_info.values()])
|
||||
if len(default_sku_default.default_value.split(",")) < var_max_len:
|
||||
tail = ",".join([ "0x00" for i in range(var_max_len-len(default_sku_default.default_value.split(",")))])
|
||||
|
@ -165,7 +165,7 @@ class VariableMgr(object):
|
|||
continue
|
||||
other_sku_other = indexedvarinfo.get(index).get((skuid,defaultstoragename))
|
||||
|
||||
if default_sku_default.data_type not in ["UINT8","UINT16","UINT32","UINT64","BOOLEAN"]:
|
||||
if default_sku_default.data_type not in DataType.TAB_PCD_NUMERIC_TYPES:
|
||||
if len(other_sku_other.default_value.split(",")) < var_max_len:
|
||||
tail = ",".join([ "0x00" for i in range(var_max_len-len(other_sku_other.default_value.split(",")))])
|
||||
|
||||
|
@ -314,7 +314,7 @@ class VariableMgr(object):
|
|||
def PACK_VARIABLES_DATA(self, var_value,data_type, tail = None):
|
||||
Buffer = ""
|
||||
data_len = 0
|
||||
if data_type == "VOID*":
|
||||
if data_type == DataType.TAB_VOID:
|
||||
for value_char in var_value.strip("{").strip("}").split(","):
|
||||
Buffer += pack("=B",int(value_char,16))
|
||||
data_len += len(var_value.split(","))
|
||||
|
@ -325,16 +325,16 @@ class VariableMgr(object):
|
|||
elif data_type == "BOOLEAN":
|
||||
Buffer += pack("=B",True) if var_value.upper() == "TRUE" else pack("=B",False)
|
||||
data_len += 1
|
||||
elif data_type == "UINT8":
|
||||
elif data_type == DataType.TAB_UINT8:
|
||||
Buffer += pack("=B",GetIntegerValue(var_value))
|
||||
data_len += 1
|
||||
elif data_type == "UINT16":
|
||||
elif data_type == DataType.TAB_UINT16:
|
||||
Buffer += pack("=H",GetIntegerValue(var_value))
|
||||
data_len += 2
|
||||
elif data_type == "UINT32":
|
||||
elif data_type == DataType.TAB_UINT32:
|
||||
Buffer += pack("=L",GetIntegerValue(var_value))
|
||||
data_len += 4
|
||||
elif data_type == "UINT64":
|
||||
elif data_type == DataType.TAB_UINT64:
|
||||
Buffer += pack("=Q",GetIntegerValue(var_value))
|
||||
data_len += 8
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
|
@ -19,6 +19,7 @@ from Common.RangeExpression import RangeExpression
|
|||
from Common.Misc import *
|
||||
from StringIO import StringIO
|
||||
from struct import pack
|
||||
from Common.DataType import *
|
||||
|
||||
class VAR_CHECK_PCD_VARIABLE_TAB_CONTAINER(object):
|
||||
def __init__(self):
|
||||
|
@ -250,13 +251,13 @@ class VAR_CHECK_PCD_VALID_OBJ(object):
|
|||
self.ValidData = True
|
||||
self.updateStorageWidth()
|
||||
def updateStorageWidth(self):
|
||||
if self.PcdDataType == "UINT8" or self.PcdDataType == "BOOLEAN":
|
||||
if self.PcdDataType == TAB_UINT8 or self.PcdDataType == "BOOLEAN":
|
||||
self.StorageWidth = 1
|
||||
elif self.PcdDataType == "UINT16":
|
||||
elif self.PcdDataType == TAB_UINT16:
|
||||
self.StorageWidth = 2
|
||||
elif self.PcdDataType == "UINT32":
|
||||
elif self.PcdDataType == TAB_UINT32:
|
||||
self.StorageWidth = 4
|
||||
elif self.PcdDataType == "UINT64":
|
||||
elif self.PcdDataType == TAB_UINT64:
|
||||
self.StorageWidth = 8
|
||||
else:
|
||||
self.StorageWidth = 0
|
||||
|
|
|
@ -41,6 +41,10 @@ TAB_UINT32 = 'UINT32'
|
|||
TAB_UINT64 = 'UINT64'
|
||||
TAB_VOID = 'VOID*'
|
||||
|
||||
TAB_PCD_CLEAN_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64}
|
||||
TAB_PCD_NUMERIC_TYPES = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN'}
|
||||
TAB_PCD_NUMERIC_TYPES_VOID = {TAB_UINT8, TAB_UINT16, TAB_UINT32, TAB_UINT64, 'BOOLEAN', TAB_VOID}
|
||||
|
||||
TAB_EDK_SOURCE = '$(EDK_SOURCE)'
|
||||
TAB_EFI_SOURCE = '$(EFI_SOURCE)'
|
||||
TAB_WORKSPACE = '$(WORKSPACE)'
|
||||
|
|
|
@ -18,6 +18,7 @@ from CommonDataClass.Exceptions import WrnExpression
|
|||
from Misc import GuidStringToGuidStructureString, ParseFieldValue, IsFieldValueAnArray
|
||||
import Common.EdkLogger as EdkLogger
|
||||
import copy
|
||||
from Common.DataType import *
|
||||
|
||||
ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].'
|
||||
ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'
|
||||
|
@ -136,7 +137,7 @@ def BuildOptionValue(PcdValue, GuidDict):
|
|||
InputValue = PcdValue
|
||||
if IsFieldValueAnArray(InputValue):
|
||||
try:
|
||||
PcdValue = ValueExpressionEx(InputValue, 'VOID*', GuidDict)(True)
|
||||
PcdValue = ValueExpressionEx(InputValue, TAB_VOID, GuidDict)(True)
|
||||
except:
|
||||
pass
|
||||
return PcdValue
|
||||
|
@ -800,20 +801,20 @@ class ValueExpressionEx(ValueExpression):
|
|||
PcdValue = self.PcdValue
|
||||
try:
|
||||
PcdValue = ValueExpression.__call__(self, RealValue, Depth)
|
||||
if self.PcdType == 'VOID*' and (PcdValue.startswith("'") or PcdValue.startswith("L'")):
|
||||
if self.PcdType == TAB_VOID and (PcdValue.startswith("'") or PcdValue.startswith("L'")):
|
||||
PcdValue, Size = ParseFieldValue(PcdValue)
|
||||
PcdValueList = []
|
||||
for I in range(Size):
|
||||
PcdValueList.append('0x%02X'%(PcdValue & 0xff))
|
||||
PcdValue = PcdValue >> 8
|
||||
PcdValue = '{' + ','.join(PcdValueList) + '}'
|
||||
elif self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN'] and (PcdValue.startswith("'") or \
|
||||
elif self.PcdType in TAB_PCD_NUMERIC_TYPES and (PcdValue.startswith("'") or \
|
||||
PcdValue.startswith('"') or PcdValue.startswith("L'") or PcdValue.startswith('L"') or PcdValue.startswith('{')):
|
||||
raise BadExpression
|
||||
except WrnExpression, Value:
|
||||
PcdValue = Value.result
|
||||
except BadExpression, Value:
|
||||
if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN']:
|
||||
if self.PcdType in TAB_PCD_NUMERIC_TYPES:
|
||||
PcdValue = PcdValue.strip()
|
||||
if type(PcdValue) == type('') and PcdValue.startswith('{') and PcdValue.endswith('}'):
|
||||
PcdValue = SplitPcdValueString(PcdValue[1:-1])
|
||||
|
@ -823,24 +824,24 @@ class ValueExpressionEx(ValueExpression):
|
|||
ValueType = ''
|
||||
for Item in PcdValue:
|
||||
Item = Item.strip()
|
||||
if Item.startswith('UINT8'):
|
||||
if Item.startswith(TAB_UINT8):
|
||||
ItemSize = 1
|
||||
ValueType = 'UINT8'
|
||||
elif Item.startswith('UINT16'):
|
||||
ValueType = TAB_UINT8
|
||||
elif Item.startswith(TAB_UINT16):
|
||||
ItemSize = 2
|
||||
ValueType = 'UINT16'
|
||||
elif Item.startswith('UINT32'):
|
||||
ValueType = TAB_UINT16
|
||||
elif Item.startswith(TAB_UINT32):
|
||||
ItemSize = 4
|
||||
ValueType = 'UINT32'
|
||||
elif Item.startswith('UINT64'):
|
||||
ValueType = TAB_UINT32
|
||||
elif Item.startswith(TAB_UINT64):
|
||||
ItemSize = 8
|
||||
ValueType = 'UINT64'
|
||||
ValueType = TAB_UINT64
|
||||
elif Item[0] in ['"',"'",'L']:
|
||||
ItemSize = 0
|
||||
ValueType = 'VOID*'
|
||||
ValueType = TAB_VOID
|
||||
else:
|
||||
ItemSize = 0
|
||||
ValueType = 'UINT8'
|
||||
ValueType = TAB_UINT8
|
||||
Item = ValueExpressionEx(Item, ValueType, self._Symb)(True)
|
||||
|
||||
if ItemSize == 0:
|
||||
|
@ -875,13 +876,13 @@ class ValueExpressionEx(ValueExpression):
|
|||
PcdValue = '0x%0{}X'.format(Size) % (TmpValue)
|
||||
if TmpValue < 0:
|
||||
raise BadExpression('Type %s PCD Value is negative' % self.PcdType)
|
||||
if self.PcdType == 'UINT8' and Size > 1:
|
||||
if self.PcdType == TAB_UINT8 and Size > 1:
|
||||
raise BadExpression('Type %s PCD Value Size is Larger than 1 byte' % self.PcdType)
|
||||
if self.PcdType == 'UINT16' and Size > 2:
|
||||
if self.PcdType == TAB_UINT16 and Size > 2:
|
||||
raise BadExpression('Type %s PCD Value Size is Larger than 2 byte' % self.PcdType)
|
||||
if self.PcdType == 'UINT32' and Size > 4:
|
||||
if self.PcdType == TAB_UINT32 and Size > 4:
|
||||
raise BadExpression('Type %s PCD Value Size is Larger than 4 byte' % self.PcdType)
|
||||
if self.PcdType == 'UINT64' and Size > 8:
|
||||
if self.PcdType == TAB_UINT64 and Size > 8:
|
||||
raise BadExpression('Type %s PCD Value Size is Larger than 8 byte' % self.PcdType)
|
||||
else:
|
||||
try:
|
||||
|
@ -910,13 +911,13 @@ class ValueExpressionEx(ValueExpression):
|
|||
raise BadExpression('%s is not a valid c variable name' % Label)
|
||||
if Label not in LabelDict:
|
||||
LabelDict[Label] = str(LabelOffset)
|
||||
if Item.startswith('UINT8'):
|
||||
if Item.startswith(TAB_UINT8):
|
||||
LabelOffset = LabelOffset + 1
|
||||
elif Item.startswith('UINT16'):
|
||||
elif Item.startswith(TAB_UINT16):
|
||||
LabelOffset = LabelOffset + 2
|
||||
elif Item.startswith('UINT32'):
|
||||
elif Item.startswith(TAB_UINT32):
|
||||
LabelOffset = LabelOffset + 4
|
||||
elif Item.startswith('UINT64'):
|
||||
elif Item.startswith(TAB_UINT64):
|
||||
LabelOffset = LabelOffset + 8
|
||||
else:
|
||||
try:
|
||||
|
@ -971,18 +972,18 @@ class ValueExpressionEx(ValueExpression):
|
|||
continue
|
||||
else:
|
||||
ValueType = ""
|
||||
if Item.startswith('UINT8'):
|
||||
if Item.startswith(TAB_UINT8):
|
||||
ItemSize = 1
|
||||
ValueType = "UINT8"
|
||||
elif Item.startswith('UINT16'):
|
||||
ValueType = TAB_UINT8
|
||||
elif Item.startswith(TAB_UINT16):
|
||||
ItemSize = 2
|
||||
ValueType = "UINT16"
|
||||
elif Item.startswith('UINT32'):
|
||||
ValueType = TAB_UINT16
|
||||
elif Item.startswith(TAB_UINT32):
|
||||
ItemSize = 4
|
||||
ValueType = "UINT32"
|
||||
elif Item.startswith('UINT64'):
|
||||
ValueType = TAB_UINT32
|
||||
elif Item.startswith(TAB_UINT64):
|
||||
ItemSize = 8
|
||||
ValueType = "UINT64"
|
||||
ValueType = TAB_UINT64
|
||||
else:
|
||||
ItemSize = 0
|
||||
if ValueType:
|
||||
|
|
|
@ -1288,22 +1288,22 @@ def ParseFieldValue (Value):
|
|||
if type(Value) <> type(''):
|
||||
raise BadExpression('Type %s is %s' %(Value, type(Value)))
|
||||
Value = Value.strip()
|
||||
if Value.startswith('UINT8') and Value.endswith(')'):
|
||||
if Value.startswith(TAB_UINT8) and Value.endswith(')'):
|
||||
Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
|
||||
if Size > 1:
|
||||
raise BadExpression('Value (%s) Size larger than %d' %(Value, Size))
|
||||
return Value, 1
|
||||
if Value.startswith('UINT16') and Value.endswith(')'):
|
||||
if Value.startswith(TAB_UINT16) and Value.endswith(')'):
|
||||
Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
|
||||
if Size > 2:
|
||||
raise BadExpression('Value (%s) Size larger than %d' %(Value, Size))
|
||||
return Value, 2
|
||||
if Value.startswith('UINT32') and Value.endswith(')'):
|
||||
if Value.startswith(TAB_UINT32) and Value.endswith(')'):
|
||||
Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
|
||||
if Size > 4:
|
||||
raise BadExpression('Value (%s) Size larger than %d' %(Value, Size))
|
||||
return Value, 4
|
||||
if Value.startswith('UINT64') and Value.endswith(')'):
|
||||
if Value.startswith(TAB_UINT64) and Value.endswith(')'):
|
||||
Value, Size = ParseFieldValue(Value.split('(', 1)[1][:-1])
|
||||
if Size > 8:
|
||||
raise BadExpression('Value (%s) Size larger than %d' % (Value, Size))
|
||||
|
@ -1490,7 +1490,7 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
|
|||
elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD):
|
||||
VpdOffset = FieldList[0]
|
||||
Value = Size = ''
|
||||
if not DataType == 'VOID*':
|
||||
if not DataType == TAB_VOID:
|
||||
if len(FieldList) > 1:
|
||||
Value = FieldList[1]
|
||||
else:
|
||||
|
@ -1558,7 +1558,7 @@ def AnalyzePcdData(Setting):
|
|||
# For PCD value setting
|
||||
#
|
||||
def CheckPcdDatum(Type, Value):
|
||||
if Type == "VOID*":
|
||||
if Type == TAB_VOID:
|
||||
ValueRe = re.compile(r'\s*L?\".*\"\s*$')
|
||||
if not (((Value.startswith('L"') or Value.startswith('"')) and Value.endswith('"'))
|
||||
or (Value.startswith('{') and Value.endswith('}')) or (Value.startswith("L'") or Value.startswith("'") and Value.endswith("'"))
|
||||
|
|
|
@ -94,11 +94,11 @@ class VpdInfoFile:
|
|||
if not (Offset >= 0 or Offset == "*"):
|
||||
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID, "Invalid offset parameter: %s." % Offset)
|
||||
|
||||
if Vpd.DatumType == "VOID*":
|
||||
if Vpd.DatumType == TAB_VOID:
|
||||
if Vpd.MaxDatumSize <= 0:
|
||||
EdkLogger.error("VpdInfoFile", BuildToolError.PARAMETER_INVALID,
|
||||
"Invalid max datum size for VPD PCD %s.%s" % (Vpd.TokenSpaceGuidCName, Vpd.TokenCName))
|
||||
elif Vpd.DatumType in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64"]:
|
||||
elif Vpd.DatumType in TAB_PCD_NUMERIC_TYPES:
|
||||
if Vpd.MaxDatumSize is None or Vpd.MaxDatumSize == "":
|
||||
Vpd.MaxDatumSize = MAX_SIZE_TYPE[Vpd.DatumType]
|
||||
else:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# This file is used to parse meta files
|
||||
#
|
||||
# Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2008 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
|
@ -1433,7 +1433,7 @@ class DscParser(MetaFileParser):
|
|||
#
|
||||
# PCD value can be an expression
|
||||
#
|
||||
if len(ValueList) > 1 and ValueList[1] == 'VOID*':
|
||||
if len(ValueList) > 1 and ValueList[1] == TAB_VOID:
|
||||
PcdValue = ValueList[0]
|
||||
try:
|
||||
ValueList[0] = ValueExpression(PcdValue, self._Macros)(True)
|
||||
|
|
|
@ -1134,7 +1134,7 @@ class FdfParser:
|
|||
|
||||
@staticmethod
|
||||
def __Verify(Name, Value, Scope):
|
||||
if Scope in ['UINT64', 'UINT8']:
|
||||
if Scope in [TAB_UINT64, TAB_UINT8]:
|
||||
ValueNumber = 0
|
||||
try:
|
||||
ValueNumber = int (Value, 0)
|
||||
|
@ -1142,10 +1142,10 @@ class FdfParser:
|
|||
EdkLogger.error("FdfParser", FORMAT_INVALID, "The value is not valid dec or hex number for %s." % Name)
|
||||
if ValueNumber < 0:
|
||||
EdkLogger.error("FdfParser", FORMAT_INVALID, "The value can't be set to negative value for %s." % Name)
|
||||
if Scope == 'UINT64':
|
||||
if Scope == TAB_UINT64:
|
||||
if ValueNumber >= 0x10000000000000000:
|
||||
EdkLogger.error("FdfParser", FORMAT_INVALID, "Too large value for %s." % Name)
|
||||
if Scope == 'UINT8':
|
||||
if Scope == TAB_UINT8:
|
||||
if ValueNumber >= 0x100:
|
||||
EdkLogger.error("FdfParser", FORMAT_INVALID, "Too large value for %s." % Name)
|
||||
return True
|
||||
|
|
|
@ -296,7 +296,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||
EdkLogger.error("GenFds", GENFDS_ERROR, 'PCD [%s.%s] Value "%s"' %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Pcd.DefaultValue),File=self.InfFileName)
|
||||
|
||||
# Check value, if value are equal, no need to patch
|
||||
if Pcd.DatumType == "VOID*":
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
if Pcd.InfDefaultValue == DefaultValue or DefaultValue in [None, '']:
|
||||
continue
|
||||
# Get the string size from FDF or DSC
|
||||
|
@ -326,7 +326,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
|||
except:
|
||||
continue
|
||||
# Check the Pcd size and data type
|
||||
if Pcd.DatumType == "VOID*":
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
if int(MaxDatumSize) > int(Pcd.MaxDatumSize):
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "The size of VOID* type PCD '%s.%s' exceeds its maximum size %d bytes." \
|
||||
% (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, int(MaxDatumSize) - int(Pcd.MaxDatumSize)))
|
||||
|
|
|
@ -811,7 +811,7 @@ class GenFdsGlobalVariable:
|
|||
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
|
||||
if PcdObj.Type != 'FixedAtBuild':
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
|
||||
if PcdObj.DatumType != 'VOID*':
|
||||
if PcdObj.DatumType != DataType.TAB_VOID:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
|
||||
|
||||
PcdValue = PcdObj.DefaultValue
|
||||
|
@ -827,7 +827,7 @@ class GenFdsGlobalVariable:
|
|||
if (PcdObj.TokenCName == TokenCName) and (PcdObj.TokenSpaceGuidCName == TokenSpace):
|
||||
if PcdObj.Type != 'FixedAtBuild':
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)
|
||||
if PcdObj.DatumType != 'VOID*':
|
||||
if PcdObj.DatumType != DataType.TAB_VOID:
|
||||
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)
|
||||
|
||||
PcdValue = PcdObj.DefaultValue
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## @file
|
||||
# Patch value into the binary file.
|
||||
#
|
||||
# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
|
@ -25,6 +25,7 @@ from Common.BuildToolError import *
|
|||
import Common.EdkLogger as EdkLogger
|
||||
from Common.BuildVersion import gBUILD_VERSION
|
||||
import array
|
||||
from Common.DataType import *
|
||||
|
||||
# Version and Copyright
|
||||
__version_number__ = ("0.10" + " " + gBUILD_VERSION)
|
||||
|
@ -62,15 +63,15 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
|||
ValueLength = 0
|
||||
if TypeName == 'BOOLEAN':
|
||||
ValueLength = 1
|
||||
elif TypeName == 'UINT8':
|
||||
elif TypeName == TAB_UINT8:
|
||||
ValueLength = 1
|
||||
elif TypeName == 'UINT16':
|
||||
elif TypeName == TAB_UINT16:
|
||||
ValueLength = 2
|
||||
elif TypeName == 'UINT32':
|
||||
elif TypeName == TAB_UINT32:
|
||||
ValueLength = 4
|
||||
elif TypeName == 'UINT64':
|
||||
elif TypeName == TAB_UINT64:
|
||||
ValueLength = 8
|
||||
elif TypeName == 'VOID*':
|
||||
elif TypeName == TAB_VOID:
|
||||
if MaxSize == 0:
|
||||
return OPTION_MISSING, "PcdMaxSize is not specified for VOID* type PCD."
|
||||
ValueLength = int(MaxSize)
|
||||
|
@ -119,7 +120,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
|||
# Set PCD value into binary data
|
||||
#
|
||||
ByteList[ValueOffset] = ValueNumber
|
||||
elif TypeName in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
|
||||
elif TypeName in TAB_PCD_CLEAN_NUMERIC_TYPES:
|
||||
#
|
||||
# Get PCD value for UINT* data type
|
||||
#
|
||||
|
@ -133,7 +134,7 @@ def PatchBinaryFile(FileName, ValueOffset, TypeName, ValueString, MaxSize=0):
|
|||
for Index in range(ValueLength):
|
||||
ByteList[ValueOffset + Index] = ValueNumber % 0x100
|
||||
ValueNumber = ValueNumber / 0x100
|
||||
elif TypeName == 'VOID*':
|
||||
elif TypeName == TAB_VOID:
|
||||
ValueString = SavedStr
|
||||
if ValueString.startswith('L"'):
|
||||
#
|
||||
|
@ -264,10 +265,10 @@ def Main():
|
|||
if CommandOptions.PcdOffset is None or CommandOptions.PcdValue is None or CommandOptions.PcdTypeName is None:
|
||||
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdOffset or PcdValue of PcdTypeName is not specified.")
|
||||
return 1
|
||||
if CommandOptions.PcdTypeName.upper() not in ["BOOLEAN", "UINT8", "UINT16", "UINT32", "UINT64", "VOID*"]:
|
||||
if CommandOptions.PcdTypeName.upper() not in TAB_PCD_NUMERIC_TYPES_VOID:
|
||||
EdkLogger.error("PatchPcdValue", PARAMETER_INVALID, ExtraData="PCD type %s is not valid." % (CommandOptions.PcdTypeName))
|
||||
return 1
|
||||
if CommandOptions.PcdTypeName.upper() == "VOID*" and CommandOptions.PcdMaxSize is None:
|
||||
if CommandOptions.PcdTypeName.upper() == TAB_VOID and CommandOptions.PcdMaxSize is None:
|
||||
EdkLogger.error("PatchPcdValue", OPTION_MISSING, ExtraData="PcdMaxSize is not specified for VOID* type PCD.")
|
||||
return 1
|
||||
#
|
||||
|
|
|
@ -41,13 +41,7 @@ from Common.Misc import SaveFileOnChange
|
|||
from Workspace.BuildClassObject import PlatformBuildClassObject, StructurePcd, PcdClassObject, ModuleBuildClassObject
|
||||
from collections import OrderedDict
|
||||
|
||||
#
|
||||
# Treat CHAR16 as a synonym for UINT16. CHAR16 support is required for VFR C structs
|
||||
#
|
||||
PcdValueInitName = 'PcdValueInit'
|
||||
PcdSupportedBaseTypes = ['BOOLEAN', 'UINT8', 'UINT16', 'UINT32', 'UINT64', 'CHAR16']
|
||||
PcdSupportedBaseTypeWidth = {'BOOLEAN':8, 'UINT8':8, 'UINT16':16, 'UINT32':32, 'UINT64':64}
|
||||
PcdUnsupportedBaseTypes = ['INT8', 'INT16', 'INT32', 'INT64', 'CHAR8', 'UINTN', 'INTN', 'VOID']
|
||||
|
||||
PcdMainCHeader = '''
|
||||
/**
|
||||
|
@ -1057,7 +1051,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
TokenCName += '.' + FieldName
|
||||
if PcdValue.startswith('H'):
|
||||
if FieldName and IsFieldValueAnArray(PcdValue[1:]):
|
||||
PcdDatumType = 'VOID*'
|
||||
PcdDatumType = TAB_VOID
|
||||
IsArray = True
|
||||
if FieldName and not IsArray:
|
||||
return PcdValue
|
||||
|
@ -1068,7 +1062,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
(TokenSpaceGuidCName, TokenCName, PcdValue, Value))
|
||||
elif PcdValue.startswith("L'") or PcdValue.startswith("'"):
|
||||
if FieldName and IsFieldValueAnArray(PcdValue):
|
||||
PcdDatumType = 'VOID*'
|
||||
PcdDatumType = TAB_VOID
|
||||
IsArray = True
|
||||
if FieldName and not IsArray:
|
||||
return PcdValue
|
||||
|
@ -1080,7 +1074,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
elif PcdValue.startswith('L'):
|
||||
PcdValue = 'L"' + PcdValue[1:] + '"'
|
||||
if FieldName and IsFieldValueAnArray(PcdValue):
|
||||
PcdDatumType = 'VOID*'
|
||||
PcdDatumType = TAB_VOID
|
||||
IsArray = True
|
||||
if FieldName and not IsArray:
|
||||
return PcdValue
|
||||
|
@ -1095,7 +1089,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
if PcdValue.upper() == 'TRUE':
|
||||
PcdValue = str(1)
|
||||
if not FieldName:
|
||||
if PcdDatumType not in ['UINT8','UINT16','UINT32','UINT64','BOOLEAN']:
|
||||
if PcdDatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
PcdValue = '"' + PcdValue + '"'
|
||||
else:
|
||||
IsArray = False
|
||||
|
@ -1107,7 +1101,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
except:
|
||||
PcdValue = '"' + PcdValue + '"'
|
||||
if IsFieldValueAnArray(PcdValue):
|
||||
PcdDatumType = 'VOID*'
|
||||
PcdDatumType = TAB_VOID
|
||||
IsArray = True
|
||||
if not IsArray:
|
||||
return PcdValue
|
||||
|
@ -1246,7 +1240,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
for defaultstore in SkuInfo.DefaultStoreDict:
|
||||
SkuInfo.DefaultStoreDict[defaultstore] = NoFiledValues[(Pcd.TokenSpaceGuidCName,Pcd.TokenCName)][0]
|
||||
if Pcd.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII], self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII]]:
|
||||
if Pcd.DatumType == "VOID*":
|
||||
if Pcd.DatumType == TAB_VOID:
|
||||
if not Pcd.MaxDatumSize:
|
||||
Pcd.MaxDatumSize = '0'
|
||||
CurrentSize = int(Pcd.MaxDatumSize,16) if Pcd.MaxDatumSize.upper().startswith("0X") else int(Pcd.MaxDatumSize)
|
||||
|
@ -1568,7 +1562,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])
|
||||
if IsArray and not (FieldList[FieldName.strip(".")][0].startswith('{GUID') and FieldList[FieldName.strip(".")][0].endswith('}')):
|
||||
try:
|
||||
Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], "VOID*", self._GuidDict)(True)
|
||||
Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
|
||||
|
@ -1598,7 +1592,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(FieldList[FieldName.strip(".")][0])
|
||||
if IsArray and not (FieldList[FieldName.strip(".")][0].startswith('{GUID') and FieldList[FieldName.strip(".")][0].endswith('}')):
|
||||
try:
|
||||
Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], "VOID*", self._GuidDict)(True)
|
||||
Value = ValueExpressionEx(FieldList[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), FieldList[FieldName.strip(".")][1], FieldList[FieldName.strip(".")][2]))
|
||||
|
@ -1622,7 +1616,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0])
|
||||
if IsArray and not (Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0].startswith('{GUID') and Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0].endswith('}')):
|
||||
try:
|
||||
Value = ValueExpressionEx(Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0], "VOID*", self._GuidDict)(True)
|
||||
Value = ValueExpressionEx(Pcd.PcdFieldValueFromComm[FieldName.strip(".")][0], TAB_VOID, self._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName.strip('.'))), Pcd.PcdFieldValueFromComm[FieldName.strip(".")][1], Pcd.PcdFieldValueFromComm[FieldName.strip(".")][2]))
|
||||
|
@ -1658,7 +1652,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(Pcd.DefaultValueFromDec)
|
||||
if IsArray:
|
||||
try:
|
||||
DefaultValueFromDec = ValueExpressionEx(Pcd.DefaultValueFromDec, "VOID*")(True)
|
||||
DefaultValueFromDec = ValueExpressionEx(Pcd.DefaultValueFromDec, TAB_VOID)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DEC: %s" %
|
||||
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, DefaultValueFromDec))
|
||||
|
@ -1679,7 +1673,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(FieldList[FieldName][0])
|
||||
if IsArray:
|
||||
try:
|
||||
FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
|
||||
FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1],FieldList[FieldName][2]))
|
||||
|
@ -1732,7 +1726,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(FieldList)
|
||||
if IsArray:
|
||||
try:
|
||||
FieldList = ValueExpressionEx(FieldList, "VOID*")(True)
|
||||
FieldList = ValueExpressionEx(FieldList, TAB_VOID)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from DSC: %s" %
|
||||
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
|
||||
|
@ -1762,7 +1756,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(FieldList[FieldName][0])
|
||||
if IsArray:
|
||||
try:
|
||||
FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
|
||||
FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
|
||||
|
@ -1806,7 +1800,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(FieldList)
|
||||
if IsArray:
|
||||
try:
|
||||
FieldList = ValueExpressionEx(FieldList, "VOID*")(True)
|
||||
FieldList = ValueExpressionEx(FieldList, TAB_VOID)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error("Build", FORMAT_INVALID, "Invalid value format for %s.%s, from Command: %s" %
|
||||
(Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldList))
|
||||
|
@ -1825,7 +1819,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
IsArray = IsFieldValueAnArray(FieldList[FieldName][0])
|
||||
if IsArray:
|
||||
try:
|
||||
FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], "VOID*", self._GuidDict)(True)
|
||||
FieldList[FieldName][0] = ValueExpressionEx(FieldList[FieldName][0], TAB_VOID, self._GuidDict)(True)
|
||||
except BadExpression:
|
||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
|
||||
|
@ -2497,7 +2491,7 @@ class DscBuildData(PlatformBuildClassObject):
|
|||
MaxSize = int(pcd.MaxDatumSize, 0)
|
||||
else:
|
||||
MaxSize = 0
|
||||
if pcd.DatumType not in ['BOOLEAN','UINT8','UINT16','UINT32','UINT64']:
|
||||
if pcd.DatumType not in TAB_PCD_NUMERIC_TYPES:
|
||||
for (_, skuobj) in pcd.SkuInfoList.items():
|
||||
datalen = 0
|
||||
skuobj.HiiDefaultValue = StringToArray(skuobj.HiiDefaultValue)
|
||||
|
|
|
@ -1007,7 +1007,7 @@ class PcdReport(object):
|
|||
First = False
|
||||
|
||||
|
||||
if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
|
||||
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
|
||||
PcdValueNumber = int(PcdValue.strip(), 0)
|
||||
if DecDefaultValue is None:
|
||||
DecMatch = True
|
||||
|
@ -1112,7 +1112,7 @@ class PcdReport(object):
|
|||
ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {})
|
||||
for ModulePath in ModuleOverride:
|
||||
ModuleDefault = ModuleOverride[ModulePath]
|
||||
if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
|
||||
if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
|
||||
ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0)
|
||||
Match = (ModulePcdDefaultValueNumber == PcdValueNumber)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue