summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-02-16 20:24:51 -0700
committerBin Meng <bmeng.cn@gmail.com>2019-02-20 15:27:08 +0800
commit1260f8c0efe126cf952c1bc19d975af34908a79d (patch)
tree38d5606156196d3d8a1ced890bd54578a506f15c /test
parentb45c833c71f1ce26e0db6c30f96dc3228051cd15 (diff)
pch: Add ioctl support
At present the PCH has 4 operations and these are reasonably widely used in the drivers. But sometimes we want to add rarely used operations, and each of these currently adds to the size of the PCH operations table. Add an ioctl() method which can be easily expanded without any more impact on the operations table. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/dm/pch.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/dm/pch.c b/test/dm/pch.c
index f184445342..54e33d187b 100644
--- a/test/dm/pch.c
+++ b/test/dm/pch.c
@@ -34,3 +34,22 @@ static int dm_test_pch_base(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_pch_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test sandbox PCH ioctl */
+static int dm_test_pch_ioctl(struct unit_test_state *uts)
+{
+ struct udevice *dev;
+ char data;
+
+ ut_assertok(uclass_first_device_err(UCLASS_PCH, &dev));
+
+ ut_asserteq(-ENOSYS, pch_ioctl(dev, PCH_REQ_TEST1, NULL, 0));
+
+ ut_asserteq('a', pch_ioctl(dev, PCH_REQ_TEST2, "a", 1));
+
+ ut_asserteq(1, pch_ioctl(dev, PCH_REQ_TEST3, &data, 1));
+ ut_asserteq('x', data);
+
+ return 0;
+}
+DM_TEST(dm_test_pch_ioctl, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);