Add a new option backend that uses values stored in CBFS files, similar to the SeaBIOS runtime config options stored in files with the etc/ prefix. Options should be stored in CBFS with the option/ prefix. Values can be set using `cbfstool coreboot.rom add-int -n option/<option-name> -i <value>`. For simplicity, options should be stored in the COREBOOT (RO) FMAP region, which is the default for cbfstool. This backend is not available in SMM due to CBFS dependencies on vboot functions which are not added to SMM, and thus the fallback will be returned by calls to get_uint_option() in SMM. Tested with QEMU Q35 by setting various options for "sata_mode" and observing the console output for the SATA controller mode during i82801ix_sata initialization. Change-Id: Ifc0439ee42f13f49ae54d4855d1d9333c39b01f5 Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/85905 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Jérémy Compostella <jeremy.compostella@intel.com>
31 lines
800 B
C
31 lines
800 B
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
|
|
#ifndef _OPTION_H_
|
|
#define _OPTION_H_
|
|
|
|
#include <types.h>
|
|
|
|
void sanitize_cmos(void);
|
|
|
|
/* The CBFS file option backend cannot be used in SMM due to vboot
|
|
* dependencies, which are not added to SMM */
|
|
#if CONFIG(OPTION_BACKEND_NONE) || (CONFIG(USE_CBFS_FILE_OPTION_BACKEND) && ENV_SMM)
|
|
|
|
static inline unsigned int get_uint_option(const char *name, const unsigned int fallback)
|
|
{
|
|
return fallback;
|
|
}
|
|
|
|
static inline enum cb_err set_uint_option(const char *name, unsigned int value)
|
|
{
|
|
return CB_CMOS_OTABLE_DISABLED;
|
|
}
|
|
|
|
#else /* !OPTION_BACKEND_NONE */
|
|
|
|
unsigned int get_uint_option(const char *name, const unsigned int fallback);
|
|
enum cb_err set_uint_option(const char *name, unsigned int value);
|
|
|
|
#endif /* OPTION_BACKEND_NONE? */
|
|
|
|
#endif /* _OPTION_H_ */
|