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 <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/88994
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2025-09-02 12:15:04 +00:00
commit e82338b0a2

View file

@ -1,14 +1,32 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <boot/coreboot_tables.h>
#include <bootmode.h>
#include <console/console.h>
#include <device/device.h>
#include <ec/google/chromeec/ec.h>
#include <gpio.h>
#include <soc/pcie.h>
#include <soc/qupv3_config_common.h>
#include <soc/qup_se_handlers_common.h>
#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;