coreboot-kgpe-d16/src/lib/master_header_pointer.c
Arthur Heymans e8217b11f1 Kconfig: Add an option to skip adding a cbfs bootblock on x86
Some targets don't need this as the bootblock is loaded differently.

Change-Id: Ia42448f7e9dd0635c72857fbc1fab54508932721
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/63377
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
2022-05-12 11:12:21 +00:00

21 lines
647 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
#include <commonlib/bsd/cbfs_serialized.h>
#include <endian.h>
#include <fmap_config.h>
#include <stdint.h>
#if CONFIG(BOOTBLOCK_IN_CBFS)
__attribute__((used, __section__(".header_pointer")))
#endif
#if FMAP_SECTION_COREBOOT_START < (0xffffffff - CONFIG_ROM_SIZE + 1)
#define COREBOOT_CBFS_START (0xffffffff - CONFIG_ROM_SIZE + 1 + FMAP_SECTION_COREBOOT_START)
#else
#define COREBOOT_CBFS_START FMAP_SECTION_COREBOOT_START
#endif
uint32_t header_pointer =
cpu_to_le32(COREBOOT_CBFS_START + ALIGN_UP(sizeof(struct cbfs_file)
+ sizeof("cbfs_master_header"),
CBFS_ATTRIBUTE_ALIGN));