diff options
Diffstat (limited to 'src/import/generic/memory/lib/utils')
-rw-r--r-- | src/import/generic/memory/lib/utils/find.H | 36 | ||||
-rw-r--r-- | src/import/generic/memory/lib/utils/shared/mss_generic_consts.H | 10 |
2 files changed, 44 insertions, 2 deletions
diff --git a/src/import/generic/memory/lib/utils/find.H b/src/import/generic/memory/lib/utils/find.H index bfae8a1c5..ee2a5b8c1 100644 --- a/src/import/generic/memory/lib/utils/find.H +++ b/src/import/generic/memory/lib/utils/find.H @@ -38,6 +38,8 @@ #include <fapi2.H> #include <vector> +#include <generic/memory/lib/utils/c_str.H> +#include <generic/memory/lib/utils/shared/mss_generic_consts.H> namespace mss { @@ -460,6 +462,40 @@ bool find_value_from_key( const std::pair<T, OT> (&i_array)[N], return false; } +/// +/// @brief Mapping boilerplate check +/// @tparam T FAPI2 target type +/// @tparam IT map key type +/// @tparam OT map value type +/// @param[in] i_target the FAPI target +/// @param[in] i_map SPD to attribute data mapping +/// @param[in] i_ffdc_code FFDC function code +/// @param[in] i_key Key to query map +/// @param[out] o_output value from key +/// @return FAPI2_RC_SUCCESS iff okay +/// +template< fapi2::TargetType T, typename IT, typename OT > +inline fapi2::ReturnCode lookup_table_check(const fapi2::Target<T>& i_target, + const std::vector<std::pair<IT, OT>>& i_map, + const generic_ffdc_codes i_ffdc_code, + const IT i_key, + OT& o_output) +{ + const bool l_is_val_found = mss::find_value_from_key(i_map, i_key, o_output); + + FAPI_ASSERT( l_is_val_found, + fapi2::MSS_LOOKUP_FAILED() + .set_KEY(i_key) + .set_DATA(o_output) + .set_FUNCTION(i_ffdc_code) + .set_TARGET(i_target), + "Failed to find a mapped value for %d on %s", + i_key, + mss::spd::c_str(i_target) ); +fapi_try_exit: + return fapi2::current_err; +} + }// mss #endif diff --git a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H index 0599a01c7..b77cbcd47 100644 --- a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H +++ b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H @@ -215,11 +215,17 @@ enum generic_ffdc_codes SET_PRIM_BUS_WIDTH = 0x1069, SET_PRIM_DIE_COUNT = 0x1070, SET_DRAM_DENSITY = 0x1071, + SET_SI_RD_VREF_DQ = 0x1075, + SET_CAC_DELAY_A = 0x1076, + SET_CAC_DELAY_B = 0x1077, + EFD_CA_LATENCY_MODE = 0x1080, + EFD_CA_PL_MODE = 0x1081, + // Power thermal functions POWER_LIMIT = 0x1072, - SLOPE = 1073, - INTERCEPT = 1074, + SLOPE = 0x1073, + INTERCEPT = 0x1074, }; /// |