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 { \ |
Soby Mathew | 2c2810f | 2024-11-15 17:11:24 +0000 | [diff] [blame^] | 13 | /* 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(); \ |
AlexeiFedorov | 9f2de63 | 2024-09-10 11:48:22 +0100 | [diff] [blame] | 20 | 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 | |
| 26 | test_result_t doe_discovery_test(void) |
| 27 | { |
| 28 | uint32_t bdf, doe_cap_base; |
| 29 | int ret; |
| 30 | |
AlexeiFedorov | 9f2de63 | 2024-09-10 11:48:22 +0100 | [diff] [blame] | 31 | 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 | |
| 41 | test_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 | } |