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>
This commit is contained in:
parent
a033d8c808
commit
50ece62d3c
|
@ -91,6 +91,7 @@ else
|
||||||
$(eval $(call early_x86_stage,bootblock,elf64-x86-64))
|
$(eval $(call early_x86_stage,bootblock,elf64-x86-64))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
$(call src-to-obj,bootblock,$(dir)/walkcbfs.S): $(obj)/fmap_config.h
|
||||||
bootblock-y += walkcbfs.S
|
bootblock-y += walkcbfs.S
|
||||||
|
|
||||||
endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64
|
endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64
|
||||||
|
|
|
@ -1,13 +1,6 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
|
||||||
#define CBFS_HEADER_PTR 0xfffffffc
|
#include <fmap_config.h>
|
||||||
|
|
||||||
#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)
|
|
||||||
|
|
||||||
/* we use this instead of CBFS_HEADER_ALIGN because the latter is retired. */
|
/* we use this instead of CBFS_HEADER_ALIGN because the latter is retired. */
|
||||||
#define CBFS_ALIGNMENT 64
|
#define CBFS_ALIGNMENT 64
|
||||||
|
@ -33,14 +26,7 @@
|
||||||
walkcbfs_asm:
|
walkcbfs_asm:
|
||||||
cld
|
cld
|
||||||
|
|
||||||
mov CBFS_HEADER_PTR, %eax
|
movl $FMAP_SECTION_COREBOOT_START, %ebx
|
||||||
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 */
|
|
||||||
|
|
||||||
/* determine filename length */
|
/* determine filename length */
|
||||||
mov $0, %eax
|
mov $0, %eax
|
||||||
|
@ -96,17 +82,11 @@ tryharder:
|
||||||
mov %ecx, %ebx
|
mov %ecx, %ebx
|
||||||
|
|
||||||
check_for_exit:
|
check_for_exit:
|
||||||
/* look if we should exit: did we pass into the bootblock already? */
|
/* if addr <= COREBOOT_END - 1, continue */
|
||||||
mov CBFS_HEADER_PTR, %ecx
|
#define FMAP_SECTION_COREBOOT_END (FMAP_SECTION_COREBOOT_START - 1 + FMAP_SECTION_COREBOOT_SIZE)
|
||||||
mov CBFS_HEADER_BOOTBLOCKSIZE(%ecx), %ecx
|
|
||||||
bswap %ecx
|
|
||||||
not %ecx
|
|
||||||
add $1, %ecx
|
|
||||||
|
|
||||||
|
movl $FMAP_SECTION_COREBOOT_END, %ecx
|
||||||
cmp %ecx, %ebx
|
cmp %ecx, %ebx
|
||||||
/* if bootblockstart >= addr (==we're still in the data area),
|
|
||||||
* jump back
|
|
||||||
*/
|
|
||||||
jbe walker
|
jbe walker
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Reference in New Issue