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/prdfHomRegisterAccess.H $ */ |
| 5 | /* */ |
| 6 | /* OpenPOWER HostBoot Project */ |
| 7 | /* */ |
| 8 | /* Contributors Listed Below - COPYRIGHT 2012,2017 */ |
| 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 PRDFHOMREGISTERACCESS_H |
| 27 | #define PRDFHOMREGISTERACCESS_H |
| 28 | /** |
| 29 | @file prdfHomRegisterAccess.H |
| 30 | @brief Provide access to scan & scan com registers via the HOM |
| 31 | */ |
| 32 | |
| 33 | |
| 34 | //-------------------------------------------------------------------- |
| 35 | // Includes |
| 36 | //-------------------------------------------------------------------- |
| 37 | |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 38 | #include <vector> |
| 39 | #include <prdfPlatServices.H> |
| 40 | #include <prdfErrlUtil.H> |
| 41 | #include <prdfGlobal.H> |
| 42 | //-------------------------------------------------------------------- |
| 43 | // Forward References |
| 44 | //-------------------------------------------------------------------- |
| 45 | |
| 46 | namespace PRDF |
| 47 | { |
| 48 | |
Zane Shelley | ea1a1ac | 2019-08-08 16:27:20 -0500 | [diff] [blame] | 49 | namespace RegisterAccess |
| 50 | { |
| 51 | enum Operation |
| 52 | { |
| 53 | READ = 0, |
| 54 | WRITE = 1, |
| 55 | }; |
| 56 | } |
| 57 | |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 58 | class ScomAccessor |
| 59 | { |
| 60 | public: |
| 61 | |
| 62 | /** |
| 63 | * @brief ctor |
| 64 | */ |
| 65 | inline ScomAccessor() {} |
| 66 | |
| 67 | /** |
| 68 | * @brief dtor |
| 69 | */ |
| 70 | inline virtual ~ScomAccessor() {} |
| 71 | |
| 72 | /** |
| 73 | * @brief Access the scan com register |
| 74 | * @param i_target Target to access the register |
| 75 | * @param bs holds data read or to write |
| 76 | * @param registerId register address |
| 77 | * @param operation [READ|WRITE] |
| 78 | * @returns SUCCESS or PRD_SCANCOM_FAILURE |
| 79 | * @pre bs.Length() must be size of register data to read/write |
| 80 | * @post For read operation, bs is modified to reflect hardware |
| 81 | * register state |
| 82 | */ |
| 83 | virtual uint32_t Access( TARGETING::TargetHandle_t i_target, |
| 84 | BitString & bs, |
| 85 | uint64_t registerId, |
Zane Shelley | ea1a1ac | 2019-08-08 16:27:20 -0500 | [diff] [blame] | 86 | RegisterAccess::Operation operation) const; |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 87 | |
| 88 | private: |
| 89 | |
| 90 | /** |
| 91 | * @brief disable copy |
| 92 | */ |
| 93 | ScomAccessor(const ScomAccessor &); |
| 94 | |
| 95 | /** |
| 96 | * @brief disable assignment |
| 97 | */ |
| 98 | ScomAccessor & operator=(const ScomAccessor &); |
| 99 | |
| 100 | }; |
| 101 | |
| 102 | /** |
| 103 | * @brief Singleton to access the only ScomService |
| 104 | */ |
| 105 | class ScomService; |
| 106 | PRDF_DECLARE_SINGLETON(ScomService, theScomService); |
| 107 | |
| 108 | /** |
| 109 | * @brief Returns a reference to the ScomService singleton |
| 110 | * |
| 111 | * @return Reference to the ScomService |
| 112 | */ |
| 113 | ScomService& getScomService(); |
| 114 | |
| 115 | /** |
| 116 | * @brief ScomService class |
| 117 | */ |
| 118 | class ScomService |
| 119 | { |
| 120 | public: |
| 121 | |
| 122 | /** |
| 123 | * @brief Construct ScomService |
| 124 | */ |
| 125 | ScomService(); |
| 126 | |
| 127 | /** |
| 128 | * @brief Destroys ScomService |
| 129 | */ |
| 130 | ~ScomService(); |
| 131 | |
| 132 | /** |
| 133 | * @brief set the scom accessor to be used |
| 134 | * |
| 135 | * @param[in] i_ScomAccessor new scom accessor |
| 136 | */ |
| 137 | void setScomAccessor(ScomAccessor & i_ScomAccessor); |
| 138 | |
| 139 | /** |
| 140 | Access the scan com register |
| 141 | @param i_target Target to access the register |
| 142 | @param BitString - holds data read or to write |
| 143 | @param register address |
| 144 | @param [READ|WRITE] |
| 145 | @returns [SUCCESS|FAIL] |
| 146 | @pre bs.Length() must be size of register data to read/write |
| 147 | @post For read operation, bs is modified to reflect hardware register state |
| 148 | @note |
| 149 | */ |
| 150 | virtual uint32_t Access(TARGETING::TargetHandle_t i_target, |
| 151 | BitString & bs, |
| 152 | uint64_t registerId, |
Zane Shelley | ea1a1ac | 2019-08-08 16:27:20 -0500 | [diff] [blame] | 153 | RegisterAccess::Operation operation) const; |
Zane Shelley | fd3f9cc | 2019-07-29 15:02:24 -0500 | [diff] [blame] | 154 | |
| 155 | private: |
| 156 | |
| 157 | // Disable copy constructor / assignment operator |
| 158 | ScomService(const ScomService& i_right); |
| 159 | ScomService& operator=(const ScomService& i_right); |
| 160 | |
| 161 | // Scom access to actual HW or Sim |
| 162 | ScomAccessor * iv_ScomAccessor; |
| 163 | }; |
| 164 | |
| 165 | } // End namespace PRDF |
| 166 | |
| 167 | #endif /* PRDFHOMREGISTERACCESS_H */ |