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 <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55753
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
diff --git a/util/ifdtool/ifdtool.c b/util/ifdtool/ifdtool.c
index bc62b48..e97efcc 100644
--- a/util/ifdtool/ifdtool.c
+++ b/util/ifdtool/ifdtool.c
@@ -700,11 +700,11 @@
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 @@
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;