aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86/acpigen.c
diff options
context:
space:
mode:
authorRajat Jain <rajatja@google.com>2020-02-26 11:02:53 -0800
committerPatrick Georgi <pgeorgi@google.com>2020-03-02 11:40:23 +0000
commit310623b2dd192a44caa1a3ee9471127ec3d6cf5e (patch)
treeae6d12ea8d2bba6366ddb42d39a75181c7a761fb /src/arch/x86/acpigen.c
parent4d9dd22bd1235717d623916f641ce69a6556a5b2 (diff)
arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio
Add new helper function in the acpigen library, that use the underlying soc routines. Change-Id: I8d65699d3c806007a50adcb51c5d84567ce451b7 Signed-off-by: Rajat Jain <rajatja@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39145 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Mathew King <mathewk@chromium.org>
Diffstat (limited to 'src/arch/x86/acpigen.c')
-rw-r--r--src/arch/x86/acpigen.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 72605bb766..9162cdb371 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -1203,6 +1203,15 @@ void acpigen_write_or(uint8_t arg1, uint8_t arg2, uint8_t res)
acpigen_emit_byte(res);
}
+/* Xor (arg1, arg2, res) */
+void acpigen_write_xor(uint8_t arg1, uint8_t arg2, uint8_t res)
+{
+ acpigen_emit_byte(XOR_OP);
+ acpigen_emit_byte(arg1);
+ acpigen_emit_byte(arg2);
+ acpigen_emit_byte(res);
+}
+
/* And (arg1, arg2, res) */
void acpigen_write_and(uint8_t arg1, uint8_t arg2, uint8_t res)
{
@@ -1759,6 +1768,14 @@ int acpigen_disable_tx_gpio(struct acpi_gpio *gpio)
return acpigen_soc_clear_tx_gpio(gpio->pins[0]);
}
+void acpigen_get_rx_gpio(struct acpi_gpio *gpio)
+{
+ acpigen_soc_read_rx_gpio(gpio->pins[0]);
+
+ if (gpio->polarity == ACPI_GPIO_ACTIVE_LOW)
+ acpigen_write_xor(LOCAL0_OP, 1, LOCAL0_OP);
+}
+
/* refer to ACPI 6.4.3.5.3 Word Address Space Descriptor section for details */
void acpigen_resource_word(u16 res_type, u16 gen_flags, u16 type_flags, u16 gran,
u16 range_min, u16 range_max, u16 translation, u16 length)