blob: 1b22e164d8a00ab5e7ec5e23e3efd82a57448d5b [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>
Zane Shelley200c3452019-09-26 11:46:30 -050040#include <util/hei_flyweight.hpp>
Zane Shelley52cb1a92019-08-21 14:38:31 -050041
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050042#include <vector>
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050043#include <prdfPlatServices.H>
44
Zane Shelleyfd275a22019-09-05 23:13:59 -050045namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050046{
47
48
49/**
50 PRD Scan Facility
51 @author Doug Gilbert
52 @par The Scan facility is used by PRD to access Scan and Scan Comm
53 @ functions.It attempts to reduce duplicate objects and their
54 @ aggragates as must as possible.
55*/
56class ScanFacility
57{
58public:
59 /**
60 The Scan Facility is a singleton - this function provides access to it.
61 */
62 static ScanFacility & Access(void);
63
64 /**
Zane Shelleycd36f432019-08-30 21:22:07 -050065 * @brief Returns reference to flyweight object of type HardwareRegister.
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050066 * An object of given address is first searched in flyweight.
67 * If object exist, reference to existing object is returned
68 * else a new one is created.
69 * @param i_address address of the register
70 * @param i_scomLength length of the bit string
71 * @param i_type type of target associated with register
72 * @param i_regOp operations supported for given register
73 * @return returns reference to flyweight object from factory
74 */
Zane Shelley23244cb2019-08-30 21:12:12 -050075 Register & GetScanCommRegister( uint64_t address,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050076 uint32_t i_scomLength, TARGETING::TYPE i_type,
Zane Shelley23244cb2019-08-30 21:12:12 -050077 Register::AccessLevel i_regOp );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050078
79 /**
80 * @brief Get a register that bitwise inverts the bitstring of a register
81 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -050082 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050083 * @post Only one instance of the register with this SCR parameter will
84 * exist
85 */
Zane Shelley23244cb2019-08-30 21:12:12 -050086 Register & GetNotRegister(Register & i_arg);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050087
88 /**
89 * @brief Get a register that bitwise left shift the bitstring of a register
90 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -050091 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050092 * @post Only one instance of the register with this SCR parameter and
93 * amount will exist
94 */
Zane Shelley23244cb2019-08-30 21:12:12 -050095 Register & GetLeftShiftRegister(
96 Register & i_arg, uint16_t i_amount);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -050097
98 /**
99 * @brief Get a register that bitwise right shift the bitstring of a register
100 * when read or written to
Zane Shelley23244cb2019-08-30 21:12:12 -0500101 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500102 * @post Only one instance of the register with this SCR parameter and amount
103 * @ will exist
104 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500105 Register & GetRightShiftRegister(
106 Register & i_arg, uint16_t i_amount);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500107
108 /**
109 * @brief Get a register for the summary construct
Zane Shelley23244cb2019-08-30 21:12:12 -0500110 * @param Register source
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500111 * @param uint16_t i_bit bit to set if any attentions found in i_arg
112 * @post Only one instance of the register with this SCR parameter and
113 * amount will exist
114 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500115 Register & GetSummaryRegister(
116 Register & i_arg, uint16_t i_bit);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500117
118 /**
119 * @brief Get a register that bit-wise ANDs the bitstring of two register
120 * when read or written to
121 * @param The 2 SCR 's to AND
122 * @posrt Only one instance of the register with these SCRs will exist
123 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500124 Register & GetAndRegister(Register & i_left,
125 Register & i_right);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500126
127 /**
128 * @brief Get a register that bitwise ORs the bitstrings of two register when
129 * read or written
130 * @param the 2 SCR's to OR
131 * @post Only one instance of the register with these SCR's will exist
132 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500133 Register & GetOrRegister(Register & i_left,
134 Register & i_right);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500135
136 /**
137 * @brief Get a AttnTypeRegister
138 * @params 5 pointers to scr Registers
139 * @post only one instance of the register with these SCR's will exist
140 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500141 Register & GetAttnTypeRegister(
142 Register * i_check,
143 Register * i_recov,
144 Register * i_special,
145 Register * i_proccs,
146 Register * i_hostattn );
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500147
148 /**
149 * @brief Get a PrdfConstantRegister
150 * @param BitString - the bit string constant to use.
151 * @post only one instance of the register with this BIT_STRING value will
152 * exist.
153 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500154 Register & GetConstantRegister(const BitStringBuffer & i_val);
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500155 /**
156 * @brief Get a plugin register
157 * @param Reference to target less flyweight object
158 * @param RuleChip associatd with register
159 * @post only one instance of the register with this BIT_STRING value will
160 * exist.
161 */
Zane Shelley23244cb2019-08-30 21:12:12 -0500162 Register & GetPluginRegister(
163 Register & i_flyweight,
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500164 ExtensibleChip & i_RuleChip );
165 /**
166 * @brief Delete all the plugin register
167 * @param None
168 * @post all the ScomRegisterAccess register flyweight object created for
169 * plugin shall be deleted
170 * exist.
171 */
172 void ResetPluginRegister();
173
174 /**
175 * @brief Intended to reset all the flyweights if PRD is uninitialized due to
176 * a reIPL, reset/reload, or failover. This free up the memory and
177 * avoids memory leaks in the flyweights.
178 */
179 void reset();
180
181#ifdef FLYWEIGHT_PROFILING
182/**
183 * @brief prints memory allocated for object residing on flyweight
184 */
185 void printStats();
186#endif
187
188 /**
189 Destructor
190 */
191// ~ScanFacility();
192private: // functions
193 /**
194 Constructor
195 * @param
196 * @returns
197 * @pre
198 * @post
199 * @see
200 * @note
201 */
202 ScanFacility() {}
203
204
205private: // Data
Zane Shelley200c3452019-09-26 11:46:30 -0500206 typedef Flyweight<HardwareRegister> ScanCommRegisters;
207 typedef Flyweight<AttnTypeRegister> AttnTypeRegisters;
208 typedef Flyweight<AndRegister> AndRegisters;
209 typedef Flyweight<OrRegister> OrRegisters;
210 typedef Flyweight<NotRegister> NotRegisters;
211 typedef Flyweight<LeftShiftRegister> LeftShiftRegisters;
212 typedef Flyweight<RightShiftRegister> RightShiftRegisters;
213 typedef Flyweight<SummaryRegister> SummaryRegisters;
214 typedef Flyweight<ConstantRegister> ConstantRegisters;
215 typedef Flyweight<ScomRegisterAccess> PluginRegisters;
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500216
217 ScanCommRegisters iv_scomRegFw;
218 AttnTypeRegisters iv_attnRegFw;
219 AndRegisters iv_andRegFw;
220 OrRegisters iv_orRegFw;
221 NotRegisters iv_notRegFw;
222 LeftShiftRegisters iv_leftRegFw;
223 SummaryRegisters iv_sumRegFw;
224 RightShiftRegisters iv_rightRegFw;
225 ConstantRegisters iv_constRegFw;
226 PluginRegisters iv_pluginRegFw;
227
228};
229
Zane Shelleyfd275a22019-09-05 23:13:59 -0500230} // end namespace libhei
Zane Shelleyfd3f9cc2019-07-29 15:02:24 -0500231
232#endif /* PRDFSCANFACILITY_H */