diff options
author | Andre Marin <aamarin@us.ibm.com> | 2018-08-09 16:04:51 -0500 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2018-08-21 10:32:08 -0500 |
commit | 971d57b0cfd81fd1ee68cbf82d08b0db53f17d19 (patch) | |
tree | 5afb461ec6d360897390a06c5d4a10df1b0a70e8 /src/import/generic | |
parent | 8d1d1f24074936fc90dff0e44f932d3ef8d20f32 (diff) | |
download | talos-hostboot-971d57b0cfd81fd1ee68cbf82d08b0db53f17d19.tar.gz talos-hostboot-971d57b0cfd81fd1ee68cbf82d08b0db53f17d19.zip |
Added I2C fields, EXP_FW_STATUS API
Change-Id: I827ea3219f60ebcf9951db1ab0feb3421858767f
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/63578
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64671
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/generic')
-rw-r--r-- | src/import/generic/memory/lib/utils/c_str.H | 3 | ||||
-rw-r--r-- | src/import/generic/memory/lib/utils/mss_field.H | 53 | ||||
-rw-r--r-- | src/import/generic/memory/lib/utils/mss_generic_check.H | 6 |
3 files changed, 41 insertions, 21 deletions
diff --git a/src/import/generic/memory/lib/utils/c_str.H b/src/import/generic/memory/lib/utils/c_str.H index 834875f7c..ee1c044c2 100644 --- a/src/import/generic/memory/lib/utils/c_str.H +++ b/src/import/generic/memory/lib/utils/c_str.H @@ -137,7 +137,8 @@ namespace spd /// @param[in] i_target - target you want the name for /// @return const char * /// -inline const char* c_str( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target ) +template < fapi2::TargetType T > +inline const char* c_str( const fapi2::Target<T>& i_target ) { fapi2::toString( i_target, c_str_storage, fapi2::MAX_ECMD_STRING_LEN ); return c_str_storage; diff --git a/src/import/generic/memory/lib/utils/mss_field.H b/src/import/generic/memory/lib/utils/mss_field.H index 54d170cd4..b4bfcc446 100644 --- a/src/import/generic/memory/lib/utils/mss_field.H +++ b/src/import/generic/memory/lib/utils/mss_field.H @@ -130,17 +130,24 @@ bool conditional(const T i_field, /// @brief Helper function to extract byte information /// @tparam F the field to extract /// @tparam T the fapi2 target type +/// @tparam IT data input type +/// @tparam OT data output type +/// @tparam FFDC ffdc code type /// @param[in] i_target the fapi2 target /// @param[in] i_data the data /// @param[in] i_ffdc_codes FFDC code /// @param[out] o_value raw value for this field /// @return FAPI2_RC_SUCCESS iff okay /// -template< const field_t& F, fapi2::TargetType T > +template< const field_t& F, + fapi2::TargetType T, + typename IT, + typename OT, + typename FFDC > fapi2::ReturnCode get_field(const fapi2::Target<T>& i_target, - const std::vector<uint8_t>& i_data, - const generic_ffdc_codes i_ffdc_codes, - uint8_t& o_value) + const std::vector<IT>& i_data, + const FFDC i_ffdc_codes, + OT& o_value) { constexpr size_t BYTE = F.get_byte(); @@ -157,8 +164,8 @@ fapi2::ReturnCode get_field(const fapi2::Target<T>& i_target, { // Extracting desired bits - const fapi2::buffer<uint8_t> l_buffer(i_data[BYTE]); - l_buffer.extractToRight<F.get_start(), F.get_length()>(o_value); + const fapi2::buffer<OT> l_buffer(i_data[BYTE]); + l_buffer.template extractToRight<F.get_start(), F.get_length()>(o_value); FAPI_DBG("%s data[%d] = 0x%02x. Field with start bit %d, bit len %d, has data 0x%02x.", spd::c_str(i_target), @@ -179,17 +186,24 @@ fapi_try_exit: /// @brief Helper function to set byte field information /// @tparam F the field to extract /// @tparam T the fapi2 target type +/// @tparam IT data input type +/// @tparam OT data output type +/// @tparam FFDC ffdc code type /// @param[in] i_target the fapi2 target /// @param[in] i_setting the setting to set /// @param[in] i_ffdc_codes FFDC code /// @param[in,out] io_data the data to modify /// @return FAPI2_RC_SUCCESS iff okay /// -template< const field_t& F, fapi2::TargetType T > +template< const field_t& F, + fapi2::TargetType T, + typename IT, + typename OT, + typename FFDC > fapi2::ReturnCode set_field(const fapi2::Target<T>& i_target, - const size_t i_setting, - const generic_ffdc_codes i_ffdc_codes, - std::vector<uint8_t>& io_data) + const IT i_setting, + const FFDC i_ffdc_codes, + std::vector<OT>& io_data) { constexpr size_t BYTE = F.get_byte(); @@ -206,10 +220,10 @@ fapi2::ReturnCode set_field(const fapi2::Target<T>& i_target, { // Insert desired setting - fapi2::buffer<uint8_t> l_buffer(io_data[BYTE]); - l_buffer.insertFromRight<F.get_start(), F.get_length()>(i_setting); + fapi2::buffer<OT> l_buffer(io_data[BYTE]); + l_buffer.template insertFromRight<F.get_start(), F.get_length()>(i_setting); - io_data[BYTE] = static_cast<uint8_t>(l_buffer); + io_data[BYTE] = static_cast<OT>(l_buffer); FAPI_DBG("%s data[%d] = 0x%02x. Field with start bit %d, bit len %d, has data 0x%02x.", spd::c_str(i_target), @@ -243,10 +257,11 @@ template< const field_t& F, typename TT, fapi2::TargetType T, typename IT, - typename OT > + typename OT, + typename FFDC > inline fapi2::ReturnCode get_field( const fapi2::Target<T>& i_target, const std::vector<IT>& i_data, - const generic_ffdc_codes i_ffdc_codes, + const FFDC i_ffdc_codes, OT& o_value ) { IT l_temp = 0; @@ -291,6 +306,7 @@ fapi_try_exit: /// @tparam T the fapi2 target type /// @tparam IT data input type /// @tparam OT data output type +/// @tparam FFDC ffdc code type /// @param[in] i_target the dimm target /// @param[in] i_setting value to set for field /// @param[in] i_ffdc_codes FFDC code @@ -301,10 +317,11 @@ template< const field_t& F, typename TT, fapi2::TargetType T, typename IT, - typename OT > + typename OT, + typename FFDC > fapi2::ReturnCode set_field( const fapi2::Target<T>& i_target, - const size_t i_setting, - const generic_ffdc_codes i_ffdc_codes, + const IT i_setting, + const FFDC i_ffdc_codes, std::vector<OT>& io_data ) { constexpr size_t BYTE = F.get_byte(); diff --git a/src/import/generic/memory/lib/utils/mss_generic_check.H b/src/import/generic/memory/lib/utils/mss_generic_check.H index ea18664ec..f10f4d79a 100644 --- a/src/import/generic/memory/lib/utils/mss_generic_check.H +++ b/src/import/generic/memory/lib/utils/mss_generic_check.H @@ -49,6 +49,7 @@ namespace check /// @brief Checks conditional passes and implements traces & exits if it fails /// @tparam T fapi2 target type /// @tparam IT input data type +/// @tparam FFDC error callout code type /// @param[in] i_target fapi2 target /// @param[in] i_conditional conditional that we are testing against /// @param[in] i_byte_index byte index @@ -57,12 +58,12 @@ namespace check /// @param[in] i_err_str error string - defaulted to "" /// @return FAPI2_RC_SUCCESS iff okay /// -template< fapi2::TargetType T, typename IT > +template< fapi2::TargetType T, typename IT , typename FFDC > inline fapi2::ReturnCode invalid_value(const fapi2::Target<T>& i_target, const bool i_conditional, const size_t i_byte_index, const IT i_data, - const generic_ffdc_codes i_ffdc_codes, + const FFDC i_ffdc_codes, const char* i_err_str = "") { FAPI_ASSERT(i_conditional, @@ -78,6 +79,7 @@ inline fapi2::ReturnCode invalid_value(const fapi2::Target<T>& i_target, i_data); return fapi2::FAPI2_RC_SUCCESS; + fapi_try_exit: return fapi2::current_err; |