summaryrefslogtreecommitdiff
path: root/config/coreboot/i945/patches/0006-drivers-pc80-rtc-option.c-Stop-resetting-CMOS-during.patch
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-04-26 09:37:01 +0100
committerLeah Rowe <leah@libreboot.org>2024-04-26 09:55:55 +0100
commita2f423535840382d72bfa1ae1e1cb5c06e4f8604 (patch)
tree0074b5804167bd274c1c29672416ca0d03d96d28 /config/coreboot/i945/patches/0006-drivers-pc80-rtc-option.c-Stop-resetting-CMOS-during.patch
parent64177dbb8e7ff9ca9c7ad847c137398f6a67cfcf (diff)
i945: switch boards to 20230625 coreboot revision
On T60 with Libreboot 20231106 and the GRUB payload, a user reported this error in GRUB when a battery was connected: "alloc magic is broken at 0x7b1aedf0: 0" This error disappears when a battery is not connected, or when using Libreboot 20230625. The issue has persisted through to LIbreboot 20240225 and after, and I believe the issue will be somewhere in coreboot, not in GRUB itself. For now, switch i945 laptops (X60, T60, Macbook2,1) back to the February 2023 coreboot revision used in Libreboot 20230625. A bisect can be done before the next Libreboot release, ETA May 2024, if time permits. Otherwise, this revert should solve the problem for now, at least so far as Libreboot is concerned. The following coreboot patches have been backported: commit 29030d0f3dad2ec6b86000dfe2c8e951ae80bf94 Author: Bill Xie <persmule@hardenedlinux.org> Date: Sat Oct 7 01:32:51 2023 +0800 drivers/pc80/rtc/option.c: Stop resetting CMOS during s3 resume Further patches from upstream: commit 432e92688eca0e85cbaebca3232f65936b305a98 Author: Bill Xie <persmule@hardenedlinux.org> Date: Fri Nov 3 12:34:01 2023 +0800 drivers/pc80/rtc/option.c: Reset only CMOS range covered by checksum These patches fixed S3 on GM45 machines, though it will be useful on the i945 machines aswell. The reason I'm doing it this way it is because I don't have a battery for my X60 or T60, and my T60 isn't in a very good state either, so I can't reproduce the error myself yet. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'config/coreboot/i945/patches/0006-drivers-pc80-rtc-option.c-Stop-resetting-CMOS-during.patch')
-rw-r--r--config/coreboot/i945/patches/0006-drivers-pc80-rtc-option.c-Stop-resetting-CMOS-during.patch56
1 files changed, 56 insertions, 0 deletions
diff --git a/config/coreboot/i945/patches/0006-drivers-pc80-rtc-option.c-Stop-resetting-CMOS-during.patch b/config/coreboot/i945/patches/0006-drivers-pc80-rtc-option.c-Stop-resetting-CMOS-during.patch
new file mode 100644
index 00000000..e11e33da
--- /dev/null
+++ b/config/coreboot/i945/patches/0006-drivers-pc80-rtc-option.c-Stop-resetting-CMOS-during.patch
@@ -0,0 +1,56 @@
+From 412f1d68c610f69384b156f09f0b326af984b7cc Mon Sep 17 00:00:00 2001
+From: Bill XIE <persmule@hardenedlinux.org>
+Date: Sat, 7 Oct 2023 01:32:51 +0800
+Subject: [PATCH 1/2] drivers/pc80/rtc/option.c: Stop resetting CMOS during s3
+ resume
+
+After commit e12b313844da ("drivers/pc80/rtc/option.c: Allow CMOS
+defaults to extend to bank 1"), Thinkpad X200 with
+CONFIG(STATIC_OPTION_TABLE) can no longer resume from s3 (detected via
+bisect).
+
+Further inspection shows that DRAM training result of GM45 is stored
+in CMOS above 128 bytes in raminit_read_write_training.c, for s3 resume
+to restore, but it will be erased by sanitize_cmos(), which now clears
+both bank 0 and bank 1, leaving only "untrained" result restored, so s3
+resume will fail.
+
+However, resetting CMOS seems unnecessary during s3 resume. Now,
+cmos_need_reset will be negated when acpi_is_wakeup_s3() returns true.
+
+Tested: Thinkpad X200 with CONFIG(STATIC_OPTION_TABLE) can resume from
+ s3 again with these changes.
+
+Change-Id: I533e83f3b95f327b0e24f4d750f8812325b7770b
+Signed-off-by: Bill XIE <persmule@hardenedlinux.org>
+Reviewed-on: https://review.coreboot.org/c/coreboot/+/78288
+Reviewed-by: Jonathon Hall <jonathon.hall@puri.sm>
+Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
+---
+ src/drivers/pc80/rtc/option.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/drivers/pc80/rtc/option.c b/src/drivers/pc80/rtc/option.c
+index e8e2345133..e6cfa175ad 100644
+--- a/src/drivers/pc80/rtc/option.c
++++ b/src/drivers/pc80/rtc/option.c
+@@ -1,5 +1,6 @@
+ /* SPDX-License-Identifier: GPL-2.0-only */
+
++#include <acpi/acpi.h>
+ #include <console/console.h>
+ #include <string.h>
+ #include <cbfs.h>
+@@ -200,7 +201,8 @@ void sanitize_cmos(void)
+ {
+ const unsigned char *cmos_default;
+ const bool cmos_need_reset =
+- CONFIG(STATIC_OPTION_TABLE) || cmos_error() || !cmos_lb_cks_valid();
++ (CONFIG(STATIC_OPTION_TABLE) || cmos_error() || !cmos_lb_cks_valid())
++ && !acpi_is_wakeup_s3();
+ size_t length = 128;
+ size_t i;
+
+--
+2.39.2
+