mb/starlabs/starfighter: Put options in CFR cbtable
Change-Id: I3e3b5448282aa81a89356f1d3145381d65e47aaa Signed-off-by: Sean Rhodes <sean@starlabs.systems> Reviewed-on: https://review.coreboot.org/c/coreboot/+/85709 Reviewed-by: Matt DeVillier <matt.devillier@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
121bc2a370
commit
d0ce8d8146
5 changed files with 334 additions and 95 deletions
|
|
@ -3,6 +3,8 @@
|
|||
config BOARD_STARLABS_STARFIGHTER_SERIES
|
||||
def_bool n
|
||||
select BOARD_ROMSIZE_KB_32768
|
||||
select DRIVERS_EFI_VARIABLE_STORE
|
||||
select DRIVERS_OPTION_CFR
|
||||
select DRIVERS_INTEL_PMC
|
||||
select DRIVERS_INTEL_USB4_RETIMER
|
||||
select DRIVERS_I2C_HID
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ subdirs-y += variants/$(VARIANT_DIR)
|
|||
|
||||
bootblock-y += bootblock.c
|
||||
|
||||
ramstage-$(CONFIG_DRIVERS_OPTION_CFR) += cfr.c
|
||||
ramstage-y += hda_verb.c
|
||||
ramstage-y += mainboard.c
|
||||
ramstage-y += smbios.c
|
||||
|
|
|
|||
326
src/mainboard/starlabs/starfighter/cfr.c
Normal file
326
src/mainboard/starlabs/starfighter/cfr.c
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include <boot/coreboot_tables.h>
|
||||
#include <commonlib/coreboot_tables.h>
|
||||
#include <drivers/option/cfr_frontend.h>
|
||||
#include <inttypes.h>
|
||||
#include <intelblocks/pcie_rp.h>
|
||||
#include <string.h>
|
||||
#include <types.h>
|
||||
#include <variants.h>
|
||||
|
||||
static const struct sm_object boot_option = SM_DECLARE_ENUM({
|
||||
.opt_name = "boot_option",
|
||||
.ui_name = "Boot Option",
|
||||
.ui_helptext = "Change the boot device in the event of a failed boot",
|
||||
.default_value = 0,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Fallback", 0 },
|
||||
{ "Normal", 1 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
#if CONFIG(EC_STARLABS_CHARGING_SPEED)
|
||||
static const struct sm_object charging_speed = SM_DECLARE_ENUM({
|
||||
.opt_name = "charging_speed",
|
||||
.ui_name = "Charging Speed",
|
||||
.ui_helptext = "Set the maximum speed to charge the battery. Charging faster"
|
||||
" will increase heat and battery wear.",
|
||||
.default_value = 1,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "1.0C", 0 },
|
||||
{ "0.5C", 1 },
|
||||
{ "0.2C", 2 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
#endif
|
||||
|
||||
static const struct sm_object debug_level = SM_DECLARE_ENUM({
|
||||
.opt_name = "debug_level",
|
||||
.ui_name = "Debug Level",
|
||||
.ui_helptext = "Set the verbosity of the debug output.",
|
||||
.default_value = 0,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Emergency", 0 },
|
||||
{ "Alert", 1 },
|
||||
{ "Critical", 2 },
|
||||
{ "Error", 3 },
|
||||
{ "Warning", 4 },
|
||||
{ "Notice", 5 },
|
||||
{ "Info", 6 },
|
||||
{ "Debug", 7 },
|
||||
{ "Spew", 8 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
static const struct sm_object fan_mode = SM_DECLARE_ENUM({
|
||||
.opt_name = "fan_mode",
|
||||
.ui_name = "Fan Mode",
|
||||
.ui_helptext = "Adjust the fan curve to prioritize performance or noise levels.",
|
||||
.default_value = 0,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Normal", 0 },
|
||||
{ "Aggressive", 1 },
|
||||
{ "Quiet", 2 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
static const struct sm_object fn_ctrl_swap = SM_DECLARE_BOOL({
|
||||
.opt_name = "fn_ctrl_swap",
|
||||
.ui_name = "Fn Ctrl Reverse",
|
||||
.ui_helptext = "Swap the functions of the [Fn] and [Ctrl] keys",
|
||||
.default_value = false,
|
||||
});
|
||||
|
||||
#if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE)
|
||||
static const struct sm_object gna = SM_DECLARE_BOOL({
|
||||
.opt_name = "gna",
|
||||
.ui_name = "Gaussian & Neural Accelerator",
|
||||
.ui_helptext = "Enable or Disable the Gaussian & Neural Accelerator",
|
||||
.default_value = false,
|
||||
});
|
||||
#endif
|
||||
|
||||
static const struct sm_object hyper_threading = SM_DECLARE_BOOL({
|
||||
.opt_name = "hyper_threading",
|
||||
.ui_name = "Hyper-Threading",
|
||||
.ui_helptext = "Enable or disable Hyper-Threading",
|
||||
.default_value = true,
|
||||
});
|
||||
|
||||
static const struct sm_object kbl_timeout = SM_DECLARE_ENUM({
|
||||
.opt_name = "kbl_timeout",
|
||||
.ui_name = "Keyboard Backlight Timeout",
|
||||
.ui_helptext = "Set the amount of time before the keyboard backlight turns off"
|
||||
" when un-used",
|
||||
.default_value = 0,
|
||||
.values = (struct sm_enum_value[]) {
|
||||
{ "30 seconds", 0 },
|
||||
{ "1 minute", 1 },
|
||||
{ "3 minutes", 2 },
|
||||
{ "5 minutes", 3 },
|
||||
{ "Never", 4 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
#if CONFIG(EC_STARLABS_LID_SWITCH)
|
||||
static const struct sm_object lid_switch = SM_DECLARE_ENUM({
|
||||
.opt_name = "lid_switch",
|
||||
.ui_name = "Lid Switch",
|
||||
.ui_helptext = "Enable or disable the lid switch.",
|
||||
.default_value = 0,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Enabled", 0 },
|
||||
{ "Disabled", 1 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
#endif
|
||||
|
||||
static const struct sm_object max_charge = SM_DECLARE_ENUM({
|
||||
.opt_name = "max_charge",
|
||||
.ui_name = "Maximum Charge Level",
|
||||
.ui_helptext = "Set the maximum level the battery will charge to.",
|
||||
.default_value = 0,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "100%", 0 },
|
||||
{ "80%", 1 },
|
||||
{ "60%", 2 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
static const struct sm_object me_state = SM_DECLARE_ENUM({
|
||||
.opt_name = "me_state",
|
||||
.ui_name = "Intel Management Engine",
|
||||
.ui_helptext = "Enable or disable the Intel Management Engine",
|
||||
.default_value = 1,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Disabled", 1 },
|
||||
{ "Enabled", 0 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
static const struct sm_object me_state_counter = SM_DECLARE_NUMBER({
|
||||
.opt_name = "me_state_counter",
|
||||
.ui_name = "ME State Counter",
|
||||
.flags = CFR_OPTFLAG_SUPPRESS,
|
||||
.default_value = 0,
|
||||
});
|
||||
|
||||
static const struct sm_object power_on_after_fail = SM_DECLARE_BOOL({
|
||||
.opt_name = "power_on_after_fail",
|
||||
.ui_name = "Power on after failure",
|
||||
.ui_helptext = "Automatically turn on after a power failure",
|
||||
.default_value = false,
|
||||
});
|
||||
|
||||
static const struct sm_object power_profile = SM_DECLARE_ENUM({
|
||||
.opt_name = "power_profile",
|
||||
.ui_name = "Power Profile",
|
||||
.ui_helptext = "Select whether to maximize performance, battery life or both.",
|
||||
.default_value = 1,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Power Saver", PP_POWER_SAVER },
|
||||
{ "Balanced", PP_BALANCED },
|
||||
{ "Performance", PP_PERFORMANCE },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
#if CONFIG(SOC_INTEL_ALDERLAKE)
|
||||
static const struct sm_object pciexp_aspm = SM_DECLARE_ENUM({
|
||||
.opt_name = "pciexp_aspm",
|
||||
.ui_name = "PCI ASPM",
|
||||
.ui_helptext = "Controls the Active State Power Management for PCI devices."
|
||||
" Enabling this feature can reduce power consumption of"
|
||||
" PCI-connected devices during idle times.",
|
||||
.default_value = ASPM_L0S_L1,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Disabled", ASPM_DISABLE },
|
||||
{ "L0s", ASPM_L0S },
|
||||
{ "L1", ASPM_L1 },
|
||||
{ "L0sL1", ASPM_L0S_L1 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
|
||||
static const struct sm_object pciexp_clk_pm = SM_DECLARE_BOOL({
|
||||
.opt_name = "pciexp_clk_pm",
|
||||
.ui_name = "PCI Clock Power Management",
|
||||
.ui_helptext = "Enables or disables power management for the PCI clock. When"
|
||||
" enabled, it reduces power consumption during idle states."
|
||||
" This can help lower overall energy use but may impact"
|
||||
" performance in power-sensitive tasks.",
|
||||
.default_value = true,
|
||||
});
|
||||
|
||||
static const struct sm_object pciexp_l1ss = SM_DECLARE_ENUM({
|
||||
.opt_name = "pciexp_l1ss",
|
||||
.ui_name = "PCI L1 Substates",
|
||||
.ui_helptext = "Controls deeper power-saving states for PCI devices."
|
||||
" Enabling this feature allows supported devices to achieve"
|
||||
" lower power states at the cost of slightly increased"
|
||||
" latency when exiting these states.",
|
||||
.default_value = L1_SS_L1_2,
|
||||
.values = (const struct sm_enum_value[]) {
|
||||
{ "Disabled", L1_SS_DISABLED },
|
||||
{ "L1.1", L1_SS_L1_1 },
|
||||
{ "L1.2", L1_SS_L1_2 },
|
||||
SM_ENUM_VALUE_END },
|
||||
});
|
||||
#endif
|
||||
|
||||
static const struct sm_object reboot_counter = SM_DECLARE_NUMBER({
|
||||
.opt_name = "reboot_counter",
|
||||
.ui_name = "Reboot Counter",
|
||||
.flags = CFR_OPTFLAG_SUPPRESS,
|
||||
.default_value = 0,
|
||||
});
|
||||
|
||||
#if CONFIG(DRIVERS_INTEL_USB4_RETIMER)
|
||||
static const struct sm_object thunderbolt = SM_DECLARE_BOOL({
|
||||
.opt_name = "thunderbolt",
|
||||
.ui_name = "Thunderbolt",
|
||||
.ui_helptext = "Enable or disable Thunderbolt support",
|
||||
.default_value = true,
|
||||
});
|
||||
#endif
|
||||
|
||||
static const struct sm_object vtd = SM_DECLARE_BOOL({
|
||||
.opt_name = "vtd",
|
||||
.ui_name = "VT-d",
|
||||
.ui_helptext = "Enable or disable Intel VT-d (virtualization)",
|
||||
.default_value = true,
|
||||
});
|
||||
|
||||
static struct sm_obj_form performance = {
|
||||
.ui_name = "Performance",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&fan_mode,
|
||||
&power_profile,
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form processor = {
|
||||
.ui_name = "Processor",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&me_state,
|
||||
&me_state_counter,
|
||||
&hyper_threading,
|
||||
&vtd,
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form power = {
|
||||
.ui_name = "Power",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&max_charge,
|
||||
#if CONFIG(EC_STARLABS_CHARGING_SPEED)
|
||||
&charging_speed,
|
||||
#endif
|
||||
&power_on_after_fail,
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form keyboard = {
|
||||
.ui_name = "Keyboard",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&kbl_timeout,
|
||||
&fn_ctrl_swap,
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form devices = {
|
||||
.ui_name = "Devices",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
#if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE)
|
||||
&gna,
|
||||
#endif
|
||||
#if CONFIG(EC_STARLABS_LID_SWITCH)
|
||||
&lid_switch,
|
||||
#endif
|
||||
#if CONFIG(DRIVERS_INTEL_USB4_RETIMER)
|
||||
&thunderbolt,
|
||||
#endif
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form pci = {
|
||||
.ui_name = "PCI",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
#if CONFIG(SOC_INTEL_ALDERLAKE)
|
||||
&pciexp_clk_pm,
|
||||
&pciexp_aspm,
|
||||
&pciexp_l1ss,
|
||||
#endif
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form coreboot = {
|
||||
.ui_name = "coreboot",
|
||||
.obj_list = (const struct sm_object *[]) {
|
||||
&boot_option,
|
||||
&debug_level,
|
||||
&reboot_counter,
|
||||
NULL
|
||||
},
|
||||
};
|
||||
|
||||
static struct sm_obj_form *sm_root[] = {
|
||||
&performance,
|
||||
&processor,
|
||||
&power,
|
||||
&keyboard,
|
||||
&devices,
|
||||
&pci,
|
||||
&coreboot,
|
||||
NULL
|
||||
};
|
||||
|
||||
void mb_cfr_setup_menu(struct lb_cfr *cfr_root)
|
||||
{
|
||||
cfr_write_setup_menu(cfr_root, sm_root);
|
||||
}
|
||||
|
|
@ -1,26 +1,4 @@
|
|||
## SPDX-License-Identifier: GPL-2.0-only
|
||||
# hardcoded
|
||||
boot_option=Fallback
|
||||
# console
|
||||
debug_level=Debug
|
||||
# cpu
|
||||
hyper_threading=Enable
|
||||
vtd=Enable
|
||||
power_profile=Balanced
|
||||
me_state=Disable
|
||||
# Devices
|
||||
wireless=Enable
|
||||
webcam=Enable
|
||||
microphone=Enable
|
||||
pci_hot_plug=Disable
|
||||
lid_switch=Enable
|
||||
gna=Disable
|
||||
# EC
|
||||
kbl_timeout=30 seconds
|
||||
fn_ctrl_swap=Disable
|
||||
charging_speed=0.5C
|
||||
# southbridge
|
||||
power_on_after_fail=Disable
|
||||
# Functions
|
||||
fn_lock_state=0x1
|
||||
trackpad_state=0x1
|
||||
|
|
|
|||
|
|
@ -12,36 +12,10 @@ entries
|
|||
304 80 h 0 ramtop
|
||||
|
||||
# RTC_BOOT_BYTE (coreboot hardcoded)
|
||||
384 1 e 2 boot_option
|
||||
388 4 h 0 reboot_counter
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# coreboot config options: console
|
||||
395 4 e 3 debug_level
|
||||
# coreboot config options: cpu
|
||||
#400 8 r 0 reserved for century byte
|
||||
408 1 e 1 hyper_threading
|
||||
416 1 e 1 vtd
|
||||
424 2 e 7 power_profile
|
||||
432 1 e 5 me_state
|
||||
440 4 h 0 me_state_counter
|
||||
|
||||
# coreboot config options: Devices
|
||||
504 1 e 1 wireless
|
||||
512 1 e 1 webcam
|
||||
520 1 e 1 microphone
|
||||
528 1 e 1 lid_switch
|
||||
536 1 e 1 gna
|
||||
|
||||
# coreboot config options: EC
|
||||
600 3 e 4 kbl_timeout
|
||||
608 1 e 1 fn_ctrl_swap
|
||||
616 2 e 8 max_charge
|
||||
624 2 e 9 fan_mode
|
||||
632 2 e 11 charging_speed
|
||||
|
||||
# coreboot config options: southbridge
|
||||
800 2 e 6 power_on_after_fail
|
||||
|
||||
# coreboot config options: check sums
|
||||
984 16 h 0 check_sum
|
||||
|
|
@ -50,7 +24,7 @@ entries
|
|||
# embedded controller settings (outside the checksummed area)
|
||||
1024 8 h 1 fn_lock_state
|
||||
1032 8 h 1 trackpad_state
|
||||
1040 8 h 10 kbl_brightness
|
||||
1040 8 h 2 kbl_brightness
|
||||
1048 8 h 1 kbl_state
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
|
|
@ -61,52 +35,10 @@ enumerations
|
|||
1 0 Disable
|
||||
1 1 Enable
|
||||
|
||||
2 0 Fallback
|
||||
2 1 Normal
|
||||
|
||||
3 0 Emergency
|
||||
3 1 Alert
|
||||
3 2 Critical
|
||||
3 3 Error
|
||||
3 4 Warning
|
||||
3 5 Notice
|
||||
3 6 Info
|
||||
3 7 Debug
|
||||
3 8 Spew
|
||||
|
||||
4 0 30 seconds
|
||||
4 1 1 minute
|
||||
4 2 3 minutes
|
||||
4 3 5 minutes
|
||||
4 4 Never
|
||||
|
||||
5 0 Enable
|
||||
5 1 Disable
|
||||
|
||||
6 0 Disable
|
||||
6 1 Enable
|
||||
6 2 Keep
|
||||
|
||||
7 0 Power Saver
|
||||
7 1 Balanced
|
||||
7 2 Performance
|
||||
|
||||
8 0 100%
|
||||
8 1 80%
|
||||
8 2 60%
|
||||
|
||||
9 0 Normal
|
||||
9 1 Aggressive
|
||||
9 2 Quiet
|
||||
|
||||
10 0 Off
|
||||
10 1 Low
|
||||
10 2 High
|
||||
10 3 On
|
||||
|
||||
11 0 1.0C
|
||||
11 1 0.5C
|
||||
11 2 0.2C
|
||||
2 0 Off
|
||||
2 1 Low
|
||||
2 2 High
|
||||
2 3 On
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
checksums
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue