From 247ec33eb995ebb10b423f86e965666e3a0ac8fa Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Fri, 7 Apr 2023 14:43:25 -0400 Subject: [PATCH] superio/common: Support more than one SuperIO in ACPI The SuperIO ACPI name was hard-coded to "SIO0". Allow setting the name in the device tree so more than one SuperIO can be named. An upcoming board (purism/librem_l1um_v2) has two SuperIOs - one in the AST2500 BMC, and a Nuvoton NCT6791D used for hardware monitor, POST display, etc. Many boards have references to SIO0 already, so the default name is still the same for a single SuperIO. Change-Id: Ibfa6ab7622749e6310ee91530bc3722e8e28d9bb Signed-off-by: Jonathon Hall Reviewed-on: https://review.coreboot.org/c/coreboot/+/75089 Reviewed-by: Angel Pons Reviewed-by: Paul Menzel Tested-by: build bot (Jenkins) --- src/superio/common/chip.h | 3 +++ src/superio/common/generic.c | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/superio/common/chip.h b/src/superio/common/chip.h index 737c90c500..2836a522f1 100644 --- a/src/superio/common/chip.h +++ b/src/superio/common/chip.h @@ -5,6 +5,9 @@ struct superio_common_config { /* FIXME: Add enter conf/exit conf codes here for SSDT generation */ + /* Rarely, boards may have more than one SuperIO. Give each SuperIO a + * unique name for ACPI. The default is 'SIO0'. */ + char acpi_name[5]; }; #endif /* __SUPERIO_COMMON_CHIP_H__ */ diff --git a/src/superio/common/generic.c b/src/superio/common/generic.c index 83f2fea2b2..c6903402a0 100644 --- a/src/superio/common/generic.c +++ b/src/superio/common/generic.c @@ -4,6 +4,7 @@ #include #include #include +#include "chip.h" static void generic_set_resources(struct device *dev) { @@ -292,6 +293,11 @@ static void generic_ssdt(const struct device *dev) static const char *generic_acpi_name(const struct device *dev) { + const struct superio_common_config *cfg = dev->chip_info; + if (cfg && cfg->acpi_name[sizeof(cfg->acpi_name)-1] == '\0' && + strlen(cfg->acpi_name) == 4) { + return cfg->acpi_name; + } return "SIO0"; } #endif