diff options
author | Arthur Heymans <arthur@aheymans.xyz> | 2021-05-04 08:46:58 +0200 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2021-05-06 14:34:51 +0000 |
commit | 50ece62d3c3c874108bfe089c8f5061423152a39 (patch) | |
tree | e87399c64e036dbac8b92de0ea511c9b6acce6d4 /src/arch/x86 | |
parent | a033d8c808faca13a80e59f5a6e2c2599b3dbbb8 (diff) |
arch/x86/walkcbfs.S: Use FMAP instead of "cbfs master header"
Tested on qemu/i440fx on X86_64:
- Page tables are found in cbfs (finding a file works)
- returns 0 when a file is not found
- works when there is no cbfs file at the start of the FMAP, e.g. with
the cbfs master header removed.
Change-Id: Ibab657cc40cd5c09c3a73c54950b98ac45a98dbf
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/52879
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/arch/x86')
-rw-r--r-- | src/arch/x86/Makefile.inc | 1 | ||||
-rw-r--r-- | src/arch/x86/walkcbfs.S | 30 |
2 files changed, 6 insertions, 25 deletions
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 <fmap_config.h> /* 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: |