Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Zane Shelley | a029985 | 2020-11-13 13:38:04 -0600 | [diff] [blame] | 3 | #include <libpdbg.h> |
| 4 | |
Zane Shelley | 7ae9c8c | 2020-12-02 20:10:31 -0600 | [diff] [blame] | 5 | #include <vector> |
| 6 | |
| 7 | // Forward reference to avoid pulling the libhei library into everything that |
| 8 | // includes this header. |
| 9 | namespace libhei |
| 10 | { |
| 11 | class Chip; |
| 12 | } |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 13 | |
| 14 | namespace util |
| 15 | { |
| 16 | |
| 17 | namespace pdbg |
| 18 | { |
| 19 | |
Zane Shelley | 35171d9 | 2020-12-03 13:31:13 -0600 | [diff] [blame] | 20 | /** Chip target types. */ |
| 21 | enum TargetType_t : uint8_t |
| 22 | { |
| 23 | TYPE_PROC = 0x05, |
| 24 | TYPE_OCMB = 0x4b, |
| 25 | }; |
| 26 | |
Zane Shelley | a029985 | 2020-11-13 13:38:04 -0600 | [diff] [blame] | 27 | /** @return The target associated with the given chip. */ |
| 28 | pdbg_target* getTrgt(const libhei::Chip& i_chip); |
| 29 | |
| 30 | /** @return A string representing the given target's devtree path. */ |
| 31 | const char* getPath(pdbg_target* i_trgt); |
| 32 | |
| 33 | /** @return A string representing the given chip's devtree path. */ |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 34 | const char* getPath(const libhei::Chip& i_chip); |
| 35 | |
Zane Shelley | a029985 | 2020-11-13 13:38:04 -0600 | [diff] [blame] | 36 | /** @return The absolute position of the given target. */ |
| 37 | uint32_t getChipPos(pdbg_target* i_trgt); |
| 38 | |
| 39 | /** @return The absolute position of the given chip. */ |
| 40 | uint32_t getChipPos(const libhei::Chip& i_chip); |
| 41 | |
| 42 | /** @return The target type of the given target. */ |
| 43 | uint8_t getTrgtType(pdbg_target* i_trgt); |
| 44 | |
| 45 | /** @return The target type of the given chip. */ |
| 46 | uint8_t getTrgtType(const libhei::Chip& i_chip); |
| 47 | |
Zane Shelley | 171a2e0 | 2020-11-13 13:56:13 -0600 | [diff] [blame] | 48 | /** |
| 49 | * @return The pib target associated with the given proc target. |
| 50 | * @note Will assert the given target is a proc target. |
| 51 | * @note Will assert the returned pib target it not nullptr. |
| 52 | */ |
| 53 | pdbg_target* getPibTrgt(pdbg_target* i_procTrgt); |
| 54 | |
| 55 | /** |
Zane Shelley | ff76b6b | 2020-11-18 13:54:26 -0600 | [diff] [blame] | 56 | * @return The fsi target associated with the given proc target. |
| 57 | * @note Will assert the given target is a proc target. |
| 58 | * @note Will assert the returned fsi target it not nullptr. |
| 59 | */ |
| 60 | pdbg_target* getFsiTrgt(pdbg_target* i_procTrgt); |
| 61 | |
| 62 | /** |
Zane Shelley | 35171d9 | 2020-12-03 13:31:13 -0600 | [diff] [blame] | 63 | * @brief Reads a CFAM FSI register. |
| 64 | * @param i_trgt Given target. |
| 65 | * @param i_addr Given address. |
| 66 | * @param o_val The returned value of the register. |
| 67 | * @return 0 if successful, non-0 otherwise. |
| 68 | * @note Will assert the given target is a proc target. |
| 69 | */ |
| 70 | int getCfam(pdbg_target* i_trgt, uint32_t i_addr, uint32_t& o_val); |
| 71 | |
| 72 | /** |
Zane Shelley | 171a2e0 | 2020-11-13 13:56:13 -0600 | [diff] [blame] | 73 | * @brief Returns the list of all active chips in the system. |
| 74 | * @param o_chips The returned list of chips. |
| 75 | */ |
| 76 | void getActiveChips(std::vector<libhei::Chip>& o_chips); |
| 77 | |
Zane Shelley | 7ae9c8c | 2020-12-02 20:10:31 -0600 | [diff] [blame] | 78 | /** |
| 79 | * @return True, if hardware analysis is supported on this system. False, |
| 80 | * otherwise. |
| 81 | * @note Support for hardware analysis from the BMC started with P10 systems |
| 82 | * and is not supported on any older chip generations. |
| 83 | */ |
| 84 | bool queryHardwareAnalysisSupported(); |
| 85 | |
Zane Shelley | f4bd5ff | 2020-11-05 22:26:04 -0600 | [diff] [blame] | 86 | } // namespace pdbg |
| 87 | |
| 88 | } // namespace util |