1 // SPDX-License-Identifier: GPL-2.0+
4 * Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
10 #include <dm/uclass-internal.h>
14 static int dm_test_cpu(struct unit_test_state *uts)
20 ut_assertok(cpu_probe_all());
22 /* Check that cpu_probe_all really activated all CPUs */
23 for (uclass_find_first_device(UCLASS_CPU, &dev);
25 uclass_find_next_device(&dev))
26 ut_assert(dev->flags & DM_FLAG_ACTIVATED);
28 ut_assertok(uclass_get_device_by_name(UCLASS_CPU, "cpu-test1", &dev));
30 ut_assertok(cpu_get_desc(dev, text, sizeof(text)));
31 ut_assertok(strcmp(text, "LEG Inc. SuperMegaUltraTurbo CPU No. 1"));
33 ut_assertok(cpu_get_info(dev, &info));
34 ut_asserteq(info.cpu_freq, 42 * 42 * 42 * 42 * 42);
35 ut_asserteq(info.features, 0x42424242);
37 ut_asserteq(cpu_get_count(dev), 42);
39 ut_assertok(cpu_get_vendor(dev, text, sizeof(text)));
40 ut_assertok(strcmp(text, "Languid Example Garbage Inc."));
45 DM_TEST(dm_test_cpu, DM_TESTF_SCAN_FDT);