From 0fc2422e88dc34883dac523191d8c1a3a7fd8306 Mon Sep 17 00:00:00 2001 From: Ian Feng Date: Mon, 24 Mar 2025 15:36:32 +0800 Subject: [PATCH] mb/google/fatcat: Implement S0ix hooks aka `MS0X` method Implemented runtime ASL method (MS0X) being called by PEPD device _DSM to configure `GPIO_SLP_S0_GATE` PIN at S0ix entry/exit. Test on francka: GPIO_SLP_S0_GATE (GPP_F23) Scope (\_SB) { Method (MS0X, 1, Serialized) { If ((Arg0 == One)) { \_SB.PCI0.CTXS (0x47) } Else { \_SB.PCI0.STXS (0x47) } } } BUG=b:399264399 TEST=Run suspend_stress_test on francka and verify that the device can suspend. Change-Id: Idd9fcd07ab09f4dc905e4fa029b9b2f897ad015c Signed-off-by: Ian Feng Reviewed-on: https://review.coreboot.org/c/coreboot/+/86981 Reviewed-by: Subrata Banik Tested-by: build bot (Jenkins) Reviewed-by: Dinesh Gehlot Reviewed-by: Kapil Porwal --- src/mainboard/google/fatcat/mainboard.c | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/mainboard/google/fatcat/mainboard.c b/src/mainboard/google/fatcat/mainboard.c index f514eb96d1..e14c5ace79 100644 --- a/src/mainboard/google/fatcat/mainboard.c +++ b/src/mainboard/google/fatcat/mainboard.c @@ -58,6 +58,32 @@ void __weak variant_generate_s0ix_hook(enum s0ix_entry entry) */ } +static void mainboard_generate_s0ix_hook(void) +{ + acpigen_write_if_lequal_op_int(ARG0_OP, 1); + { + if (CONFIG(HAVE_SLP_S0_GATE)) + acpigen_soc_clear_tx_gpio(GPIO_SLP_S0_GATE); + variant_generate_s0ix_hook(S0IX_ENTRY); + } + acpigen_write_else(); + { + if (CONFIG(HAVE_SLP_S0_GATE)) + acpigen_soc_set_tx_gpio(GPIO_SLP_S0_GATE); + variant_generate_s0ix_hook(S0IX_EXIT); + } + acpigen_write_if_end(); +} + +static void mainboard_fill_ssdt(const struct device *dev) +{ + acpigen_write_scope("\\_SB"); + acpigen_write_method_serialized("MS0X", 1); + mainboard_generate_s0ix_hook(); + acpigen_write_method_end(); /* Method */ + acpigen_write_scope_end(); /* Scope */ +} + static void mainboard_dev_init(struct device *dev) { mainboard_ec_init(); @@ -66,6 +92,7 @@ static void mainboard_dev_init(struct device *dev) static void mainboard_enable(struct device *dev) { dev->ops->init = mainboard_dev_init; + dev->ops->acpi_fill_ssdt = mainboard_fill_ssdt; } struct chip_operations mainboard_ops = {