From f2b710430879765c4238730d7270c94e08573883 Mon Sep 17 00:00:00 2001 From: Arthur Heymans Date: Wed, 19 May 2021 15:40:10 +0200 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/54680 Reviewed-by: Rizwan Qureshi Reviewed-by: Meera Ravindranath Tested-by: build bot (Jenkins) --- util/cbfstool/fit.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/util/cbfstool/fit.c b/util/cbfstool/fit.c index da931432e9..89b0fd28d9 100644 --- a/util/cbfstool/fit.c +++ b/util/cbfstool/fit.c @@ -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; }