Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/63598 )
Change subject: util/apcb/apcb_v3_edit.py: Edit APCB based on different SPD magic ......................................................................
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 --- M util/apcb/apcb_v3_edit.py 1 file changed, 14 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Raul Rangel: Looks good to me, approved Rob Barnes: Looks good to me, approved
diff --git a/util/apcb/apcb_v3_edit.py b/util/apcb/apcb_v3_edit.py index 9a70bac..140b232 100755 --- a/util/apcb/apcb_v3_edit.py +++ b/util/apcb/apcb_v3_edit.py @@ -14,8 +14,10 @@ # 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 @@ '--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 main(): + spd_magic = LP4_SPD_MAGIC + args = parseargs()
print(f'Reading input APCB from {args.apcb_in}') @@ -75,6 +84,9 @@
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 @@ 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