1 /*
2 * Copyright (c) 2020 Carlo Caione <ccaione@baylibre.com>
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/ztest.h>
8 #include <zephyr/drivers/pm_cpu_ops/psci.h>
9 #include <zephyr/drivers/pm_cpu_ops.h>
10
ZTEST(arm64_psci,test_psci_func)11 ZTEST(arm64_psci, test_psci_func)
12 {
13 uint32_t ver;
14 int ret;
15
16 /* This should return 2 for v0.2 */
17 ver = psci_version();
18 zassert_false((PSCI_VERSION_MAJOR(ver) == 0 &&
19 PSCI_VERSION_MINOR(ver) < 2),
20 "Wrong PSCI firmware version");
21
22 /* This should return -PSCI_RET_ALREADY_ON that is mapped to -EINVAL */
23 ret = pm_cpu_on(0, 0);
24 zassert_true(ret == -EINVAL, "Wrong return code from psci_cpu_on");
25 }
26
27 ZTEST_SUITE(arm64_psci, NULL, NULL, NULL, NULL, NULL);
28