blob: cc852fac25735e4fa23d9cb8ef61722136a1b319 [file] [log] [blame]
AlexeiFedorov9f2de632024-09-10 11:48:22 +01001/*
2 * Copyright (c) 2024, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include "doe_helpers.h"
8
9#include <test_helpers.h>
10
11#define SKIP_TEST_IF_DOE_NOT_SUPPORTED() \
12 do { \
Soby Mathew2c2810f2024-11-15 17:11:24 +000013 /* Test PCIe DOE only for RME */ \
14 if (!get_armv9_2_feat_rme_support()) { \
15 tftf_testcase_printf("FEAT_RME not supported\n"); \
16 return TEST_RESULT_SKIPPED; \
17 } \
18 \
19 pcie_init(); \
AlexeiFedorov9f2de632024-09-10 11:48:22 +010020 if (find_doe_device(&bdf, &doe_cap_base) != 0) { \
21 tftf_testcase_printf("PCIe DOE not supported\n"); \
22 return TEST_RESULT_SKIPPED; \
23 } \
24 } while (false)
25
26test_result_t doe_discovery_test(void)
27{
28 uint32_t bdf, doe_cap_base;
29 int ret;
30
AlexeiFedorov9f2de632024-09-10 11:48:22 +010031 SKIP_TEST_IF_DOE_NOT_SUPPORTED();
32
33 ret = doe_discovery(bdf, doe_cap_base);
34 if (ret != 0) {
35 return TEST_RESULT_FAIL;
36 }
37
38 return TEST_RESULT_SUCCESS;
39}
40
41test_result_t spdm_version_test(void)
42{
43 uint32_t bdf, doe_cap_base;
44 int ret;
45
46 SKIP_TEST_IF_DOE_NOT_SUPPORTED();
47
48 ret = get_spdm_version(bdf, doe_cap_base);
49 if (ret != 0) {
50 return TEST_RESULT_FAIL;
51 }
52
53 return TEST_RESULT_SUCCESS;
54}