AlexeiFedorov | 9f2de63 | 2024-09-10 11:48:22 +0100 | [diff] [blame^] | 1 | /* |
| 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 { \ |
| 13 | if (find_doe_device(&bdf, &doe_cap_base) != 0) { \ |
| 14 | tftf_testcase_printf("PCIe DOE not supported\n"); \ |
| 15 | return TEST_RESULT_SKIPPED; \ |
| 16 | } \ |
| 17 | } while (false) |
| 18 | |
| 19 | test_result_t doe_discovery_test(void) |
| 20 | { |
| 21 | uint32_t bdf, doe_cap_base; |
| 22 | int ret; |
| 23 | |
| 24 | pcie_init(); |
| 25 | |
| 26 | SKIP_TEST_IF_DOE_NOT_SUPPORTED(); |
| 27 | |
| 28 | ret = doe_discovery(bdf, doe_cap_base); |
| 29 | if (ret != 0) { |
| 30 | return TEST_RESULT_FAIL; |
| 31 | } |
| 32 | |
| 33 | return TEST_RESULT_SUCCESS; |
| 34 | } |
| 35 | |
| 36 | test_result_t spdm_version_test(void) |
| 37 | { |
| 38 | uint32_t bdf, doe_cap_base; |
| 39 | int ret; |
| 40 | |
| 41 | SKIP_TEST_IF_DOE_NOT_SUPPORTED(); |
| 42 | |
| 43 | ret = get_spdm_version(bdf, doe_cap_base); |
| 44 | if (ret != 0) { |
| 45 | return TEST_RESULT_FAIL; |
| 46 | } |
| 47 | |
| 48 | return TEST_RESULT_SUCCESS; |
| 49 | } |