diff options
author | Stephen Glancy <sglancy@us.ibm.com> | 2019-05-23 13:08:29 -0400 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2019-06-11 08:48:44 -0500 |
commit | 8a6b5a50b388558237b79ec39ef23fb5f34c4899 (patch) | |
tree | e40ca178c8ac40ba03ea99666719832e33988570 /src/import/generic/memory/lib/utils/find.H | |
parent | 0f0d13a5bb80bf3fd61aa63176ac46a6703e7beb (diff) | |
download | talos-hostboot-8a6b5a50b388558237b79ec39ef23fb5f34c4899.tar.gz talos-hostboot-8a6b5a50b388558237b79ec39ef23fb5f34c4899.zip |
Adds EFD decode updates for 07MAY19 spec updates
Change-Id: Ia1727ad2987b8e82c1a21fffe3fadcb24c48e457
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77813
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Mark Pizzutillo <mark.pizzutillo@ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/78020
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/generic/memory/lib/utils/find.H')
-rw-r--r-- | src/import/generic/memory/lib/utils/find.H | 36 |
1 files changed, 36 insertions, 0 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 |