blob: 02644f7b9179fa9d6d8be5ce706e7a776e6f756f [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.H $ */
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#ifndef PRDFSCANFACILITY_H
27#define PRDFSCANFACILITY_H
28/**
29 @file prdfScanFacility.H
30 @brief Description
31*/
32
33
34//--------------------------------------------------------------------
35// Includes
36//--------------------------------------------------------------------
37
38#include <prdfFlyWeight.H>
39#include <prdfFlyWeightS.H>
40#include <vector>
41#include <prdfHomRegisterAccess.H>
42#include <prdfScomRegister.H>
43#include <prdfScomRegisterAccess.H>
44#include <prdfOperatorRegister.H>
45#include <prdfPlatServices.H>
46
47namespace PRDF
48{
49
50
51/**
52 PRD Scan Facility
53 @author Doug Gilbert
54 @par The Scan facility is used by PRD to access Scan and Scan Comm
55 @ functions.It attempts to reduce duplicate objects and their
56 @ aggragates as must as possible.
57*/
58class ScanFacility
59{
60public:
61 /**
62 The Scan Facility is a singleton - this function provides access to it.
63 */
64 static ScanFacility & Access(void);
65
66 /**
67 * @brief Returns reference to flyweight object of type ScomRegister.
68 * An object of given address is first searched in flyweight.
69 * If object exist, reference to existing object is returned
70 * else a new one is created.
71 * @param i_address address of the register
72 * @param i_scomLength length of the bit string
73 * @param i_type type of target associated with register
74 * @param i_regOp operations supported for given register
75 * @return returns reference to flyweight object from factory
76 */
77 SCAN_COMM_REGISTER_CLASS & GetScanCommRegister( uint64_t address,
78 uint32_t i_scomLength, TARGETING::TYPE i_type,
79 SCAN_COMM_REGISTER_CLASS::AccessLevel i_regOp );
80
81 /**
82 * @brief Get a register that bitwise inverts the bitstring of a register
83 * when read or written to
84 * @param SCAN_COMM_REGISTER_CLASS source
85 * @post Only one instance of the register with this SCR parameter will
86 * exist
87 */
88 SCAN_COMM_REGISTER_CLASS & GetNotRegister(SCAN_COMM_REGISTER_CLASS & i_arg);
89
90 /**
91 * @brief Get a register that bitwise left shift the bitstring of a register
92 * when read or written to
93 * @param SCAN_COMM_REGISTER_CLASS source
94 * @post Only one instance of the register with this SCR parameter and
95 * amount will exist
96 */
97 SCAN_COMM_REGISTER_CLASS & GetLeftShiftRegister(
98 SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount);
99
100 /**
101 * @brief Get a register that bitwise right shift the bitstring of a register
102 * when read or written to
103 * @param SCAN_COMM_REGISTER_CLASS source
104 * @post Only one instance of the register with this SCR parameter and amount
105 * @ will exist
106 */
107 SCAN_COMM_REGISTER_CLASS & GetRightShiftRegister(
108 SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_amount);
109
110 /**
111 * @brief Get a register for the summary construct
112 * @param SCAN_COMM_REGISTER_CLASS source
113 * @param uint16_t i_bit bit to set if any attentions found in i_arg
114 * @post Only one instance of the register with this SCR parameter and
115 * amount will exist
116 */
117 SCAN_COMM_REGISTER_CLASS & GetSummaryRegister(
118 SCAN_COMM_REGISTER_CLASS & i_arg, uint16_t i_bit);
119
120 /**
121 * @brief Get a register that bit-wise ANDs the bitstring of two register
122 * when read or written to
123 * @param The 2 SCR 's to AND
124 * @posrt Only one instance of the register with these SCRs will exist
125 */
126 SCAN_COMM_REGISTER_CLASS & GetAndRegister(SCAN_COMM_REGISTER_CLASS & i_left,
127 SCAN_COMM_REGISTER_CLASS & i_right);
128
129 /**
130 * @brief Get a register that bitwise ORs the bitstrings of two register when
131 * read or written
132 * @param the 2 SCR's to OR
133 * @post Only one instance of the register with these SCR's will exist
134 */
135 SCAN_COMM_REGISTER_CLASS & GetOrRegister(SCAN_COMM_REGISTER_CLASS & i_left,
136 SCAN_COMM_REGISTER_CLASS & i_right);
137
138 /**
139 * @brief Get a AttnTypeRegister
140 * @params 5 pointers to scr Registers
141 * @post only one instance of the register with these SCR's will exist
142 */
143 SCAN_COMM_REGISTER_CLASS & GetAttnTypeRegister(
144 SCAN_COMM_REGISTER_CLASS * i_check,
145 SCAN_COMM_REGISTER_CLASS * i_recov,
146 SCAN_COMM_REGISTER_CLASS * i_special,
147 SCAN_COMM_REGISTER_CLASS * i_proccs,
148 SCAN_COMM_REGISTER_CLASS * i_hostattn );
149
150 /**
151 * @brief Get a PrdfConstantRegister
152 * @param BitString - the bit string constant to use.
153 * @post only one instance of the register with this BIT_STRING value will
154 * exist.
155 */
156 SCAN_COMM_REGISTER_CLASS & GetConstantRegister(const BitStringBuffer & i_val);
157 /**
158 * @brief Get a plugin register
159 * @param Reference to target less flyweight object
160 * @param RuleChip associatd with register
161 * @post only one instance of the register with this BIT_STRING value will
162 * exist.
163 */
164 SCAN_COMM_REGISTER_CLASS & GetPluginRegister(
165 SCAN_COMM_REGISTER_CLASS & i_flyweight,
166 ExtensibleChip & i_RuleChip );
167 /**
168 * @brief Delete all the plugin register
169 * @param None
170 * @post all the ScomRegisterAccess register flyweight object created for
171 * plugin shall be deleted
172 * exist.
173 */
174 void ResetPluginRegister();
175
176 /**
177 * @brief Intended to reset all the flyweights if PRD is uninitialized due to
178 * a reIPL, reset/reload, or failover. This free up the memory and
179 * avoids memory leaks in the flyweights.
180 */
181 void reset();
182
183#ifdef FLYWEIGHT_PROFILING
184/**
185 * @brief prints memory allocated for object residing on flyweight
186 */
187 void printStats();
188#endif
189
190 /**
191 Destructor
192 */
193// ~ScanFacility();
194private: // functions
195 /**
196 Constructor
197 * @param
198 * @returns
199 * @pre
200 * @post
201 * @see
202 * @note
203 */
204 ScanFacility() {}
205
206
207private: // Data
208 typedef FlyWeightS<ScomRegister,50> ScanCommRegisters;
209 //FIXME RTC 64345 Investigate benefit of changing below from FlyWeight to
210 //FlyWeightS
211 typedef FlyWeight<AttnTypeRegister,50> AttnTypeRegisters;
212 typedef FlyWeightS<AndRegister,50> AndRegisters;
213 typedef FlyWeightS<OrRegister,10> OrRegisters;
214 typedef FlyWeightS<NotRegister,50> NotRegisters;
215 typedef FlyWeightS<LeftShiftRegister,10> LeftShiftRegisters;
216 typedef FlyWeightS<RightShiftRegister, 10> RightShiftRegisters;
217 typedef FlyWeightS<SummaryRegister,10> SummaryRegisters;
218 typedef FlyWeight<ConstantRegister, 10> ConstantRegisters;
219 typedef FlyWeightS<ScomRegisterAccess, 10> PluginRegisters;
220
221 ScanCommRegisters iv_scomRegFw;
222 AttnTypeRegisters iv_attnRegFw;
223 AndRegisters iv_andRegFw;
224 OrRegisters iv_orRegFw;
225 NotRegisters iv_notRegFw;
226 LeftShiftRegisters iv_leftRegFw;
227 SummaryRegisters iv_sumRegFw;
228 RightShiftRegisters iv_rightRegFw;
229 ConstantRegisters iv_constRegFw;
230 PluginRegisters iv_pluginRegFw;
231
232};
233
234} // end namespace PRDF
235
236#endif /* PRDFSCANFACILITY_H */