From 2715b3623c08bf1ad2dfe6076ad86c24e3138016 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 7 Jul 2020 13:11:40 -0600 Subject: acpi: Add a way to check device status At present U-Boot does not support the different ACPI status values, but it is best to put this logic in a central place. Add a function to get the device status. Signed-off-by: Simon Glass Reviewed-by: Wolfgang Wallner Reviewed-by: Bin Meng --- test/dm/acpi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/dm/acpi.c b/test/dm/acpi.c index 5b84593..07b0daa 100644 --- a/test/dm/acpi.c +++ b/test/dm/acpi.c @@ -384,3 +384,15 @@ static int dm_test_acpi_device_path(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_acpi_device_path, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test acpi_device_status() */ +static int dm_test_acpi_device_status(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_first_device_err(UCLASS_TEST_ACPI, &dev)); + ut_asserteq(ACPI_DSTATUS_ALL_ON, acpi_device_status(dev)); + + return 0; +} +DM_TEST(dm_test_acpi_device_status, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); -- cgit v1.1