Skip to content

Commit

Permalink
Updates WR VREF for characterization results
Browse files Browse the repository at this point in the history
Change-Id: I9803ee77afa2ebc32e12d9d528ac4ae6a6c947f8
CQ:SW411492
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/50709
Dev-Ready: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@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://ralgit01.raleigh.ibm.com/gerrit1/50713
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: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
esteban012 authored and dcrowell77 committed Jan 13, 2018
1 parent 02e505b commit 01c730d
Show file tree
Hide file tree
Showing 18 changed files with 1,969 additions and 118 deletions.
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -830,6 +830,9 @@ struct mrs00_data
///
mrs00_data( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, fapi2::ReturnCode& o_rc );

// Delete MRS00 default constructor
mrs00_data() = delete;

///
/// @brief Less than operator
/// @param[in] i_rhs right hand comparison operator
Expand Down Expand Up @@ -873,6 +876,16 @@ struct mrs00_data
return iv_burst_length < i_rhs.iv_burst_length;
}

///
/// @brief Equal to operator
/// @param[in] i_rhs right hand comparison operator
/// @bool true if this object is equal to i_rhs
///
bool operator==(const mss::ddr4::mrs00_data& i_rhs) const
{
return !((*this < i_rhs) || (i_rhs < *this));
}

uint8_t iv_burst_length;
uint8_t iv_read_burst_type;
uint8_t iv_dll_reset;
Expand Down Expand Up @@ -905,6 +918,9 @@ struct mrs01_data
///
mrs01_data( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, fapi2::ReturnCode& o_rc );

// Delete MRS01 default constructor
mrs01_data() = delete;

///
/// @brief Less than operator
/// @param[in] i_rhs right hand comparison operator
Expand Down Expand Up @@ -958,6 +974,16 @@ struct mrs01_data
return iv_dll_enable < i_rhs.iv_dll_enable;
}

///
/// @brief Equal to operator
/// @param[in] i_rhs right hand comparison operator
/// @bool true if this object is equal to i_rhs
///
bool operator==(const mss::ddr4::mrs01_data& i_rhs) const
{
return !((*this < i_rhs) || (i_rhs < *this));
}

uint8_t iv_dll_enable;
uint8_t iv_odic[MAX_RANK_PER_DIMM];
uint8_t iv_additive_latency;
Expand Down Expand Up @@ -991,6 +1017,9 @@ struct mrs02_data
///
mrs02_data( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, fapi2::ReturnCode& o_rc );

// Delete MRS02 default constructor
mrs02_data() = delete;

///
/// @brief Less than operator
/// @param[in] i_rhs right hand comparison operator
Expand Down Expand Up @@ -1024,6 +1053,16 @@ struct mrs02_data
return iv_cwl < i_rhs.iv_cwl;
}

///
/// @brief Equal to operator
/// @param[in] i_rhs right hand comparison operator
/// @bool true if this object is equal to i_rhs
///
bool operator==(const mss::ddr4::mrs02_data& i_rhs) const
{
return !((*this < i_rhs) || (i_rhs < *this));
}

uint8_t iv_lpasr;
uint8_t iv_cwl;
uint8_t iv_write_crc;
Expand Down Expand Up @@ -1055,6 +1094,9 @@ struct mrs03_data
///
mrs03_data( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, fapi2::ReturnCode& o_rc );

// Delete MRS03 default constructor
mrs03_data() = delete;

///
/// @brief Less than operator
/// @param[in] i_rhs right hand comparison operator
Expand Down Expand Up @@ -1110,6 +1152,16 @@ struct mrs03_data
return iv_mpr_page < i_rhs.iv_mpr_page;
}

///
/// @brief Equal to operator
/// @param[in] i_rhs right hand comparison operator
/// @bool true if this object is equal to i_rhs
///
bool operator==(const mss::ddr4::mrs03_data& i_rhs) const
{
return !((*this < i_rhs) || (i_rhs < *this));
}

uint8_t iv_mpr_mode;
uint8_t iv_mpr_page;
uint8_t iv_geardown;
Expand Down Expand Up @@ -1144,6 +1196,9 @@ struct mrs04_data
///
mrs04_data( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, fapi2::ReturnCode& o_rc );

// Delete MRS04 default constructor
mrs04_data() = delete;

