Debian Codegraph @

src/mainboard/starlabs/starfighter/cfr.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <boot/coreboot_tables.h>
4 #include <console/cfr.h>
5 #include <drivers/option/cfr_frontend.h>
6 #include <ec/starlabs/merlin/cfr.h>
7 #include <intelblocks/cfr.h>
8 #include <variants.h>
9
10 #if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE)
11 static const struct sm_object gna = SM_DECLARE_BOOL({
12 .opt_name = "gna",
13 .ui_name = "Gaussian & Neural Accelerator",
14 .ui_helptext = "Enable or Disable the Gaussian & Neural Accelerator",
15 .default_value = false,
16 });
17 #endif
18
19 static const struct sm_object hyper_threading = SM_DECLARE_BOOL({
20 .opt_name = "hyper_threading",
21 .ui_name = "Hyper-Threading",
22 .ui_helptext = "Enable or disable Hyper-Threading",
23 .default_value = true,
24 });
25
26
27 static const struct sm_object power_profile = SM_DECLARE_ENUM({
28 .opt_name = "power_profile",
29 .ui_name = "Power Profile",
30 .ui_helptext = "Select whether to maximize performance, battery life or both.",
31 .default_value = 1,
32 .values = (const struct sm_enum_value[]) {
33 { "Power Saver", PP_POWER_SAVER },
34 { "Balanced", PP_BALANCED },
35 { "Performance", PP_PERFORMANCE },
36 SM_ENUM_VALUE_END },
37 });
38
39 #if CONFIG(DRIVERS_INTEL_USB4_RETIMER)
40 static const struct sm_object thunderbolt = SM_DECLARE_BOOL({
41 .opt_name = "thunderbolt",
42 .ui_name = "Thunderbolt",
43 .ui_helptext = "Enable or disable Thunderbolt support",
44 .default_value = true,
45 });
46 #endif
47
48 static const struct sm_object vtd = SM_DECLARE_BOOL({
49 .opt_name = "vtd",
50 .ui_name = "VT-d",
51 .ui_helptext = "Enable or disable Intel VT-d (virtualization)",
52 .default_value = true,
53 });
54
55 static const struct sm_object bluetooth_rtd3 = SM_DECLARE_BOOL({
56 .opt_name = "bluetooth_rtd3",
57 .ui_name = "Bluetooth Runtime-D3",
58 .ui_helptext = "Enable or disable Bluetooth power optimization.\n"
59 "Recommended to disable when booting Windows.",
60 .default_value = true,
61 });
62
63 static const struct sm_object display_native_res = SM_DECLARE_BOOL({
64 .opt_name = "display_native_res",
65 .ui_name = "Display: Use Native Resolution",
66 .ui_helptext = "Enabled: use the native panel resolution at boot.\n"
67 "Disabled: use a fixed/scaled video mode at boot.",
68 .default_value = false,
69 });
70
71 static const struct sm_object s0ix_enable = SM_DECLARE_BOOL({
72 .opt_name = "s0ix_enable",
73 .ui_name = "Modern Standby (S0ix)",
74 .ui_helptext = "Enabled: Use S0ix for device sleep.\n"
75 "Disabled: Use ACPI S3 for device sleep.\n"
76 "Requires Intel ME to be enabled.\n"
77 "Recommended: Enabled when booting Windows, disabled otherwise.",
78 .default_value = false,
79 });
80
81 static struct sm_obj_form performance = {
82 .ui_name = "Performance",
83 .obj_list = (const struct sm_object *[]) {
84 &bluetooth_rtd3,
85 &fan_mode,
86 &power_profile,
87 NULL
88 },
89 };
90
91 static struct sm_obj_form processor = {
92 .ui_name = "Processor",
93 .obj_list = (const struct sm_object *[]) {
94 &me_state,
95 &me_state_counter,
96 &hyper_threading,
97 &s0ix_enable,
98 &vtd,
99 NULL
100 },
101 };
102
103 static struct sm_obj_form power = {
104 .ui_name = "Power",
105 .obj_list = (const struct sm_object *[]) {
106 &max_charge,
107 #if CONFIG(EC_STARLABS_CHARGING_SPEED)
108 &charging_speed,
109 #endif
110 &power_on_after_fail_bool,
111 NULL
112 },
113 };
114
115 static struct sm_obj_form keyboard = {
116 .ui_name = "Keyboard",
117 .obj_list = (const struct sm_object *[]) {
118 &kbl_timeout,
119 &fn_ctrl_swap,
120 NULL
121 },
122 };
123
124 static struct sm_obj_form devices = {
125 .ui_name = "Devices",
126 .obj_list = (const struct sm_object *[]) {
127 #if CONFIG(SOC_INTEL_TIGERLAKE) || CONFIG(SOC_INTEL_ALDERLAKE) || CONFIG(SOC_INTEL_RAPTORLAKE)
128 &gna,
129 #endif
130 &display_native_res,
131 #if CONFIG(EC_STARLABS_LID_SWITCH)
132 &lid_switch,
133 #endif
134 #if CONFIG(DRIVERS_INTEL_USB4_RETIMER)
135 &thunderbolt,
136 #endif
137 NULL
138 },
139 };
140
141 static struct sm_obj_form pci = {
142 .ui_name = "PCI",
143 .obj_list = (const struct sm_object *[]) {
144 #if CONFIG(SOC_INTEL_COMMON_BLOCK_ASPM)
145 &pciexp_clk_pm,
146 &pciexp_aspm,
147 #if CONFIG(HAS_INTEL_CPU_ROOT_PORTS)
148 &pciexp_aspm_cpu,
149 #endif
150 &pciexp_l1ss,
151 #endif
152 NULL
153 },
154 };
155
156 static struct sm_obj_form coreboot = {
157 .ui_name = "coreboot",
158 .obj_list = (const struct sm_object *[]) {
159 &debug_level,
160 NULL
161 },
162 };
163
164 static struct sm_obj_form *sm_root[] = {
165 &performance,
166 &processor,
167 &power,
168 &keyboard,
169 &devices,
170 &pci,
171 &coreboot,
172 NULL
173 };
174
175 void mb_cfr_setup_menu(struct lb_cfr *cfr_root)
176 {
177 cfr_write_setup_menu(cfr_root, sm_root);
178 }