fix(realm): make PCIe tests default for testing

This patch moves the PCIe DOE test to the default realm world
testsuite.

Also fixes some build issues and hardens the PCIe functions.

Note that FVP_Base_RevC model needs to have the following
options enabled for the PCIe tests to work :

    -C pci.pcie_rc.ahci0.endpoint.doe_supported=1
    -C pci.pcie_rc.ahci0.endpoint.ide_supported=1


Change-Id: Icfd6b68799b0bacb44299c6a3cf99a3c425f833d
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
diff --git a/tftf/tests/doe_tests/doe_helpers.c b/tftf/tests/doe_tests/doe_helpers.c
index 28b6a86..911fbd0 100644
--- a/tftf/tests/doe_tests/doe_helpers.c
+++ b/tftf/tests/doe_tests/doe_helpers.c
@@ -13,12 +13,15 @@
 #include <pcie_doe.h>
 #include <spdm.h>
 
-#include <platform_pcie.h>
-
 void pcie_init(void)
 {
+	static bool is_init;
+
 	/* Create PCIe table and enumeration */
-	pcie_create_info_table();
+	if (!is_init) {
+		pcie_create_info_table();
+		is_init = true;
+	}
 }
 
 /*
@@ -113,7 +116,7 @@
 			sizeof(ver_resp->version_number_entry_count));
 
 	while (entry_count-- != 0) {
-		spdm_version_number_t ver = *ver_ptr++;
+		spdm_version_number_t ver __unused = *ver_ptr++;
 
 		INFO("SPDM v%llu.%llu.%llu.%llu\n",
 			EXTRACT(SPDM_VER_MAJOR, ver),
diff --git a/tftf/tests/doe_tests/doe_helpers.h b/tftf/tests/doe_tests/doe_helpers.h
index 08137e3..d0fc5c8 100644
--- a/tftf/tests/doe_tests/doe_helpers.h
+++ b/tftf/tests/doe_tests/doe_helpers.h
@@ -8,6 +8,8 @@
 #ifndef DOE_HELPERS_H
 #define DOE_HELPERS_H
 
+#include <stdint.h>
+
 void pcie_init(void);
 int find_doe_device(uint32_t *bdf_ptr, uint32_t *cap_base_ptr);
 int doe_discovery(uint32_t bdf, uint32_t doe_cap_base);
diff --git a/tftf/tests/doe_tests/test_doe.c b/tftf/tests/doe_tests/test_doe.c
index 6eb5079..cc852fa 100644
--- a/tftf/tests/doe_tests/test_doe.c
+++ b/tftf/tests/doe_tests/test_doe.c
@@ -10,6 +10,13 @@
 
 #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;				\
@@ -21,8 +28,6 @@
 	uint32_t bdf, doe_cap_base;
 	int ret;
 
-	pcie_init();
-
 	SKIP_TEST_IF_DOE_NOT_SUPPORTED();
 
 	ret = doe_discovery(bdf, doe_cap_base);