+def UpdateMemSiUpdInitOffsetValue (DscFile):\r
+ DscFd = open(DscFile, "r")\r
+ DscLines = DscFd.readlines()\r
+ DscFd.close()\r
+\r
+ DscContent = []\r
+ MemUpdInitOffset = 0\r
+ SiUpdInitOffset = 0\r
+ MemUpdInitOffsetValue = 0\r
+ SiUpdInitOffsetValue = 0\r
+\r
+ while len(DscLines):\r
+ DscLine = DscLines.pop(0)\r
+ DscContent.append(DscLine)\r
+ DscLine = DscLine.strip()\r
+ Match = re.match("^([_a-zA-Z0-9]+).(MemoryInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)\r
+ if Match:\r
+ MemUpdInitOffsetValue = int(Match.group(5), 0)\r
+ Match = re.match("^\s*([_a-zA-Z0-9]+).(SiliconInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)\r
+ if Match:\r
+ SiUpdInitOffsetValue = int(Match.group(5), 0)\r
+ Match = re.match("^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(0x244450554D454D24)",DscLine)\r
+ if Match:\r
+ MemUpdInitOffset = int(Match.group(3), 0)\r
+ Match = re.match("^([_a-zA-Z0-9]+).([_a-zA-Z0-9]+)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(0x244450555F495324)",DscLine)\r
+ if Match:\r
+ SiUpdInitOffset = int(Match.group(3), 0)\r
+\r
+ if MemUpdInitOffsetValue != MemUpdInitOffset or SiUpdInitOffsetValue != SiUpdInitOffset:\r
+ MemUpdInitOffsetStr = "0x%08X" % MemUpdInitOffset\r
+ SiUpdInitOffsetStr = "0x%08X" % SiUpdInitOffset\r
+ DscFd = open(DscFile,"w")\r
+ for DscLine in DscContent:\r
+ Match = re.match("^\s*([_a-zA-Z0-9]+).(MemoryInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)\r
+ if Match:\r
+ DscLine = re.sub(r'(?:[^\s]+\s*$)', MemUpdInitOffsetStr + '\n', DscLine)\r
+ Match = re.match("^\s*([_a-zA-Z0-9]+).(SiliconInitUpdOffset)\s*\|\s*(0x[0-9A-F]+)\s*\|\s*(\d+|0x[0-9a-fA-F]+)\s*\|\s*(.+)",DscLine)\r
+ if Match:\r
+ DscLine = re.sub(r'(?:[^\s]+\s*$)', SiUpdInitOffsetStr + '\n', line)\r
+ DscFd.writelines(DscLine)\r
+ DscFd.close()\r
+\r