From 984ee53de87fd7b20c0872dbf201bd66087fd992 Mon Sep 17 00:00:00 2001 From: Keith Hui Date: Sun, 31 Aug 2025 17:09:24 -0400 Subject: [PATCH] mb/asus/p8x7x-series: Introduce CFR setup menu Options are organized to be as close to vendor firmware as possible. Some options are not implemented for all variants. Those are either excluded from build via preprocessor, or left visible but unused. They will be squared off later. TEST=abuild tested on the whole series. TEST=Complete platform setup menu appears for mb/asus/p8z77-v_le_plus with edk2/mrchromebox payload, with changes to front audio panel type reflected in hardware. Change-Id: I558012b28d098a90863e3ff6610017c2410c23ed Signed-off-by: Keith Hui Reviewed-on: https://review.coreboot.org/c/coreboot/+/89045 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Rudolph --- src/mainboard/asus/p8x7x-series/Makefile.mk | 1 + src/mainboard/asus/p8x7x-series/cfr.c | 118 ++++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 src/mainboard/asus/p8x7x-series/cfr.c diff --git a/src/mainboard/asus/p8x7x-series/Makefile.mk b/src/mainboard/asus/p8x7x-series/Makefile.mk index e339285620..3fc1de8f61 100644 --- a/src/mainboard/asus/p8x7x-series/Makefile.mk +++ b/src/mainboard/asus/p8x7x-series/Makefile.mk @@ -6,3 +6,4 @@ bootblock-y += variants/$(VARIANT_DIR)/gpio.c romstage-y += variants/$(VARIANT_DIR)/gpio.c ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += variants/$(VARIANT_DIR)/gma-mainboard.ads +ramstage-$(CONFIG_DRIVERS_OPTION_CFR) += cfr.c diff --git a/src/mainboard/asus/p8x7x-series/cfr.c b/src/mainboard/asus/p8x7x-series/cfr.c new file mode 100644 index 0000000000..bba60a6610 --- /dev/null +++ b/src/mainboard/asus/p8x7x-series/cfr.c @@ -0,0 +1,118 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include +#include +#include + +#if CONFIG(USE_NATIVE_RAMINIT) +static struct sm_obj_form sysagent = { + .ui_name = "Graphics Configuration", + .obj_list = (const struct sm_object *[]) { + &gfx_uma_size, + NULL + }, +}; +#else +static const struct sm_object usb3_mode = SM_DECLARE_ENUM({ + .opt_name = "usb3_mode", + .ui_name = "Intel xHCI Mode", + .default_value = 3, + .values = (const struct sm_enum_value[]) { + { "Disable", 0 }, + { "Enable", 1 }, + { "Auto", 2 }, + { "Smart Auto", 3 }, + SM_ENUM_VALUE_END }, +}); + +static const struct sm_object usb3_drv = SM_DECLARE_BOOL({ + .opt_name = "usb3_drv", + .ui_name = "Legacy USB3.0 Support", + .ui_helptext = "Enable/Disable USB3.0 (XHCI) Controller Legacy Support.", + .default_value = 1, +}); + +static const struct sm_object usb3_streams = SM_DECLARE_BOOL({ + .opt_name = "usb3_streams", + .ui_name = "xHCI Streams", + .default_value = 1, +}); + +static struct sm_obj_form sysagent = { + .ui_name = "System Agent Configuration", + .obj_list = (const struct sm_object *[]) { + &gfx_uma_size, + &usb3_mode, + &usb3_drv, + &usb3_streams, + NULL + }, +}; +#endif + +/* Front audio panel */ +static const struct sm_object audio_panel_type = SM_DECLARE_ENUM({ + .opt_name = "audio_panel_type", + .ui_name = "Front Panel Type", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "HD", 0 }, + { "AC97", 1 }, + SM_ENUM_VALUE_END }, +}); + +#if CONFIG(BOARD_ASUS_P8Z77_V_LE_PLUS) +static const struct sm_object spdif_dest = SM_DECLARE_ENUM({ + .opt_name = "spdif_dest", + .ui_name = "SPDIF Out Type", + .default_value = 0, + .values = (const struct sm_enum_value[]) { + { "SPDIF", 0 }, + { "HDMI", 1 }, + SM_ENUM_VALUE_END }, +}); +#endif + +static struct sm_obj_form onboard_devices = { + .ui_name = "Onboard Devices Configuration", + .obj_list = (const struct sm_object *[]) { + &sata_mode, + &audio_panel_type, +#if CONFIG(BOARD_ASUS_P8Z77_V_LE_PLUS) + &spdif_dest, +#endif + NULL + }, +}; + +static struct sm_obj_form power = { + .ui_name = "Power Management", + .obj_list = (const struct sm_object *[]) { + &power_on_after_fail, + NULL + }, +}; + +static struct sm_obj_form system = { + .ui_name = "Other System Settings", + .obj_list = (const struct sm_object *[]) { + &nmi, + &debug_level, + NULL + }, +}; + +static struct sm_obj_form *sm_root[] = { + &sysagent, + &onboard_devices, + &power, + &system, + NULL +}; + +void mb_cfr_setup_menu(struct lb_cfr *cfr_root) +{ + cfr_write_setup_menu(cfr_root, sm_root); +}