blob: a0aadac9b3505d4848ef1595ce9406d4e7019380 [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>
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050039
Zane Shelleyfd275a22019-09-05 23:13:59 -050040namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050041{
42
43//----------------------------------------------------------------------
44// Constants
45//----------------------------------------------------------------------
46
47//----------------------------------------------------------------------
48// Macros
49//----------------------------------------------------------------------
50
51//----------------------------------------------------------------------
52// Internal Function Prototypes
53//----------------------------------------------------------------------
54
55//----------------------------------------------------------------------
56// Global Variables
57//----------------------------------------------------------------------
58
59NullRegister AttnTypeRegister::cv_null(1024);
60
61//---------------------------------------------------------------------
62// Member Function Specifications
63//---------------------------------------------------------------------
64
65
66ScanFacility & ScanFacility::Access(void)
67{
68 static ScanFacility sf;
69 return sf;
70}
71//-----------------------------------------------------------------------------
Zane Shelley23244cb2019-08-30 21:12:12 -050072Register & ScanFacility::GetScanCommRegister( uint64_t address,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050073 uint32_t i_scomLength, TARGETING::TYPE i_type,
Zane Shelley23244cb2019-08-30 21:12:12 -050074 Register::AccessLevel i_regOp )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050075{
76 /* i_regOp is not used to determine uniqueness of the object for following
77 reason -
78 There can not be two registers in hardware with same address and target
79 type supporting different operations say one supports only write and
80 other both read and write.
81 */
82
Zane Shelleycd36f432019-08-30 21:22:07 -050083 HardwareRegister scrKey( address, i_scomLength, i_type, i_regOp );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050084 // in case we get a object with different default operation, we shall reset
85 // it to what it should be as per rule file.
Zane Shelleycd36f432019-08-30 21:22:07 -050086 HardwareRegister &regCreated = iv_scomRegFw.get(scrKey);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050087 regCreated.setAccessLevel( i_regOp );
88 return regCreated;
89}
90
91//------------------------------------------------------------------------------
92
Zane Shelley23244cb2019-08-30 21:12:12 -050093Register & ScanFacility::GetNotRegister(
94 Register & i_arg )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050095{
96 NotRegister r(i_arg);
97 return iv_notRegFw.get(r);
98}
99
100//-----------------------------------------------------------------------------
101
Zane Shelley23244cb2019-08-30 21:12:12 -0500102Register & ScanFacility::GetLeftShiftRegister(
103 Register & i_arg,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500104 uint16_t i_amount )
105{
106 LeftShiftRegister r(i_arg, i_amount);
107 return iv_leftRegFw.get(r);
108}
109
110//-----------------------------------------------------------------------------
111
Zane Shelley23244cb2019-08-30 21:12:12 -0500112Register & ScanFacility::GetSummaryRegister(
113 Register & i_arg,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500114 uint16_t i_bit )
115{
116 SummaryRegister r(i_arg, i_bit);
117 return iv_sumRegFw.get(r);
118}
119
120//------------------------------------------------------------------------------
121
Zane Shelley23244cb2019-08-30 21:12:12 -0500122Register & ScanFacility::GetRightShiftRegister(
123 Register & i_arg,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500124 uint16_t i_amount )
125{
126 RightShiftRegister r(i_arg, i_amount);
127 return iv_rightRegFw.get(r);
128}
129
130
131//------------------------------------------------------------------------------
132
Zane Shelley23244cb2019-08-30 21:12:12 -0500133Register & ScanFacility::GetAndRegister(
134 Register & i_left,
135 Register & i_right )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500136{
137 AndRegister r(i_left,i_right);
138 return iv_andRegFw.get(r);
139}
140
141//------------------------------------------------------------------------------
142
Zane Shelley23244cb2019-08-30 21:12:12 -0500143Register & ScanFacility::GetOrRegister(
144 Register & i_left,
145 Register & i_right )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500146{
147 OrRegister r(i_left,i_right);
148 return iv_orRegFw.get(r);
149}
150
151//-----------------------------------------------------------------------------
152
Zane Shelley23244cb2019-08-30 21:12:12 -0500153Register & ScanFacility::GetAttnTypeRegister(
154 Register * i_check,
155 Register * i_recov,
156 Register * i_special,
157 Register * i_proccs,
158 Register * i_hostattn )
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500159{
160 AttnTypeRegister r(i_check, i_recov, i_special, i_proccs, i_hostattn);
161 return iv_attnRegFw.get(r);
162}
163
164//------------------------------------------------------------------------------
165
Zane Shelley23244cb2019-08-30 21:12:12 -0500166Register & ScanFacility::GetConstantRegister(
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500167 const BitStringBuffer & i_val )
168{
169 ConstantRegister r(i_val);
170 return iv_constRegFw.get(r);
171}
172//------------------------------------------------------------------------------
Zane Shelley23244cb2019-08-30 21:12:12 -0500173Register & ScanFacility::GetPluginRegister(
174 Register & i_flyweight,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500175 ExtensibleChip & i_RuleChip )
176{
177 ScomRegisterAccess l_regKey ( i_flyweight,&i_RuleChip );
178 return iv_pluginRegFw.get(l_regKey);
179
180}
181//-----------------------------------------------------------------------------
182void ScanFacility::ResetPluginRegister()
183{
184 iv_pluginRegFw.clear();
185
186
187}
188
189//-----------------------------------------------------------------------------
190
191void ScanFacility::reset()
192{
193 iv_scomRegFw.clear();
194 iv_attnRegFw.clear();
195 iv_andRegFw.clear();
196 iv_orRegFw.clear();
197 iv_notRegFw.clear();
198 iv_leftRegFw.clear();
199 iv_sumRegFw.clear();
200 iv_rightRegFw.clear();
201 iv_constRegFw.clear();
202 iv_pluginRegFw.clear();
203}
204
205//------------------------------------------------------------------------------
206#ifdef FLYWEIGHT_PROFILING
207void ScanFacility::printStats()
208{
Zane Shelleycd36f432019-08-30 21:22:07 -0500209 PRDF_TRAC("HardwareRegister");
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500210 iv_scomRegFw.printStats();
211 PRDF_TRAC("Not Register");
212 iv_notRegFw.printStats();
213 PRDF_TRAC("Left Register");
214 iv_leftRegFw.printStats();
215 PRDF_TRAC("Right Register");
216 iv_rightRegFw.printStats();
217 PRDF_TRAC("And Register");
218 iv_andRegFw.printStats();
219 PRDF_TRAC("Or Register");
220 iv_orRegFw.printStats();
221 PRDF_TRAC("AttnTypeRegisters FW" );
222 iv_attnRegFw.printStats();
223 PRDF_TRAC("SummaryRegisters FW" );
224 iv_sumRegFw.printStats();
225 PRDF_TRAC("ConstantRegisters FW" );
226 iv_constRegFw.printStats();
227 PRDF_TRAC("PluginRegisters FW" );
228 iv_pluginRegFw.printStats();
229}
230
231#endif
232
Zane Shelleyfd275a22019-09-05 23:13:59 -0500233} // end namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500234