util/cbfstool/fit.c: Fix getting the topswap table

There is a function to fetch the fit table at both the regular address
and the TS address. So reuse that function instead of attempting to
find the TS fit using some pointer aritmetics that is incorrect.

Change-Id: I9114f5439202ede7e01cd0fcbb1e3c4cdb8698b0
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/54680
Reviewed-by: Rizwan Qureshi <rizwan.qureshi@intel.com>
Reviewed-by: Meera Ravindranath <meera.ravindranath@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Arthur Heymans 2021-05-19 15:40:10 +02:00 committed by Werner Zeh
parent 3164b645ab
commit f2b7104308
1 changed files with 1 additions and 13 deletions

View File

@ -561,7 +561,7 @@ struct fit_table *fit_get_table(struct buffer *bootblock,
uint32_t topswap_size)
{
struct fit_table *fit;
uint32_t *fit_pointer = get_fit_ptr(bootblock, offset_fn, 0);
uint32_t *fit_pointer = get_fit_ptr(bootblock, offset_fn, topswap_size);
/* Ensure pointer is below 4GiB and within 16MiB of 4GiB */
if (fit_pointer[1] != 0 || fit_pointer[0] < FIT_TABLE_LOWEST_ADDRESS) {
@ -576,18 +576,6 @@ struct fit_table *fit_get_table(struct buffer *bootblock,
return NULL;
}
if (topswap_size) {
struct fit_table *fit2 = (struct fit_table *)((uintptr_t)fit -
topswap_size);
if (!fit_table_verified(fit2)) {
ERROR("second FIT is invalid\n");
return NULL;
}
fit = fit2;
}
DEBUG("Operating on table (0x%x)\n", *fit_pointer - topswap_size);
return fit;
}