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/lib/pcie/pcie.c b/lib/pcie/pcie.c
index 5f8c97f..8de2825 100644
--- a/lib/pcie/pcie.c
+++ b/lib/pcie/pcie.c
@@ -5,11 +5,13 @@
  */
 
 #include <assert.h>
+#include <errno.h>
 #include <stddef.h>
 
 #include <debug.h>
 #include <mmio.h>
 #include <pcie.h>
+#include <pcie_doe.h>
 #include <pcie_spec.h>
 #include <platform.h>
 #include <tftf_lib.h>
@@ -617,3 +619,14 @@
 	pcie_create_device_bdf_table();
 	pcie_print_device_info();
 }
+
+void pcie_init(void)
+{
+	static bool is_init;
+
+	/* Create PCIe table and enumeration */
+	if (!is_init) {
+		pcie_create_info_table();
+		is_init = true;
+	}
+}