From 8ff80b269d3e94c46d88c135f5f0e41e7c626905 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Wed, 23 Sep 2020 19:17:12 +0530 Subject: soc/intel/common/block/acpi: Factor out common gpio_op.asl This patch moves gpio_op.asl into common block acpi directory to avoid duplicating the same ASL code block across SoC directory. TEST=Able to build and boot TGL, CNL and CML platform. 1) Dump and disassemble DSDT, verify all methods present inside common gpio_op.asl like GRXS, GTXS etc. are still there. 2) Verify no ACPI error seen while running 'dmesg` from console. Signed-off-by: Subrata Banik Change-Id: I248f5e66994d2f3d6b0bd398347e7cf9ae7f2cc6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/45566 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/soc/intel/cannonlake/acpi/gpio.asl | 2 +- src/soc/intel/cannonlake/acpi/gpio_cnp_h.asl | 2 +- src/soc/intel/cannonlake/acpi/gpio_op.asl | 127 ----------------------- src/soc/intel/common/block/acpi/acpi/gpio_op.asl | 127 +++++++++++++++++++++++ src/soc/intel/icelake/acpi/gpio.asl | 19 +--- src/soc/intel/jasperlake/acpi/gpio.asl | 2 +- src/soc/intel/jasperlake/acpi/gpio_op.asl | 126 ---------------------- src/soc/intel/skylake/acpi/gpio.asl | 62 +---------- src/soc/intel/tigerlake/acpi/gpio.asl | 2 +- src/soc/intel/tigerlake/acpi/gpio_op.asl | 126 ---------------------- 10 files changed, 133 insertions(+), 462 deletions(-) delete mode 100644 src/soc/intel/cannonlake/acpi/gpio_op.asl create mode 100644 src/soc/intel/common/block/acpi/acpi/gpio_op.asl delete mode 100644 src/soc/intel/jasperlake/acpi/gpio_op.asl delete mode 100644 src/soc/intel/tigerlake/acpi/gpio_op.asl (limited to 'src/soc') diff --git a/src/soc/intel/cannonlake/acpi/gpio.asl b/src/soc/intel/cannonlake/acpi/gpio.asl index 2a4534330f..f1284e1412 100644 --- a/src/soc/intel/cannonlake/acpi/gpio.asl +++ b/src/soc/intel/cannonlake/acpi/gpio.asl @@ -1,9 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include -#include "gpio_op.asl" Device (GPIO) { diff --git a/src/soc/intel/cannonlake/acpi/gpio_cnp_h.asl b/src/soc/intel/cannonlake/acpi/gpio_cnp_h.asl index da0756f62a..5b3123df2c 100644 --- a/src/soc/intel/cannonlake/acpi/gpio_cnp_h.asl +++ b/src/soc/intel/cannonlake/acpi/gpio_cnp_h.asl @@ -1,8 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include -#include "gpio_op.asl" Device (GPIO) { diff --git a/src/soc/intel/cannonlake/acpi/gpio_op.asl b/src/soc/intel/cannonlake/acpi/gpio_op.asl deleted file mode 100644 index 9fa3dc4a86..0000000000 --- a/src/soc/intel/cannonlake/acpi/gpio_op.asl +++ /dev/null @@ -1,127 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -#include - -/* - * Get GPIO Value - * Arg0 - GPIO Number - */ -Method (GRXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = (PAD_CFG0_RX_STATE & VAL0) >> PAD_CFG0_RX_STATE_BIT - - Return (Local0) -} - -/* - * Get GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (GTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = PAD_CFG0_TX_STATE & VAL0 - - Return (Local0) -} - -/* - * Set GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (STXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 |= PAD_CFG0_TX_STATE -} - -/* - * Clear GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (CTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 &= ~PAD_CFG0_TX_STATE -} - -/* - * Set Pad mode - * Arg0 - GPIO Number - * Arg1 - Pad mode - * 0 = GPIO control pad - * 1 = Native Function 1 - * 2 = Native Function 2 - * 3 = Native Function 3 - */ -Method (GPMO, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = ~PAD_CFG0_MODE_MASK & VAL0 - Arg1 = (Arg1 << PAD_CFG0_MODE_SHIFT) & PAD_CFG0_MODE_MASK - VAL0 = Local0 | Arg1 -} - -/* - * Enable/Disable Tx buffer - * Arg0 - GPIO Number - * Arg1 - TxBuffer state - * 0 = Disable Tx Buffer - * 1 = Enable Tx Buffer - */ -Method (GTXE, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - - If (Arg1 == 1) { - VAL0 &= ~PAD_CFG0_TX_DISABLE - } ElseIf (Arg1 == 0){ - VAL0 |= PAD_CFG0_TX_DISABLE - } -} - -/* - * Enable/Disable Rx buffer - * Arg0 - GPIO Number - * Arg1 - RxBuffer state - * 0 = Disable Rx Buffer - * 1 = Enable Rx Buffer - */ -Method (GRXE, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - - If (Arg1 == 1) { - VAL0 &= ~PAD_CFG0_RX_DISABLE - } ElseIf (Arg1 == 0){ - VAL0 |= PAD_CFG0_RX_DISABLE - } -} diff --git a/src/soc/intel/common/block/acpi/acpi/gpio_op.asl b/src/soc/intel/common/block/acpi/acpi/gpio_op.asl new file mode 100644 index 0000000000..9fa3dc4a86 --- /dev/null +++ b/src/soc/intel/common/block/acpi/acpi/gpio_op.asl @@ -0,0 +1,127 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#include + +/* + * Get GPIO Value + * Arg0 - GPIO Number + */ +Method (GRXS, 1, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + Local0 = (PAD_CFG0_RX_STATE & VAL0) >> PAD_CFG0_RX_STATE_BIT + + Return (Local0) +} + +/* + * Get GPIO Tx Value + * Arg0 - GPIO Number + */ +Method (GTXS, 1, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + Local0 = PAD_CFG0_TX_STATE & VAL0 + + Return (Local0) +} + +/* + * Set GPIO Tx Value + * Arg0 - GPIO Number + */ +Method (STXS, 1, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + VAL0 |= PAD_CFG0_TX_STATE +} + +/* + * Clear GPIO Tx Value + * Arg0 - GPIO Number + */ +Method (CTXS, 1, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + VAL0 &= ~PAD_CFG0_TX_STATE +} + +/* + * Set Pad mode + * Arg0 - GPIO Number + * Arg1 - Pad mode + * 0 = GPIO control pad + * 1 = Native Function 1 + * 2 = Native Function 2 + * 3 = Native Function 3 + */ +Method (GPMO, 2, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + Local0 = ~PAD_CFG0_MODE_MASK & VAL0 + Arg1 = (Arg1 << PAD_CFG0_MODE_SHIFT) & PAD_CFG0_MODE_MASK + VAL0 = Local0 | Arg1 +} + +/* + * Enable/Disable Tx buffer + * Arg0 - GPIO Number + * Arg1 - TxBuffer state + * 0 = Disable Tx Buffer + * 1 = Enable Tx Buffer + */ +Method (GTXE, 2, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + + If (Arg1 == 1) { + VAL0 &= ~PAD_CFG0_TX_DISABLE + } ElseIf (Arg1 == 0){ + VAL0 |= PAD_CFG0_TX_DISABLE + } +} + +/* + * Enable/Disable Rx buffer + * Arg0 - GPIO Number + * Arg1 - RxBuffer state + * 0 = Disable Rx Buffer + * 1 = Enable Rx Buffer + */ +Method (GRXE, 2, Serialized) +{ + OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) + Field (PREG, AnyAcc, NoLock, Preserve) + { + VAL0, 32 + } + + If (Arg1 == 1) { + VAL0 &= ~PAD_CFG0_RX_DISABLE + } ElseIf (Arg1 == 0){ + VAL0 |= PAD_CFG0_RX_DISABLE + } +} diff --git a/src/soc/intel/icelake/acpi/gpio.asl b/src/soc/intel/icelake/acpi/gpio.asl index a00521ac3c..4498818882 100644 --- a/src/soc/intel/icelake/acpi/gpio.asl +++ b/src/soc/intel/icelake/acpi/gpio.asl @@ -1,10 +1,9 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include +#include #include #include #include - Device (GPIO) { Name (_HID, "INT3455") @@ -103,19 +102,3 @@ Method (GADD, 1, NotSerialized) Add (Local2, PAD_CFG_BASE, Local2) Return (Add (Local2, Multiply (Local1, 16))) } - -/* - * Get GPIO Value - * Arg0 - GPIO Number - */ -Method (GRXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = (PAD_CFG0_RX_STATE & VAL0) >> PAD_CFG0_RX_STATE_BIT - - Return (Local0) -} diff --git a/src/soc/intel/jasperlake/acpi/gpio.asl b/src/soc/intel/jasperlake/acpi/gpio.asl index f8b180df11..e39ac8afc2 100644 --- a/src/soc/intel/jasperlake/acpi/gpio.asl +++ b/src/soc/intel/jasperlake/acpi/gpio.asl @@ -1,10 +1,10 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include -#include "gpio_op.asl" #include diff --git a/src/soc/intel/jasperlake/acpi/gpio_op.asl b/src/soc/intel/jasperlake/acpi/gpio_op.asl deleted file mode 100644 index ff12da4c10..0000000000 --- a/src/soc/intel/jasperlake/acpi/gpio_op.asl +++ /dev/null @@ -1,126 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -/* - * Get GPIO Value - * Arg0 - GPIO Number - */ -Method (GRXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = (PAD_CFG0_RX_STATE & VAL0) >> PAD_CFG0_RX_STATE_BIT - - Return (Local0) -} - -/* - * Get GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (GTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = PAD_CFG0_TX_STATE & VAL0 - - Return (Local0) -} - -/* - * Set GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (STXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 |= PAD_CFG0_TX_STATE -} - -/* - * Clear GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (CTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 &= ~PAD_CFG0_TX_STATE -} - -/* - * Set Pad mode - * Arg0 - GPIO Number - * Arg1 - Pad mode - * 0 = GPIO control pad - * 1 = Native Function 1 - * 2 = Native Function 2 - * 3 = Native Function 3 - */ -Method (GPMO, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = ~PAD_CFG0_MODE_MASK & VAL0 - Arg1 = (Arg1 << PAD_CFG0_MODE_SHIFT) & PAD_CFG0_MODE_MASK - VAL0 = Local0 | Arg1 -} - -/* - * Enable/Disable Tx buffer - * Arg0 - GPIO Number - * Arg1 - TxBuffer state - * 0 = Disable Tx Buffer - * 1 = Enable Tx Buffer - */ -Method (GTXE, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - - If (Arg1 == 1) { - VAL0 &= ~PAD_CFG0_TX_DISABLE - } ElseIf (Arg1 == 0){ - VAL0 &= PAD_CFG0_TX_DISABLE - } -} - -/* - * Enable/Disable Rx buffer - * Arg0 - GPIO Number - * Arg1 - RxBuffer state - * 0 = Disable Rx Buffer - * 1 = Enable Rx Buffer - */ -Method (GRXE, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - - If (Arg1 == 1) { - VAL0 &= ~PAD_CFG0_RX_DISABLE - } ElseIf (Arg1 == 0){ - VAL0 |= PAD_CFG0_RX_DISABLE - } -} diff --git a/src/soc/intel/skylake/acpi/gpio.asl b/src/soc/intel/skylake/acpi/gpio.asl index 9877a77571..c1f559eb8d 100644 --- a/src/soc/intel/skylake/acpi/gpio.asl +++ b/src/soc/intel/skylake/acpi/gpio.asl @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#include +#include #include Device (GPIO) @@ -105,63 +105,3 @@ Method (GADD, 1, NotSerialized) Add (Local2, PAD_CFG_BASE, Local2) Return (Add (Local2, Multiply (Local1, 8))) } - -/* - * Get GPIO Rx Value - * Arg0 - GPIO Number - */ -Method (GRXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = (PAD_CFG0_RX_STATE & VAL0) >> PAD_CFG0_RX_STATE_BIT - - Return (Local0) -} - -/* - * Get GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (GTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = PAD_CFG0_TX_STATE & VAL0 - - Return (Local0) -} - -/* - * Set GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (STXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 |= PAD_CFG0_TX_STATE -} - -/* - * Clear GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (CTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 &= ~PAD_CFG0_TX_STATE -} diff --git a/src/soc/intel/tigerlake/acpi/gpio.asl b/src/soc/intel/tigerlake/acpi/gpio.asl index b17abfe483..5a6e54a4a7 100644 --- a/src/soc/intel/tigerlake/acpi/gpio.asl +++ b/src/soc/intel/tigerlake/acpi/gpio.asl @@ -2,9 +2,9 @@ #include #include #include +#include #include #include -#include "gpio_op.asl" Device (GPIO) { diff --git a/src/soc/intel/tigerlake/acpi/gpio_op.asl b/src/soc/intel/tigerlake/acpi/gpio_op.asl deleted file mode 100644 index ff12da4c10..0000000000 --- a/src/soc/intel/tigerlake/acpi/gpio_op.asl +++ /dev/null @@ -1,126 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ - -/* - * Get GPIO Value - * Arg0 - GPIO Number - */ -Method (GRXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = (PAD_CFG0_RX_STATE & VAL0) >> PAD_CFG0_RX_STATE_BIT - - Return (Local0) -} - -/* - * Get GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (GTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = PAD_CFG0_TX_STATE & VAL0 - - Return (Local0) -} - -/* - * Set GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (STXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 |= PAD_CFG0_TX_STATE -} - -/* - * Clear GPIO Tx Value - * Arg0 - GPIO Number - */ -Method (CTXS, 1, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - VAL0 &= ~PAD_CFG0_TX_STATE -} - -/* - * Set Pad mode - * Arg0 - GPIO Number - * Arg1 - Pad mode - * 0 = GPIO control pad - * 1 = Native Function 1 - * 2 = Native Function 2 - * 3 = Native Function 3 - */ -Method (GPMO, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - Local0 = ~PAD_CFG0_MODE_MASK & VAL0 - Arg1 = (Arg1 << PAD_CFG0_MODE_SHIFT) & PAD_CFG0_MODE_MASK - VAL0 = Local0 | Arg1 -} - -/* - * Enable/Disable Tx buffer - * Arg0 - GPIO Number - * Arg1 - TxBuffer state - * 0 = Disable Tx Buffer - * 1 = Enable Tx Buffer - */ -Method (GTXE, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - - If (Arg1 == 1) { - VAL0 &= ~PAD_CFG0_TX_DISABLE - } ElseIf (Arg1 == 0){ - VAL0 &= PAD_CFG0_TX_DISABLE - } -} - -/* - * Enable/Disable Rx buffer - * Arg0 - GPIO Number - * Arg1 - RxBuffer state - * 0 = Disable Rx Buffer - * 1 = Enable Rx Buffer - */ -Method (GRXE, 2, Serialized) -{ - OperationRegion (PREG, SystemMemory, GADD (Arg0), 4) - Field (PREG, AnyAcc, NoLock, Preserve) - { - VAL0, 32 - } - - If (Arg1 == 1) { - VAL0 &= ~PAD_CFG0_RX_DISABLE - } ElseIf (Arg1 == 0){ - VAL0 |= PAD_CFG0_RX_DISABLE - } -} -- cgit v1.2.3