Asherah Connor | ab1975b | 2021-03-19 18:21:41 +1100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2021 Asherah Connor <ashe@kivikakk.ee> |
| 4 | */ |
| 5 | |
| 6 | #include <common.h> |
| 7 | #include <qfw.h> |
| 8 | #include <dm.h> |
| 9 | #include <asm/test.h> |
| 10 | #include <dm/test.h> |
| 11 | #include <test/ut.h> |
| 12 | |
| 13 | /* |
| 14 | * Exercise the device enough to be satisfied the initialisation and DMA |
| 15 | * interfaces work. |
| 16 | */ |
| 17 | |
| 18 | static int dm_test_qfw_cpus(struct unit_test_state *uts) |
| 19 | { |
| 20 | struct udevice *dev; |
| 21 | |
| 22 | ut_assertok(uclass_first_device_err(UCLASS_QFW, &dev)); |
| 23 | ut_asserteq(5, qfw_online_cpus(dev)); |
| 24 | |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | DM_TEST(dm_test_qfw_cpus, UT_TESTF_SCAN_PDATA); |
| 29 | |
| 30 | static int dm_test_qfw_firmware_list(struct unit_test_state *uts) |
| 31 | { |
| 32 | struct udevice *dev; |
| 33 | struct fw_file *file; |
| 34 | |
| 35 | ut_assertok(uclass_first_device_err(UCLASS_QFW, &dev)); |
| 36 | ut_assertok(qfw_read_firmware_list(dev)); |
| 37 | ut_assertok_ptr((file = qfw_find_file(dev, "test-one"))); |
| 38 | |
| 39 | return 0; |
| 40 | } |
| 41 | |
| 42 | DM_TEST(dm_test_qfw_firmware_list, UT_TESTF_SCAN_PDATA); |