diff options
author | Prachi Gupta <pragupta@us.ibm.com> | 2015-04-30 14:52:08 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-05-20 12:44:52 -0500 |
commit | beb2e485a26985cddfdf47dc1fed489f679b8d35 (patch) | |
tree | 13d8d9a00e22a837a900618ec87ebb0e4e66a9c9 /src/usr/hwpf/hwp | |
parent | 4e9d06245ea04920d5d27bd78638e07cbb0eaae4 (diff) | |
download | blackbird-hostboot-beb2e485a26985cddfdf47dc1fed489f679b8d35.tar.gz blackbird-hostboot-beb2e485a26985cddfdf47dc1fed489f679b8d35.zip |
SW295280: Adjust Regulator Power Limit per DIMM based on number of DIMMs populat
Change-Id: I9469cc4373f468008ce0b565d3460f0a845c0b78
CQ:SW295280
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16297
Reviewed-by: Michael D. Pardeik <pardeik@us.ibm.com>
Reviewed-by: Thi N. Tran <thi@us.ibm.com>
Reviewed-by: PRACHI GUPTA <pragupta@us.ibm.com>
Tested-by: PRACHI GUPTA <pragupta@us.ibm.com>
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/17552
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp')
4 files changed, 399 insertions, 100 deletions
diff --git a/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_bulk_pwr_throttles.C b/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_bulk_pwr_throttles.C index 21668b90e..9c9ae50fe 100644 --- a/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_bulk_pwr_throttles.C +++ b/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_bulk_pwr_throttles.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -22,7 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: mss_bulk_pwr_throttles.C,v 1.28 2014/12/01 19:07:07 pardeik Exp $ +// $Id: mss_bulk_pwr_throttles.C,v 1.30 2015/03/06 15:54:35 pardeik Exp $ // $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/ // centaur/working/procedures/ipl/fapi/mss_bulk_pwr_throttles.C,v $ //------------------------------------------------------------------------------ @@ -73,6 +73,9 @@ //------------------------------------------------------------------------------ // Version:| Author: | Date: | Comment: //---------|----------|---------|----------------------------------------------- +// 1.30 | pardeik |12-FEB-15| Review change to check for l_throttle_n_per_chip +// | | | being zero (shouldn't have any impact to hwp) +// 1.29 | pardeik |12-FEB-15| CDIMM DDR4 throttle updates (set Nmba to Nchip) // 1.28 | pardeik |01-DEC-14| Gerrit review updates // | | | changed MAX_UTIL to max_util // | | | changed MIN_UTIL const to min_util float @@ -235,6 +238,7 @@ extern "C" { uint32_t channel_pair_power; uint32_t runtime_throttle_n_per_mba; uint32_t runtime_throttle_n_per_chip; + uint8_t l_dram_gen; // get input attributes rc = FAPI_ATTR_GET(ATTR_EFF_CUSTOM_DIMM, &i_target_mba, l_custom_dimm); @@ -271,6 +275,12 @@ extern "C" { FAPI_ERR("Error getting attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP"); return rc; } + rc = FAPI_ATTR_GET(ATTR_EFF_DRAM_GEN, + &i_target_mba, l_dram_gen); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_EFF_DRAM_GEN"); + return rc; + } // other attributes for custom dimms to get if (l_custom_dimm == fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_YES) @@ -479,12 +489,20 @@ extern "C" { } // ensure that N throttle values are not zero, if so set to lowest values possible - if ( (l_throttle_n_per_mba == 0) || (l_throttle_n_per_mba == 0)) + if ( (l_throttle_n_per_mba == 0) || (l_throttle_n_per_chip == 0)) { l_throttle_n_per_mba = 1; l_throttle_n_per_chip = l_throttle_n_per_mba * l_num_mba_with_dimms; } +// for better custom dimm performance for DDR4, set the per mba throttle to the per chip throttle +// Not planning on doing this for DDR3 + if ( (l_dram_gen == fapi::ENUM_ATTR_EFF_DRAM_GEN_DDR4) + && (l_custom_dimm == fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_YES) ) + { + l_throttle_n_per_mba = l_throttle_n_per_chip; + } + // adjust the throttles to the MRW thermal limit throttles (ie. thermal/power limit less than available power) if ( (l_throttle_n_per_mba > runtime_throttle_n_per_mba) || (l_throttle_n_per_chip > runtime_throttle_n_per_chip) ) diff --git a/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_eff_config_thermal.C b/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_eff_config_thermal.C index a86cf1d0e..1f1bb7e63 100644 --- a/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_eff_config_thermal.C +++ b/src/usr/hwpf/hwp/mc_config/mss_eff_config/mss_eff_config_thermal.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2015 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -22,7 +22,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: mss_eff_config_thermal.C,v 1.29 2014/11/06 21:05:54 pardeik Exp $ +// $Id: mss_eff_config_thermal.C,v 1.31 2015/04/06 22:33:11 pardeik Exp $ // $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/ // centaur/working/procedures/ipl/fapi/mss_eff_config_thermal.C,v $ //------------------------------------------------------------------------------ @@ -55,6 +55,9 @@ //------------------------------------------------------------------------------ // Version:| Author: | Date: | Comment: //---------|----------|---------|----------------------------------------------- +// 1.31 | pardeik | 04/06/15 | attribute name changed for adjustment enable +// 1.30 | pardeik |12-FEB-15| CDIMM DDR4 throttle updates (set Nmba to Nchip) +// | | | Support for vmem regulator power adjustment // 1.29 | pardeik |06-NOV-14| removed strings in trace statements // | | | changed FAPI_IMP to FAPI_INF // | | | removed unused constants @@ -448,7 +451,12 @@ extern "C" { uint8_t ras_increment; uint8_t cas_increment; uint32_t l_max_dram_databus_util; - + uint32_t l_dimm_reg_power_limit_per_dimm_adj; + uint32_t l_dimm_reg_power_limit_per_dimm; + uint8_t l_max_number_dimms_per_reg; + uint8_t l_dimm_reg_power_limit_adj_enable; + uint8_t l_reg_max_dimm_count; + uint8_t l_dram_gen; //------------------------------------------------------------------------------ // Get input attributes //------------------------------------------------------------------------------ @@ -489,6 +497,36 @@ extern "C" { FAPI_ERR("Error getting attribute ATTR_MRW_MAX_DRAM_DATABUS_UTIL"); return rc; } + rc = FAPI_ATTR_GET(ATTR_MRW_VMEM_REGULATOR_MEMORY_POWER_LIMIT_PER_DIMM, + NULL, l_dimm_reg_power_limit_per_dimm); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_MRW_VMEM_REGULATOR_MEMORY_POWER_LIMIT_PER_DIMM"); + return rc; + } + rc = FAPI_ATTR_GET(ATTR_MRW_MAX_NUMBER_DIMMS_POSSIBLE_PER_VMEM_REGULATOR, + NULL, l_max_number_dimms_per_reg); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_MRW_MAX_NUMBER_DIMMS_POSSIBLE_PER_VMEM_REGULATOR"); + return rc; + } + rc = FAPI_ATTR_GET(ATTR_MRW_VMEM_REGULATOR_POWER_LIMIT_PER_DIMM_ADJ_ENABLE, + NULL, l_dimm_reg_power_limit_adj_enable); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_MRW_VMEM_REGULATOR_POWER_LIMIT_PER_DIMM_ADJ_ENABLE"); + return rc; + } + rc = FAPI_ATTR_GET(ATTR_MSS_VMEM_REGULATOR_MAX_DIMM_COUNT, + NULL, l_reg_max_dimm_count); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_MSS_VMEM_REGULATOR_MAX_DIMM_COUNT"); + return rc; + } + rc = FAPI_ATTR_GET(ATTR_EFF_DRAM_GEN, + &i_target_mba, l_dram_gen); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_EFF_DRAM_GEN"); + return rc; + } // Get number of Centaur MBAs that have dimms present // Custom dimms (CDIMMs) use mba/chip throttling, so count number of mbas that have dimms @@ -543,121 +581,154 @@ extern "C" { // This means that the power limit for a MBA channel pair must be the total // CDIMM power limit minus the idle power of the other MBAs logical dimms //------------------------------------------------------------------------------ - if (custom_dimm == fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_YES) + +// adjust the regulator power limit per dimm if enabled and use this if less than the thermal limit + l_dimm_reg_power_limit_per_dimm_adj = l_dimm_reg_power_limit_per_dimm; + if (l_dimm_reg_power_limit_adj_enable == fapi::ENUM_ATTR_MRW_VMEM_REGULATOR_POWER_LIMIT_PER_DIMM_ADJ_ENABLE_TRUE) + { +// adjust reg power limit per cdimm only if l_reg_max_dimm_count>0 and l_reg_max_dimm_count<l_max_number_dimms_per_reg + if ( + (l_reg_max_dimm_count > 0) + && (l_reg_max_dimm_count < l_max_number_dimms_per_reg) + ) { - channel_pair_thermal_power_limit = - dimm_thermal_power_limit / num_mba_with_dimms; + l_dimm_reg_power_limit_per_dimm_adj = + l_dimm_reg_power_limit_per_dimm + * l_max_number_dimms_per_reg + / l_reg_max_dimm_count; + FAPI_INF("VMEM Regulator Power/DIMM Limit Adjustment from %d to %d cW (DIMMs under regulator %d/%d)", l_dimm_reg_power_limit_per_dimm, l_dimm_reg_power_limit_per_dimm_adj, l_reg_max_dimm_count, l_max_number_dimms_per_reg); } + } +// Use the smaller of the thermal limit and regulator power limit per dimm + if (l_dimm_reg_power_limit_per_dimm_adj < dimm_thermal_power_limit) + { + dimm_thermal_power_limit = l_dimm_reg_power_limit_per_dimm_adj; + } + +// Adjust the thermal/power limit to represent the power for all dimms under an MBA + if (custom_dimm == fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_YES) + { + channel_pair_thermal_power_limit = + dimm_thermal_power_limit / num_mba_with_dimms; + } // ISDIMMs thermal power limit from MRW is per DIMM, so multiply by number of dimms on channel to get channel power and multiply by 2 to get channel pair power - else - { + else + { // ISDIMMs - channel_pair_thermal_power_limit = - dimm_thermal_power_limit * num_dimms_on_port * 2; - } + channel_pair_thermal_power_limit = + dimm_thermal_power_limit * num_dimms_on_port * 2; + } // Update the channel pair power limit attribute - rc = FAPI_ATTR_SET(ATTR_MSS_MEM_WATT_TARGET, - &i_target_mba, channel_pair_thermal_power_limit); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_MEM_WATT_TARGET"); - return rc; - } + rc = FAPI_ATTR_SET(ATTR_MSS_MEM_WATT_TARGET, + &i_target_mba, channel_pair_thermal_power_limit); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_MEM_WATT_TARGET"); + return rc; + } // Initialize the runtime throttle attributes to an unthrottled value for mss_bulk_pwr_throttles // max utilization comes from MRW value in c% - convert to % - float MAX_UTIL = (float) l_max_dram_databus_util / 100; - runtime_throttle_n_per_mba = (int)(runtime_throttle_d * (MAX_UTIL / 100) / 4); - runtime_throttle_n_per_chip = (int)(runtime_throttle_d * (MAX_UTIL / 100) / 4) * - num_mba_with_dimms; + float MAX_UTIL = (float) l_max_dram_databus_util / 100; + runtime_throttle_n_per_mba = (int)(runtime_throttle_d * (MAX_UTIL / 100) / 4); + runtime_throttle_n_per_chip = (int)(runtime_throttle_d * (MAX_UTIL / 100) / 4) * + num_mba_with_dimms; + +// for better custom dimm performance for DDR4, set the per mba throttle to the per chip throttle +// Not planning on doing this for DDR3 + if ( (l_dram_gen == fapi::ENUM_ATTR_EFF_DRAM_GEN_DDR4) + && (custom_dimm == fapi::ENUM_ATTR_EFF_CUSTOM_DIMM_YES) ) + { + runtime_throttle_n_per_mba = runtime_throttle_n_per_chip; + } - rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA, - &i_target_mba, runtime_throttle_n_per_mba); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA"); - return rc; - } - rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP, - &i_target_mba, runtime_throttle_n_per_chip); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP"); - return rc; - } - rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR, - &i_target_mba, runtime_throttle_d); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR"); - return rc; - } + rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA, + &i_target_mba, runtime_throttle_n_per_mba); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA"); + return rc; + } + rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP, + &i_target_mba, runtime_throttle_n_per_chip); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP"); + return rc; + } + rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR, + &i_target_mba, runtime_throttle_d); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR"); + return rc; + } + + FAPI_INF("Min Power/Thermal Limit per MBA %d cW. Unthrottled values [%d/%d/%d].", channel_pair_thermal_power_limit, runtime_throttle_n_per_mba, runtime_throttle_n_per_chip, runtime_throttle_d); // Call the procedure function that takes a channel pair power limit and // converts it to throttle values - FAPI_EXEC_HWP(rc, mss_bulk_pwr_throttles, i_target_mba); - if (rc) - { - FAPI_ERR("Error (0x%x) calling mss_bulk_pwr_throttles", static_cast<uint32_t>(rc)); - return rc; - } - - FAPI_INF("MRW Power/Thermal Limit %d. Throttles [%d/%d/%d].", channel_pair_thermal_power_limit, runtime_throttle_n_per_mba, runtime_throttle_n_per_chip, runtime_throttle_d); + FAPI_EXEC_HWP(rc, mss_bulk_pwr_throttles, i_target_mba); + if (rc) + { + FAPI_ERR("Error (0x%x) calling mss_bulk_pwr_throttles", static_cast<uint32_t>(rc)); + return rc; + } // Read back in the updated throttle attribute values (these are now set to // values that will give dimm/channel power underneath the thermal power limit) - rc = FAPI_ATTR_GET(ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_MBA, - &i_target_mba, runtime_throttle_n_per_mba); - if (rc) { - FAPI_ERR("Error getting attribute ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_MBA"); - return rc; - } - rc = FAPI_ATTR_GET(ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_CHIP, - &i_target_mba, runtime_throttle_n_per_chip); - if (rc) { - FAPI_ERR("Error getting attribute ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_CHIP"); - return rc; - } - rc = FAPI_ATTR_GET(ATTR_MSS_MEM_THROTTLE_DENOMINATOR, - &i_target_mba, runtime_throttle_d); - if (rc) { - FAPI_ERR("Error getting attribute ATTR_MSS_MEM_THROTTLE_DENOMINATOR"); - return rc; - } + rc = FAPI_ATTR_GET(ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_MBA, + &i_target_mba, runtime_throttle_n_per_mba); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_MBA"); + return rc; + } + rc = FAPI_ATTR_GET(ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_CHIP, + &i_target_mba, runtime_throttle_n_per_chip); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_MSS_MEM_THROTTLE_NUMERATOR_PER_CHIP"); + return rc; + } + rc = FAPI_ATTR_GET(ATTR_MSS_MEM_THROTTLE_DENOMINATOR, + &i_target_mba, runtime_throttle_d); + if (rc) { + FAPI_ERR("Error getting attribute ATTR_MSS_MEM_THROTTLE_DENOMINATOR"); + return rc; + } // Setup the RAS and CAS increments used in the throttling register - ras_increment=0; - cas_increment=1; + ras_increment=0; + cas_increment=1; // update output attributes - rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA, - &i_target_mba, runtime_throttle_n_per_mba); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA"); - return rc; - } - rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP, - &i_target_mba, runtime_throttle_n_per_chip); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP"); - return rc; - } - rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR, - &i_target_mba, runtime_throttle_d); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR"); - return rc; - } - rc = FAPI_ATTR_SET(ATTR_MSS_THROTTLE_CONTROL_RAS_WEIGHT, - &i_target_mba, ras_increment); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_THROTTLE_CONTROL_RAS_WEIGHT"); - return rc; - } - rc = FAPI_ATTR_SET(ATTR_MSS_THROTTLE_CONTROL_CAS_WEIGHT, - &i_target_mba, cas_increment); - if (rc) { - FAPI_ERR("Error writing attribute ATTR_MSS_THROTTLE_CONTROL_CAS_WEIGHT"); - return rc; - } + rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA, + &i_target_mba, runtime_throttle_n_per_mba); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_MBA"); + return rc; + } + rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP, + &i_target_mba, runtime_throttle_n_per_chip); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_NUMERATOR_PER_CHIP"); + return rc; + } + rc = FAPI_ATTR_SET(ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR, + &i_target_mba, runtime_throttle_d); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_RUNTIME_MEM_THROTTLE_DENOMINATOR"); + return rc; + } + rc = FAPI_ATTR_SET(ATTR_MSS_THROTTLE_CONTROL_RAS_WEIGHT, + &i_target_mba, ras_increment); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_THROTTLE_CONTROL_RAS_WEIGHT"); + return rc; + } + rc = FAPI_ATTR_SET(ATTR_MSS_THROTTLE_CONTROL_CAS_WEIGHT, + &i_target_mba, cas_increment); + if (rc) { + FAPI_ERR("Error writing attribute ATTR_MSS_THROTTLE_CONTROL_CAS_WEIGHT"); + return rc; + } FAPI_INF("*** mss_eff_config_thermal_throttles COMPLETE on %s ***", i_target_mba.toEcmdString()); diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.C new file mode 100644 index 000000000..c581cae9a --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.C @@ -0,0 +1,140 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +// $Id: mss_volt_dimm_count.C,v 1.3 2015/04/06 22:33:05 pardeik Exp $ +// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/ +// centaur/working/procedures/ipl/fapi/mss_volt_dimm_count.C,v $ + +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2007 +// *! All Rights Reserved -- Property of IBM +// *! *** *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_dimm_count.C +// *! DESCRIPTION : Tools for centaur procedures +// *! OWNER NAME : Michael Pardeik (pardeik@us.ibm.com) +// *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) +// #! ADDITIONAL COMMENTS : +// +// applicable CQ component memory_screen +// +// DESCRIPTION: +// This procedure takes a vector of Centaurs behind a vmem voltage domain, +// and counts the number of dimms that are present. Only the highest +// number of dimms found under any given vmem power domain will be saved away. +// The array of centaur targets are to be present (configured and deconfigured). +// +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.3 | pardeik | 04/06/15 | attribute name changed for adjustment enable +// 1.2 | pardeik | 03/06/15 | Review update to check l_rc after for loops +// 1.1 | pardeik | 02/17/15 | Initial draft. + + +//---------------------------------------------------------------------- +// Includes - FAPI +//---------------------------------------------------------------------- +#include <fapi.H> +#include <mss_volt_dimm_count.H> + +fapi::ReturnCode mss_volt_dimm_count(std::vector<fapi::Target> & i_targets_memb) +{ + + fapi::ReturnCode l_rc; + uint8_t l_memb_count=0; + uint8_t l_dimm_count=0; + uint8_t l_mrw_reg_power_limit_adj_enable; + uint8_t l_mrw_max_number_dimms_per_reg; + uint8_t l_spd_custom; + uint8_t l_custom_dimm = 0; + uint8_t l_dimm_count_under_reg; + uint8_t l_max_dimm_count_per_reg; + + do { + l_rc = FAPI_ATTR_GET(ATTR_MRW_VMEM_REGULATOR_POWER_LIMIT_PER_DIMM_ADJ_ENABLE, NULL, l_mrw_reg_power_limit_adj_enable); + if (l_rc) break; + if (l_mrw_reg_power_limit_adj_enable == fapi::ENUM_ATTR_MRW_VMEM_REGULATOR_POWER_LIMIT_PER_DIMM_ADJ_ENABLE_TRUE) + { + l_rc = FAPI_ATTR_GET(ATTR_MRW_MAX_NUMBER_DIMMS_POSSIBLE_PER_VMEM_REGULATOR, NULL, l_mrw_max_number_dimms_per_reg); + if (l_rc) break; + l_rc = FAPI_ATTR_GET(ATTR_MSS_VMEM_REGULATOR_MAX_DIMM_COUNT, NULL, l_max_dimm_count_per_reg); + if (l_rc) break; + + // Iterate through the list of centaurs (configured and deconfigured) + for (uint32_t i=0; i < i_targets_memb.size(); i++) + { + l_memb_count++; + std::vector<fapi::Target> l_mbaChiplets; + // Get associated MBA's on this centaur + l_rc=fapiGetChildChiplets(i_targets_memb[i], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets, fapi::TARGET_STATE_PRESENT); + if (l_rc) break; + // Loop through the 2 MBA's + for (uint32_t j=0; j < l_mbaChiplets.size(); j++) + { + l_dimm_count++; + std::vector<fapi::Target> l_dimm_targets; + // Get a vector of DIMM targets + l_rc = fapiGetAssociatedDimms(l_mbaChiplets[j], l_dimm_targets, fapi::TARGET_STATE_PRESENT); + if (l_rc) break; + + for (uint32_t k=0; k < l_dimm_targets.size(); k++) + { + l_rc = FAPI_ATTR_GET(ATTR_SPD_CUSTOM, &l_dimm_targets[k], l_spd_custom); + if (l_rc) break; + if (l_spd_custom == fapi::ENUM_ATTR_SPD_CUSTOM_YES) + { + l_custom_dimm=1; + } + } + if (l_rc) break; + } + if (l_rc) break; + } + if (l_rc) break; + + // DIMM count will be number of centaurs for custom dimms + // or number of dimms for non custom dimms + if (l_custom_dimm == 1) + { + l_dimm_count_under_reg = l_memb_count; + } + else + { + l_dimm_count_under_reg = l_dimm_count; + } + FAPI_INF("mss_volt_dimm_count complete: DIMM Count %d/%d", l_dimm_count_under_reg, l_mrw_max_number_dimms_per_reg); + if (l_dimm_count_under_reg > l_max_dimm_count_per_reg) + { + l_rc = FAPI_ATTR_SET(ATTR_MSS_VMEM_REGULATOR_MAX_DIMM_COUNT, NULL, l_dimm_count_under_reg); + if (l_rc) break; + } + } + }while(0); + return(l_rc); +} diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.H b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.H new file mode 100644 index 000000000..21161cdc8 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.H @@ -0,0 +1,70 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_dimm_count.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +// $Id: mss_volt_dimm_count.H,v 1.1 2015/02/17 19:33:58 pardeik Exp $ +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_dimm_count.H +// *! DESCRIPTION : see additional comments below +// *! OWNER NAME : Michael Pardeik Email: pardeik@us.ibm.com +// *! BACKUP NAME : Jacob Sloat Email: jdsloat@us.ibm.com +// *! ADDITIONAL COMMENTS : +// +// Header file for mss_volt_dimm_count. +// +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.1 | pardeik | 02/17/15 | initial drop + +#ifndef MSS_VOLT_DIMM_COUNT_H_ +#define MSS_VOLT_DIMM_COUNT_H_ + +#include <fapi.H> + +typedef fapi::ReturnCode (*mss_volt_dimm_count_FP_t)(std::vector<fapi::Target> &); + +extern "C" +{ + +/** + * @brief mss_volt_dimm_count procedure. Determines number of dimms present behind a voltage domain + * + * @param[in] std::vector<fapi::Target> l_targets Reference to vector of present Centaur Targets in a particular power domain + * + * @return ReturnCode + */ + + fapi::ReturnCode mss_volt_dimm_count(std::vector<fapi::Target> & i_targets_memb); + +} // extern "C" + +#endif // MSS_VOLT_DIMM_COUNT_H_ |