diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h index fefafb87e1..ab57ed0270 100644 --- a/src/commonlib/include/commonlib/coreboot_tables.h +++ b/src/commonlib/include/commonlib/coreboot_tables.h @@ -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 diff --git a/src/include/boot/coreboot_tables.h b/src/include/boot/coreboot_tables.h index 9c258c687e..be737b0bb9 100644 --- a/src/include/boot/coreboot_tables.h +++ b/src/include/boot/coreboot_tables.h @@ -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); diff --git a/src/lib/coreboot_table.c b/src/lib/coreboot_table.c index 3902c88eff..d8ecdce868 100644 --- a/src/lib/coreboot_table.c +++ b/src/lib/coreboot_table.c @@ -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); }