Skip to content

Commit

Permalink
L3 work for volt and freq_systems
Browse files Browse the repository at this point in the history
Change-Id: If35a855130a5f6d06f8e1a480623a26f9cec2e14
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34838
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Reviewed-by: Brian R. Silver <bsilver@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/35059
Reviewed-by: Hostboot Team <hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
  • Loading branch information
JacobHarvey authored and crgeddes committed Jan 25, 2017
1 parent 38aa7b9 commit 88d44d2
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 175 deletions.
64 changes: 37 additions & 27 deletions src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.C
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -30,7 +30,7 @@
// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com>
// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: HB:FSP

#include <vector>
Expand Down Expand Up @@ -169,8 +169,10 @@ bool deconfigure(const fapi2::Target<TARGET_TYPE_MCBIST>& i_target,
.set_MSS_FREQ(i_dimm_speed)
.set_NEST_FREQ(i_nest_freq)
.set_MCS_TARGET(l_mcs),
"Deconfiguring %s",
mss::c_str(l_mcs) );
"Deconfiguring %s due to unequal frequencies: mss: %d, nest: %d",
mss::c_str(l_mcs),
i_dimm_speed,
i_nest_freq );
}// end for
}// end if

Expand Down Expand Up @@ -280,8 +282,11 @@ fapi2::ReturnCode select_sync_mode(const std::map< fapi2::Target<TARGET_TYPE_MCB
break;

default:
// Switches on an enum class
// The only valid speed_equality values are NOT_EQUAL and EQUAL.
// If it's something else ,I think it's a code error and really shouldn't be possible, thus fapi2::Assert below
FAPI_ERR("Invalid speed_equality parameter!");
return fapi2::FAPI2_RC_INVALID_PARAMETER;
fapi2::Assert(false);
break;
}// end switch

