From f749a664891ad165ebbbbf608b708b4662014d85 Mon Sep 17 00:00:00 2001 From: Andre Marin Date: Tue, 13 Dec 2016 23:37:58 -0600 Subject: [PATCH] Add FORCE_FIFO_CAPTURE API and UTs. scominit cleanup. Change-Id: I26fe63dee8e16a331131d1db359909b2d57a506a Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33817 Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Brian R. Silver Reviewed-by: JACOB L. HARVEY Reviewed-by: Louis Stermole Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33821 Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- .../p9/procedures/hwp/memory/lib/phy/dp16.C | 35 ++++++++++++++++++- .../p9/procedures/hwp/memory/lib/phy/dp16.H | 18 +++++++++- .../p9/procedures/hwp/memory/lib/utils/scom.H | 8 ++--- 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.C b/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.C index a119a2ffeff..fab3712cd6d 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.C +++ b/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -2435,5 +2435,38 @@ fapi_try_exit: return fapi2::current_err; } +/// +/// @brief Write FORCE_FIFO_CAPTURE +/// Force DQ capture in Read FIFO to support DDR4 LRDIMM calibration +/// @param[in] i_target the fapi2 target of the port +/// @param[in] i_state mss::states::ON or mss::states::OFF +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template<> +fapi2::ReturnCode write_force_fifo_capture( const fapi2::Target& i_target, + const mss::states i_state) +{ + // TK - Some functions have vector as part of the trait class + // while others have within the function - AAM + static const std::vector< uint64_t > l_addr + { + MCA_DDRPHY_DP16_RD_DIA_CONFIG5_P0_0, + MCA_DDRPHY_DP16_RD_DIA_CONFIG5_P0_1, + MCA_DDRPHY_DP16_RD_DIA_CONFIG5_P0_2, + MCA_DDRPHY_DP16_RD_DIA_CONFIG5_P0_3, + MCA_DDRPHY_DP16_RD_DIA_CONFIG5_P0_4, + }; + + typedef dp16Traits TT; + fapi2::buffer l_data; + + l_data.writeBit(i_state); + + FAPI_TRY( mss::scom_blastah(i_target, l_addr, l_data) ); + +fapi_try_exit: + return fapi2::current_err; +} + } // close namespace dp16 } // close namespace mss diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.H b/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.H index 49ec12b5567..9fb1b1ae30b 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/phy/dp16.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -305,6 +305,9 @@ class dp16Traits READ_OFFSET_LOWER_LEN = MCA_DDRPHY_DP16_READ_DELAY_OFFSET0_RANK_PAIR0_P0_0_01_LEN, READ_OFFSET_UPPER = MCA_DDRPHY_DP16_READ_DELAY_OFFSET0_RANK_PAIR0_P0_0_01_OFFSET1, READ_OFFSET_UPPER_LEN = MCA_DDRPHY_DP16_READ_DELAY_OFFSET0_RANK_PAIR0_P0_0_01_OFFSET1_LEN, + + // Read Diagnostic Config 5 (same bit for all MCAs) + FORCE_FIFO_CAPTURE = MCA_DDRPHY_DP16_RD_DIA_CONFIG5_P0_0_01_FORCE_FIFO_CAPTURE, }; }; @@ -1757,6 +1760,19 @@ fapi2::ReturnCode process_rdvref_cal_errors( const fapi2::Target& i_target ); +/// +/// @brief Write FORCE_FIFO_CAPTURE +/// Force DQ capture in Read FIFO to support DDR4 LRDIMM calibration +/// @tparam T fapi2 Target Type - derived +/// @tparam TT traits type defaults to dp16Traits +/// @param[in] i_target the fapi2 target of the port +/// @param[in] i_state mss::states::ON or mss::states::OFF +/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff ok +/// +template< fapi2::TargetType T, typename TT = dp16Traits > +fapi2::ReturnCode write_force_fifo_capture( const fapi2::Target& i_target, + const mss::states i_state); + } // close namespace dp16 } // close namespace mss diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/utils/scom.H b/src/import/chips/p9/procedures/hwp/memory/lib/utils/scom.H index d193944bafc..7cd747dd6a0 100644 --- a/src/import/chips/p9/procedures/hwp/memory/lib/utils/scom.H +++ b/src/import/chips/p9/procedures/hwp/memory/lib/utils/scom.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2016 */ +/* Contributors Listed Below - COPYRIGHT 2015,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -134,7 +134,7 @@ fapi2::ReturnCode scom_blastah( const fapi2::Target& i_target, { size_t count(0); - for (auto a : i_addrs) + for (const auto& a : i_addrs) { FAPI_TRY( mss::putScom(i_target, a, i_data) ); ++count; @@ -162,7 +162,7 @@ fapi2::ReturnCode scom_blastah( const std::vector >& i_targets, { size_t count(0); - for (auto t : i_targets) + for (const auto& t : i_targets) { FAPI_TRY( mss::putScom(t, i_addr, i_data) ); ++count; @@ -190,7 +190,7 @@ fapi2::ReturnCode scom_blastah( const std::vector >& i_targets, { size_t count(0); - for (auto t : i_targets) + for (const auto& t : i_targets) { FAPI_TRY( mss::scom_blastah(t, i_addrs, i_data) ); ++count;