Skip to content

Commit

Permalink
add function to turn on adaptation in bootconfig
Browse files Browse the repository at this point in the history
Change-Id: Ia5602d413250f1fbbb23d50b113f245526e3bf54
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/84744
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
Dev-Ready: Devon A Baughen <devon.baughen1@ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/84891
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: Christian R Geddes <crgeddes@us.ibm.com>
  • Loading branch information
devonbaughen authored and crgeddes committed Oct 14, 2019
1 parent e3407c1 commit df80bf4
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Expand Up @@ -65,6 +65,7 @@ struct fields
static constexpr mss::field_t<mss::endian::BIG> DFE_DISABLE{0, 0, 1};
static constexpr mss::field_t<mss::endian::BIG> LANE_MODE{0, 1, 3};
static constexpr mss::field_t<mss::endian::BIG> SERDES_FREQ{0, 4, 4};
static constexpr mss::field_t<mss::endian::BIG> ADAPTATION_MODE{1, 0, 1};
static constexpr mss::field_t<mss::endian::BIG> FW_MODE{1, 1, 2};
static constexpr mss::field_t<mss::endian::BIG> LOOPBACK_TEST{1, 3, 1};
static constexpr mss::field_t<mss::endian::BIG> TRANSPORT_LAYER{1, 4, 2};
Expand Down Expand Up @@ -182,6 +183,20 @@ struct fieldTraits<fields::FW_MODE>
using COMPARISON_OP = std::less_equal<T>;
};

///
/// @class fieldTraits - ADAPTATION_MODE specialization
/// @brief Traits assoiated with the Explorer I2C commands
///
template <>
struct fieldTraits<fields::ADAPTATION_MODE>
{
static constexpr uint8_t COMPARISON_VAL = 0x01;
static constexpr const char* FIELD_STR = "Adaptation Mode";

template <typename T>
using COMPARISON_OP = std::less_equal<T>;
};

///
/// @class fieldTraits - CMD_ID specialization
/// @brief Traits assoiated with the Explorer I2C commands
Expand Down Expand Up @@ -380,6 +395,33 @@ inline fapi2::ReturnCode set_dl_layer_boot_mode(const fapi2::Target<fapi2::TARGE
return set_field<fields::DL_LAYER_BOOT_MODE>(i_target, io_data, i_setting);
}

/// @brief ADAPTATION_MODE getter
/// @param[in] i_target the OCMB target
/// @param[in] i_data the buffer as a reference to a vector
/// @param[out] o_setting
/// @return FAPI2_RC_SUCCESS iff okay
///
inline fapi2::ReturnCode get_adaptation_mode(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
const std::vector<uint8_t>& i_data,
uint8_t& o_setting)
{
return get_field<fields::ADAPTATION_MODE>(i_target, i_data, o_setting);
}

///
/// @brief ADAPTATION_MODE setter
/// @param[in] i_target the OCMB target
/// @param[in,out] io_data the buffer as a reference to a vector
/// @param[in] i_setting the value to set
/// @return FAPI2_RC_SUCCESS iff okay
///
inline fapi2::ReturnCode set_adaptation_mode(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
std::vector<uint8_t>& io_data,
const uint8_t i_setting)
{
return set_field<fields::ADAPTATION_MODE>(i_target, io_data, i_setting);
}

///
/// @brief DL_LAYER_BOOT_MODE getter
/// @param[in] i_target the OCMB target
Expand Down
Expand Up @@ -102,11 +102,14 @@ fapi2::ReturnCode setup_fw_boot_config( const fapi2::Target<fapi2::TARGET_TYPE_O
uint8_t l_dl_layer_boot_mode = 0;
uint8_t l_dfe_disable = 0;
uint8_t l_lane_mode = 0;
uint8_t l_adaptation_mode = 0;
uint32_t l_omi_freq = 0;

const auto& l_proc = mss::find_target<fapi2::TARGET_TYPE_PROC_CHIP>(i_target);

// Read the EXP_FW_BOOT_CONFIG from the attributes
FAPI_TRY(mss::attr::get_ocmb_exp_boot_config_adaptation_mode(i_target, l_adaptation_mode));

FAPI_TRY(mss::attr::get_ocmb_exp_boot_config_fw_mode(i_target, l_fw_mode));

FAPI_TRY(mss::attr::get_ocmb_exp_boot_config_opencapi_loopback_test(i_target, l_loopback_test));
Expand All @@ -133,6 +136,7 @@ fapi2::ReturnCode setup_fw_boot_config( const fapi2::Target<fapi2::TARGET_TYPE_O
FAPI_TRY(mss::exp::i2c::boot_cfg::set_transport_layer( i_target, o_data, l_transport_layer ));
FAPI_TRY(mss::exp::i2c::boot_cfg::set_loopback_test( i_target, o_data, l_loopback_test ));
FAPI_TRY(mss::exp::i2c::boot_cfg::set_fw_mode( i_target, o_data, l_fw_mode ));
FAPI_TRY(mss::exp::i2c::boot_cfg::set_adaptation_mode( i_target, o_data, l_adaptation_mode ));

fapi_try_exit:
return fapi2::current_err;
Expand Down
Expand Up @@ -156,4 +156,19 @@
<mssAccessorName>ocmb_exp_boot_config_serdes_frequency</mssAccessorName>
</attribute>

<attribute>
<id>ATTR_MSS_OCMB_EXP_BOOT_CONFIG_ADAPTATION_MODE</id>
<targetType>TARGET_TYPE_OCMB_CHIP</targetType>
<description>
Indicates whether to enable adaptation
</description>
<valueType>uint8</valueType>
<enum>
DISABLE = 0,
ENABLE = 1
</enum>
<default>ENABLE</default>
<platInit/>
<mssAccessorName>ocmb_exp_boot_config_adaptation_mode</mssAccessorName>
</attribute>
</attributes>

0 comments on commit df80bf4

Please sign in to comment.