///
/// @brief Less than operator
/// @param[in] i_rhs right hand comparison operator
Expand Down Expand Up @@ -1217,6 +1272,16 @@ struct mrs04_data
return iv_max_pd_mode < i_rhs.iv_max_pd_mode;
}

///
/// @brief Equal to operator
/// @param[in] i_rhs right hand comparison operator
/// @bool true if this object is equal to i_rhs
///
bool operator==(const mss::ddr4::mrs04_data& i_rhs) const
{
return !((*this < i_rhs) || (i_rhs < *this));
}

uint8_t iv_max_pd_mode;
uint8_t iv_temp_refresh_range;
uint8_t iv_temp_ref_mode;
Expand Down Expand Up @@ -1254,6 +1319,9 @@ struct mrs05_data
///
mrs05_data( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, fapi2::ReturnCode& o_rc );

// Delete MRS05 default constructor
mrs05_data() = delete;

///
/// @brief Less than operator
/// @param[in] i_rhs right hand comparison operator
Expand Down Expand Up @@ -1317,6 +1385,16 @@ struct mrs05_data
return iv_ca_parity_latency < i_rhs.iv_ca_parity_latency;
}

///
/// @brief Equal to operator
/// @param[in] i_rhs right hand comparison operator
/// @bool true if this object is equal to i_rhs
///
bool operator==(const mss::ddr4::mrs05_data& i_rhs) const
{
return !((*this < i_rhs) || (i_rhs < *this));
}

uint8_t iv_ca_parity_latency;
uint8_t iv_crc_error_clear;
uint8_t iv_ca_parity_error_status;
Expand Down Expand Up @@ -1352,6 +1430,9 @@ struct mrs06_data
///
mrs06_data( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target, fapi2::ReturnCode& o_rc );

// Delete MRS06 default constructor
mrs06_data() = delete;

///
/// @brief Less than operator
/// @param[in] i_rhs right hand comparison operator
Expand Down Expand Up @@ -1388,6 +1469,16 @@ struct mrs06_data
return memcmp(iv_vrefdq_train_value, i_rhs.iv_vrefdq_train_value, sizeof(i_rhs.iv_vrefdq_train_value)) < MEMCMP_EQUAL;
}

///
/// @brief Equal to operator
/// @param[in] i_rhs right hand comparison operator
/// @bool true if this object is equal to i_rhs
///
bool operator==(const mss::ddr4::mrs06_data& i_rhs) const
{
return !((*this < i_rhs) || (i_rhs < *this));
}

