/* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ /* $Source: src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/dimm/exp_rank.H $ */ /* */ /* OpenPOWER HostBoot Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ /* You may obtain a copy of the License at */ /* */ /* http://www.apache.org/licenses/LICENSE-2.0 */ /* */ /* Unless required by applicable law or agreed to in writing, software */ /* distributed under the License is distributed on an "AS IS" BASIS, */ /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ /* implied. See the License for the specific language governing */ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ /// /// @file exp_rank.H /// @brief Explorer rank definitions /// // *HWP HWP Owner: Andre Marin // *HWP HWP Backup: Stephen Glancy // *HWP Team: Memory // *HWP Level: 2 // *HWP Consumed by: FSP:HB #ifndef _MSS_EXP_RANK_H_ #define _MSS_EXP_RANK_H_ #include #include namespace mss { namespace rank { /// /// @brief Rank traits for explorer /// template <> class rankTraits { public: static constexpr uint8_t MAX_DIMMS_PER_PORT = 2; static constexpr uint8_t MAX_RANKS_PER_DIMM = 4; static constexpr uint8_t RANK_INDEX_STEP = 4; // Note! a configuration of 2 4-rank dimms is not possible. // In this hypothetical scenario, the value for phy-rank would not // be valid / does not apply, as there will be some rollover. static constexpr uint8_t PHY_RANK_INDEX_STEP = 2; }; /// /// @brief Return a vector of rank numbers which represent the primary rank pairs for this port /// @param[in] i_target port target on which to operate /// @param[out] o_ranks a vector of ranks /// @return FAPI@_RC_SUCCESS iff all is ok inline fapi2::ReturnCode primary_ranks( const fapi2::Target& i_target, std::vector< uint64_t >& o_rps ) { o_rps.clear(); std::vector> l_rank_info_vect; FAPI_TRY(mss::rank::ranks_on_port(i_target, l_rank_info_vect)); // Loop through and assemble the ranks for(const auto& l_rank_info : l_rank_info_vect) { o_rps.push_back(l_rank_info.get_port_rank()); } fapi_try_exit: return fapi2::current_err; } /// /// @brief Return a vector of rank numbers which represent the primary rank pairs for this dimm /// @param[in] i_target DIMM target on which to operate /// @param[out] o_ranks a vector of ranks /// @return FAPI@_RC_SUCCESS iff all is ok inline fapi2::ReturnCode primary_ranks( const fapi2::Target& i_target, std::vector< uint64_t >& o_rps ) { o_rps.clear(); std::vector> l_rank_info_vect; FAPI_TRY(mss::rank::ranks_on_dimm(i_target, l_rank_info_vect)); // Loop through and assemble the ranks for(const auto& l_rank_info : l_rank_info_vect) { o_rps.push_back(l_rank_info.get_port_rank()); } fapi_try_exit: return fapi2::current_err; } /// /// @brief Return the *port relative position* of the DIMM which posesses this rank /// @param[in] i_rank the rank number. /// @return the relative position of the DIMM which contains this rank. inline size_t get_dimm_from_rank(const uint64_t i_rank) { using TT = rankTraits; return i_rank / TT::MAX_RANKS_PER_DIMM; } } // namespace rank } // namespace mss #endif