Matt Spinler | 0c0eeff | 2017-02-28 10:06:56 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Matt Spinler | 0c0eeff | 2017-02-28 10:06:56 -0600 | [diff] [blame] | 3 | #include "targeting.hpp" |
| 4 | |
Patrick Venture | f78d904 | 2018-11-01 15:39:53 -0700 | [diff] [blame] | 5 | #include <memory> |
| 6 | |
Matt Spinler | 0c0eeff | 2017-02-28 10:06:56 -0600 | [diff] [blame] | 7 | namespace openpower |
| 8 | { |
| 9 | namespace cfam |
| 10 | { |
| 11 | namespace access |
| 12 | { |
| 13 | |
| 14 | using cfam_address_t = uint16_t; |
| 15 | using cfam_data_t = uint32_t; |
| 16 | using cfam_mask_t = uint32_t; |
| 17 | |
| 18 | /** |
| 19 | * @brief Writes a CFAM (Common FRU Access Macro) register in a P9. |
| 20 | * |
| 21 | * Throws an exception on error. |
| 22 | * |
| 23 | * @param[in] target - The Target to perform the operation on |
| 24 | * @param[in] address - The register address to write to |
| 25 | * @param[in] data - The data to write |
| 26 | */ |
| 27 | void writeReg(const std::unique_ptr<openpower::targeting::Target>& target, |
Patrick Venture | f78d904 | 2018-11-01 15:39:53 -0700 | [diff] [blame] | 28 | cfam_address_t address, cfam_data_t data); |
Matt Spinler | 0c0eeff | 2017-02-28 10:06:56 -0600 | [diff] [blame] | 29 | |
| 30 | /** |
| 31 | * @brief Reads a CFAM (Common FRU Access Macro) register in a P9. |
| 32 | * |
| 33 | * Throws an exception on error. |
| 34 | * |
| 35 | * @param[in] target - The Target to perform the operation on |
| 36 | * @param[in] address - The register address to read |
| 37 | * @return - The register data |
| 38 | */ |
Patrick Venture | f78d904 | 2018-11-01 15:39:53 -0700 | [diff] [blame] | 39 | cfam_data_t readReg(const std::unique_ptr<openpower::targeting::Target>& target, |
| 40 | cfam_address_t address); |
Matt Spinler | 0c0eeff | 2017-02-28 10:06:56 -0600 | [diff] [blame] | 41 | |
| 42 | /** |
| 43 | * @brief Writes a CFAM (Common FRU Access Macro) register in a P9 |
| 44 | * using a mask to specify the bits the modify. |
| 45 | * |
| 46 | * Only bits that are set in the mask parameter will be modified. |
| 47 | * |
| 48 | * Throws an exception on error. |
| 49 | * |
| 50 | * @param[in] target - The Target to perform the operation on |
| 51 | * @param[in] address - The register address to write to |
| 52 | * @param[in] data - The data to write |
| 53 | * @param[in] mask - The mask |
| 54 | */ |
| 55 | void writeRegWithMask( |
| 56 | const std::unique_ptr<openpower::targeting::Target>& target, |
Patrick Venture | f78d904 | 2018-11-01 15:39:53 -0700 | [diff] [blame] | 57 | cfam_address_t address, cfam_data_t data, cfam_mask_t mask); |
| 58 | } // namespace access |
| 59 | } // namespace cfam |
| 60 | } // namespace openpower |