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.C $ */ |
| 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 | /** |
| 27 | @file prdfScanFacility.C |
| 28 | @brief PRD ScanFaclity class definition |
| 29 | */ |
| 30 | //---------------------------------------------------------------------- |
| 31 | // Includes |
| 32 | //---------------------------------------------------------------------- |
| 33 | #define prdfScanFacility_C |
| 34 | |
| 35 | #include <iipscr.h> |
| 36 | #include <prdfScanFacility.H> |
| 37 | #include <prdfFlyWeight.C> |
| 38 | #include <prdfFlyWeightS.C> |
| 39 | #include <prdfScomRegisterAccess.H> |
| 40 | |
| 41 | #undef prdfScanFacility_C |
| 42 | |
| 43 | namespace PRDF |
| 44 | { |
| 45 | |
| 46 | //---------------------------------------------------------------------- |
| 47 | // Constants |
| 48 | //---------------------------------------------------------------------- |
| 49 | |
| 50 | //---------------------------------------------------------------------- |
| 51 | // Macros |
| 52 | //---------------------------------------------------------------------- |
| 53 | |
| 54 | //---------------------------------------------------------------------- |
| 55 | // Internal Function Prototypes |
| 56 | //---------------------------------------------------------------------- |
| 57 | |
| 58 | //---------------------------------------------------------------------- |
| 59 | // Global Variables |
| 60 | //---------------------------------------------------------------------- |
| 61 | |
| 62 | NullRegister AttnTypeRegister::cv_null(1024); |
| 63 | |
| 64 | //--------------------------------------------------------------------- |
| 65 | // Member Function Specifications |
| 66 | //--------------------------------------------------------------------- |
| 67 | |
| 68 | |
| 69 | ScanFacility & ScanFacility::Access(void) |
| 70 | { |
| 71 | static ScanFacility sf; |
| 72 | return sf; |
| 73 | } |
| 74 | //----------------------------------------------------------------------------- |
| 75 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetScanCommRegister( uint64_t address, |
| 76 | uint32_t i_scomLength, TARGETING::TYPE i_type, |
| 77 | SCAN_COMM_REGISTER_CLASS::AccessLevel i_regOp ) |
| 78 | { |
| 79 | /* i_regOp is not used to determine uniqueness of the object for following |
| 80 | reason - |
| 81 | There can not be two registers in hardware with same address and target |
| 82 | type supporting different operations say one supports only write and |
| 83 | other both read and write. |
| 84 | */ |
| 85 | |
| 86 | ScomRegister scrKey( address, i_scomLength, i_type, i_regOp ); |
| 87 | // in case we get a object with different default operation, we shall reset |
| 88 | // it to what it should be as per rule file. |
| 89 | ScomRegister ®Created = iv_scomRegFw.get(scrKey); |
| 90 | regCreated.setAccessLevel( i_regOp ); |
| 91 | return regCreated; |
| 92 | } |
| 93 | |
| 94 | //------------------------------------------------------------------------------ |
| 95 | |
| 96 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetNotRegister( |
| 97 | SCAN_COMM_REGISTER_CLASS & i_arg ) |
| 98 | { |
| 99 | NotRegister r(i_arg); |
| 100 | return iv_notRegFw.get(r); |
| 101 | } |
| 102 | |
| 103 | //----------------------------------------------------------------------------- |
| 104 | |
| 105 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetLeftShiftRegister( |
| 106 | SCAN_COMM_REGISTER_CLASS & i_arg, |
| 107 | uint16_t i_amount ) |
| 108 | { |
| 109 | LeftShiftRegister r(i_arg, i_amount); |
| 110 | return iv_leftRegFw.get(r); |
| 111 | } |
| 112 | |
| 113 | //----------------------------------------------------------------------------- |
| 114 | |
| 115 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetSummaryRegister( |
| 116 | SCAN_COMM_REGISTER_CLASS & i_arg, |
| 117 | uint16_t i_bit ) |
| 118 | { |
| 119 | SummaryRegister r(i_arg, i_bit); |
| 120 | return iv_sumRegFw.get(r); |
| 121 | } |
| 122 | |
| 123 | //------------------------------------------------------------------------------ |
| 124 | |
| 125 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetRightShiftRegister( |
| 126 | SCAN_COMM_REGISTER_CLASS & i_arg, |
| 127 | uint16_t i_amount ) |
| 128 | { |
| 129 | RightShiftRegister r(i_arg, i_amount); |
| 130 | return iv_rightRegFw.get(r); |
| 131 | } |
| 132 | |
| 133 | |
| 134 | //------------------------------------------------------------------------------ |
| 135 | |
| 136 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAndRegister( |
| 137 | SCAN_COMM_REGISTER_CLASS & i_left, |
| 138 | SCAN_COMM_REGISTER_CLASS & i_right ) |
| 139 | { |
| 140 | AndRegister r(i_left,i_right); |
| 141 | return iv_andRegFw.get(r); |
| 142 | } |
| 143 | |
| 144 | //------------------------------------------------------------------------------ |
| 145 | |
| 146 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetOrRegister( |
| 147 | SCAN_COMM_REGISTER_CLASS & i_left, |
| 148 | SCAN_COMM_REGISTER_CLASS & i_right ) |
| 149 | { |
| 150 | OrRegister r(i_left,i_right); |
| 151 | return iv_orRegFw.get(r); |
| 152 | } |
| 153 | |
| 154 | //----------------------------------------------------------------------------- |
| 155 | |
| 156 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetAttnTypeRegister( |
| 157 | SCAN_COMM_REGISTER_CLASS * i_check, |
| 158 | SCAN_COMM_REGISTER_CLASS * i_recov, |
| 159 | SCAN_COMM_REGISTER_CLASS * i_special, |
| 160 | SCAN_COMM_REGISTER_CLASS * i_proccs, |
| 161 | SCAN_COMM_REGISTER_CLASS * i_hostattn ) |
| 162 | { |
| 163 | AttnTypeRegister r(i_check, i_recov, i_special, i_proccs, i_hostattn); |
| 164 | return iv_attnRegFw.get(r); |
| 165 | } |
| 166 | |
| 167 | //------------------------------------------------------------------------------ |
| 168 | |
| 169 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetConstantRegister( |
| 170 | const BitStringBuffer & i_val ) |
| 171 | { |
| 172 | ConstantRegister r(i_val); |
| 173 | return iv_constRegFw.get(r); |
| 174 | } |
| 175 | //------------------------------------------------------------------------------ |
| 176 | SCAN_COMM_REGISTER_CLASS & ScanFacility::GetPluginRegister( |
| 177 | SCAN_COMM_REGISTER_CLASS & i_flyweight, |
| 178 | ExtensibleChip & i_RuleChip ) |
| 179 | { |
| 180 | ScomRegisterAccess l_regKey ( i_flyweight,&i_RuleChip ); |
| 181 | return iv_pluginRegFw.get(l_regKey); |
| 182 | |
| 183 | } |
| 184 | //----------------------------------------------------------------------------- |
| 185 | void ScanFacility::ResetPluginRegister() |
| 186 | { |
| 187 | iv_pluginRegFw.clear(); |
| 188 | |
| 189 | |
| 190 | } |
| 191 | |
| 192 | //----------------------------------------------------------------------------- |
| 193 | |
| 194 | void ScanFacility::reset() |
| 195 | { |
| 196 | iv_scomRegFw.clear(); |
| 197 | iv_attnRegFw.clear(); |
| 198 | iv_andRegFw.clear(); |
| 199 | iv_orRegFw.clear(); |
| 200 | iv_notRegFw.clear(); |
| 201 | iv_leftRegFw.clear(); |
| 202 | iv_sumRegFw.clear(); |
| 203 | iv_rightRegFw.clear(); |
| 204 | iv_constRegFw.clear(); |
| 205 | iv_pluginRegFw.clear(); |
| 206 | } |
| 207 | |
| 208 | //------------------------------------------------------------------------------ |
| 209 | #ifdef FLYWEIGHT_PROFILING |
| 210 | void ScanFacility::printStats() |
| 211 | { |
| 212 | PRDF_TRAC("ScomRegister"); |
| 213 | iv_scomRegFw.printStats(); |
| 214 | PRDF_TRAC("Not Register"); |
| 215 | iv_notRegFw.printStats(); |
| 216 | PRDF_TRAC("Left Register"); |
| 217 | iv_leftRegFw.printStats(); |
| 218 | PRDF_TRAC("Right Register"); |
| 219 | iv_rightRegFw.printStats(); |
| 220 | PRDF_TRAC("And Register"); |
| 221 | iv_andRegFw.printStats(); |
| 222 | PRDF_TRAC("Or Register"); |
| 223 | iv_orRegFw.printStats(); |
| 224 | PRDF_TRAC("AttnTypeRegisters FW" ); |
| 225 | iv_attnRegFw.printStats(); |
| 226 | PRDF_TRAC("SummaryRegisters FW" ); |
| 227 | iv_sumRegFw.printStats(); |
| 228 | PRDF_TRAC("ConstantRegisters FW" ); |
| 229 | iv_constRegFw.printStats(); |
| 230 | PRDF_TRAC("PluginRegisters FW" ); |
| 231 | iv_pluginRegFw.printStats(); |
| 232 | } |
| 233 | |
| 234 | #endif |
| 235 | |
| 236 | } // end namespace PRDF |
| 237 | |