blob: 926d9564f9c3bab754399fb482f31c8e14da8e3e [file] [log] [blame]
Jayanth Othayothc3d6b872021-07-28 05:07:25 -05001#pragma once
2
3#include <libipl.H>
4
5extern "C"
6{
7#include <libpdbg.h>
8}
9
10namespace openpower
11{
12namespace 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 */
24uint32_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 */
36uint32_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 */
46pdbg_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 */
58uint32_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 */
65void setDevtreeEnv();
66
Jayanth Othayotha2029872021-09-10 09:17:50 -050067/**
68 * @brief Helper function to set PDATA_INFODB
69 *
70 * PDATA_INFODB environment variable set to pdata attributes infodb path
71 */
72void setPdataInfoDBEnv();
73
Jayanth Othayothc3d6b872021-07-28 05:07:25 -050074} // namespace phal
75} // namespace openpower