Rajat Jain has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
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 --- M Documentation/acpi/gpio.md M src/arch/x86/acpigen.c M src/arch/x86/include/arch/acpigen.h 3 files changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/39145/1
diff --git a/Documentation/acpi/gpio.md b/Documentation/acpi/gpio.md index d42042f..b9acd96 100644 --- a/Documentation/acpi/gpio.md +++ b/Documentation/acpi/gpio.md @@ -73,6 +73,15 @@ functions internally. Thus, all the ACPI AML calling conventions for the platform functions apply to these helper functions as well.
+3. Get Rx GPIO + int acpigen_get_rx_gpio(struct acpi_gpio gpio) + +This function takes as input, an struct acpi_gpio type and outputs +AML code to read the *logical* value of a gpio (after taking its +polarity into consideration), into the Local0 variable. It calls +the platform specific acpigen_soc_read_rx_gpio() to actually read +the rx gpio value. + ## Implementation Details
ACPI library in coreboot will provide weak definitions for all the diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c index 72605bb..2dad00a 100644 --- a/src/arch/x86/acpigen.c +++ b/src/arch/x86/acpigen.c @@ -1203,6 +1203,15 @@ acpigen_emit_byte(res); }
+/* Xor (arg1, arg2, res) */ +void acpigen_write_xor(uint9_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 @@ 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) diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h index 0807558..34c5197 100644 --- a/src/arch/x86/include/arch/acpigen.h +++ b/src/arch/x86/include/arch/acpigen.h @@ -361,6 +361,7 @@ void acpigen_write_store(void); void acpigen_write_store_ops(uint8_t src, uint8_t dst); void acpigen_write_or(uint8_t arg1, uint8_t arg2, uint8_t res); +void acpigen_write_xor(uint8_t arg1, uint8_t arg2, uint8_t res); void acpigen_write_and(uint8_t arg1, uint8_t arg2, uint8_t res); void acpigen_write_not(uint8_t arg, uint8_t res); void acpigen_write_debug_string(const char *str); @@ -472,6 +473,14 @@ int acpigen_enable_tx_gpio(struct acpi_gpio *gpio); int acpigen_disable_tx_gpio(struct acpi_gpio *gpio);
+/* + * Helper function for getting a RX GPIO value based on the GPIO polarity. + * The return value is stored in Local0 variable. + * This function ends up calling acpigen_soc_get_rx_gpio to make callbacks + * into SoC acpigen code + */ +void acpigen_get_rx_gpio(struct acpi_gpio *gpio); + /* 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); @@ -481,4 +490,5 @@ /* refer to ACPI 6.4.3.5.1 QWord Address Space Descriptor section for details */ void acpigen_resource_qword(u16 res_type, u16 gen_flags, u16 type_flags, u64 gran, u64 range_min, u64 range_max, u64 translation, u64 length); + #endif
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/39145/1/Documentation/acpi/gpio.md File Documentation/acpi/gpio.md:
https://review.coreboot.org/c/coreboot/+/39145/1/Documentation/acpi/gpio.md@... PS1, Line 83: rx raw Rx
https://review.coreboot.org/c/coreboot/+/39145/1/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/39145/1/src/arch/x86/acpigen.c@1207 PS1, Line 1207: uint9_t New data type ;).
Hello Tim Wawrzynczak, Mathew King, Duncan Laurie, build bot (Jenkins), Furquan Shaikh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/39145
to look at the new patch set (#2).
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
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 --- M Documentation/acpi/gpio.md M src/arch/x86/acpigen.c M src/arch/x86/include/arch/acpigen.h 3 files changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/39145/2
Mathew King has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
Patch Set 2: Code-Review+2
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c@1776 PS2, Line 1776: acpigen_write_xor If you're just using this to toggle the bit, I don't think you need to add acpigen_write_xor(), I think you can use the already existing acpigen_write_not() instead.
Hello Tim Wawrzynczak, Mathew King, Duncan Laurie, build bot (Jenkins), Furquan Shaikh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/39145
to look at the new patch set (#3).
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
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 --- M Documentation/acpi/gpio.md M src/arch/x86/acpigen.c M src/arch/x86/include/arch/acpigen.h 3 files changed, 36 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/45/39145/3
Rajat Jain has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
Patch Set 3:
(1 comment)
`
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c@1776 PS2, Line 1776: acpigen_write_xor
If you're just using this to toggle the bit, I don't think you need to add acpigen_write_xor(), I th […]
Now that I have it, I think it may help some one else in future hopefully :-)
Tim Wawrzynczak has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c@1776 PS2, Line 1776: acpigen_write_xor
Now that I have it, I think it may help some one else in future hopefully :-)
Oops yeah, I believe our write_not() is bitwise Not, instead of LNot (logical not).
Rajat Jain has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
Patch Set 3:
(3 comments)
https://review.coreboot.org/c/coreboot/+/39145/1/Documentation/acpi/gpio.md File Documentation/acpi/gpio.md:
https://review.coreboot.org/c/coreboot/+/39145/1/Documentation/acpi/gpio.md@... PS1, Line 83: rx
raw Rx
Done
https://review.coreboot.org/c/coreboot/+/39145/1/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/39145/1/src/arch/x86/acpigen.c@1207 PS1, Line 1207: uint9_t
New data type ;).
Done
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c File src/arch/x86/acpigen.c:
https://review.coreboot.org/c/coreboot/+/39145/2/src/arch/x86/acpigen.c@1776 PS2, Line 1776: acpigen_write_xor
Oops yeah, I believe our write_not() is bitwise Not, instead of LNot (logical not).
Done
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/39145 )
Change subject: arch/x86/acpigen: Add new helper routines for XOR and get_rx_gpio ......................................................................
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 --- M Documentation/acpi/gpio.md M src/arch/x86/acpigen.c M src/arch/x86/include/arch/acpigen.h 3 files changed, 36 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Mathew King: Looks good to me, approved
diff --git a/Documentation/acpi/gpio.md b/Documentation/acpi/gpio.md index d42042f..abde3a0 100644 --- a/Documentation/acpi/gpio.md +++ b/Documentation/acpi/gpio.md @@ -73,6 +73,15 @@ functions internally. Thus, all the ACPI AML calling conventions for the platform functions apply to these helper functions as well.
+3. Get Rx GPIO + int acpigen_get_rx_gpio(struct acpi_gpio gpio) + +This function takes as input, an struct acpi_gpio type and outputs +AML code to read the *logical* value of a gpio (after taking its +polarity into consideration), into the Local0 variable. It calls +the platform specific acpigen_soc_read_rx_gpio() to actually read +the raw Rx gpio value. + ## Implementation Details
ACPI library in coreboot will provide weak definitions for all the diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c index 72605bb..9162cdb 100644 --- a/src/arch/x86/acpigen.c +++ b/src/arch/x86/acpigen.c @@ -1203,6 +1203,15 @@ 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 @@ 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) diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h index 0807558..34c5197 100644 --- a/src/arch/x86/include/arch/acpigen.h +++ b/src/arch/x86/include/arch/acpigen.h @@ -361,6 +361,7 @@ void acpigen_write_store(void); void acpigen_write_store_ops(uint8_t src, uint8_t dst); void acpigen_write_or(uint8_t arg1, uint8_t arg2, uint8_t res); +void acpigen_write_xor(uint8_t arg1, uint8_t arg2, uint8_t res); void acpigen_write_and(uint8_t arg1, uint8_t arg2, uint8_t res); void acpigen_write_not(uint8_t arg, uint8_t res); void acpigen_write_debug_string(const char *str); @@ -472,6 +473,14 @@ int acpigen_enable_tx_gpio(struct acpi_gpio *gpio); int acpigen_disable_tx_gpio(struct acpi_gpio *gpio);
+/* + * Helper function for getting a RX GPIO value based on the GPIO polarity. + * The return value is stored in Local0 variable. + * This function ends up calling acpigen_soc_get_rx_gpio to make callbacks + * into SoC acpigen code + */ +void acpigen_get_rx_gpio(struct acpi_gpio *gpio); + /* 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); @@ -481,4 +490,5 @@ /* refer to ACPI 6.4.3.5.1 QWord Address Space Descriptor section for details */ void acpigen_resource_qword(u16 res_type, u16 gen_flags, u16 type_flags, u64 gran, u64 range_min, u64 range_max, u64 translation, u64 length); + #endif