Attention is currently required from: Patrick Rudolph, Christian Walter. Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/54731 )
Change subject: mb/prodrive/hermes: Implement option API ......................................................................
mb/prodrive/hermes: Implement option API
The `power_state_after_g3` board setting in the EEPROM can be updated by the BMC. Implement the option API for `power_on_after_fail` using the EEPROM value. For simplicity, only implement reading values for now.
Change-Id: I6473a0a80346f7b7d69653e1cac19cd428a59ba0 Signed-off-by: Angel Pons th3fanbus@gmail.com --- M src/mainboard/prodrive/hermes/Kconfig M src/mainboard/prodrive/hermes/Makefile.inc A src/mainboard/prodrive/hermes/option.c 3 files changed, 47 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/31/54731/1
diff --git a/src/mainboard/prodrive/hermes/Kconfig b/src/mainboard/prodrive/hermes/Kconfig index ac497e6..ec29805 100644 --- a/src/mainboard/prodrive/hermes/Kconfig +++ b/src/mainboard/prodrive/hermes/Kconfig @@ -8,6 +8,7 @@ select SUPERIO_ASPEED_AST2400 select DRIVERS_ASPEED_AST_COMMON select DRIVERS_ASPEED_AST2050 + select HAVE_MAINBOARD_SPECIFIC_OPTION_BACKEND select INTEL_LPSS_UART_FOR_CONSOLE select MAINBOARD_HAS_TPM2 select MAINBOARD_HAS_LPC_TPM diff --git a/src/mainboard/prodrive/hermes/Makefile.inc b/src/mainboard/prodrive/hermes/Makefile.inc index 6f6a638..c72190b 100644 --- a/src/mainboard/prodrive/hermes/Makefile.inc +++ b/src/mainboard/prodrive/hermes/Makefile.inc @@ -5,11 +5,15 @@
bootblock-y += bootblock.c romstage-y += memory.c -romstage-y += eeprom.c
ramstage-y += ramstage.c ramstage-y += mainboard.c -ramstage-y += eeprom.c + +all-y += eeprom.c +smm-y += eeprom.c + +all-$(CONFIG_USE_MAINBOARD_SPECIFIC_OPTION_BACKEND) += option.c +smm-$(CONFIG_USE_MAINBOARD_SPECIFIC_OPTION_BACKEND) += option.c
ramstage-$(CONFIG_AZALIA_PLUGIN_SUPPORT) += variants/baseboard/hda_verb.c ramstage-$(CONFIG_AZALIA_PLUGIN_SUPPORT) += variants/r04/hda_verb.c diff --git a/src/mainboard/prodrive/hermes/option.c b/src/mainboard/prodrive/hermes/option.c new file mode 100644 index 0000000..3c924c3 --- /dev/null +++ b/src/mainboard/prodrive/hermes/option.c @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <console/console.h> +#include <intelblocks/pmclib.h> +#include <option.h> +#include <string.h> +#include <types.h> + +#include "variants/baseboard/include/eeprom.h" + +unsigned int get_uint_option(const char *name, const unsigned int fallback) +{ + if (!name) + return fallback; + + struct eeprom_board_settings *bs = get_board_settings(); + if (!bs) + return fallback; + + if (strcmp(name, "power_on_after_fail") == 0) { + /* Encoding: 0 -> S0, 1 -> S5 */ + switch (bs->power_state_after_g3) { + case 0: + return MAINBOARD_POWER_STATE_ON; + case 1: + return MAINBOARD_POWER_STATE_OFF; + default: + printk(BIOS_ERR, "Hermes: unhandled power_state_after_g3 value %u\n", + bs->power_state_after_g3); + return fallback; + } + } + return fallback; +} + +enum cb_err set_uint_option(const char *name, unsigned int value) +{ + /* Not implemented yet */ + return CB_CMOS_OTABLE_DISABLED; +}