From e82338b0a2173c6a72b6ff4496b746df3da8c872 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Tue, 2 Sep 2025 12:15:04 +0000 Subject: [PATCH] mb/google/bluey: Add boot mode to coreboot tables This change implements `lb_add_boot_mode` for the `bluey` mainboard, which adds the platform's boot mode information to the coreboot tables. This is done by checking the EC (Embedded Controller) to determine if the battery is below a critical threshold. If the battery is critically low, the `LB_BOOT_MODE_LOW_BATTERY` flag is set. This information is then passed to the payload, allowing it to take specific actions, such as displaying a low-battery charging screen. TEST=Able to build and boot the `bluey` mainboard. Change-Id: I473cec7645954e753e160467aa8b83b67b28ab76 Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/88994 Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- src/mainboard/google/bluey/mainboard.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/mainboard/google/bluey/mainboard.c b/src/mainboard/google/bluey/mainboard.c index 1ff845c541..6d2f705a41 100644 --- a/src/mainboard/google/bluey/mainboard.c +++ b/src/mainboard/google/bluey/mainboard.c @@ -1,14 +1,32 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include #include #include #include +#include #include #include #include #include #include "board.h" +void lb_add_boot_mode(struct lb_header *header) +{ + if (!CONFIG(EC_GOOGLE_CHROMEEC)) + return; + + struct lb_boot_mode *mode = (struct lb_boot_mode *)lb_new_record(header); + memset(mode, 0, sizeof(*mode)); + + mode->tag = LB_TAG_BOOT_MODE; + mode->size = sizeof(*mode); + mode->boot_mode = LB_BOOT_MODE_NORMAL; + + if (google_chromeec_is_below_critical_threshold()) + mode->boot_mode = LB_BOOT_MODE_LOW_BATTERY; +} + bool mainboard_needs_pcie_init(void) { return true;