From 0424a2c59fb28201494aa97a17f873c23645ddfd Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Tue, 22 Jun 2021 11:14:24 +0200 Subject: [PATCH] util/ifdtool: Fix printing or setting PCH straps When printing or setting the PCH straps use the PSL directly instead of multiplying it by 4. Change-Id: Ia91697fdf0c6d80502e8611b259c444f39c6cd57 Signed-off-by: Arthur Heymans Reviewed-on: https://review.coreboot.org/c/coreboot/+/55753 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/ifdtool/ifdtool.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c index bc62b4859f..e97efcc206 100644 --- a/util/ifdtool/ifdtool.c +++ b/util/ifdtool/ifdtool.c @@ -700,11 +700,11 @@ static void dump_fcba(const fcba_t *fcba, const fpsba_t *fpsba) static void dump_fpsba(const fdbar_t *fdb, const fpsba_t *fpsba) { unsigned int i; - /* SoC Strap Length, aka PSL, aka ISL */ - unsigned int SSL = ((fdb->flmap1 >> 24) & 0xff) * sizeof(uint32_t); + /* SoC Straps, aka PSL, aka ISL */ + unsigned int SS = (fdb->flmap1 >> 24) & 0xff; printf("Found PCH Strap Section\n"); - for (i = 0; i < SSL; i++) + for (i = 0; i < SS; i++) printf("PCHSTRP%-3u: 0x%08x\n", i, fpsba->pchstrp[i]); if (ifd_version >= IFD_VERSION_2) { @@ -1362,10 +1362,10 @@ static void set_pchstrap(fpsba_t *fpsba, const fdbar_t *fdb, const int strap, exit(EXIT_FAILURE); } - /* SoC Strap Length, aka PSL, aka ISL */ - int SSL = ((fdb->flmap1 >> 24) & 0xff) * sizeof(uint32_t); - if (strap >= SSL) { - fprintf(stderr, "Strap index %d out of range (max: %d)\n", strap, SSL); + /* SoC Strap, aka PSL, aka ISL */ + int SS = (fdb->flmap1 >> 24) & 0xff; + if (strap >= SS) { + fprintf(stderr, "Strap index %d out of range (max: %d)\n", strap, SS); exit(EXIT_FAILURE); } fpsba->pchstrp[strap] = value;