bmc-reset: add support to write a cfam
A future commit requires this support so refactor the getCFAM a bit to
move some shared code to a common function and add putCFAM
Tested:
- Verified the putCFAM worked as expected when called on p10bmc hardware
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: I349505aa19bf0164a2f01d133a47298fabbf3299
diff --git a/procedures/phal/common_utils.hpp b/procedures/phal/common_utils.hpp
index 2d9d57b..277272c 100644
--- a/procedures/phal/common_utils.hpp
+++ b/procedures/phal/common_utils.hpp
@@ -25,7 +25,7 @@
/**
* @brief Check if primary processor or not
*
- * @param[in] procTarget - Target to check if primary or not
+ * @param[in] procTarget - Processor target to check if primary or not
*
* @return True/False
*/
@@ -34,7 +34,7 @@
/**
* @brief Read the input CFAM register
*
- * @param[in] procTarget - The Target to perform the operation on
+ * @param[in] procTarget - Processor target to perform the operation on
* @param[in] reg - The register address to read
* @param[out] val - The value read from the register
*
@@ -43,5 +43,38 @@
uint32_t getCFAM(struct pdbg_target* procTarget, const uint32_t reg,
uint32_t& val);
+/**
+ * @brief Write the input CFAM register
+ *
+ * @param[in] procTarget - Processor target to perform the operation on
+ * @param[in] reg - The register address to write
+ * @param[out] val - The value to write to the register
+ *
+ * @return 0 on success, non-0 on failure
+ */
+uint32_t putCFAM(struct pdbg_target* procTarget, const uint32_t reg,
+ const uint32_t val);
+
+/**
+ * @brief Helper function to find FSI target needed for FSI operations
+ *
+ * @param[in] procTarget - Processor target to find the FSI target on
+ *
+ * @return Valid pointer to FSI target on success, nullptr on failure
+ */
+pdbg_target* getFsiTarget(struct pdbg_target* procTarget);
+
+/**
+ * @brief Helper function to probe the processor target
+ *
+ * The probe call only has to happen once per application start so ensure
+ * this function only probes once no matter how many times it's called.
+ *
+ * @param[in] procTarget - Processor target to probe
+ *
+ * @return 0 on success, non-0 on failure
+ */
+uint32_t probeTarget(struct pdbg_target* procTarget);
+
} // namespace phal
} // namespace openpower