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 <yupingso@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90738
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Yidi Lin <yidilin@google.com>
Reviewed-by: Chen-Tsung Hsieh <chentsung@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Yu-Ping Wu 2026-01-13 11:48:42 +08:00 committed by Yu-Ping Wu
commit 8cfc71d9e0
6 changed files with 29 additions and 0 deletions

View file

@ -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,

View file

@ -47,6 +47,7 @@
#include <cbgfx.h>
#if CONFIG(LP_GPL)
#include <commonlib/helpers.h>
#include <commonlib/mipi/cmd.h>
#else
#include <commonlib/bsd/helpers.h>
#endif

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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,