refactor(realm): define PCIe helpers
This patch refactors the existing PCIe and DOE
helpers to define generic helpers to make them
reusable across more tests.
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Change-Id: I56a9f5c59715c7916f3f737ed6d3af94b0e3679f
diff --git a/tftf/tests/doe_tests/test_doe.c b/tftf/tests/doe_tests/test_doe.c
index cc852fa..84b30d5 100644
--- a/tftf/tests/doe_tests/test_doe.c
+++ b/tftf/tests/doe_tests/test_doe.c
@@ -5,30 +5,15 @@
*/
#include "doe_helpers.h"
-
+#include <pcie_doe.h>
#include <test_helpers.h>
-#define SKIP_TEST_IF_DOE_NOT_SUPPORTED() \
- do { \
- /* Test PCIe DOE only for RME */ \
- if (!get_armv9_2_feat_rme_support()) { \
- tftf_testcase_printf("FEAT_RME not supported\n"); \
- return TEST_RESULT_SKIPPED; \
- } \
- \
- pcie_init(); \
- if (find_doe_device(&bdf, &doe_cap_base) != 0) { \
- tftf_testcase_printf("PCIe DOE not supported\n"); \
- return TEST_RESULT_SKIPPED; \
- } \
- } while (false)
-
test_result_t doe_discovery_test(void)
{
uint32_t bdf, doe_cap_base;
int ret;
- SKIP_TEST_IF_DOE_NOT_SUPPORTED();
+ SKIP_TEST_IF_DOE_NOT_SUPPORTED(bdf, doe_cap_base);
ret = doe_discovery(bdf, doe_cap_base);
if (ret != 0) {
@@ -43,7 +28,7 @@
uint32_t bdf, doe_cap_base;
int ret;
- SKIP_TEST_IF_DOE_NOT_SUPPORTED();
+ SKIP_TEST_IF_DOE_NOT_SUPPORTED(bdf, doe_cap_base);
ret = get_spdm_version(bdf, doe_cap_base);
if (ret != 0) {