diff options
author | Simon Glass <sjg@chromium.org> | 2020-07-07 13:11:41 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-07-17 14:32:24 +0800 |
commit | f4955137f5f15e615376cf38559414a9b53e3d55 (patch) | |
tree | 699167d9e3cc6cae0fae4a0ddeb4b335c05786aa /test | |
parent | 2715b3623c08bf1ad2dfe6076ad86c24e3138016 (diff) | |
download | u-boot-f4955137f5f15e615376cf38559414a9b53e3d55.zip u-boot-f4955137f5f15e615376cf38559414a9b53e3d55.tar.gz u-boot-f4955137f5f15e615376cf38559414a9b53e3d55.tar.bz2 |
irq: Add a method to convert an interrupt to ACPI
When generating ACPI tables we need to convert IRQs in U-Boot to the ACPI
structures required by ACPI. This is a SoC-specific conversion and cannot
be handled by generic code, so add a new IRQ method to do the conversion.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/irq.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/dm/irq.c b/test/dm/irq.c index 192d80d..51bae31 100644 --- a/test/dm/irq.c +++ b/test/dm/irq.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> #include <irq.h> +#include <acpi/acpi_device.h> #include <asm/test.h> #include <dm/test.h> #include <test/ut.h> @@ -75,3 +76,25 @@ static int dm_test_request(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_request, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test of irq_get_acpi() */ +static int dm_test_irq_get_acpi(struct unit_test_state *uts) +{ + struct acpi_irq airq; + struct udevice *dev; + struct irq irq; + + ut_assertok(uclass_first_device_err(UCLASS_TEST_FDT, &dev)); + ut_assertok(irq_get_by_index(dev, 0, &irq)); + + /* see sandbox_get_acpi() */ + ut_assertok(irq_get_acpi(&irq, &airq)); + ut_asserteq(3, airq.pin); + ut_asserteq(ACPI_IRQ_LEVEL_TRIGGERED, airq.mode); + ut_asserteq(ACPI_IRQ_ACTIVE_HIGH, airq.polarity); + ut_asserteq(ACPI_IRQ_SHARED, airq.shared); + ut_asserteq(ACPI_IRQ_WAKE, airq.wake); + + return 0; +} +DM_TEST(dm_test_irq_get_acpi, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); |