blob: 9a423dd1fd00c9f2cd0414dfcbd4c6b02f3e6ef1 [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
Zane Shelley52cb1a92019-08-21 14:38:31 -050038#include <register/hei_hardware_register.hpp>
39#include <register/hei_operator_register.hpp>
40
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050041#include <prdfFlyWeight.H>
42#include <prdfFlyWeightS.H>
43#include <vector>
44#include <prdfHomRegisterAccess.H>
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050045#include <prdfScomRegisterAccess.H>
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050046#include <prdfPlatServices.H>
47
48namespace PRDF
49{
50
51
52/**
53 PRD Scan Facility
54 @author Doug Gilbert
55 @par The Scan facility is used by PRD to access Scan and Scan Comm
56 @ functions.It attempts to reduce duplicate objects and their
57 @ aggragates as must as possible.
58*/
59class ScanFacility
60{
61public:
62 /**
63 The Scan Facility is a singleton - this function provides access to it.
64 */
65 static ScanFacility & Access(void);
66
67 /**
Zane Shelleycd36f432019-08-30 21:22:07 -050068 * @brief Returns reference to flyweight object of type HardwareRegister.
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050069 * An object of given address is first searched in flyweight.
70 * If object exist, reference to existing object is returned
71 * else a new one is created.
72 * @param i_address address of the register
73 * @param i_scomLength length of the bit string
74 * @param i_type type of target associated with register
75 * @param i_regOp operations supported for given register
76 * @return returns reference to flyweight object from factory
77 */
Zane Shelley23244cb2019-08-30 21:12:12 -050078 Register & GetScanCommRegister( uint64_t address,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050079 uint32_t i_scomLength, TARGETING::TYPE i_type,
Zane Shelley23244cb2019-08-30 21:12:12 -050080 Register::AccessLevel i_regOp );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050081
82 /**
83 * @brief Get a register that bitwise inverts the bitstring of a register
84 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -050085 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050086 * @post Only one instance of the register with this SCR parameter will
87 * exist
88 */
Zane Shelley23244cb2019-08-30 21:12:12 -050089 Register & GetNotRegister(Register & i_arg);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050090
91 /**
92 * @brief Get a register that bitwise left shift the bitstring of a register
93 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -050094 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050095 * @post Only one instance of the register with this SCR parameter and
96 * amount will exist
97 */
Zane Shelley23244cb2019-08-30 21:12:12 -050098 Register & GetLeftShiftRegister(
99 Register & i_arg, uint16_t i_amount);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500100
101 /**
102 * @brief Get a register that bitwise right shift the bitstring of a register
103 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -0500104 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500105 * @post Only one instance of the register with this SCR parameter and amount
106 * @ will exist
107 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500108 Register & GetRightShiftRegister(
109 Register & i_arg, uint16_t i_amount);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500110
111 /**
112 * @brief Get a register for the summary construct
Zane Shelley23244cb2019-08-30 21:12:12 -0500113 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500114 * @param uint16_t i_bit bit to set if any attentions found in i_arg
115 * @post Only one instance of the register with this SCR parameter and
116 * amount will exist
117 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500118 Register & GetSummaryRegister(
119 Register & i_arg, uint16_t i_bit);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500120
121 /**
122 * @brief Get a register that bit-wise ANDs the bitstring of two register
123 * when read or written to
124 * @param The 2 SCR 's to AND
125 * @posrt Only one instance of the register with these SCRs will exist
126 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500127 Register & GetAndRegister(Register & i_left,
128 Register & i_right);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500129
130 /**
131 * @brief Get a register that bitwise ORs the bitstrings of two register when
132 * read or written
133 * @param the 2 SCR's to OR
134 * @post Only one instance of the register with these SCR's will exist
135 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500136 Register & GetOrRegister(Register & i_left,
137 Register & i_right);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500138
139 /**
140 * @brief Get a AttnTypeRegister
141 * @params 5 pointers to scr Registers
142 * @post only one instance of the register with these SCR's will exist
143 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500144 Register & GetAttnTypeRegister(
145 Register * i_check,
146 Register * i_recov,
147 Register * i_special,
148 Register * i_proccs,
149 Register * i_hostattn );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500150
151 /**
152 * @brief Get a PrdfConstantRegister
153 * @param BitString - the bit string constant to use.
154 * @post only one instance of the register with this BIT_STRING value will
155 * exist.
156 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500157 Register & GetConstantRegister(const BitStringBuffer & i_val);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500158 /**
159 * @brief Get a plugin register
160 * @param Reference to target less flyweight object
161 * @param RuleChip associatd with register
162 * @post only one instance of the register with this BIT_STRING value will
163 * exist.
164 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500165 Register & GetPluginRegister(
166 Register & i_flyweight,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500167 ExtensibleChip & i_RuleChip );
168 /**
169 * @brief Delete all the plugin register
170 * @param None
171 * @post all the ScomRegisterAccess register flyweight object created for
172 * plugin shall be deleted
173 * exist.
174 */
175 void ResetPluginRegister();
176
177 /**
178 * @brief Intended to reset all the flyweights if PRD is uninitialized due to
179 * a reIPL, reset/reload, or failover. This free up the memory and
180 * avoids memory leaks in the flyweights.
181 */
182 void reset();
183
184#ifdef FLYWEIGHT_PROFILING
185/**
186 * @brief prints memory allocated for object residing on flyweight
187 */
188 void printStats();
189#endif
190
191 /**
192 Destructor
193 */
194// ~ScanFacility();
195private: // functions
196 /**
197 Constructor
198 * @param
199 * @returns
200 * @pre
201 * @post
202 * @see
203 * @note
204 */
205 ScanFacility() {}
206
207
208private: // Data
Zane Shelleycd36f432019-08-30 21:22:07 -0500209 typedef FlyWeightS<HardwareRegister,50> ScanCommRegisters;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500210 //FIXME RTC 64345 Investigate benefit of changing below from FlyWeight to
211 //FlyWeightS
212 typedef FlyWeight<AttnTypeRegister,50> AttnTypeRegisters;
213 typedef FlyWeightS<AndRegister,50> AndRegisters;
214 typedef FlyWeightS<OrRegister,10> OrRegisters;
215 typedef FlyWeightS<NotRegister,50> NotRegisters;
216 typedef FlyWeightS<LeftShiftRegister,10> LeftShiftRegisters;
217 typedef FlyWeightS<RightShiftRegister, 10> RightShiftRegisters;
218 typedef FlyWeightS<SummaryRegister,10> SummaryRegisters;
219 typedef FlyWeight<ConstantRegister, 10> ConstantRegisters;
220 typedef FlyWeightS<ScomRegisterAccess, 10> PluginRegisters;
221
222 ScanCommRegisters iv_scomRegFw;
223 AttnTypeRegisters iv_attnRegFw;
224 AndRegisters iv_andRegFw;
225 OrRegisters iv_orRegFw;
226 NotRegisters iv_notRegFw;
227 LeftShiftRegisters iv_leftRegFw;
228 SummaryRegisters iv_sumRegFw;
229 RightShiftRegisters iv_rightRegFw;
230 ConstantRegisters iv_constRegFw;
231 PluginRegisters iv_pluginRegFw;
232
233};
234
235} // end namespace PRDF
236
237#endif /* PRDFSCANFACILITY_H */