diff options
author | Stephen Glancy <sglancy@us.ibm.com> | 2018-09-04 10:57:35 -0500 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2018-09-19 17:21:05 -0500 |
commit | 4f8cfb6e9c07076261fac4b58105bd6863f6c13f (patch) | |
tree | bd3133e372feeedfd117aa16c23030cf190d0ca1 /src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H | |
parent | 8247477571339e0cba2d06d0701378e029628806 (diff) | |
download | talos-hostboot-4f8cfb6e9c07076261fac4b58105bd6863f6c13f.tar.gz talos-hostboot-4f8cfb6e9c07076261fac4b58105bd6863f6c13f.zip |
Moves sync code to generic folder
Change-Id: I440cdb0ea105a6dbdcd0ac26696308e55d56f88b
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65786
Dev-Ready: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66323
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H')
-rw-r--r-- | src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H | 209 |
1 files changed, 39 insertions, 170 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H b/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H index 4e46f0b1e..7a780c310 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H @@ -40,23 +40,21 @@ #include <fapi2.H> #include <lib/shared/mss_const.H> +#include <generic/memory/lib/utils/freq/mss_freq_scoreboard.H> +#include <generic/memory/lib/utils/c_str.H> namespace mss { -enum class speed_equality : uint8_t -{ - NOT_EQUAL_DIMM_SPEEDS = 0, ///< denotes all DIMMs don't have the same speed - EQUAL_DIMM_SPEEDS = 1, ///< denotes all DIMMs have the same speed -}; - -// DDR4 speed NIMBUS supports -static const std::vector<uint32_t> NIMBUS_SUPPORTED_FREQS = +// List of the nest frequencies for nimbus +// Note: these need to be sorted so binary search works +static const std::vector<uint64_t> NIMBUS_NEST_FREQS = { - fapi2::ENUM_ATTR_MSS_FREQ_MT1866, - fapi2::ENUM_ATTR_MSS_FREQ_MT2133, - fapi2::ENUM_ATTR_MSS_FREQ_MT2400, - fapi2::ENUM_ATTR_MSS_FREQ_MT2666, + fapi2::ENUM_ATTR_FREQ_PB_MHZ_1600, + fapi2::ENUM_ATTR_FREQ_PB_MHZ_1866, + fapi2::ENUM_ATTR_FREQ_PB_MHZ_2000, + fapi2::ENUM_ATTR_FREQ_PB_MHZ_2133, + fapi2::ENUM_ATTR_FREQ_PB_MHZ_2400 }; /// @@ -66,102 +64,13 @@ static const std::vector<uint32_t> NIMBUS_SUPPORTED_FREQS = /// inline bool is_nest_freq_valid (const uint64_t i_proposed_freq) { - std::vector<uint64_t> l_nest_freqs_supported = { fapi2::ENUM_ATTR_FREQ_PB_MHZ_1600, - fapi2::ENUM_ATTR_FREQ_PB_MHZ_1866, - fapi2::ENUM_ATTR_FREQ_PB_MHZ_2000, - fapi2::ENUM_ATTR_FREQ_PB_MHZ_2133, - fapi2::ENUM_ATTR_FREQ_PB_MHZ_2400 - }; - - std::sort(l_nest_freqs_supported.begin(), l_nest_freqs_supported.end()); - return ( std::binary_search(l_nest_freqs_supported.begin(), l_nest_freqs_supported.end(), i_proposed_freq) ); + return ( std::binary_search(NIMBUS_NEST_FREQS.begin(), NIMBUS_NEST_FREQS.end(), i_proposed_freq) ); } -/// -/// @class freq_scoreboard -/// @brief class that encapsulates MCA supported frequencies -/// -class freq_scoreboard +enum class speed_equality : uint8_t { - public: - /// - /// @brief Create a new frequency scoreboard - /// - freq_scoreboard() - { - iv_freq_mca_supported = std::vector<std::vector<bool>>(PORTS_PER_MCBIST, - std::vector<bool>(NIMBUS_SUPPORTED_FREQS.size(), true)); - } - - /// - /// @brief default destructor - /// - ~freq_scoreboard() = default; - - /// - /// @brief Remove frequencies above a limit from the scoreboard - /// @param[in] i_port_pos position index of port within parent MCBIST - /// @param[in] i_freq_limit upper limit for frequency - /// @return FAPI2_RC_SUCCESS if successful - /// - fapi2::ReturnCode remove_freqs_above_limit(const uint64_t i_port_pos, - const uint32_t i_freq_limit); - - /// - /// @brief Remove frequencies above a limit from the scoreboard - /// @param[in] i_port_pos position index of port within parent MCBIST - /// @param[in] i_freq_limits reference to vector of upper limits for frequency per port - /// @return FAPI2_RC_SUCCESS if successful - /// - fapi2::ReturnCode remove_freqs_above_limit(const uint64_t i_port_pos, - const std::vector<uint32_t> i_freq_limits); - - /// - /// @brief Remove frequencies not on a given list from the scoreboard - /// @param[in] i_port_pos position index of port within parent MCBIST - /// @param[in] i_freq_list vector of supported frequencies - /// @return FAPI2_RC_SUCCESS if successful - /// - fapi2::ReturnCode remove_freqs_not_on_list(const uint64_t i_port_pos, - const std::vector<uint32_t>& i_freq_list); - - /// - /// @brief Return the maximum supported frequency for a given port - /// @param[in] i_port_pos position index of port within parent MCBIST - /// @param[out] o_freq max supported frequency - /// @return FAPI2_RC_SUCCESS if successful - /// - fapi2::ReturnCode max_supported_freq(const uint64_t i_port_pos, - uint32_t& o_freq) const; - - /// - /// @brief Return a list of supported frequencies for a given port - /// @param[in] i_port_pos position index of port within parent MCBIST - /// @param[out] o_freq vector of supported frequencies - /// @return FAPI2_RC_SUCCESS if successful - /// - fapi2::ReturnCode supported_freqs(const uint64_t i_port_pos, - std::vector<uint32_t>& o_freqs) const; - - /// - /// @brief Resolve frequency scoreboard by deconfiguring any non-conforming ports - /// and return a list of the supported frequencies - /// @param[in] i_target MCBIST target - /// @param[in] i_req_sync_mode bool whether or not we're forced into sync mode - /// @param[in] i_vpd_supported_freqs vector of hardware supported freqs -- from VPD - /// @param[out] o_deconfigured vector of port positions that were deconfigured by this function - /// @param[out] o_freqs vector of frequencies supported by all ports - /// @return FAPI2_RC_SUCCESS if successful - /// - fapi2::ReturnCode resolve(const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, - const bool i_req_sync_mode, - const std::vector<std::vector<uint32_t>>& i_vpd_supported_freqs, - std::vector<uint8_t>& o_deconfigured, - std::vector<uint32_t>& o_freqs); - - private: - std::vector<std::vector<bool>> iv_freq_mca_supported; - + NOT_EQUAL_DIMM_SPEEDS = 0, ///< denotes all DIMMs don't have the same speed + EQUAL_DIMM_SPEEDS = 1, ///< denotes all DIMMs have the same speed }; /// @@ -204,76 +113,36 @@ fapi2::ReturnCode select_sync_mode(const std::map< fapi2::Target<fapi2::TARGET_T uint64_t& o_selected_freq); /// -/// @brief Create a vector of support freq based on VPD config -/// @param[in] i_target MCBIST target for which to get the DIMM configs -/// @param[out] reference to a 2 dimensional std::vector of supported VPD frequencies for each MCA -/// @return FAPI2_RC_SUCCESS iff ok -/// -fapi2::ReturnCode vpd_supported_freqs( const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, - std::vector<std::vector<uint32_t>>& o_vpd_supported_freqs); - -/// -/// @brief Retrieves max frequency each port supports due to DIMM SPD -/// @param[in] i_target the MCBIST target -/// @param[out] o_supported_freqs reference to vector of max SPD supported freq for each port -/// @return FAPI2_RC_SUCCESS iff okay -/// -fapi2::ReturnCode spd_supported_freq(const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, - std::vector<uint32_t>& o_supported_freqs); - -/// -/// @brief Create and sort a vector of supported MT/s (freq) -/// @param[in] i_target MCA target for which to get the DIMM configs -/// @param[out] o_freqs reference to a std::vector to put the sorted vector -/// @return FAPI2_RC_SUCCESS iff ok -/// @note Taken from VPD supported freqs. The result is sorted so such that the min -/// supported freq is std::vector<>.begin and the max is std::vector<>.end - 1. You can -/// search the resulting vector for valid frequencies as it is sorted. -/// -fapi2::ReturnCode supported_freqs(const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, - std::vector<uint32_t>& o_freqs); - -/// -/// @brief Update supported frequency scoreboard according to MRW/config limits -/// @param[in] i_target MCBIST target for which to get the DIMM configs -/// @param[in] i_max_mrw_freqs vector of max allowed freqs -/// @param[in,out] io_scoreboard scoreboard of MCA targets supporting each frequency -/// @return FAPI2_RC_SUCCESS iff ok -/// @note the attributes which drive this are read-only so they're hard to change when -/// testing. So this helper allows us to use the attributes for the main path but -/// have a path for testing -/// -fapi2::ReturnCode limit_freq_by_mrw(const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, - const std::vector<uint32_t>& i_max_mrw_freqs, - freq_scoreboard& io_scoreboard); - -/// -/// @brief Update supported frequency scoreboard according to VPD limits -/// @param[in] i_target MCBIST target for which to get the DIMM configs -/// @param[in] i_hw_freqs vector of hardware supported freqs -- from VPD -/// @param[in,out] io_scoreboard scoreboard of MCA targets supporting each frequency -/// @return FAPI2_RC_SUCCESS iff ok -/// @note the attributes which drive this are read-only so they're hard to change when -/// testing. So this helper allows us to use the attributes for the main path but -/// have a path for testing -/// -fapi2::ReturnCode limit_freq_by_vpd(const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, - const std::vector<std::vector<uint32_t>>& i_hw_freqs, - freq_scoreboard& io_scoreboard); - -/// -/// @brief Update supported frequency scoreboard according to SPD limits -/// @param[in] i_target MCBIST target for which to get the DIMM configs -/// @param[in] i_hw_freqs vector of hardware supported freqs -- from SPD -/// @param[in,out] io_scoreboard scoreboard of MCA targets supporting each frequency +/// @brief Update supported frequency scoreboard according to whether the processor is in sync mode or not +/// @param[in] i_target processor frequency domain +/// @param[in,out] io_scoreboard scoreboard of port targets supporting each frequency /// @return FAPI2_RC_SUCCESS iff ok /// @note the attributes which drive this are read-only so they're hard to change when /// testing. So this helper allows us to use the attributes for the main path but /// have a path for testing /// -fapi2::ReturnCode limit_freq_by_spd(const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, - const std::vector<uint32_t>& i_hw_freqs, - freq_scoreboard& io_scoreboard); +inline fapi2::ReturnCode limit_freq_by_processor(const fapi2::Target<fapi2::TARGET_TYPE_MCBIST>& i_target, + const bool i_sync_mode, + freq_scoreboard& io_scoreboard) +{ + // If we're not in sync mode, just exit + if(!i_sync_mode) + { + FAPI_INF("%s is not in sync mode, skipping the sync mode check", mss::c_str(i_target)); + return fapi2::FAPI2_RC_SUCCESS; + } + + // Loop through all potential ports + for(uint64_t l_port_pos = 0; l_port_pos < PORTS_PER_MCBIST; ++l_port_pos) + { + FAPI_TRY(io_scoreboard.remove_freqs_not_on_list(l_port_pos, NIMBUS_NEST_FREQS)); + } + + return fapi2::FAPI2_RC_SUCCESS; + +fapi_try_exit: + return fapi2::current_err; +} }// mss |