From 625e85ec0d587836eba8978a0922fb29b7e61ba4 Mon Sep 17 00:00:00 2001 From: Andre Marin Date: Mon, 18 Jul 2016 13:29:22 -0500 Subject: Fix p9_mss_utils_to_throttle, create throttles API, attribute cleanup Change-Id: I42700a4d0832d1bfc2c8e7b8127af478ab51b909 Original-Change-Id: Ibdb563542adb9e4f05dd07d597a9687b1deaf3c8 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27183 Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: JACOB L. HARVEY Reviewed-by: STEPHEN GLANCY Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31753 Tested-by: FSP CI Jenkins Reviewed-by: Christian R. Geddes --- .../hwp/memory/p9_mss_utils_to_throttle.C | 59 ++++++++++++++-------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C index 3182388de..48285cb3f 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C @@ -25,18 +25,29 @@ /// /// @file p9_mss_utils_to_throttle.C -/// @brief Set the N throttle attributes for a given dram data bus utilization. +/// @brief Sets throttles +/// TMGT will call this procedure to set the N address operations (commands) +/// allowed within a window of M DRAM clocks given the minimum dram data bus utilization. /// + // *HWP HWP Owner: Andre Marin // *HWP HWP Backup: Brian Silver // *HWP Team: Memory -// *HWP Level: 1 +// *HWP Level: 2 // *HWP Consumed by: FSP:HB -#include -#include #include +// fapi2 +#include + +// mss lib +#include +#include +#include +#include +#include + using fapi2::TARGET_TYPE_MCS; using fapi2::TARGET_TYPE_MCA; using fapi2::TARGET_TYPE_DIMM; @@ -51,30 +62,38 @@ extern "C" /// fapi2::ReturnCode p9_mss_utils_to_throttle( const fapi2::Target& i_target ) { - uint8_t l_databus_util[mss::PORTS_PER_MCS][mss::MAX_DIMM_PER_PORT] = {0}; - uint32_t l_dram_clocks = 0; - uint32_t l_num_commands_allowed[mss::PORTS_PER_MCS][mss::MAX_DIMM_PER_PORT] = {}; + std::vector l_databus_util(mss::PORTS_PER_MCS, 0); + std::vector l_throttled_cmds(mss::PORTS_PER_MCS, 0); - FAPI_TRY( mss::databus_util(i_target, &l_databus_util[0][0]) ); + uint32_t l_dram_clocks = 0; FAPI_TRY( mss::mrw_mem_m_dram_clocks(l_dram_clocks) ); - for( const auto& l_mca : i_target.getChildren() ) + // TK - Who sets this attribute? OCC? Not set in eff_config for p8 - AAM + // If set by OCC can they just pass in value as a parameter? - AAM + FAPI_TRY( mss::databus_util( i_target, l_databus_util.data()) ); + + for( const auto& l_mca : mss::find_targets(i_target) ) { - const auto l_port_num = mss::index(l_mca); + const auto l_port_num = mss::index( l_mca ); + + FAPI_INF( "MRW dram clock window: %d, databus utilization[%d]: %d", + l_dram_clocks, + l_port_num, + l_databus_util[l_port_num] ); + + // Calculate programmable N address operations within M dram clock window + l_throttled_cmds[l_port_num] = mss::throttled_cmds( l_databus_util[l_port_num], l_dram_clocks ); - for( const auto& l_dimm : l_mca.getChildren() ) - { - const auto l_dimm_num = mss::index(l_dimm); + FAPI_INF( "Calculated N commands per port [%d] = %d", + l_port_num, + l_throttled_cmds[l_port_num]); - l_num_commands_allowed[l_port_num][l_dimm_num] = mss::commands_allowed_over_clock_window( - l_databus_util[l_port_num][l_dimm_num], - l_dram_clocks); - } - } + }// end for - FAPI_ATTR_SET(fapi2::ATTR_MSS_THROTTLED_N_COMMANDS, i_target, l_num_commands_allowed); + FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_OCC_THROTTLED_N_CMDS, + i_target, + UINT32_VECTOR_TO_1D_ARRAY(l_throttled_cmds, mss::PORTS_PER_MCS)) ); - FAPI_INF("End utils_to_throttle"); fapi_try_exit: return fapi2::current_err; } -- cgit v1.2.3