Skip to content

Commit f366f5e

Browse files
committed
mainboard/clevo/mtl-h/variants/dgpu/ramstage.c: dGPU only global reset
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
1 parent 5e30ff5 commit f366f5e

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/ec/system76/ec/system76_ec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ uint8_t system76_read_option(uint8_t option, uint8_t *value)
115115
*value = system76_ec_read(REG_DATA);
116116

117117
return (system76_ec_read(REG_RESULT));
118-
118+
119119
}
120120

121121
uint8_t system76_ec_read_version(uint8_t *data)

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ 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);
36-
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);
36+
3737
/*
3838
* If the MUX_CTRL_BIOS option needs to be changed to match the settings, we need a
3939
* global reset
@@ -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)