| 1 |
|
| 2 |
|
| 3 |
#include <boot/coreboot_tables.h> |
| 4 |
#include <drivers/option/cfr_frontend.h> |
| 5 |
#include <ec/lenovo/h8/cfr.h> |
| 6 |
#include <ec/lenovo/pmh7/cfr.h> |
| 7 |
#include <intelblocks/cfr.h> |
| 8 |
#include <soc/cfr.h> |
| 9 |
#include <static.h> |
| 10 |
|
| 11 |
|
| 12 |
static void update_dgpu(const struct sm_object *obj, struct sm_object *new) |
| 13 |
{ |
| 14 |
struct device *dgpu = DEV_PTR(dgpu); |
| 15 |
if (!dgpu || !dgpu->enabled) { |
| 16 |
new->sm_bool.flags = CFR_OPTFLAG_SUPPRESS; |
| 17 |
} |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
static const struct sm_object dgpu = SM_DECLARE_ENUM({ |
| 22 |
.opt_name = "dgpu_enable", |
| 23 |
.ui_name = "dGPU", |
| 24 |
.ui_helptext = "Enable or disable the dGPU", |
| 25 |
.default_value = 0, |
| 26 |
.values = (const struct sm_enum_value[]) { |
| 27 |
{ "Disabled", 0 }, |
| 28 |
{ "Enabled", 1 }, |
| 29 |
SM_ENUM_VALUE_END }, |
| 30 |
}, WITH_CALLBACK(update_dgpu)); |
| 31 |
|
| 32 |
static struct sm_obj_form system = { |
| 33 |
.ui_name = "System", |
| 34 |
.obj_list = (const struct sm_object *[]) { |
| 35 |
&dgpu, |
| 36 |
&hyper_threading, |
| 37 |
&igd_dvmt, |
| 38 |
&igd_aperture, |
| 39 |
&legacy_8254_timer, |
| 40 |
&me_state, |
| 41 |
&me_state_counter, |
| 42 |
&pciexp_aspm, |
| 43 |
&pciexp_clk_pm, |
| 44 |
&pciexp_l1ss, |
| 45 |
&pciexp_speed, |
| 46 |
&s0ix_enable, |
| 47 |
&vtd, |
| 48 |
NULL |
| 49 |
}, |
| 50 |
}; |
| 51 |
|
| 52 |
static struct sm_obj_form ec = { |
| 53 |
.ui_name = "Embedded Controller", |
| 54 |
.obj_list = (const struct sm_object *[]) { |
| 55 |
&bluetooth, |
| 56 |
&backlight, |
| 57 |
&uwb, |
| 58 |
&usb_always_on, |
| 59 |
&volume, |
| 60 |
&wlan, |
| 61 |
&wwan, |
| 62 |
&pm_beeps, |
| 63 |
&battery_beep, |
| 64 |
&fn_ctrl_swap, |
| 65 |
&sticky_fn, |
| 66 |
&f1_to_f12_as_primary, |
| 67 |
&touchpad, |
| 68 |
&trackpoint, |
| 69 |
NULL |
| 70 |
}, |
| 71 |
}; |
| 72 |
|
| 73 |
static struct sm_obj_form *sm_root[] = { |
| 74 |
&ec, |
| 75 |
&system, |
| 76 |
NULL |
| 77 |
}; |
| 78 |
|
| 79 |
void mb_cfr_setup_menu(struct lb_cfr *cfr_root) |
| 80 |
{ |
| 81 |
cfr_write_setup_menu(cfr_root, sm_root); |
| 82 |
} |