blob: 501f72b3dd507162f01bbbd086ed0f250e6417df [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>
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050044#include <prdfPlatServices.H>
45
Zane Shelleyfd275a22019-09-05 23:13:59 -050046namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050047{
48
49
50/**
51 PRD Scan Facility
52 @author Doug Gilbert
53 @par The Scan facility is used by PRD to access Scan and Scan Comm
54 @ functions.It attempts to reduce duplicate objects and their
55 @ aggragates as must as possible.
56*/
57class ScanFacility
58{
59public:
60 /**
61 The Scan Facility is a singleton - this function provides access to it.
62 */
63 static ScanFacility & Access(void);
64
65 /**
Zane Shelleycd36f432019-08-30 21:22:07 -050066 * @brief Returns reference to flyweight object of type HardwareRegister.
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050067 * An object of given address is first searched in flyweight.
68 * If object exist, reference to existing object is returned
69 * else a new one is created.
70 * @param i_address address of the register
71 * @param i_scomLength length of the bit string
72 * @param i_type type of target associated with register
73 * @param i_regOp operations supported for given register
74 * @return returns reference to flyweight object from factory
75 */
Zane Shelley23244cb2019-08-30 21:12:12 -050076 Register & GetScanCommRegister( uint64_t address,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050077 uint32_t i_scomLength, TARGETING::TYPE i_type,
Zane Shelley23244cb2019-08-30 21:12:12 -050078 Register::AccessLevel i_regOp );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050079
80 /**
81 * @brief Get a register that bitwise inverts the bitstring of a register
82 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -050083 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050084 * @post Only one instance of the register with this SCR parameter will
85 * exist
86 */
Zane Shelley23244cb2019-08-30 21:12:12 -050087 Register & GetNotRegister(Register & i_arg);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050088
89 /**
90 * @brief Get a register that bitwise left shift the bitstring of a register
91 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -050092 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050093 * @post Only one instance of the register with this SCR parameter and
94 * amount will exist
95 */
Zane Shelley23244cb2019-08-30 21:12:12 -050096 Register & GetLeftShiftRegister(
97 Register & i_arg, uint16_t i_amount);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050098
99 /**
100 * @brief Get a register that bitwise right shift the bitstring of a register
101 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -0500102 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500103 * @post Only one instance of the register with this SCR parameter and amount
104 * @ will exist
105 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500106 Register & GetRightShiftRegister(
107 Register & i_arg, uint16_t i_amount);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500108
109 /**
110 * @brief Get a register for the summary construct
Zane Shelley23244cb2019-08-30 21:12:12 -0500111 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500112 * @param uint16_t i_bit bit to set if any attentions found in i_arg
113 * @post Only one instance of the register with this SCR parameter and
114 * amount will exist
115 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500116 Register & GetSummaryRegister(
117 Register & i_arg, uint16_t i_bit);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500118
119 /**
120 * @brief Get a register that bit-wise ANDs the bitstring of two register
121 * when read or written to
122 * @param The 2 SCR 's to AND
123 * @posrt Only one instance of the register with these SCRs will exist
124 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500125 Register & GetAndRegister(Register & i_left,
126 Register & i_right);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500127
128 /**
129 * @brief Get a register that bitwise ORs the bitstrings of two register when
130 * read or written
131 * @param the 2 SCR's to OR
132 * @post Only one instance of the register with these SCR's will exist
133 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500134 Register & GetOrRegister(Register & i_left,
135 Register & i_right);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500136
137 /**
138 * @brief Get a AttnTypeRegister
139 * @params 5 pointers to scr Registers
140 * @post only one instance of the register with these SCR's will exist
141 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500142 Register & GetAttnTypeRegister(
143 Register * i_check,
144 Register * i_recov,
145 Register * i_special,
146 Register * i_proccs,
147 Register * i_hostattn );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500148
149 /**
150 * @brief Get a PrdfConstantRegister
151 * @param BitString - the bit string constant to use.
152 * @post only one instance of the register with this BIT_STRING value will
153 * exist.
154 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500155 Register & GetConstantRegister(const BitStringBuffer & i_val);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500156 /**
157 * @brief Get a plugin register
158 * @param Reference to target less flyweight object
159 * @param RuleChip associatd with register
160 * @post only one instance of the register with this BIT_STRING value will
161 * exist.
162 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500163 Register & GetPluginRegister(
164 Register & i_flyweight,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500165 ExtensibleChip & i_RuleChip );
166 /**
167 * @brief Delete all the plugin register
168 * @param None
169 * @post all the ScomRegisterAccess register flyweight object created for
170 * plugin shall be deleted
171 * exist.
172 */
173 void ResetPluginRegister();
174
175 /**
176 * @brief Intended to reset all the flyweights if PRD is uninitialized due to
177 * a reIPL, reset/reload, or failover. This free up the memory and
178 * avoids memory leaks in the flyweights.
179 */
180 void reset();
181
182#ifdef FLYWEIGHT_PROFILING
183/**
184 * @brief prints memory allocated for object residing on flyweight
185 */
186 void printStats();
187#endif
188
189 /**
190 Destructor
191 */
192// ~ScanFacility();
193private: // functions
194 /**
195 Constructor
196 * @param
197 * @returns
198 * @pre
199 * @post
200 * @see
201 * @note
202 */
203 ScanFacility() {}
204
205
206private: // Data
Zane Shelleycd36f432019-08-30 21:22:07 -0500207 typedef FlyWeightS<HardwareRegister,50> ScanCommRegisters;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500208 //FIXME RTC 64345 Investigate benefit of changing below from FlyWeight to
209 //FlyWeightS
210 typedef FlyWeight<AttnTypeRegister,50> AttnTypeRegisters;
211 typedef FlyWeightS<AndRegister,50> AndRegisters;
212 typedef FlyWeightS<OrRegister,10> OrRegisters;
213 typedef FlyWeightS<NotRegister,50> NotRegisters;
214 typedef FlyWeightS<LeftShiftRegister,10> LeftShiftRegisters;
215 typedef FlyWeightS<RightShiftRegister, 10> RightShiftRegisters;
216 typedef FlyWeightS<SummaryRegister,10> SummaryRegisters;
217 typedef FlyWeight<ConstantRegister, 10> ConstantRegisters;
218 typedef FlyWeightS<ScomRegisterAccess, 10> PluginRegisters;
219
220 ScanCommRegisters iv_scomRegFw;
221 AttnTypeRegisters iv_attnRegFw;
222 AndRegisters iv_andRegFw;
223 OrRegisters iv_orRegFw;
224 NotRegisters iv_notRegFw;
225 LeftShiftRegisters iv_leftRegFw;
226 SummaryRegisters iv_sumRegFw;
227 RightShiftRegisters iv_rightRegFw;
228 ConstantRegisters iv_constRegFw;
229 PluginRegisters iv_pluginRegFw;
230
231};
232
Zane Shelleyfd275a22019-09-05 23:13:59 -0500233} // end namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500234
235#endif /* PRDFSCANFACILITY_H */