diff options
author | Tony Huang <tony-huang@quanta.corp-partner.google.com> | 2022-09-06 17:03:27 +0800 |
---|---|---|
committer | Karthik Ramasubramanian <kramasub@google.com> | 2022-09-13 16:36:04 +0000 |
commit | e5c547c2d75a452e3230cf5923c5b7f318993ed3 (patch) | |
tree | f7fad74854efe163ad539e70059bba3b916539ea | |
parent | 20e1dc27e95a9ee6667112380ee989ceaa179722 (diff) |
mb/google/dedede: Generate MS0X entry and provide variant hook
BUG=b:245426120
BRANCH=firmware-dedede-13606.B
TEST=emerge-dedede coreboot
check SSDT table has MS0X entry
Scope (\_SB)
{
Method (MS0X, 1, Serialized)
{
If ((Arg0 == One)) {}
Else
{
}
}
}
Change-Id: Id01089531503e62231c5ab19e4cd8056198b9acb
Signed-off-by: Tony Huang <tony-huang@quanta.corp-partner.google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/67373
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
-rw-r--r-- | src/mainboard/google/dedede/mainboard.c | 37 | ||||
-rw-r--r-- | src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h | 7 |
2 files changed, 44 insertions, 0 deletions
diff --git a/src/mainboard/google/dedede/mainboard.c b/src/mainboard/google/dedede/mainboard.c index ca5a21c83b..4cb38c04eb 100644 --- a/src/mainboard/google/dedede/mainboard.c +++ b/src/mainboard/google/dedede/mainboard.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ #include <acpi/acpi.h> +#include <acpi/acpigen.h> #include <baseboard/variants.h> #include <console/console.h> #include <device/device.h> @@ -63,10 +64,46 @@ static unsigned long mainboard_write_acpi_tables( return current; } +static void mainboard_generate_s0ix_hook(void) +{ + acpigen_write_if_lequal_op_int(ARG0_OP, 1); + variant_generate_s0ix_hook(S0IX_ENTRY); + acpigen_write_else(); + 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 */ + +} + +void __weak variant_generate_s0ix_hook(enum s0ix_entry entry) +{ + + /* Add board-specific MS0X entries */ + /* + if (s0ix_entry == S0IX_ENTRY) { + implement variant operations here + } + if (s0ix_entry == S0IX_EXIT) { + implement variant operations here + } + */ +} + + static void mainboard_enable(struct device *dev) { dev->ops->init = mainboard_dev_init; dev->ops->write_acpi_tables = mainboard_write_acpi_tables; + dev->ops->acpi_fill_ssdt = mainboard_fill_ssdt; } struct chip_operations mainboard_ops = { diff --git a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h index aef30751cc..fda5c31ab8 100644 --- a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h @@ -15,6 +15,11 @@ const struct pad_config *variant_early_gpio_table(size_t *num); const struct pad_config *variant_sleep_gpio_table(size_t *num); const struct pad_config *variant_override_gpio_table(size_t *num); +enum s0ix_entry { + S0IX_EXIT, + S0IX_ENTRY, +}; + /** * Get board's Hardware features as defined in FW_CONFIG * @@ -44,4 +49,6 @@ void variant_devtree_update(void); /* Modify LTE devictree settings during ramstage. */ void update_lte_device(struct acpi_gpio *lte_reset_gpio, struct acpi_gpio *lte_enable_gpio); + +void variant_generate_s0ix_hook(enum s0ix_entry); #endif /*__BASEBOARD_VARIANTS_H__ */ |