Skip to content

Commit 1eb60fa

Browse files
committed
global reset based on option read
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
1 parent fae7b04 commit 1eb60fa

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/mainboard/clevo/mtl-h/variants/dgpu/ramstage.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ void variant_devtree_update(void)
3030

3131
static void set_dgpu_only(void)
3232
{
33-
uint8_t option_state = 99;
34-
system76_read_option(OPT_GPU_MUX_CTRL, &option_state);
35-
printk(BIOS_ERR, "MUX_CTRL_BIOS state in coreboot: %d", option_state);
33+
uint8_t initial_option_state = 99;
34+
system76_read_option(OPT_GPU_MUX_CTRL, &initial_option_state);
35+
printk(BIOS_ERR, "MUX_CTRL_BIOS state in coreboot: %d", initial_option_state);
3636

3737
/*
3838
* If the MUX_CTRL_BIOS option needs to be changed to match the settings, we need a
@@ -48,12 +48,21 @@ static void set_dgpu_only(void)
4848
};
4949

5050
if (dasharo_dgpu_state() == DGPU_ONLY) {
51-
printk(BIOS_ERR, "dgpu_state = dgpu_only, index = %d, value = %d; calling global reset \n", cmd.index, cmd.value);
5251
system76_ec_smfi_cmd(CMD_OPTION_SET, sizeof(cmd) / sizeof(uint8_t), (uint8_t *)&cmd);
53-
// do_global_reset();
52+
if (initial_option_state == 0) {
53+
printk(BIOS_ERR, "dgpu_state = dgpu_only, index = %d, value = %d; calling global reset \n", cmd.index, initial_option_state);
54+
do_global_reset();
55+
}
56+
} else {
57+
cmd.value = 0;
58+
system76_ec_smfi_cmd(CMD_OPTION_SET, sizeof(cmd) / sizeof(uint8_t), (uint8_t *)&cmd);
59+
if (initial_option_state == 1) {
60+
printk(BIOS_ERR, "dgpu_state = dgpu_only, index = %d, value = %d; calling global reset \n", cmd.index, initial_option_state);
61+
do_global_reset();
62+
}
5463
}
5564

56-
printk(BIOS_ERR, "dgpu_state = %d, index = %d, value = %d; global reset not called \n", dasharo_dgpu_state(), cmd.index, cmd.value);
65+
printk(BIOS_ERR, "dgpu_state = %d, index = %d, value = %d; global reset not called \n", dasharo_dgpu_state(), cmd.index, initial_option_state);
5766
}
5867

5968
void variant_final(void)

0 commit comments

Comments
 (0)