blob: 6426b4ac3015f4647b86db477cc69c9a01234cdc [file] [log] [blame]
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -05001/* IBM_PROLOG_BEGIN_TAG */
2/* This is an automatically generated prolog. */
3/* */
4/* $Source: src/usr/diag/prdf/common/framework/register/prdfHomRegisterAccess.H $ */
5/* */
6/* OpenPOWER HostBoot Project */
7/* */
8/* Contributors Listed Below - COPYRIGHT 2012,2017 */
9/* [+] International Business Machines Corp. */
10/* */
11/* */
12/* Licensed under the Apache License, Version 2.0 (the "License"); */
13/* you may not use this file except in compliance with the License. */
14/* You may obtain a copy of the License at */
15/* */
16/* http://www.apache.org/licenses/LICENSE-2.0 */
17/* */
18/* Unless required by applicable law or agreed to in writing, software */
19/* distributed under the License is distributed on an "AS IS" BASIS, */
20/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21/* implied. See the License for the specific language governing */
22/* permissions and limitations under the License. */
23/* */
24/* IBM_PROLOG_END_TAG */
25
26#ifndef PRDFHOMREGISTERACCESS_H
27#define PRDFHOMREGISTERACCESS_H
28/**
29 @file prdfHomRegisterAccess.H
30 @brief Provide access to scan & scan com registers via the HOM
31*/
32
33
34//--------------------------------------------------------------------
35// Includes
36//--------------------------------------------------------------------
37
38#include <iipMopRegisterAccess.h>
39#include <vector>
40#include <prdfPlatServices.H>
41#include <prdfErrlUtil.H>
42#include <prdfGlobal.H>
43//--------------------------------------------------------------------
44// Forward References
45//--------------------------------------------------------------------
46
47namespace PRDF
48{
49
50class ScomAccessor
51{
52 public:
53
54 /**
55 * @brief ctor
56 */
57 inline ScomAccessor() {}
58
59 /**
60 * @brief dtor
61 */
62 inline virtual ~ScomAccessor() {}
63
64 /**
65 * @brief Access the scan com register
66 * @param i_target Target to access the register
67 * @param bs holds data read or to write
68 * @param registerId register address
69 * @param operation [READ|WRITE]
70 * @returns SUCCESS or PRD_SCANCOM_FAILURE
71 * @pre bs.Length() must be size of register data to read/write
72 * @post For read operation, bs is modified to reflect hardware
73 * register state
74 */
75 virtual uint32_t Access( TARGETING::TargetHandle_t i_target,
76 BitString & bs,
77 uint64_t registerId,
78 MopRegisterAccess::Operation operation) const;
79
80 private:
81
82 /**
83 * @brief disable copy
84 */
85 ScomAccessor(const ScomAccessor &);
86
87 /**
88 * @brief disable assignment
89 */
90 ScomAccessor & operator=(const ScomAccessor &);
91
92};
93
94/**
95 * @brief Singleton to access the only ScomService
96 */
97class ScomService;
98PRDF_DECLARE_SINGLETON(ScomService, theScomService);
99
100/**
101 * @brief Returns a reference to the ScomService singleton
102 *
103 * @return Reference to the ScomService
104 */
105ScomService& getScomService();
106
107/**
108 * @brief ScomService class
109 */
110class ScomService
111{
112 public:
113
114 /**
115 * @brief Construct ScomService
116 */
117 ScomService();
118
119 /**
120 * @brief Destroys ScomService
121 */
122 ~ScomService();
123
124 /**
125 * @brief set the scom accessor to be used
126 *
127 * @param[in] i_ScomAccessor new scom accessor
128 */
129 void setScomAccessor(ScomAccessor & i_ScomAccessor);
130
131 /**
132 Access the scan com register
133 @param i_target Target to access the register
134 @param BitString - holds data read or to write
135 @param register address
136 @param [READ|WRITE]
137 @returns [SUCCESS|FAIL]
138 @pre bs.Length() must be size of register data to read/write
139 @post For read operation, bs is modified to reflect hardware register state
140 @note
141 */
142 virtual uint32_t Access(TARGETING::TargetHandle_t i_target,
143 BitString & bs,
144 uint64_t registerId,
145 MopRegisterAccess::Operation operation) const;
146
147 private:
148
149 // Disable copy constructor / assignment operator
150 ScomService(const ScomService& i_right);
151 ScomService& operator=(const ScomService& i_right);
152
153 // Scom access to actual HW or Sim
154 ScomAccessor * iv_ScomAccessor;
155};
156
157} // End namespace PRDF
158
159#endif /* PRDFHOMREGISTERACCESS_H */