Expand Down Expand Up @@ -362,7 +367,7 @@ fapi2::ReturnCode supported_freqs_helper(const fapi2::Target<TARGET_TYPE_MCS>& i
io_freqs.clear();

// This magic number isn't the number of frequencies supported by the hardware, it's the number
// of frequencies in the attribute or VPD. They may be different (see *1 below)
// of frequencies in the attribute or VPD. They may be different
if (i_freqs.size() != NUM_VPD_FREQS)
{
FAPI_ERR("incorrect number of frequencies for %s (%d)", mss::c_str(i_target), i_freqs.size());
Expand All @@ -372,7 +377,7 @@ fapi2::ReturnCode supported_freqs_helper(const fapi2::Target<TARGET_TYPE_MCS>& i
FAPI_INF("unsorted supported freqs %d %d %d %d",
i_freqs[0], i_freqs[1], i_freqs[2], i_freqs[3]);

// (*1) This is the number of elelments in the max_allowed_dimm_freq attribute, not the frequencies of
// This is the number of elements in the max_allowed_dimm_freq attribute, not the frequencies of
// the system. Hence the magic number.
if (i_max_freqs.size() != NUM_MAX_FREQS)
{
Expand All @@ -389,12 +394,13 @@ fapi2::ReturnCode supported_freqs_helper(const fapi2::Target<TARGET_TYPE_MCS>& i
const auto l_dimms = mss::find_targets<TARGET_TYPE_DIMM>(p);
uint64_t l_dimms_on_port = l_dimms.size();

// Just a quick check but we're in deep yogurt if this triggers
if (l_dimms_on_port > MAX_DIMM_PER_PORT)
{
FAPI_ERR("seeing %d DIMM on port %s", l_dimms_on_port, mss::c_str(p));
fapi2::Assert(false);
}
FAPI_ASSERT( (l_dimms_on_port <= MAX_DIMM_PER_PORT),
fapi2::MSS_TOO_MANY_DIMMS_ON_PORT()
.set_DIMM_COUNT(l_dimms_on_port)
.set_MCA_TARGET(p),
"Seeing %d DIMM on port %s",
l_dimms_on_port,
mss::c_str(p));

for (const auto& d : l_dimms)
{
Expand All @@ -404,11 +410,13 @@ fapi2::ReturnCode supported_freqs_helper(const fapi2::Target<TARGET_TYPE_MCS>& i
FAPI_TRY( mss::eff_num_master_ranks_per_dimm(d, l_num_master_ranks) );

// Just a quick check but we're in deep yogurt if this triggers
if (l_num_master_ranks > MAX_PRIMARY_RANKS_PER_PORT)
{
FAPI_ERR("seeing %d primary ranks on DIMM %s", l_num_master_ranks, mss::c_str(d));
fapi2::Assert(false);
}
FAPI_ASSERT( (l_num_master_ranks <= MAX_RANK_PER_DIMM),
fapi2::MSS_TOO_MANY_PRIMARY_RANKS_ON_DIMM()
.set_RANK_COUNT(l_num_master_ranks)
.set_DIMM_TARGET(p),
"seeing %d primary ranks on DIMM %s",
l_dimms_on_port,
mss::c_str(d));

FAPI_INF("%s rank config %d drop %d yields max freq attribute index of %d (%d)",
mss::c_str(d), l_num_master_ranks, l_dimms_on_port,
Expand All @@ -417,13 +425,15 @@ fapi2::ReturnCode supported_freqs_helper(const fapi2::Target<TARGET_TYPE_MCS>& i

l_index = l_indexes[l_dimms_on_port - 1][l_num_master_ranks - 1];

// Just a quick check but we're in deep yogurt if this triggers
if (l_index > NUM_MAX_FREQS)
{
FAPI_ERR("seeing %d index for %d DIMM and %d ranks on DIMM %s",
l_index, l_dimms_on_port, l_num_master_ranks, mss::c_str(d));
fapi2::Assert(false);
}
FAPI_ASSERT( (l_index < NUM_MAX_FREQS),
fapi2::MSS_FREQ_INDEX_TOO_LARGE()
.set_INDEX(l_index)
.set_NUM_MAX_FREQS(NUM_MAX_FREQS),
"seeing %d index for %d DIMM and %d ranks on DIMM %s",
l_index,
l_dimms_on_port,
l_num_master_ranks,
mss::c_str(d));

l_our_max_freq = std::min(l_our_max_freq, i_max_freqs[l_index]);
}
Expand Down Expand Up @@ -460,7 +470,7 @@ fapi2::ReturnCode supported_freqs_helper(const fapi2::Target<TARGET_TYPE_MCS>& i
// Sort it so we know supported min is io_freq.begin and supported max is io_freq.end - 1
std::sort(io_freqs.begin(), io_freqs.end());

// If we have an empty set, we have a pro'lem
// If we have an empty set, we have a problem
FAPI_ASSERT(io_freqs.size() != 0,
fapi2::MSS_VPD_FREQ_MAX_FREQ_EMPTY_SET()
.set_MSS_VPD_FREQ_0(i_freqs[0])
Expand All @@ -487,7 +497,7 @@ fapi_try_exit:
/// @param[in] reference to a std::vector<uint32_t> of freqs
/// @return bool, true iff input freq is supported
///
fapi2::ReturnCode is_freq_supported(const uint32_t i_freq, const std::vector<uint32_t>& i_freqs)
bool is_freq_supported(const uint32_t i_freq, const std::vector<uint32_t>& i_freqs)
{
return std::binary_search(i_freqs.begin(), i_freqs.end(), i_freq);
}
Expand Down
6 changes: 3 additions & 3 deletions src/import/chips/p9/procedures/hwp/memory/lib/freq/sync.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -29,7 +29,7 @@
// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com>
// *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: HB:FSP

#ifndef _MSS_SYNC_H_
Expand Down Expand Up @@ -124,7 +124,7 @@ fapi2::ReturnCode supported_freqs(const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i
/// @param[in] reference to a std::vector<uint32_t> of freqs
/// @return bool, true iff input freq is supported
///
fapi2::ReturnCode is_freq_supported(const uint32_t i_freq, const std::vector<uint32_t>& i_freqs);
bool is_freq_supported(const uint32_t i_freq, const std::vector<uint32_t>& i_freqs);


}// mss
Expand Down
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -30,7 +30,7 @@
// *HWP HWP Owner: Brian Silver <bsilver@us.ibm.com>
// *HWP HWP Backup: Jacob Harvey <jlharvey@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: HB:FSP

#ifndef _MSS_COUNT_DIMM_H_
Expand Down
10 changes: 5 additions & 5 deletions src/import/chips/p9/procedures/hwp/memory/p9_mss_freq_system.C
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -30,7 +30,7 @@
// *HWP HWP Owner: Andre A. Marin <aamarin@us.ibm.com>
// *HWP FW Owner: Brian Silver <bsilver@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: FSP:HB
#include <vector>
#include <map>
Expand Down Expand Up @@ -64,12 +64,12 @@ extern "C"
// attributes for the PHY, etc. If there is even one DIMM on any of this list of MCBIST,
// we do the right thing.
uint64_t l_dimm_count = 0;
std::for_each( i_targets.begin(), i_targets.end(),
std::for_each( i_targets.begin(),
i_targets.end(),
[&l_dimm_count](const fapi2::Target<TARGET_TYPE_MCBIST>& i_target)
{
l_dimm_count += mss::count_dimm(i_target);
}
);
} );

if (l_dimm_count == 0)
{
Expand Down
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016 */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -30,7 +30,7 @@
// *HWP HWP Owner: Andre A. Marin <aamarin@us.ibm.com>
// *HWP FW Owner: Brian Silver <bsilver@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: FSP:HB

#ifndef FREQ_SYSTEM_H_
Expand Down
21 changes: 10 additions & 11 deletions src/import/chips/p9/procedures/hwp/memory/p9_mss_volt.C
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2016 */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -31,7 +31,7 @@
// *HWP HWP Backup: Andre A. Marin <aamarin@us.ibm.com>
// *HWP FW Owner: Brian Silver <bsilver@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: FSP:HB

#include <p9_mss_volt.H>
Expand Down Expand Up @@ -61,12 +61,11 @@ using fapi2::FAPI2_RC_SUCCESS;
extern "C"
{


///
/// @brief Calculate and save off rail voltages
/// @param[in] i_targets vector of controllers (e.g., MCS)
/// @return FAPI2_RC_SUCCESS iff ok
///
///
/// @brief Calculate and save off rail voltages
/// @param[in] i_targets vector of controllers (e.g., MCS)
/// @return FAPI2_RC_SUCCESS iff ok
///
fapi2::ReturnCode p9_mss_volt( const std::vector< fapi2::Target<TARGET_TYPE_MCS> >& i_targets )
{
// Loop through MCS
Expand All @@ -82,7 +81,7 @@ extern "C"
// Get dimms for each MCS
for ( const auto& l_dimm : mss::find_targets<TARGET_TYPE_DIMM> (l_mcs))
{
const auto& l_dimm_pos = mss::pos(l_dimm);
const auto l_dimm_pos = mss::pos(l_dimm);

// Find decoder factory for this dimm position
auto l_it = l_factory_caches.find(l_dimm_pos);
Expand Down Expand Up @@ -117,8 +116,8 @@ extern "C"
// Set the attributes for this MCS, values are in mss_const.H
// TK : will need to change attribute target according to voltage rails in the future
FAPI_TRY (mss::set_voltage_attributes (l_mcs,
uint64_t(mss::DDR4_NOMINAL_VOLTAGE),
uint64_t(mss::DDR4_VPP_VOLTAGE)),
mss::DDR4_NOMINAL_VOLTAGE,
mss::DDR4_VPP_VOLTAGE),
"Failed to set volt attributes");
} // mcs

Expand Down
4 changes: 2 additions & 2 deletions src/import/chips/p9/procedures/hwp/memory/p9_mss_volt.H
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2016 */
/* Contributors Listed Below - COPYRIGHT 2015,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -31,7 +31,7 @@
// *HWP HWP Backup: Andre A. Marin <aamarin@us.ibm.com>
// *HWP FW Owner: Brian Silver <bsilver@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 2
// *HWP Level: 3
// *HWP Consumed by: FSP:HB

#ifndef MSS_VOLT_H_
Expand Down

0 comments on commit 88d44d2

Please sign in to comment.