diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc index 07378920d8..a7d91a4753 100644 --- a/src/arch/x86/Makefile.inc +++ b/src/arch/x86/Makefile.inc @@ -91,6 +91,7 @@ else $(eval $(call early_x86_stage,bootblock,elf64-x86-64)) endif +$(call src-to-obj,bootblock,$(dir)/walkcbfs.S): $(obj)/fmap_config.h bootblock-y += walkcbfs.S endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64 diff --git a/src/arch/x86/walkcbfs.S b/src/arch/x86/walkcbfs.S index 393bcf54ed..4608e2c12a 100644 --- a/src/arch/x86/walkcbfs.S +++ b/src/arch/x86/walkcbfs.S @@ -1,13 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#define CBFS_HEADER_PTR 0xfffffffc - -#define CBFS_HEADER_MAGIC 0 -#define CBFS_HEADER_VERSION (CBFS_HEADER_MAGIC + 4) -#define CBFS_HEADER_ROMSIZE (CBFS_HEADER_VERSION + 4) -#define CBFS_HEADER_BOOTBLOCKSIZE (CBFS_HEADER_ROMSIZE + 4) -#define CBFS_HEADER_ALIGN (CBFS_HEADER_BOOTBLOCKSIZE + 4) -#define CBFS_HEADER_OFFSET (CBFS_HEADER_ALIGN + 4) +#include /* we use this instead of CBFS_HEADER_ALIGN because the latter is retired. */ #define CBFS_ALIGNMENT 64 @@ -33,14 +26,7 @@ walkcbfs_asm: cld - mov CBFS_HEADER_PTR, %eax - mov CBFS_HEADER_ROMSIZE(%eax), %ecx - bswap %ecx - mov $0, %ebx - sub %ecx, %ebx /* ROM base address in ebx */ - mov CBFS_HEADER_OFFSET(%eax), %ecx - bswap %ecx - add %ecx, %ebx /* address where we start looking for LARCHIVEs */ + movl $FMAP_SECTION_COREBOOT_START, %ebx /* determine filename length */ mov $0, %eax @@ -96,17 +82,11 @@ tryharder: mov %ecx, %ebx check_for_exit: - /* look if we should exit: did we pass into the bootblock already? */ - mov CBFS_HEADER_PTR, %ecx - mov CBFS_HEADER_BOOTBLOCKSIZE(%ecx), %ecx - bswap %ecx - not %ecx - add $1, %ecx + /* if addr <= COREBOOT_END - 1, continue */ +#define FMAP_SECTION_COREBOOT_END (FMAP_SECTION_COREBOOT_START - 1 + FMAP_SECTION_COREBOOT_SIZE) + movl $FMAP_SECTION_COREBOOT_END, %ecx cmp %ecx, %ebx - /* if bootblockstart >= addr (==we're still in the data area), - * jump back - */ jbe walker out: