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:
committed by
Yonghong Zhu
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
|
||||
|
Reference in New Issue
Block a user