summaryrefslogtreecommitdiffstats
path: root/cfam_access.hpp
blob: 131376c5b51e029e5084c6cbb242b263937f557b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#pragma once

#include "targeting.hpp"

#include <memory>

namespace openpower
{
namespace cfam
{
namespace access
{

using cfam_address_t = uint16_t;
using cfam_data_t = uint32_t;
using cfam_mask_t = uint32_t;

/**
 * @brief Writes a CFAM (Common FRU Access Macro) register in a P9.
 *
 * Throws an exception on error.
 *
 * @param[in] target - The Target to perform the operation on
 * @param[in] address - The register address to write to
 * @param[in] data - The data to write
 */
void writeReg(const std::unique_ptr<openpower::targeting::Target>& target,
              cfam_address_t address, cfam_data_t data);

/**
 * @brief Reads a CFAM (Common FRU Access Macro) register in a P9.
 *
 * Throws an exception on error.
 *
 * @param[in] target - The Target to perform the operation on
 * @param[in] address - The register address to read
 * @return - The register data
 */
cfam_data_t readReg(const std::unique_ptr<openpower::targeting::Target>& target,
                    cfam_address_t address);

/**
 * @brief Writes a CFAM (Common FRU Access Macro) register in a P9
 *        using a mask to specify the bits the modify.
 *
 * Only bits that are set in the mask parameter will be modified.
 *
 * Throws an exception on error.
 *
 * @param[in] target - The Target to perform the operation on
 * @param[in] address - The register address to write to
 * @param[in] data - The data to write
 * @param[in] mask - The mask
 */
void writeRegWithMask(
    const std::unique_ptr<openpower::targeting::Target>& target,
    cfam_address_t address, cfam_data_t data, cfam_mask_t mask);
} // namespace access
} // namespace cfam
} // namespace openpower
OpenPOWER on IntegriCloud