diff options
author | Mark Kettenis <kettenis@openbsd.org> | 2021-10-23 16:58:02 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-10-31 08:46:44 -0400 |
commit | fb5746243707d6b84dea02490a86868c3d7f534d (patch) | |
tree | 42152600fb6ba702c4211d7065c4d5801087eb9d /test | |
parent | 40dbf03d7d2dd2b5516f797069e3ea830db6fecc (diff) | |
download | u-boot-fb5746243707d6b84dea02490a86868c3d7f534d.zip u-boot-fb5746243707d6b84dea02490a86868c3d7f534d.tar.gz u-boot-fb5746243707d6b84dea02490a86868c3d7f534d.tar.bz2 |
test: Add tests for IOMMU uclass
Add a set of tests for the IOMMU uclass.
Signed-off-by: Mark Kettenis <kettenis@openbsd.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/dm/Makefile | 1 | ||||
-rw-r--r-- | test/dm/iommu.c | 28 |
2 files changed, 29 insertions, 0 deletions
diff --git a/test/dm/Makefile b/test/dm/Makefile index 55162e9..7de013f 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -48,6 +48,7 @@ obj-$(CONFIG_DM_I2C) += i2c.o obj-$(CONFIG_SOUND) += i2s.o obj-y += irq.o obj-$(CONFIG_CLK_K210_SET_RATE) += k210_pll.o +obj-$(CONFIG_IOMMU) += iommu.o obj-$(CONFIG_LED) += led.o obj-$(CONFIG_DM_MAILBOX) += mailbox.o obj-$(CONFIG_DM_MDIO) += mdio.o diff --git a/test/dm/iommu.c b/test/dm/iommu.c new file mode 100644 index 0000000..94174a7 --- /dev/null +++ b/test/dm/iommu.c @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2021 Mark Kettenis <kettenis@openbsd.org> + */ + +#include <common.h> +#include <dm.h> +#include <dm/test.h> +#include <dm/uclass-internal.h> +#include <iommu.h> +#include <test/test.h> +#include <test/ut.h> + +static int dm_test_iommu(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_find_device(UCLASS_IOMMU, 0, &dev)); + ut_assert(!(dev_get_flags(dev) & DM_FLAG_ACTIVATED)); + + /* Probing USB probes the IOMMU through the "iommus" property */ + ut_assertok(uclass_probe_all(UCLASS_USB)); + ut_assert(dev_get_flags(dev) & DM_FLAG_ACTIVATED); + + return 0; +} + +DM_TEST(dm_test_iommu, UT_TESTF_SCAN_FDT); |