blob: 547377f7ca4e68a127f56dbc3b6eb4753643a4ea [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 Shelleyfd3f9cc2019-07-29 15:02:24 -050041namespace PRDF
42{
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//-----------------------------------------------------------------------------
73SCAN_COMM_REGISTER_CLASS & ScanFacility::GetScanCommRegister( uint64_t address,
74 uint32_t i_scomLength, TARGETING::TYPE i_type,
75 SCAN_COMM_REGISTER_CLASS::AccessLevel i_regOp )
76{
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
84 ScomRegister scrKey( address, i_scomLength, i_type, i_regOp );
85 // in case we get a object with different default operation, we shall reset
86 // it to what it should be as per rule file.
87 ScomRegister &regCreated = iv_scomRegFw.get(scrKey);
88 regCreated.setAccessLevel( i_regOp );
89 return regCreated;
90}
91
92//------------------------------------------------------------------------------
93
94SCAN_COMM_REGISTER_CLASS & ScanFacility::GetNotRegister(
95 SCAN_COMM_REGISTER_CLASS & i_arg )
96{
97 NotRegister r(i_arg);
98 return iv_notRegFw.get(r);
99}
100
101//-----------------------------------------------------------------------------
102
103SCAN_COMM_REGISTER_CLASS & ScanFacility::GetLeftShiftRegister(
104 SCAN_COMM_REGISTER_CLASS & i_arg,
105 uint16_t i_amount )
106{
107 LeftShiftRegister r(i_arg, i_amount);
108 return iv_leftRegFw.get(r);
109}
110
111//-----------------------------------------------------------------------------
112
113SCAN_COMM_REGISTER_CLASS & ScanFacility::GetSummaryRegister(
114 SCAN_COMM_REGISTER_CLASS & i_arg,
115 uint16_t i_bit )
116{
117 SummaryRegister r(i_arg, i_bit);
118 return iv_sumRegFw.get(r);
119}
120
121//------------------------------------------------------------------------------
122
123SCAN_COMM_REGISTER_CLASS & ScanFacility::GetRightShiftRegister(
124 SCAN_COMM_REGISTER_CLASS & i_arg,
125 uint16_t i_amount )
126{
127 RightShiftRegister r(i_arg, i_amount);
128 return iv_rightRegFw.get(r);
129}
130
131
132//------------------------------------------------------------------------------
133
134SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAndRegister(
135 SCAN_COMM_REGISTER_CLASS & i_left,
136 SCAN_COMM_REGISTER_CLASS & i_right )
137{
138 AndRegister r(i_left,i_right);
139 return iv_andRegFw.get(r);
140}
141
142//------------------------------------------------------------------------------
143
144SCAN_COMM_REGISTER_CLASS & ScanFacility::GetOrRegister(
145 SCAN_COMM_REGISTER_CLASS & i_left,
146 SCAN_COMM_REGISTER_CLASS & i_right )
147{
148 OrRegister r(i_left,i_right);
149 return iv_orRegFw.get(r);
150}
151
152//-----------------------------------------------------------------------------
153
154SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAttnTypeRegister(
155 SCAN_COMM_REGISTER_CLASS * i_check,
156 SCAN_COMM_REGISTER_CLASS * i_recov,
157 SCAN_COMM_REGISTER_CLASS * i_special,
158 SCAN_COMM_REGISTER_CLASS * i_proccs,
159 SCAN_COMM_REGISTER_CLASS * i_hostattn )
160{
161 AttnTypeRegister r(i_check, i_recov, i_special, i_proccs, i_hostattn);
162 return iv_attnRegFw.get(r);
163}
164
165//------------------------------------------------------------------------------
166
167SCAN_COMM_REGISTER_CLASS & ScanFacility::GetConstantRegister(
168 const BitStringBuffer & i_val )
169{
170 ConstantRegister r(i_val);
171 return iv_constRegFw.get(r);
172}
173//------------------------------------------------------------------------------
174SCAN_COMM_REGISTER_CLASS & ScanFacility::GetPluginRegister(
175 SCAN_COMM_REGISTER_CLASS & i_flyweight,
176 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{
210 PRDF_TRAC("ScomRegister");
211 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
234} // end namespace PRDF
235