From 8cfc71d9e07e79d9be262e35a97e2bd204324e90 Mon Sep 17 00:00:00 2001 From: Yu-Ping Wu Date: Tue, 13 Jan 2026 11:48:42 +0800 Subject: [PATCH] libpayload: Pass panel power-off commands to payloads Introduce the lb_panel_poweroff/cb_panel_poweroff structs to pass the panel power-off commands from coreboot to payloads. Also add mipi_panel_parse_commands() to libpayload libc, so that payloads can utilize it to parse the power-off commands. BUG=b:474187570 TEST=emerge-jedi coreboot libpayload BRANCH=skywalker Change-Id: I652178c8075a1f3aee356502e682ef9a4f3d1cf8 Signed-off-by: Yu-Ping Wu Reviewed-on: https://review.coreboot.org/c/coreboot/+/90738 Tested-by: build bot (Jenkins) Reviewed-by: Yidi Lin Reviewed-by: Chen-Tsung Hsieh Reviewed-by: Julius Werner --- payloads/libpayload/include/coreboot_tables.h | 9 +++++++++ payloads/libpayload/include/libpayload.h | 1 + payloads/libpayload/include/sysinfo.h | 1 + payloads/libpayload/libc/Makefile.mk | 1 + payloads/libpayload/libc/coreboot.c | 8 ++++++++ src/commonlib/include/commonlib/coreboot_tables.h | 9 +++++++++ 6 files changed, 29 insertions(+) diff --git a/payloads/libpayload/include/coreboot_tables.h b/payloads/libpayload/include/coreboot_tables.h index 01d86c272c..36ec6e9125 100644 --- a/payloads/libpayload/include/coreboot_tables.h +++ b/payloads/libpayload/include/coreboot_tables.h @@ -85,6 +85,7 @@ enum { CB_TAG_TYPE_C_INFO = 0x0042, CB_TAG_ACPI_RSDP = 0x0043, CB_TAG_PCIE = 0x0044, + CB_TAG_PANEL_POWEROFF = 0x0049, CB_TAG_CMOS_OPTION_TABLE = 0x00c8, CB_TAG_OPTION = 0x00c9, CB_TAG_OPTION_ENUM = 0x00ca, @@ -446,6 +447,14 @@ struct cb_acpi_rsdp { cb_uint64_t rsdp_pointer; /* Address of the ACPI RSDP */ }; +struct cb_panel_poweroff { + uint32_t tag; + uint32_t size; + + /* MIPI DSI poweroff commands from panel_serializable_data. */ + uint8_t cmd[]; +}; + enum boot_mode_t { CB_BOOT_MODE_NORMAL, CB_BOOT_MODE_LOW_BATTERY, diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index 86429144ec..6125fe0285 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -47,6 +47,7 @@ #include #if CONFIG(LP_GPL) #include +#include #else #include #endif diff --git a/payloads/libpayload/include/sysinfo.h b/payloads/libpayload/include/sysinfo.h index 23e2d55409..324233170e 100644 --- a/payloads/libpayload/include/sysinfo.h +++ b/payloads/libpayload/include/sysinfo.h @@ -180,6 +180,7 @@ struct sysinfo_t { enum boot_mode_t boot_mode; uintptr_t memory_info; + uintptr_t cb_panel_poweroff; }; extern struct sysinfo_t lib_sysinfo; diff --git a/payloads/libpayload/libc/Makefile.mk b/payloads/libpayload/libc/Makefile.mk index 063118a925..45152f135c 100644 --- a/payloads/libpayload/libc/Makefile.mk +++ b/payloads/libpayload/libc/Makefile.mk @@ -52,5 +52,6 @@ libc-srcs += $(coreboottop)/src/commonlib/bsd/string.c ifeq ($(CONFIG_LP_GPL),y) libc-srcs += $(coreboottop)/src/commonlib/device_tree.c libc-srcs += $(coreboottop)/src/commonlib/list.c +libc-srcs += $(coreboottop)/src/commonlib/mipi/cmd.c endif endif diff --git a/payloads/libpayload/libc/coreboot.c b/payloads/libpayload/libc/coreboot.c index b1be37c19e..bd05d7c04a 100644 --- a/payloads/libpayload/libc/coreboot.c +++ b/payloads/libpayload/libc/coreboot.c @@ -301,6 +301,11 @@ static void cb_parse_rsdp(void *ptr, struct sysinfo_t *info) info->acpi_rsdp = cb_acpi_rsdp->rsdp_pointer; } +static void cb_parse_panel_poweroff(unsigned char *ptr, struct sysinfo_t *info) +{ + info->cb_panel_poweroff = virt_to_phys(ptr); +} + int cb_parse_header(void *addr, int len, struct sysinfo_t *info) { struct cb_header *header; @@ -447,6 +452,9 @@ int cb_parse_header(void *addr, int len, struct sysinfo_t *info) case CB_TAG_PCIE: cb_parse_pcie(ptr, info); break; + case CB_TAG_PANEL_POWEROFF: + cb_parse_panel_poweroff(ptr, info); + break; case CB_TAG_BOOT_MODE: cb_parse_boot_mode(ptr, info); break; diff --git a/src/commonlib/include/commonlib/coreboot_tables.h b/src/commonlib/include/commonlib/coreboot_tables.h index fcc7761044..ed5d52f0b5 100644 --- a/src/commonlib/include/commonlib/coreboot_tables.h +++ b/src/commonlib/include/commonlib/coreboot_tables.h @@ -91,6 +91,7 @@ enum { LB_TAG_CAPSULE = 0x0046, LB_TAG_CFR_ROOT = 0x0047, LB_TAG_ROOT_BRIDGE_INFO = 0x0048, + LB_TAG_PANEL_POWEROFF = 0x0049, /* The following options are CMOS-related */ LB_TAG_CMOS_OPTION_TABLE = 0x00c8, LB_TAG_OPTION = 0x00c9, @@ -629,6 +630,14 @@ struct lb_cfr { /* struct lb_cfr_option_form forms[] */ }; +struct lb_panel_poweroff { + uint32_t tag; + uint32_t size; + + /* MIPI DSI poweroff commands from panel_serializable_data. */ + uint8_t cmd[]; +}; + enum boot_mode_t { LB_BOOT_MODE_NORMAL, LB_BOOT_MODE_LOW_BATTERY,