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