Skip to content

Commit

Permalink
Added I2C fields, EXP_FW_STATUS API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aamarin authored and crgeddes committed Aug 21, 2018
1 parent 8d1d1f2 commit 971d57b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
3 changes: 2 additions & 1 deletion src/import/generic/memory/lib/utils/c_str.H
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
53 changes: 35 additions & 18 deletions src/import/generic/memory/lib/utils/mss_field.H
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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),
Expand All @@ -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();

Expand All @@ -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),
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down
6 changes: 4 additions & 2 deletions src/import/generic/memory/lib/utils/mss_generic_check.H
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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;

Expand Down

0 comments on commit 971d57b

Please sign in to comment.