uint8_t iv_vrefdq_train_value[MAX_RANK_PER_DIMM];
uint8_t iv_vrefdq_train_range[MAX_RANK_PER_DIMM];
uint8_t iv_vrefdq_train_enable[MAX_RANK_PER_DIMM];
Expand Down
72 changes: 62 additions & 10 deletions src/import/chips/p9/procedures/hwp/memory/lib/dimm/ddr4/pda.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2017 */
/* Contributors Listed Below - COPYRIGHT 2017,2018 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -208,7 +208,8 @@ class commands
public:
// Typdefs to make the code more readable
typedef std::pair<fapi2::Target<fapi2::TARGET_TYPE_DIMM>, uint64_t> rank_target;
typedef std::map<D, std::vector<uint64_t> > mrs_drams;
typedef std::pair<D, std::vector<uint64_t> > mrs_dram;
typedef std::vector<mrs_dram> mrs_drams_vect;

///
/// @brief Base constructor
Expand Down Expand Up @@ -267,7 +268,57 @@ class commands
set_FUNCTION(mss::ffdc_function_codes::PDA_ADD_COMMAND),
"%s does not have rank %lu", mss::c_str(i_target), i_rank);

iv_commands[ {i_target, i_rank}][i_mrs].push_back(i_dram);
// Does the compression
{
// If the rank/target pair does not exist simply insert a new pair
const rank_target RANK_TARGET = {i_target, i_rank};
// Note: technically this should be const auto to keep the iterator at the found position
// However, HB asumes that the const in front of the auto makes this a const_iterator
// Note: Find value from key prints an error if the key could not be found. We don't want that
// Rolling our own below
// TODO:RTC184689 Create find_iterator_from_value and find_iterator_from_key
auto l_it = std::find_if(iv_commands.begin(),
iv_commands.end(), [&RANK_TARGET](const std::pair<rank_target, mrs_drams_vect>& i_rhs)
{
return RANK_TARGET == i_rhs.first;
});

if( l_it == iv_commands.end() )
{
FAPI_INF("%s rank%lu NEW target rank info DRAM%lu", mss::c_str(i_target), i_rank, i_dram);
mrs_drams_vect l_mrs_dram = {{ i_mrs, { i_dram } }};
iv_commands.push_back( { RANK_TARGET, l_mrs_dram } );
}
// The rank/target exist
else
{
// Does the MRS exist?
auto& l_mrs_vect = l_it->second;
// Note: technically this should be const auto to keep the iterator at the found position
// However, HB asumes that the const in front of the auto makes this a const_iterator
// Note: Find value from key prints an error if the key could not be found. We don't want that
// Rolling our own below
// TODO:RTC184689 Create find_iterator_from_value and find_iterator_from_key
auto l_mrs_it = std::find_if(l_mrs_vect.begin(), l_mrs_vect.end(), [&i_mrs](const mrs_dram & i_rhs)
{
return i_mrs == i_rhs.first;
});

// No, add a new DRAM mapping
if( l_mrs_it == l_mrs_vect.end() )
{
FAPI_INF("%s rank%lu inserting new DRAM + MRS info DRAM%lu", mss::c_str(i_target), i_rank, i_dram);
const mrs_dram MRS_DRAM = { i_mrs, { i_dram } };
l_mrs_vect.push_back( MRS_DRAM );
}
// Yes, add a DRAM onto the vector
else
{
l_mrs_it->second.push_back( i_dram );
FAPI_INF("%s rank%lu pushing back DRAM%lu size %lu", mss::c_str(i_target), i_rank, i_dram, l_mrs_it->second.size());
}
}
}

fapi_try_exit:
return fapi2::current_err;
Expand All @@ -294,31 +345,32 @@ class commands
/// @brief Returns the command information
/// @return iv_commands
///
inline const typename std::map<rank_target, mrs_drams>& get() const
inline const typename std::vector<std::pair<rank_target, mrs_drams_vect>>& get() const
{
return iv_commands;
}

private:
// The following is a map of targets/DIMM as the key to a map of
// The following is a vector of target/DIMM pairs as the key to a vector of
// the MRS command as the key to the DRAM's to toggle. An explanation as to the data structure is included below
// Note: due to HB compile, a vector is used instead of a map

// PDA compression is a little complex, but is organized to allow us to minimize the number of commands run
// Each individual map is designed to further minimize the number of commands run
// The compressed commands consist of a map within a map
// The outside map, maps the DIMM/rank to the MRS command and DRAM's that need to be run
// Each individual vector is designed to further minimize the number of commands run
// The compressed commands consist of a vector of pairs within a vector of pairs
// The outside vector, maps the DIMM/rank to the MRS command and DRAM's that need to be run
// Basically, it's a list of a specific rank target with all the commands that need to be run
// The rank-specific target information allows us to just issue the enter/exit commands for PDA for each rank once
// The MRS commands to the DRAM are then looped over in the inside loop
// The inside map has a key of the MRS and a value of a vector of DRAM's to issue the MRS to
// The inside vector has a key of the MRS and a value of a vector of DRAM's to issue the MRS to
// CCS does not allow the user to toggle the DQ during an MRS command
// The DQ information is stored in separate registers in the PHY
// What this means for issuing the commands is that we have to issue an invocation of CCS for each different MRS command we issue
// We can issue a single MRS command for multiple DRAM's however
// Each invocation of CCS creates a noticable increase in time, as the registers need to be configured, CCS needs to be started, and we need to poll for done
// By only entering into PDA on a DIMM-rank once and by issuing the PDA MRS's to multiple DRAM's at a time, we can save a lot of runtime
// Note: in shmoo, adding the compression reduced runtime from about 13 minutes down to 3 minutes
typename std::map<rank_target, mrs_drams> iv_commands;
typename std::vector<std::pair<rank_target, mrs_drams_vect>> iv_commands;
};

///
Expand Down

0 comments on commit 01c730d

Please sign in to comment.