Maxim Polyakov has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36379 )
Change subject: src/superio/nuvoton/nct6791d: use SuperIO acpigen ......................................................................
src/superio/nuvoton/nct6791d: use SuperIO acpigen
Adds the code needed to use apcigen[1] for the nct6791d SuperIO chip.
[1] https://review.coreboot.org/c/coreboot/+/33033
Change-Id: Idad66546168bbd26f0a4241deb66e5bfd83367af Signed-off-by: Maxim Polyakov max.senia.poliak@gmail.com --- M src/superio/nuvoton/nct6791d/Makefile.inc M src/superio/nuvoton/nct6791d/superio.c 2 files changed, 30 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/79/36379/1
diff --git a/src/superio/nuvoton/nct6791d/Makefile.inc b/src/superio/nuvoton/nct6791d/Makefile.inc index db5c620..a1299a4 100644 --- a/src/superio/nuvoton/nct6791d/Makefile.inc +++ b/src/superio/nuvoton/nct6791d/Makefile.inc @@ -14,3 +14,5 @@ ##
ramstage-$(CONFIG_SUPERIO_NUVOTON_NCT6791D) += superio.c +ramstage-$(CONFIG_SUPERIO_NUVOTON_NCT6791D) += ../../common/ssdt.c +ramstage-$(CONFIG_SUPERIO_NUVOTON_NCT6791D) += ../../common/generic.c diff --git a/src/superio/nuvoton/nct6791d/superio.c b/src/superio/nuvoton/nct6791d/superio.c index 23d5a6f..08f0bfa 100644 --- a/src/superio/nuvoton/nct6791d/superio.c +++ b/src/superio/nuvoton/nct6791d/superio.c @@ -22,10 +22,10 @@ #include <device/pnp.h> #include <pc80/keyboard.h> #include <superio/conf_mode.h> - +#include <superio/common/ssdt.h> +#include <arch/acpi.h> #include "nct6791d.h"
- static void nct6791d_init(struct device *dev) { if (!dev->enabled) @@ -38,6 +38,27 @@ } }
+#if CONFIG(HAVE_ACPI_TABLES) +/* Provide ACPI HIDs for generic Super I/O SSDT */ +static const char *nct6791d_acpi_hid(const struct device *dev) +{ + if ((dev->path.type != DEVICE_PATH_PNP) || + (dev->path.pnp.port == 0) || + ((dev->path.pnp.device & 0xff) > NCT6791D_DS)) + return NULL; + + switch (dev->path.pnp.device & 0xff) { + case NCT6791D_SP1: /* falltrough */ + case NCT6791D_SP2: + return ACPI_HID_COM; + case NCT6791D_KBC: + return ACPI_HID_KEYBOARD; + default: + return ACPI_HID_PNP; + } +} +#endif + static struct device_operations ops = { .read_resources = pnp_read_resources, .set_resources = pnp_set_resources, @@ -45,6 +66,11 @@ .enable = pnp_alt_enable, .init = nct6791d_init, .ops_pnp_mode = &pnp_conf_mode_8787_aa, +#if CONFIG(HAVE_ACPI_TABLES) + .acpi_fill_ssdt_generator = superio_common_fill_ssdt_generator, + .acpi_name = superio_common_ldn_acpi_name, + .acpi_hid = nct6791d_acpi_hid, +#endif };
static struct pnp_info pnp_dev_info[] = {
Maxim Polyakov has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36379 )
Change subject: superio/nuvoton/nct6791d: use SuperIO ACPI generator ......................................................................
Patch Set 2:
This change is ready for review.
Felix Held has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/36379 )
Change subject: superio/nuvoton/nct6791d: use SuperIO ACPI generator ......................................................................
Patch Set 2: Code-Review+2
Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/36379 )
Change subject: superio/nuvoton/nct6791d: use SuperIO ACPI generator ......................................................................
superio/nuvoton/nct6791d: use SuperIO ACPI generator
Adds SuperIO SSDT ACPI generator[1] support. It has been tested on Asrock H110M DVS motherboard [2].
[1] https://review.coreboot.org/c/coreboot/+/33033 [2] https://review.coreboot.org/c/coreboot/+/36381
Change-Id: Idad66546168bbd26f0a4241deb66e5bfd83367af Signed-off-by: Maxim Polyakov max.senia.poliak@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/36379 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Felix Held felix-coreboot@felixheld.de --- M src/superio/nuvoton/nct6791d/Makefile.inc M src/superio/nuvoton/nct6791d/superio.c 2 files changed, 30 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Felix Held: Looks good to me, approved
diff --git a/src/superio/nuvoton/nct6791d/Makefile.inc b/src/superio/nuvoton/nct6791d/Makefile.inc index db5c620..a1299a4 100644 --- a/src/superio/nuvoton/nct6791d/Makefile.inc +++ b/src/superio/nuvoton/nct6791d/Makefile.inc @@ -14,3 +14,5 @@ ##
ramstage-$(CONFIG_SUPERIO_NUVOTON_NCT6791D) += superio.c +ramstage-$(CONFIG_SUPERIO_NUVOTON_NCT6791D) += ../../common/ssdt.c +ramstage-$(CONFIG_SUPERIO_NUVOTON_NCT6791D) += ../../common/generic.c diff --git a/src/superio/nuvoton/nct6791d/superio.c b/src/superio/nuvoton/nct6791d/superio.c index 23d5a6f..08f0bfa 100644 --- a/src/superio/nuvoton/nct6791d/superio.c +++ b/src/superio/nuvoton/nct6791d/superio.c @@ -22,10 +22,10 @@ #include <device/pnp.h> #include <pc80/keyboard.h> #include <superio/conf_mode.h> - +#include <superio/common/ssdt.h> +#include <arch/acpi.h> #include "nct6791d.h"
- static void nct6791d_init(struct device *dev) { if (!dev->enabled) @@ -38,6 +38,27 @@ } }
+#if CONFIG(HAVE_ACPI_TABLES) +/* Provide ACPI HIDs for generic Super I/O SSDT */ +static const char *nct6791d_acpi_hid(const struct device *dev) +{ + if ((dev->path.type != DEVICE_PATH_PNP) || + (dev->path.pnp.port == 0) || + ((dev->path.pnp.device & 0xff) > NCT6791D_DS)) + return NULL; + + switch (dev->path.pnp.device & 0xff) { + case NCT6791D_SP1: /* falltrough */ + case NCT6791D_SP2: + return ACPI_HID_COM; + case NCT6791D_KBC: + return ACPI_HID_KEYBOARD; + default: + return ACPI_HID_PNP; + } +} +#endif + static struct device_operations ops = { .read_resources = pnp_read_resources, .set_resources = pnp_set_resources, @@ -45,6 +66,11 @@ .enable = pnp_alt_enable, .init = nct6791d_init, .ops_pnp_mode = &pnp_conf_mode_8787_aa, +#if CONFIG(HAVE_ACPI_TABLES) + .acpi_fill_ssdt_generator = superio_common_fill_ssdt_generator, + .acpi_name = superio_common_ldn_acpi_name, + .acpi_hid = nct6791d_acpi_hid, +#endif };
static struct pnp_info pnp_dev_info[] = {