From 6110ede079a625bb29a64cd4a92c84ddb1c360ce Mon Sep 17 00:00:00 2001 From: "Andre A. Marin" Date: Tue, 10 Mar 2020 23:03:23 -0500 Subject: [PATCH] Add explorer rc response to eff_config Change-Id: I914585acdada326f191dbfb199dbdfac948b24b1 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/91480 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Tested-by: PPE CI Tested-by: Hostboot CI Reviewed-by: Louis Stermole Reviewed-by: Mark Pizzutillo Dev-Ready: ANDRE A MARIN Reviewed-by: Jennifer A Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/94045 Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Daniel M Crowell --- .../lib/eff_config/explorer_rc_resp_fields.H | 507 ++++++++++++++++++ 1 file changed, 507 insertions(+) diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/eff_config/explorer_rc_resp_fields.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/eff_config/explorer_rc_resp_fields.H index 253936aee51..c48e8d1ad7e 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/eff_config/explorer_rc_resp_fields.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/eff_config/explorer_rc_resp_fields.H @@ -22,3 +22,510 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ +#include +#include +#include + +namespace mss +{ +namespace exp +{ + +/// +/// @class rc_resp_adaptor +/// @brief Adaptor to plug into mss::gen::attr_engine::set(...) algorithm +/// +struct rc_resp_adaptor +{ + fapi2::Target iv_target; + user_response_rc_msdg_t iv_rc_resp; + + /// + /// @brief Construct a new rc resp adaptor object - default + /// + rc_resp_adaptor() = default; + + /// + /// @brief Construct a new rc resp adaptor object + /// @param[in] i_target the OCMB target associated with this rc response + /// @param[in] i_rc_resp the explorer rc resp structure + /// + rc_resp_adaptor(const fapi2::Target& i_target, + const user_response_rc_msdg_t& i_rc_resp) : iv_target(i_target), iv_rc_resp(i_rc_resp) {} + + /// + /// @brief default copy constructor + /// + rc_resp_adaptor(const rc_resp_adaptor&) = default; + + /// + /// @brief default assignment constructor + /// @return rc_resp_adaptor& + /// + rc_resp_adaptor& operator=(const rc_resp_adaptor&) = default; + + /// + /// @brief Destroy the rc resp adaptor object + /// + ~rc_resp_adaptor() = default; + + /// + /// @brief target getter + /// @return fapi2::Target by value + /// + fapi2::Target get_target() const + { + return iv_target; + } +}; + +} // namespace exp + +namespace gen +{ + +/// +/// @class get - TARGET_TYPE_MEM_PORT, rc_resp_adaptor specialization +/// @brief get target helper class for attr_engine +/// +template <> +struct get +{ + /// + /// @brief Get target for TARGET_TYPE_MEM_PORT and rc_resp_adaptor + /// + /// @param[in] i_data rc_resp_adaptor + /// @return fapi2::Target Attribute target type + /// + static fapi2::Target target(const exp::rc_resp_adaptor& i_data) + { + return mss::find_target(i_data.iv_target); + } +}; + +} // namespace gen + +namespace exp +{ + +enum rcw_max_val : uint8_t +{ + RCW_4BIT_MAX = 0x0F, + RCW_8BIT_MAX = 0xFF, +}; + +/// +/// @class rc_rsp_fields +/// @brief Explorer rc response fields +/// +struct rc_rsp_fields +{ + enum + { + // F0RC00 + F0RC00_IDX = 0x00, + F0RC00_START = 4, + F0RC00_LEN = 4, + + // F0RC01 + F0RC01_IDX = 0x01, + F0RC01_START = 4, + F0RC01_LEN = 4, + + // F0RC03 + F0RC03_IDX = 0x03, + F0RC03_START = 4, + F0RC03_LEN = 4, + + // F0RC04 + F0RC04_IDX = 0x04, + F0RC04_START = 4, + F0RC04_LEN = 4, + + // F0RC05 + F0RC05_IDX = 0x05, + F0RC05_START = 4, + F0RC05_LEN = 4, + + // F0RC0B + F0RC0B_IDX = 0x0B, + F0RC0B_START = 4, + F0RC0B_LEN = 4, + + // F0RC0E + F0RC0E_IDX = 0x0E, + F0RC0E_START = 4, + F0RC0E_LEN = 4, + + // F0RC0F + F0RC0F_IDX = 0x0F, + F0RC0F_START = 4, + F0RC0F_LEN = 4, + + // F0RC1X + F0RC1X_IDX = 0x10, + F0RC1X_START = 0, + F0RC1X_LEN = 8, + + // F0RC7X + F0RC7X_IDX = 0x17, + F0RC7X_START = 0, + F0RC7X_LEN = 8, + + // F1RC00 + F1RC00_IDX = 0x00, + F1RC00_START = 4, + F1RC00_LEN = 4, + + // F1RC02 + F1RC02_IDX = 0x01, + F1RC02_START = 4, + F1RC02_LEN = 4, + + // F1RC03 + F1RC03_IDX = 0x03, + F1RC03_START = 4, + F1RC03_LEN = 4, + + // F1RC04 + F1RC04_IDX = 0x04, + F1RC04_START = 4, + F1RC04_LEN = 4, + + // F1RC05 + F1RC05_IDX = 0x05, + F1RC05_START = 4, + F1RC05_LEN = 4, + }; + + // First value is byte index, then buffer extract start bit, and extract data length + static constexpr mss::field_t F0RC00{F0RC00_IDX, F0RC00_START, F0RC00_LEN}; + static constexpr mss::field_t F0RC01{F0RC01_IDX, F0RC01_START, F0RC01_LEN}; + static constexpr mss::field_t F0RC03{F0RC03_IDX, F0RC03_START, F0RC03_LEN}; + static constexpr mss::field_t F0RC04{F0RC04_IDX, F0RC04_START, F0RC04_LEN}; + static constexpr mss::field_t F0RC05{F0RC05_IDX, F0RC05_START, F0RC05_LEN}; + static constexpr mss::field_t F0RC0B{F0RC0B_IDX, F0RC0B_START, F0RC0B_LEN}; + static constexpr mss::field_t F0RC0E{F0RC0E_IDX, F0RC0E_START, F0RC0E_LEN}; + static constexpr mss::field_t F0RC0F{F0RC0F_IDX, F0RC0F_START, F0RC0F_LEN}; + static constexpr mss::field_t F0RC1X{F0RC1X_IDX, F0RC1X_START, F0RC1X_LEN}; + static constexpr mss::field_t F0RC7X{F0RC7X_IDX, F0RC7X_START, F0RC7X_LEN}; + static constexpr mss::field_t F1RC00{F1RC00_IDX, F1RC00_START, F1RC00_LEN}; + static constexpr mss::field_t F1RC02{F1RC02_IDX, F1RC02_START, F1RC02_LEN}; + static constexpr mss::field_t F1RC03{F1RC03_IDX, F1RC03_START, F1RC03_LEN}; + static constexpr mss::field_t F1RC04{F1RC04_IDX, F1RC04_START, F1RC04_LEN}; + static constexpr mss::field_t F1RC05{F1RC05_IDX, F1RC05_START, F1RC05_LEN}; +}; + +/// +/// @brief Helper function to retrieve the F0RC_D0 data +/// @param[in] i_rc_resp explorer RC response adapter +/// @param[out] o_output copy of response in vector form +/// @note DIMM0 data +/// +inline void get_data_F0RC_D0(const rc_resp_adaptor& i_rc_resp, + std::vector& o_output) +{ + o_output.assign(MAX_RCW_RESP_ARRAY_SIZE, 0); + std::copy(std::begin(i_rc_resp.iv_rc_resp.F0RC_D0), std::end(i_rc_resp.iv_rc_resp.F0RC_D0), std::begin(o_output)); +} + +/// +/// @brief Helper function to retrieve the F0RC_D1 data +/// @param[in] i_rc_resp explorer RC response adapter +/// @param[out] o_output copy of response in vector form +/// @note DIMM1 data +/// +inline void get_data_F0RC_D1(const rc_resp_adaptor& i_rc_resp, + std::vector& o_output) +{ + o_output.assign(MAX_RCW_RESP_ARRAY_SIZE, 0); + std::copy(std::begin(i_rc_resp.iv_rc_resp.F0RC_D1), std::end(i_rc_resp.iv_rc_resp.F0RC_D1), std::begin(o_output)); +} + +/// +/// @brief Helper function to retrieve the F1RC_D0 data +/// @param[in] i_rc_resp explorer RC response adapter +/// @param[out] o_output copy of response in vector form +/// @note DIMM0 data +/// +inline void get_data_F1RC_D0(const rc_resp_adaptor& i_rc_resp, + std::vector& o_output) +{ + o_output.assign(MAX_RCW_RESP_ARRAY_SIZE, 0); + std::copy(std::begin(i_rc_resp.iv_rc_resp.F1RC_D0), std::end(i_rc_resp.iv_rc_resp.F1RC_D0), std::begin(o_output)); +} + +/// +/// @brief Helper function to retrieve the F1RC_D1 data +/// @param[in] i_rc_resp explorer RC response adapter +/// @param[out] o_output copy of response in vector form +/// @note DIMM1 data +/// +inline void get_data_F1RC_D1(const rc_resp_adaptor& i_rc_resp, + std::vector& o_output) +{ + o_output.assign(MAX_RCW_RESP_ARRAY_SIZE, 0); + std::copy(std::begin(i_rc_resp.iv_rc_resp.F1RC_D1), std::end(i_rc_resp.iv_rc_resp.F1RC_D1), std::begin(o_output)); +} + +/// +/// @class readerTraits +/// @brief trait structure to hold static SPD information +/// @tparam F holds RCW field info +/// +template &F> +class readerTraits; + +/// +/// @brief RCW reader +/// @tparam F the SPD field to read +/// @tparam OT data output type +/// @tparam TT traits associated with reader, defaulted to readerTraits +/// @param[in] i_target the fapi2 target +/// @param[in] i_data the SPD data +/// @param[out] o_value raw value for this SPD field +/// @return FAPI2_RC_SUCCESS iff okay +/// @warning reader for F0RC_D0 and F0RC_D1 (DIMM0 vs DIMM1) are equivalent. +/// Will need to be updated if the array from the RC response structure varies. +/// +template &F, + typename OT, + typename TT = readerTraits> +fapi2::ReturnCode reader(const fapi2::Target& i_target, + const std::vector& i_data, + OT& o_value) +{ + FAPI_TRY((mss::get_field(i_target, i_data, READ_RC_RSP_FIELD, o_value)), + "Failed read_field() for %s", spd::c_str(i_target)); + +fapi_try_exit: + return fapi2::current_err; +} + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC00 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Global Features Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC01 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Clock Driver Enable Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC03 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "CA and CS Signals Driver Characteristics Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC04 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "ODT and CKE Signals Driver Characteristics Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC05 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Clock Driver Characteristics Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC0B field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Operating Voltage VDD and VREFCA Source Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC0E field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Parity, NV Mode Enable, and ALERT Configuration Control Word "; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC0F field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Command Latency Adder Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC1X field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_8BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Internal VrefCA Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F0RC7X field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_8BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "IBT Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F1RC00 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Data Buffer Interface Driver Characteristics Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F1RC02 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "CA and CS Output Slew Rate Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F1RC03 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "ODT and CKEn Output Slew Rate Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F1RC04 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Clock Driver Output Slew Rate Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +/// +/// @class readerTraits +/// @brief trait structure to hold static explorer RC response information +/// @note F1RC05 field specialization +/// +template <> +struct readerTraits +{ + static constexpr size_t COMPARISON_VAL = RCW_4BIT_MAX; ///< Largest valid explorer RC resp encoding + static constexpr const char* FIELD_STR = "Data Buffer Interface Output Slew Rate Control Word"; + + template + using COMPARISON_OP = std::less_equal; +}; + +} // namespace exp +} // namespace mss