1 #pragma once
2 
3 #include <libipl.H>
4 
5 extern "C"
6 {
7 #include <libpdbg.h>
8 }
9 
10 namespace openpower
11 {
12 namespace phal
13 {
14 
15 /**
16  *  @brief  Read the input CFAM register
17  *
18  *  @param[in]  procTarget - Processor target to perform the operation on
19  *  @param[in]  reg - The register address to read
20  *  @param[out] val - The value read from the register
21  *
22  *  @return 0 on success, non-0 on failure
23  */
24 uint32_t getCFAM(struct pdbg_target* procTarget, const uint32_t reg,
25                  uint32_t& val);
26 
27 /**
28  *  @brief  Write the input CFAM register
29  *
30  *  @param[in]  procTarget - Processor target to perform the operation on
31  *  @param[in]  reg - The register address to write
32  *  @param[out] val - The value to write to the register
33  *
34  *  @return 0 on success, non-0 on failure
35  */
36 uint32_t putCFAM(struct pdbg_target* procTarget, const uint32_t reg,
37                  const uint32_t val);
38 
39 /**
40  *  @brief  Helper function to find FSI target needed for FSI operations
41  *
42  *  @param[in]  procTarget - Processor target to find the FSI target on
43  *
44  *  @return Valid pointer to FSI target on success, nullptr on failure
45  */
46 pdbg_target* getFsiTarget(struct pdbg_target* procTarget);
47 
48 /**
49  *  @brief  Helper function to probe the processor target
50  *
51  *  The probe call only has to happen once per application start so ensure
52  *  this function only probes once no matter how many times it's called.
53  *
54  *  @param[in]  procTarget - Processor target to probe
55  *
56  *  @return 0 on success, non-0 on failure
57  */
58 uint32_t probeTarget(struct pdbg_target* procTarget);
59 
60 /**
61  * @brief Helper function to set PDBG_DTB
62  *
63  * PDBG_DTB environment variable set to CEC device tree path
64  */
65 void setDevtreeEnv();
66 
67 } // namespace phal
68 } // namespace openpower
69