pdbg util to get FSI target
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I9cd110fe43b1274c0e738c8b3e127c6c95760869
diff --git a/util/pdbg.cpp b/util/pdbg.cpp
index 0ca6574..e33098f 100644
--- a/util/pdbg.cpp
+++ b/util/pdbg.cpp
@@ -76,6 +76,24 @@
//------------------------------------------------------------------------------
+pdbg_target* getFsiTrgt(pdbg_target* i_procTrgt)
+{
+ // The input target must be a processor.
+ assert(0x05 == getTrgtType(i_procTrgt));
+
+ // Get the fsi path.
+ char path[16];
+ sprintf(path, "/proc%d/fsi", pdbg_target_index(i_procTrgt));
+
+ // Return the fsi target.
+ pdbg_target* fsiTrgt = pdbg_target_from_path(nullptr, path);
+ assert(nullptr != fsiTrgt);
+
+ return fsiTrgt;
+}
+
+//------------------------------------------------------------------------------
+
uint32_t __getChipId(pdbg_target* i_trgt)
{
uint32_t attr = 0;
diff --git a/util/pdbg.hpp b/util/pdbg.hpp
index 33e4320..2c95c28 100644
--- a/util/pdbg.hpp
+++ b/util/pdbg.hpp
@@ -39,6 +39,13 @@
pdbg_target* getPibTrgt(pdbg_target* i_procTrgt);
/**
+ * @return The fsi target associated with the given proc target.
+ * @note Will assert the given target is a proc target.
+ * @note Will assert the returned fsi target it not nullptr.
+ */
+pdbg_target* getFsiTrgt(pdbg_target* i_procTrgt);
+
+/**
* @brief Returns the list of all active chips in the system.
* @param o_chips The returned list of chips.
*/