summaryrefslogtreecommitdiffstats
path: root/src/import/generic/memory/lib/utils/mc
diff options
context:
space:
mode:
authorAlvin Wang <wangat@tw.ibm.com>2019-03-14 10:25:31 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-04-22 11:18:12 -0500
commit3c3ab2bd4c3cbee67eb518bcce214234d8f071f3 (patch)
tree6bf46537fd7357489516b93fdcc3d699248818be /src/import/generic/memory/lib/utils/mc
parente4956ca54c226efdda7639decb8f06a92e586825 (diff)
downloadtalos-hostboot-3c3ab2bd4c3cbee67eb518bcce214234d8f071f3.tar.gz
talos-hostboot-3c3ab2bd4c3cbee67eb518bcce214234d8f071f3.zip
Move MCBIST lib to generic folder
Change-Id: Ib717742707bea6a626131578f5a3b1aeebc76281 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/69677 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Dev-Ready: STEPHEN GLANCY <sglancy@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+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/69707 Reviewed-by: Zane C. Shelley <zshelle@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Tested-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/generic/memory/lib/utils/mc')
-rw-r--r--src/import/generic/memory/lib/utils/mc/gen_mss_port.H112
1 files changed, 111 insertions, 1 deletions
diff --git a/src/import/generic/memory/lib/utils/mc/gen_mss_port.H b/src/import/generic/memory/lib/utils/mc/gen_mss_port.H
index e44601ac2..f5e822f8f 100644
--- a/src/import/generic/memory/lib/utils/mc/gen_mss_port.H
+++ b/src/import/generic/memory/lib/utils/mc/gen_mss_port.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2018 */
+/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -412,6 +412,116 @@ fapi_try_exit:
return fapi2::current_err;
}
+///
+/// @brief Configures the write reorder queue bit
+/// @tparam MC the memory controller type
+/// @tparam T, the mc
+/// @tparam TT, the class traits for the port
+/// @param[in] i_target the target to effect
+/// @param[in] i_state to set the bit too
+/// @return FAPI2_RC_SUCCSS iff ok
+///
+template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T, typename TT = portTraits<MC> >
+inline fapi2::ReturnCode configure_wrq(const fapi2::Target<T>& i_target,
+ const mss::states i_state)
+{
+ // Loops through all port targets, hitting all the registers
+ for( const auto& l_port : mss::find_targets<TT::PORT_TYPE>(i_target) )
+ {
+ fapi2::buffer<uint64_t> l_data;
+
+ // Gets the reg
+ FAPI_TRY(mss::getScom(l_port, TT::WRQ_REG, l_data), "%s failed to getScom from WRQ0Q", mss::c_str(l_port));
+
+ // Sets the bit
+ l_data.writeBit<TT::WRQ_FIFO_MODE>(i_state == mss::states::ON);
+
+ // Sets the regs
+ FAPI_TRY(mss::putScom(l_port, TT::WRQ_REG, l_data), "%s failed to putScom to WRQ0Q", mss::c_str(l_port));
+ }
+
+ // In case we don't have any port's
+ return fapi2::FAPI2_RC_SUCCESS;
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Configures the read reorder queue bit
+/// @tparam MC the memory controller type
+/// @tparam T, the mc
+/// @tparam TT, the class traits for the port
+/// @param[in] i_target the target to effect
+/// @param[in] i_state to set the bit too
+/// @return FAPI2_RC_SUCCSS iff ok
+///
+template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T, typename TT = portTraits<MC> >
+inline fapi2::ReturnCode configure_rrq(const fapi2::Target<T>& i_target, const mss::states i_state)
+{
+ // Loops through all port targets, hitting all the registers
+ for( const auto& l_port : mss::find_targets<TT::PORT_TYPE>(i_target) )
+ {
+ fapi2::buffer<uint64_t> l_data;
+
+ // Gets the reg
+ FAPI_TRY(mss::getScom(l_port, TT::RRQ_REG, l_data), "%s failed to getScom from RRQ0Q", mss::c_str(l_port));
+
+ // Sets the bit
+ l_data.writeBit<TT::RRQ_FIFO_MODE>(i_state == mss::states::ON);
+
+ // Sets the regs
+ FAPI_TRY(mss::putScom(l_port, TT::RRQ_REG, l_data), "%s failed to putScom to RRQ0Q", mss::c_str(l_port));
+ }
+
+ // In case we don't have any port's
+ return fapi2::FAPI2_RC_SUCCESS;
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+
+/// @brief Get the attributes for the reorder queue setting
+/// @tparam MC the memory controller type
+/// @tparam T, the mc
+/// @param[in] const ref to the mc target
+/// @param[out] uint8_t& reference to store the value
+/// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK
+/// @note Contains the settings for write/read reorder queue
+///
+template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T >
+inline fapi2::ReturnCode reorder_queue_setting(const fapi2::Target<T>& i_target, uint8_t& o_value);
+
+///
+/// @brief Resets the write/read reorder queue values - needs to be called after MCBIST execution
+/// @tparam MC the memory controller type
+/// @tparam T, the mc
+/// @tparam TT, the class traits for the port
+/// @param[in] i_target the target to effect
+/// @return FAPI2_RC_SUCCSS iff ok
+///
+template< mss::mc_type MC = DEFAULT_MC_TYPE, fapi2::TargetType T, typename TT = portTraits<MC> >
+inline fapi2::ReturnCode reset_reorder_queue_settings(const fapi2::Target<T>& i_target)
+{
+ uint8_t l_reorder_queue = 0;
+ FAPI_TRY(reorder_queue_setting<MC>(i_target, l_reorder_queue));
+
+ // Changes the reorder queue settings
+ {
+ // Two settings are FIFO and REORDER. FIFO is a 1 in the registers, while reorder is a 0 state
+ const mss::states l_state = ((l_reorder_queue == fapi2::ENUM_ATTR_MSS_REORDER_QUEUE_SETTING_FIFO) ?
+ mss::states::ON : mss::states::OFF);
+ FAPI_TRY(configure_rrq(i_target, l_state), "%s failed to reset read reorder queue settings", mss::c_str(i_target));
+ FAPI_TRY(configure_wrq(i_target, l_state), "%s failed to reset read reorder queue settings", mss::c_str(i_target));
+ }
+
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+
}// ns mss
#endif
OpenPOWER on IntegriCloud