summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthikeyan Ramasubramanian <kramasub@google.com>2022-04-12 16:54:34 -0600
committerFelix Held <felix-coreboot@felixheld.de>2022-04-14 22:24:09 +0000
commit4bdc2320a48cd2131fcf7fb3395a2b21002340db (patch)
tree886ef3ba1123fc107fa383d7bade37f6830295bd
parent58d75f80b41bc372597aa83948252156a66635ad (diff)
util/apcb/apcb_v3_edit.py: Edit APCB based on different SPD magic
APCB edit tool edits APCBs with LP4 specific SPDs. Introduce an option to support different SPD magic so that the tool can be used to edit APCBs with LP5 specific SPDs. BUG=None TEST=Build Skyrim board with LP5 specific SPDs. Build Guybrush board with LP4 specific SPDs. Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Change-Id: I8e96c89e4e5ce8e0567a17bf7685b69080fa1708 Reviewed-on: https://review.coreboot.org/c/coreboot/+/63598 Reviewed-by: Raul Rangel <rrangel@chromium.org> Reviewed-by: Rob Barnes <robbarnes@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rwxr-xr-xutil/apcb/apcb_v3_edit.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/util/apcb/apcb_v3_edit.py b/util/apcb/apcb_v3_edit.py
index 9a70bace3e..140b23238c 100755
--- a/util/apcb/apcb_v3_edit.py
+++ b/util/apcb/apcb_v3_edit.py
@@ -14,8 +14,10 @@ import os
# Byte 0 = 0x23 = 512 bytes total / 384 bytes used
# Byte 1 = 0x11 = Revision 1.1
# Byte 2 = 0x11 = LPDDR4X SDRAM
+# = 0x13 = LP5 SDRAM
# Byte 3 = 0x0E = Non-DIMM Solution
-SPD_MAGIC = bytes.fromhex('2311110E')
+LP4_SPD_MAGIC = bytes.fromhex('2311110E')
+LP5_SPD_MAGIC = bytes.fromhex('2311130E')
EMPTY_SPD = b'\x00' * 512
spd_ssp_struct_fmt = '??B?IIBBBxIIBBBx'
@@ -47,6 +49,11 @@ def parseargs():
'--spd_sources',
nargs='+',
help='List of SPD sources')
+ parser.add_argument(
+ '--mem_type',
+ type=str,
+ default='lp4',
+ help='Memory type [lp4|lp5]. Default = lp4')
return parser.parse_args()
@@ -62,6 +69,8 @@ def inject(orig, insert, offset):
def main():
+ spd_magic = LP4_SPD_MAGIC
+
args = parseargs()
print(f'Reading input APCB from {args.apcb_in}')
@@ -75,6 +84,9 @@ def main():
print(f'Using SPD Sources = {args.spd_sources}')
+ if args.mem_type == 'lp5':
+ spd_magic = LP5_SPD_MAGIC
+
spds = []
for spd_source in args.spd_sources:
with open(spd_source, 'rb') as f:
@@ -85,7 +97,7 @@ def main():
spd_offset = 0
instance = 0
while True:
- spd_offset = apcb.find(SPD_MAGIC, spd_offset)
+ spd_offset = apcb.find(spd_magic, spd_offset)
if spd_offset < 0:
print('No more SPD magic numbers in APCB')
break