From 95bff2e17e8b9e84e588aeb9504e086174edd0b0 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 10 Dec 2019 14:12:03 +0100 Subject: superio/common: Add more ACPI methods * Make use of introduced SSDT config mode access * Make use of introduced SSDT mutex * Provide ACPI functions to safely access SIO config space * Implement method to query LDN enable state * Implement method to set LDN enable state * Use introduced functions to implement _DIS and _STA in the device * Update documentation Tested on Aspeed AST2500 and Linux 5.2. Manually verified ACPI code that generates no errors in Linux. Change-Id: I520b29de925f368cd71ff8f1f58d2d57d72eff8d Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/37640 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/superio/common/ssdt.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/superio/common/ssdt.c') diff --git a/src/superio/common/ssdt.c b/src/superio/common/ssdt.c index a919aa5620..bc5d39460a 100644 --- a/src/superio/common/ssdt.c +++ b/src/superio/common/ssdt.c @@ -200,7 +200,24 @@ void superio_common_fill_ssdt_generator(struct device *dev) acpigen_write_name_byte("LDN", ldn); acpigen_write_name_byte("VLDN", vldn); - acpigen_write_STA(dev->enabled ? 0xf : 0); + acpigen_write_method("_STA", 0); + { + acpigen_write_store(); + acpigen_emit_namestring("^^QLDN"); + acpigen_write_integer(ldn); + acpigen_emit_byte(LOCAL0_OP); + + /* Multiply (Local0, 0xf, Local0) */ + acpigen_emit_byte(MULTIPLY_OP); + acpigen_emit_byte(LOCAL0_OP); + acpigen_write_integer(0xf); + acpigen_emit_byte(LOCAL0_OP); + + acpigen_emit_byte(RETURN_OP); + acpigen_emit_byte(LOCAL0_OP); + + } + acpigen_pop_len(); /* Method */ if (!dev->enabled) { acpigen_pop_len(); /* Device */ @@ -242,6 +259,13 @@ void superio_common_fill_ssdt_generator(struct device *dev) acpigen_write_name_string("_HID", hid); acpigen_write_name_string("_DDN", name_from_hid(hid)); + acpigen_write_method("_DIS", 0); + { + acpigen_emit_namestring("^^DLDN"); + acpigen_write_integer(ldn); + } + acpigen_pop_len(); /* Method */ + acpigen_pop_len(); /* Device */ acpigen_pop_len(); /* Scope */ } -- cgit v1.2.3