blob: 2ce591d99279620b641f25278e496d943bc84191 [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/prdfScanFacility.C $ */
5/* */
6/* OpenPOWER HostBoot Project */
7/* */
8/* Contributors Listed Below - COPYRIGHT 2012,2018 */
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/**
27 @file prdfScanFacility.C
28 @brief PRD ScanFaclity class definition
29*/
30//----------------------------------------------------------------------
31// Includes
32//----------------------------------------------------------------------
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050033
Zane Shelley52cb1a92019-08-21 14:38:31 -050034#include <register/hei_register.hpp>
35
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050036#include <prdfScanFacility.H>
37#include <prdfFlyWeight.C>
38#include <prdfFlyWeightS.C>
39#include <prdfScomRegisterAccess.H>
40
Zane Shelleyfd275a22019-09-05 23:13:59 -050041namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050042{
43
44//----------------------------------------------------------------------
45// Constants
46//----------------------------------------------------------------------
47
48//----------------------------------------------------------------------
49// Macros
50//----------------------------------------------------------------------
51
52//----------------------------------------------------------------------
53// Internal Function Prototypes
54//----------------------------------------------------------------------
55
56//----------------------------------------------------------------------
57// Global Variables
58//----------------------------------------------------------------------
59
60NullRegister AttnTypeRegister::cv_null(1024);
61
62//---------------------------------------------------------------------
63// Member Function Specifications
64//---------------------------------------------------------------------
65
66
67ScanFacility & ScanFacility::Access(void)
68{
69 static ScanFacility sf;
70 return sf;
71}
72//-----------------------------------------------------------------------------
Zane Shelley23244cb2019-08-30 21:12:12 -050073Register & ScanFacility::GetScanCommRegister( uint64_t address,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050074 uint32_t i_scomLength, TARGETING::TYPE i_type,
Zane Shelley23244cb2019-08-30 21:12:12 -050075 Register::AccessLevel i_regOp )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050076{
77 /* i_regOp is not used to determine uniqueness of the object for following
78 reason -
79 There can not be two registers in hardware with same address and target
80 type supporting different operations say one supports only write and
81 other both read and write.
82 */
83
Zane Shelleycd36f432019-08-30 21:22:07 -050084 HardwareRegister scrKey( address, i_scomLength, i_type, i_regOp );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050085 // in case we get a object with different default operation, we shall reset
86 // it to what it should be as per rule file.
Zane Shelleycd36f432019-08-30 21:22:07 -050087 HardwareRegister &regCreated = iv_scomRegFw.get(scrKey);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050088 regCreated.setAccessLevel( i_regOp );
89 return regCreated;
90}
91
92//------------------------------------------------------------------------------
93
Zane Shelley23244cb2019-08-30 21:12:12 -050094Register & ScanFacility::GetNotRegister(
95 Register & i_arg )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050096{
97 NotRegister r(i_arg);
98 return iv_notRegFw.get(r);
99}
100
101//-----------------------------------------------------------------------------
102
Zane Shelley23244cb2019-08-30 21:12:12 -0500103Register & ScanFacility::GetLeftShiftRegister(
104 Register & i_arg,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500105 uint16_t i_amount )
106{
107 LeftShiftRegister r(i_arg, i_amount);
108 return iv_leftRegFw.get(r);
109}
110
111//-----------------------------------------------------------------------------
112
Zane Shelley23244cb2019-08-30 21:12:12 -0500113Register & ScanFacility::GetSummaryRegister(
114 Register & i_arg,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500115 uint16_t i_bit )
116{
117 SummaryRegister r(i_arg, i_bit);
118 return iv_sumRegFw.get(r);
119}
120
121//------------------------------------------------------------------------------
122
Zane Shelley23244cb2019-08-30 21:12:12 -0500123Register & ScanFacility::GetRightShiftRegister(
124 Register & i_arg,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500125 uint16_t i_amount )
126{
127 RightShiftRegister r(i_arg, i_amount);
128 return iv_rightRegFw.get(r);
129}
130
131
132//------------------------------------------------------------------------------
133
Zane Shelley23244cb2019-08-30 21:12:12 -0500134Register & ScanFacility::GetAndRegister(
135 Register & i_left,
136 Register & i_right )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500137{
138 AndRegister r(i_left,i_right);
139 return iv_andRegFw.get(r);
140}
141
142//------------------------------------------------------------------------------
143
Zane Shelley23244cb2019-08-30 21:12:12 -0500144Register & ScanFacility::GetOrRegister(
145 Register & i_left,
146 Register & i_right )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500147{
148 OrRegister r(i_left,i_right);
149 return iv_orRegFw.get(r);
150}
151
152//-----------------------------------------------------------------------------
153
Zane Shelley23244cb2019-08-30 21:12:12 -0500154Register & ScanFacility::GetAttnTypeRegister(
155 Register * i_check,
156 Register * i_recov,
157 Register * i_special,
158 Register * i_proccs,
159 Register * i_hostattn )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500160{
161 AttnTypeRegister r(i_check, i_recov, i_special, i_proccs, i_hostattn);
162 return iv_attnRegFw.get(r);
163}
164
165//------------------------------------------------------------------------------
166
Zane Shelley23244cb2019-08-30 21:12:12 -0500167Register & ScanFacility::GetConstantRegister(
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500168 const BitStringBuffer & i_val )
169{
170 ConstantRegister r(i_val);
171 return iv_constRegFw.get(r);
172}
173//------------------------------------------------------------------------------
Zane Shelley23244cb2019-08-30 21:12:12 -0500174Register & ScanFacility::GetPluginRegister(
175 Register & i_flyweight,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500176 ExtensibleChip & i_RuleChip )
177{
178 ScomRegisterAccess l_regKey ( i_flyweight,&i_RuleChip );
179 return iv_pluginRegFw.get(l_regKey);
180
181}
182//-----------------------------------------------------------------------------
183void ScanFacility::ResetPluginRegister()
184{
185 iv_pluginRegFw.clear();
186
187
188}
189
190//-----------------------------------------------------------------------------
191
192void ScanFacility::reset()
193{
194 iv_scomRegFw.clear();
195 iv_attnRegFw.clear();
196 iv_andRegFw.clear();
197 iv_orRegFw.clear();
198 iv_notRegFw.clear();
199 iv_leftRegFw.clear();
200 iv_sumRegFw.clear();
201 iv_rightRegFw.clear();
202 iv_constRegFw.clear();
203 iv_pluginRegFw.clear();
204}
205
206//------------------------------------------------------------------------------
207#ifdef FLYWEIGHT_PROFILING
208void ScanFacility::printStats()
209{
Zane Shelleycd36f432019-08-30 21:22:07 -0500210 PRDF_TRAC("HardwareRegister");
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500211 iv_scomRegFw.printStats();
212 PRDF_TRAC("Not Register");
213 iv_notRegFw.printStats();
214 PRDF_TRAC("Left Register");
215 iv_leftRegFw.printStats();
216 PRDF_TRAC("Right Register");
217 iv_rightRegFw.printStats();
218 PRDF_TRAC("And Register");
219 iv_andRegFw.printStats();
220 PRDF_TRAC("Or Register");
221 iv_orRegFw.printStats();
222 PRDF_TRAC("AttnTypeRegisters FW" );
223 iv_attnRegFw.printStats();
224 PRDF_TRAC("SummaryRegisters FW" );
225 iv_sumRegFw.printStats();
226 PRDF_TRAC("ConstantRegisters FW" );
227 iv_constRegFw.printStats();
228 PRDF_TRAC("PluginRegisters FW" );
229 iv_pluginRegFw.printStats();
230}
231
232#endif
233
Zane Shelleyfd275a22019-09-05 23:13:59 -0500234} // end namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500235