Merge pull request 'config/coreboot/default: Disable Latitude early thermal shutdown' (#376) from nic3-14159/lbmk:mec5035-updates into master

Reviewed-on: https://codeberg.org/libreboot/lbmk/pulls/376
This commit is contained in:
Leah Rowe
2025-11-18 15:12:28 +01:00
2 changed files with 128 additions and 0 deletions
@@ -0,0 +1,92 @@
From 4968635d22dcd4f1eed0083565c423f7a42fc74c Mon Sep 17 00:00:00 2001
From: Nicholas Chin <nic.c3.14@gmail.com>
Date: Sun, 11 May 2025 15:41:22 -0600
Subject: [PATCH 42/43] ec/dell/mec5035: Add command to disable EC-initiated
thermal shutdown
If command 0xBF isn't sent, the EC shuts down the system without warning
as soon as the CPU temperature reaches about 87 degrees, without letting
the CPU thermal throttle to try and reduce the temperature. With vendor
firmware, the CPU is able to reach around 100 degrees before thermal
throttling.
This command was found by collecting EC commands by logging the LPC bus
while running with vendor firmware and then replaying observed commands
from coreboot. By systematically replaying subsets of commands in a
binary search pattern and then stress testing the system, the command to
disable the shutdown was isolated.
The exact meaning of the parameters for this command are unknown at this
time, but do seem to differ between different generations of these
laptops. Due to this, the commmand should be called by mainboard
specific code which passes the specific parameter value used.
The Google Wilco EC code, which runs on Latitude Chromebooks and shares
many commands with the standard Latitude ECs, suggests that command 0xBF
tells the EC about the processors CPUID. However, the values observed in
LPC bus logs do not seem to correspond with any CPUID values on the
non-Chromebook systems I tested.
Observed command parameter values (sent on mailbox registers 2-4):
- E6430 (Ivy Bridge): 0x07, 0x00, 0x00
- M6800 (Haswell): 0x14, 0x00, 0x00
Change-Id: I42f09a3ef681007f64d9c5b1a29248b594737a86
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
---
src/ec/dell/mec5035/mec5035.c | 19 +++++++++++++++++++
src/ec/dell/mec5035/mec5035.h | 2 ++
2 files changed, 21 insertions(+)
diff --git a/src/ec/dell/mec5035/mec5035.c b/src/ec/dell/mec5035/mec5035.c
index dffbb7960c..6c19d1f509 100644
--- a/src/ec/dell/mec5035/mec5035.c
+++ b/src/ec/dell/mec5035/mec5035.c
@@ -94,6 +94,25 @@ void mec5035_control_radio(enum ec_radio_dev dev, enum ec_radio_state state)
ec_command(CMD_RADIO_CTRL);
}
+void mec5035_cmd_bf(u8 i)
+{
+ /*
+ * If this command isn't sent, the EC shuts down the system as soon as
+ * the CPU temperature reaches about 87 degrees. It is unknown exactly
+ * what the parameters represent. The Google Wilco EC code, which runs
+ * on Latitude Chromebooks and shares some commands with the standard
+ * Latitude EC code, suggests command 0xBF tells the EC the CPUID, but
+ * the values observed in LPC bus logs don't seem to match any CPUID
+ * values of the normal Latitudes this was tested with.
+ * Observed i values:
+ * - E6430 (Ivy Bridge): 0x7
+ * - M6800 (Haswell): 0x14
+ */
+ u8 buf[3] = {i, 0, 0};
+ write_mailbox_regs(buf, 2, 3);
+ ec_command(CMD_BF);
+}
+
void mec5035_early_init(void)
{
/* If this isn't sent the EC shuts down the system after about 15
diff --git a/src/ec/dell/mec5035/mec5035.h b/src/ec/dell/mec5035/mec5035.h
index 32f791cb01..e2000c455b 100644
--- a/src/ec/dell/mec5035/mec5035.h
+++ b/src/ec/dell/mec5035/mec5035.h
@@ -10,6 +10,7 @@
enum mec5035_cmd {
CMD_MOUSE_TP = 0x1a,
CMD_RADIO_CTRL = 0x2b,
+ CMD_BF = 0xbf,
CMD_CPU_OK = 0xc2,
};
@@ -37,5 +38,6 @@ u8 mec5035_mouse_touchpad(enum ec_mouse_setting setting);
void mec5035_cpu_ok(void);
void mec5035_early_init(void);
void mec5035_control_radio(enum ec_radio_dev device, enum ec_radio_state state);
+void mec5035_cmd_bf(u8 i);
#endif /* _EC_DELL_MEC5035_H_ */
--
2.51.2
@@ -0,0 +1,36 @@
From 6e52d15cd47c849567bfc2cb75ccf3c6513dc688 Mon Sep 17 00:00:00 2001
From: Nicholas Chin <nic.c3.14@gmail.com>
Date: Sun, 11 May 2025 16:28:23 -0600
Subject: [PATCH 43/43] mb/dell/snb_ivb_latitude: Disable EC initiated shutdown
at 87 degrees
If command 0xBF isn't sent, the EC will shut down the system without
warning once the CPU reaches approximately 87 degrees, without the
system thermal throttling first. Call the newly added function from the
MEC5035 code to send this command and disable this behavior.
Tested on the Latitude E6430.
Change-Id: I2b2dc1e3ab115e05d05eaac06892343394d37fdf
Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
---
src/mainboard/dell/snb_ivb_latitude/early_init.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/mainboard/dell/snb_ivb_latitude/early_init.c b/src/mainboard/dell/snb_ivb_latitude/early_init.c
index ff83db095b..ef385a0a70 100644
--- a/src/mainboard/dell/snb_ivb_latitude/early_init.c
+++ b/src/mainboard/dell/snb_ivb_latitude/early_init.c
@@ -11,4 +11,9 @@ void bootblock_mainboard_early_init(void)
| KBC_LPC_EN | FDD_LPC_EN | LPT_LPC_EN
| COMB_LPC_EN | COMA_LPC_EN);
mec5035_early_init();
+
+ /* Observed from LPC logs with vendor firmware. Seems to disable
+ * EC-initiated shutdown when the CPU reaches approximately 87 degrees.
+ * The exact meaning of the parameter is currently unknown. */
+ mec5035_cmd_bf(0x07);
}
--
2.51.2