Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 1 | /* 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 Shelley | 52cb1a9 | 2019-08-21 14:38:31 -0500 | [diff] [blame] | 38 | #include <register/hei_hardware_register.hpp> |
| 39 | #include <register/hei_operator_register.hpp> |
Zane Shelley | 200c345 | 2019-09-26 11:46:30 -0500 | [diff] [blame^] | 40 | #include <util/hei_flyweight.hpp> |
Zane Shelley | 52cb1a9 | 2019-08-21 14:38:31 -0500 | [diff] [blame] | 41 | |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 42 | #include <vector> |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 43 | #include <prdfPlatServices.H> |
| 44 | |
Zane Shelley | fd275a2 | 2019-09-05 23:13:59 -0500 | [diff] [blame] | 45 | namespace libhei |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 46 | { |
| 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 | */ |
| 56 | class ScanFacility |
| 57 | { |
| 58 | public: |
| 59 | /** |
| 60 | The Scan Facility is a singleton - this function provides access to it. |
| 61 | */ |
| 62 | static ScanFacility & Access(void); |
| 63 | |
| 64 | /** |
Zane Shelley | cd36f43 | 2019-08-30 21:22:07 -0500 | [diff] [blame] | 65 | * @brief Returns reference to flyweight object of type HardwareRegister. |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 66 | * 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 Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 75 | Register & GetScanCommRegister( uint64_t address, |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 76 | uint32_t i_scomLength, TARGETING::TYPE i_type, |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 77 | Register::AccessLevel i_regOp ); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 78 | |
| 79 | /** |
| 80 | * @brief Get a register that bitwise inverts the bitstring of a register |
| 81 | * when read or written to |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 82 | * @param Register source |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 83 | * @post Only one instance of the register with this SCR parameter will |
| 84 | * exist |
| 85 | */ |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 86 | Register & GetNotRegister(Register & i_arg); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * @brief Get a register that bitwise left shift the bitstring of a register |
| 90 | * when read or written to |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 91 | * @param Register source |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 92 | * @post Only one instance of the register with this SCR parameter and |
| 93 | * amount will exist |
| 94 | */ |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 95 | Register & GetLeftShiftRegister( |
| 96 | Register & i_arg, uint16_t i_amount); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 97 | |
| 98 | /** |
| 99 | * @brief Get a register that bitwise right shift the bitstring of a register |
| 100 | * when read or written to |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 101 | * @param Register source |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 102 | * @post Only one instance of the register with this SCR parameter and amount |
| 103 | * @ will exist |
| 104 | */ |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 105 | Register & GetRightShiftRegister( |
| 106 | Register & i_arg, uint16_t i_amount); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 107 | |
| 108 | /** |
| 109 | * @brief Get a register for the summary construct |
Zane Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 110 | * @param Register source |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 111 | * @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 Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 115 | Register & GetSummaryRegister( |
| 116 | Register & i_arg, uint16_t i_bit); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 117 | |
| 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 Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 124 | Register & GetAndRegister(Register & i_left, |
| 125 | Register & i_right); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 126 | |
| 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 Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 133 | Register & GetOrRegister(Register & i_left, |
| 134 | Register & i_right); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 135 | |
| 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 Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 141 | Register & GetAttnTypeRegister( |
| 142 | Register * i_check, |
| 143 | Register * i_recov, |
| 144 | Register * i_special, |
| 145 | Register * i_proccs, |
| 146 | Register * i_hostattn ); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 147 | |
| 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 Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 154 | Register & GetConstantRegister(const BitStringBuffer & i_val); |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 155 | /** |
| 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 Shelley | 23244cb | 2019-08-30 21:12:12 -0500 | [diff] [blame] | 162 | Register & GetPluginRegister( |
| 163 | Register & i_flyweight, |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 164 | 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(); |
| 192 | private: // functions |
| 193 | /** |
| 194 | Constructor |
| 195 | * @param |
| 196 | * @returns |
| 197 | * @pre |
| 198 | * @post |
| 199 | * @see |
| 200 | * @note |
| 201 | */ |
| 202 | ScanFacility() {} |
| 203 | |
| 204 | |
| 205 | private: // Data |
Zane Shelley | 200c345 | 2019-09-26 11:46:30 -0500 | [diff] [blame^] | 206 | 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 Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 216 | |
| 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 Shelley | fd275a2 | 2019-09-05 23:13:59 -0500 | [diff] [blame] | 230 | } // end namespace libhei |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 231 | |
| 232 | #endif /* PRDFSCANFACILITY_H */ |