summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/AutoGen/GenVar.py
diff options
context:
space:
mode:
authorCarsey, Jaben <jaben.carsey@intel.com>2018-04-28 01:32:48 +0300
committerYonghong Zhu <yonghong.zhu@intel.com>2018-05-04 08:07:34 +0300
commitd0a0c52c221e5dcf82f24d4346c1cf52109d6dfb (patch)
tree093b255c1d0235ab8cbbea57be4ccbd0a37fecff /BaseTools/Source/Python/AutoGen/GenVar.py
parent31ff1c443e25d6bff758bdcd9a248a907cff651b (diff)
downloadedk2-d0a0c52c221e5dcf82f24d4346c1cf52109d6dfb.tar.xz
BaseTools: standardize GUID and pack size
currently GUID packing and pack size determination is spread throughout the code. This introduces a shared function and dict and routes all code paths through them. 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>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenVar.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenVar.py25
1 files changed, 1 insertions, 24 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index e3595bb623..5660cf1348 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -26,22 +26,6 @@ var_info = collections.namedtuple("uefi_var", "pcdindex,pcdname,defaultstoragena
NvStorageHeaderSize = 28
VariableHeaderSize = 32
-def PackGUID(Guid):
- GuidBuffer = pack('=LHHBBBBBBBB',
- int(Guid[0], 16),
- int(Guid[1], 16),
- int(Guid[2], 16),
- int(Guid[3][-4:-2], 16),
- int(Guid[3][-2:], 16),
- int(Guid[4][-12:-10], 16),
- int(Guid[4][-10:-8], 16),
- int(Guid[4][-8:-6], 16),
- int(Guid[4][-6:-4], 16),
- int(Guid[4][-4:-2], 16),
- int(Guid[4][-2:], 16)
- )
- return GuidBuffer
-
class VariableMgr(object):
def __init__(self, DefaultStoreMap,SkuIdMap):
self.VarInfo = []
@@ -87,14 +71,7 @@ class VariableMgr(object):
data_type = item.data_type
value_list = item.default_value.strip("{").strip("}").split(",")
if data_type in DataType.TAB_PCD_NUMERIC_TYPES:
- if data_type == ["BOOLEAN", DataType.TAB_UINT8]:
- data_flag = "=B"
- elif data_type == DataType.TAB_UINT16:
- data_flag = "=H"
- elif data_type == DataType.TAB_UINT32:
- data_flag = "=L"
- elif data_type == DataType.TAB_UINT64:
- data_flag = "=Q"
+ data_flag = DataType.PACK_CODE_BY_SIZE[MAX_SIZE_TYPE[data_type]]
data = value_list[0]
value_list = []
for data_byte in pack(data_flag,int(data,16) if data.upper().startswith('0X') else int(data)):