commonlib: Handle DIR64 relocation type in FSP relocation code

It seems fixup or adjustment addition for relocation type
EFI_IMAGE_REL_BASED_DIR64 is missing in the fsp rebasing code. The
patch address the miss. Without extending the fixup for the relocation
type, build system throws warnings during the rebasing of FSP-M and
FSP-S blobs which are built with 64bit.

Portion of build output containing warning with debug enabled cbfs lib:
...................................................
E: file offset: 9218
E: file type = 4
E: file attribs = 0
E: section offset: 9230
E: section type: 12
E: TE image at offset 9234
E: TE Image 0xffed80d4 -> 0xff256234 adjust value: ff37e000
E: Relocs for RVA offset 12000
E: Num relocs in block: 18
E: reloc type a offset f40
E: Unknown reloc type: a

Portion of build output after fix:
..................................
E: file offset: 9218
E: file type = 4
E: file attribs = 0
E: section offset: 9230
E: section type: 12
E: TE image at offset 9234
E: TE Image 0xffed80d4 -> 0xff256234 adjust value: ff37e000
E: Relocs for RVA offset 12000^M
E: Num relocs in block: 18
E: reloc type a offset f40
E: Adjusting 0x7f2e7f377024 ffee9192 -> ff267192
E: reloc type a offset f48

TEST: Integrate FSP blobs built with 64 bit and do boot test.

Signed-off-by: Sridhar Siricilla <sridhar.siricilla@intel.com>
Change-Id: I894007ec50378357c00d635ec86d044710892aab
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65383
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
Sridhar Siricilla 2022-06-25 16:30:52 +05:30 committed by Felix Held
parent 9dbf9689c9
commit 5902d88264
1 changed files with 2 additions and 1 deletions

View File

@ -170,7 +170,8 @@ static int te_relocate(uintptr_t new_addr, void *te)
printk(FSP_DBG_LVL, "reloc type %x offset %zx\n",
type, offset);
if (type == EFI_IMAGE_REL_BASED_HIGHLOW) {
if (type == EFI_IMAGE_REL_BASED_HIGHLOW ||
type == EFI_IMAGE_REL_BASED_DIR64) {
uint32_t *reloc_addr;
uint32_t val;