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