diff options
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C')
-rw-r--r-- | src/import/chips/p9/procedures/hwp/memory/p9_mss_utils_to_throttle.C | 43 |
1 files changed, 25 insertions, 18 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 8809ad0f4..cbf1fe988 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 @@ -33,7 +33,7 @@ // *HWP HWP Owner: Jacob Harvey <jlharvey@us.ibm.com> // *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com> // *HWP Team: Memory -// *HWP Level: 1 +// *HWP Level: 2 // *HWP Consumed by: FSP:HB #include <p9_mss_utils_to_throttle.H> @@ -46,6 +46,7 @@ #include <lib/utils/index.H> #include <lib/utils/find.H> #include <lib/utils/conversions.H> +#include <lib/power_thermal/throttle.H> #include <lib/mss_attribute_accessors.H> using fapi2::TARGET_TYPE_MCS; @@ -65,43 +66,49 @@ extern "C" { for( const auto& l_mcs : i_targets ) { - //TODO RTC 160048 Complete implementing (calculating power and per slot throttles) - JLH uint32_t l_databus_util [mss::PORTS_PER_MCS]; - uint32_t l_throttled_cmds_port[mss::PORTS_PER_MCS]; - uint32_t l_throttled_cmds_slot[mss::PORTS_PER_MCS]; + uint32_t l_dram_clocks = 0; + + uint16_t l_throttled_cmds_port[mss::PORTS_PER_MCS]; + uint16_t l_throttled_cmds_slot[mss::PORTS_PER_MCS]; uint32_t l_max_power[mss::PORTS_PER_MCS]; - uint32_t l_dram_clocks = 0; FAPI_TRY( mss::mrw_mem_m_dram_clocks(l_dram_clocks) ); - + //Util attribute set by OCC FAPI_TRY( mss::databus_util(l_mcs, l_databus_util) ); for( const auto& l_mca : mss::find_targets<TARGET_TYPE_MCA>(l_mcs) ) { const auto l_port_num = mss::index( l_mca ); + //Make a throttle object in order to calculate the port power + fapi2::ReturnCode l_rc; + mss::power_thermal::throttle l_throttle (l_mca, l_rc); + FAPI_TRY(l_rc, "Error calculating mss::power_thermal::throttle constructor in p9_mss_utils_to_throttles"); FAPI_INF( "MRW dram clock window: %d, databus utilization: %d", l_dram_clocks, - l_databus_util ); - - // Calculate programmable N address operations within M dram clock window - l_throttled_cmds_port[l_port_num] = mss::power_thermal::throttled_cmds( l_databus_util[l_port_num], l_dram_clocks ); - l_throttled_cmds_slot[l_port_num] = mss::power_thermal::throttled_cmds( l_databus_util[l_port_num], l_dram_clocks ); - //TK - actually implement function - JLH - //Quick hard code for API purposes - l_max_power[l_port_num] = 2088; - FAPI_INF( "Calculated N commands per port [%d] = %d", + l_databus_util); + + //Calculate programmable N address operations within M dram clock window + l_throttled_cmds_port[l_port_num] = mss::power_thermal::throttled_cmds(l_databus_util[l_port_num], + l_dram_clocks ); + l_throttled_cmds_slot[l_port_num] = l_throttled_cmds_port[l_port_num]; + //Calculate the port power needed to reach the calculated N value + l_max_power[l_port_num] = l_throttle.calc_power_from_n(l_throttled_cmds_slot[l_port_num]); + + FAPI_INF( "Calculated N commands per port [%d] = %d commands, maxpower is %d", l_port_num, - l_throttled_cmds_port[l_port_num]); + l_throttled_cmds_port[l_port_num], + l_max_power[l_port_num]); }// end for FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_PORT_MAXPOWER, l_mcs, l_max_power) ); - FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_RUNTIME_MEM_THROTTLED_N_COMMANDS_PER_SLOT, + FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_MEM_THROTTLED_N_COMMANDS_PER_SLOT, l_mcs, l_throttled_cmds_slot) ); - FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_RUNTIME_MEM_THROTTLED_N_COMMANDS_PER_PORT, + FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_MEM_THROTTLED_N_COMMANDS_PER_PORT, l_mcs, l_throttled_cmds_port) ); } |