summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen/GenVar.py
diff options
context:
space:
mode:
authorFeng, Bob C <bob.c.feng@intel.com>2018-02-07 10:01:59 +0800
committerLiming Gao <liming.gao@intel.com>2018-02-08 11:09:42 +0800
commit8aa4db4b807ea7de395acd4018a139745327e374 (patch)
tree4dda3b284ed27dd946e5dc0a9793cb3862540334 /BaseTools/Source/Python/AutoGen/GenVar.py
parentc60d751b73108e6b1ffe94722ef3efcdbcf3151c (diff)
downloadedk2-8aa4db4b807ea7de395acd4018a139745327e374.tar.gz
edk2-8aa4db4b807ea7de395acd4018a139745327e374.tar.bz2
edk2-8aa4db4b807ea7de395acd4018a139745327e374.zip
BaseTool: Fixed Pcd issues.
1. Check variable offset when merging Hii Pcds 2. Fixed the issue of Hii value inherit with default store. 3. Error handling for incorrect structure pcd declare. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenVar.py')
-rw-r--r--BaseTools/Source/Python/AutoGen/GenVar.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/Python/AutoGen/GenVar.py
index 1389d7ff62..d222e6ed5e 100644
--- a/BaseTools/Source/Python/AutoGen/GenVar.py
+++ b/BaseTools/Source/Python/AutoGen/GenVar.py
@@ -104,10 +104,27 @@ class VariableMgr(object):
for data_byte in pack(data_flag,int(data,16) if data.upper().startswith('0X') else int(data)):
value_list += [hex(unpack("B",data_byte)[0])]
newvalue[int(item.var_offset,16) if item.var_offset.upper().startswith("0X") else int(item.var_offset)] = value_list
- newvaluestr = "{" + ",".join(reduce(lambda x,y: x+y, [newvalue[k] for k in sorted(newvalue.keys())] )) +"}"
+ try:
+ newvaluestr = "{" + ",".join(self.assemble_variable(newvalue)) +"}"
+ 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*")]
self.VarInfo = [item[0] for item in indexedvarinfo.values()]
+
+ def assemble_variable(self, valuelist):
+ ordered_value = [valuelist[k] for k in sorted(valuelist.keys())]
+ ordered_offset = sorted(valuelist.keys())
+ var_value = []
+ num = 0
+ for offset in ordered_offset:
+ if offset < len(var_value):
+ raise
+ for _ in xrange(offset - len(var_value)):
+ var_value.append('0x00')
+ var_value += ordered_value[num]
+ num +=1
+ return var_value
def process_variable_data(self):
var_data = dict()