blob: 3b293e079c32e319c89762ee69a688684fb96027 [file] [log] [blame]
Zane Shelleyf4bd5ff2020-11-05 22:26:04 -06001#pragma once
2
Zane Shelleya0299852020-11-13 13:38:04 -06003#include <libpdbg.h>
4
Zane Shelley7ae9c8c2020-12-02 20:10:31 -06005#include <vector>
6
7// Forward reference to avoid pulling the libhei library into everything that
8// includes this header.
9namespace libhei
10{
11class Chip;
12}
Zane Shelleyf4bd5ff2020-11-05 22:26:04 -060013
14namespace util
15{
16
17namespace pdbg
18{
19
Zane Shelleya0299852020-11-13 13:38:04 -060020/** @return The target associated with the given chip. */
21pdbg_target* getTrgt(const libhei::Chip& i_chip);
22
23/** @return A string representing the given target's devtree path. */
24const char* getPath(pdbg_target* i_trgt);
25
26/** @return A string representing the given chip's devtree path. */
Zane Shelleyf4bd5ff2020-11-05 22:26:04 -060027const char* getPath(const libhei::Chip& i_chip);
28
Zane Shelleya0299852020-11-13 13:38:04 -060029/** @return The absolute position of the given target. */
30uint32_t getChipPos(pdbg_target* i_trgt);
31
32/** @return The absolute position of the given chip. */
33uint32_t getChipPos(const libhei::Chip& i_chip);
34
35/** @return The target type of the given target. */
36uint8_t getTrgtType(pdbg_target* i_trgt);
37
38/** @return The target type of the given chip. */
39uint8_t getTrgtType(const libhei::Chip& i_chip);
40
Zane Shelley171a2e02020-11-13 13:56:13 -060041/**
42 * @return The pib target associated with the given proc target.
43 * @note Will assert the given target is a proc target.
44 * @note Will assert the returned pib target it not nullptr.
45 */
46pdbg_target* getPibTrgt(pdbg_target* i_procTrgt);
47
48/**
Zane Shelleyff76b6b2020-11-18 13:54:26 -060049 * @return The fsi target associated with the given proc target.
50 * @note Will assert the given target is a proc target.
51 * @note Will assert the returned fsi target it not nullptr.
52 */
53pdbg_target* getFsiTrgt(pdbg_target* i_procTrgt);
54
55/**
Zane Shelley171a2e02020-11-13 13:56:13 -060056 * @brief Returns the list of all active chips in the system.
57 * @param o_chips The returned list of chips.
58 */
59void getActiveChips(std::vector<libhei::Chip>& o_chips);
60
Zane Shelley7ae9c8c2020-12-02 20:10:31 -060061/**
62 * @return True, if hardware analysis is supported on this system. False,
63 * otherwise.
64 * @note Support for hardware analysis from the BMC started with P10 systems
65 * and is not supported on any older chip generations.
66 */
67bool queryHardwareAnalysisSupported();
68
Zane Shelleyf4bd5ff2020-11-05 22:26:04 -060069} // namespace pdbg
70
71} // namespace util