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>
This commit is contained in:
Arthur Heymans 2021-06-22 11:14:24 +02:00 committed by Felix Held
parent 7ea7986963
commit 0424a2c59f
1 changed files with 7 additions and 7 deletions

View File

@ -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;