blob: 88dcc77c2b119dfa7b6f29d8563a06fb9f77d6cf [file] [log] [blame]
Matt Spinler0c0eeff2017-02-28 10:06:56 -06001#pragma once
2
3#include <memory>
4#include "targeting.hpp"
5
6namespace openpower
7{
8namespace cfam
9{
10namespace access
11{
12
13using cfam_address_t = uint16_t;
14using cfam_data_t = uint32_t;
15using 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 */
26void 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 */
40cfam_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 */
58void 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}