lib: Add boot mode information to coreboot tables
This change introduces `LB_TAG_BOOT_MODE` to the coreboot tables to convey platform boot information to the payload. The new `lb_boot_mode` struct uses `enum boot_mode_t` to specify whether the device is booting in `normal mode`, `low-battery mode` or `off-mode charging`. This is crucial for platforms where the Application Processor (AP) manages the charging solution, as it provides the necessary context for the payload's charger driver. By passing this data through the coreboot table, we avoid redundant implementation and ensure consistent battery and charging information is available across both coreboot and the payload. A new weak function, `lb_add_boot_mode`, is also introduced. This function can be overridden by platforms that require this data to add the boot mode information to the coreboot table. TEST=Able to build and boot google/quenbi. Change-Id: I5aea72c02b4d6c856e2504f4007de584c59ee89f Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/88992 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Kapil Porwal <kapilporwal@google.com>
This commit is contained in:
parent
c73f30e74b
commit
a45c8441af
3 changed files with 31 additions and 0 deletions
|
|
@ -96,6 +96,7 @@ enum {
|
|||
LB_TAG_OPTION_ENUM = 0x00ca,
|
||||
LB_TAG_OPTION_DEFAULTS = 0x00cb,
|
||||
LB_TAG_OPTION_CHECKSUM = 0x00cc,
|
||||
LB_TAG_BOOT_MODE = 0x00cd,
|
||||
};
|
||||
|
||||
/* All table entry base addresses and sizes must be 4-byte aligned. */
|
||||
|
|
@ -621,4 +622,22 @@ struct lb_cfr {
|
|||
/* struct lb_cfr_option_form forms[] */
|
||||
};
|
||||
|
||||
enum boot_mode_t {
|
||||
LB_BOOT_MODE_NORMAL,
|
||||
LB_BOOT_MODE_LOW_BATTERY,
|
||||
LB_BOOT_MODE_OFFMODE_CHARGING,
|
||||
};
|
||||
|
||||
/*
|
||||
* Boot Mode: Pass the platform boot mode information to payload about
|
||||
* booting in low-battery mode or off-mode charging. These information
|
||||
* is useful for payload to implement charger driver.
|
||||
*/
|
||||
struct lb_boot_mode {
|
||||
uint32_t tag;
|
||||
uint32_t size;
|
||||
|
||||
enum boot_mode_t boot_mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ struct lb_record *lb_new_record(struct lb_header *header);
|
|||
/* Add VBOOT VBNV offsets. */
|
||||
void lb_table_add_vbnv_cmos(struct lb_header *header);
|
||||
|
||||
/* Add Boot Mode information */
|
||||
void lb_add_boot_mode(struct lb_header *header);
|
||||
|
||||
/* Define this in mainboard.c to add board specific CFR entries */
|
||||
void mb_cfr_setup_menu(struct lb_cfr *cfr_root);
|
||||
|
||||
|
|
|
|||
|
|
@ -464,6 +464,13 @@ static void lb_add_acpi_rsdp(struct lb_header *head)
|
|||
acpi_rsdp->rsdp_pointer = get_coreboot_rsdp();
|
||||
}
|
||||
|
||||
/*
|
||||
* Not all platform would need to fill in the boot mode information.
|
||||
* This is useful for platform that would like to implement battery
|
||||
* charging solution in AP firmware.
|
||||
*/
|
||||
void __weak lb_add_boot_mode(struct lb_header *header) { /* NOOP */ }
|
||||
|
||||
size_t write_coreboot_forwarding_table(uintptr_t entry, uintptr_t target)
|
||||
{
|
||||
struct lb_header *head;
|
||||
|
|
@ -585,6 +592,8 @@ static uintptr_t write_coreboot_table(uintptr_t rom_table_end)
|
|||
if (CONFIG(HAVE_ACPI_TABLES))
|
||||
lb_add_acpi_rsdp(head);
|
||||
|
||||
lb_add_boot_mode(head);
|
||||
|
||||
/* Remember where my valid memory ranges are */
|
||||
return lb_table_fini(head);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue