diff options
| -rw-r--r-- | src/usr/htmgt/htmgt_activate.C | 4 | ||||
| -rw-r--r-- | src/usr/htmgt/htmgt_cfgdata.C | 69 | ||||
| -rw-r--r-- | src/usr/htmgt/htmgt_cfgdata.H | 12 |
3 files changed, 53 insertions, 32 deletions
diff --git a/src/usr/htmgt/htmgt_activate.C b/src/usr/htmgt/htmgt_activate.C index f8417d577..528f10aa1 100644 --- a/src/usr/htmgt/htmgt_activate.C +++ b/src/usr/htmgt/htmgt_activate.C @@ -212,9 +212,7 @@ namespace HTMGT { //Make sure this value is between the min & max allowed min = sys->getAttr<ATTR_OPEN_POWER_MIN_POWER_CAP_WATTS>(); - max = sys-> - getAttr<ATTR_OPEN_POWER_N_PLUS_ONE_BULK_POWER_LIMIT_WATTS>(); - + max = getMaxPowerCap(sys); if ((limit != 0) && (limit < min)) { TMGT_INF("sendOccUserPowerCap: User power cap %d is below" diff --git a/src/usr/htmgt/htmgt_cfgdata.C b/src/usr/htmgt/htmgt_cfgdata.C index 604263c4d..75d118b7a 100644 --- a/src/usr/htmgt/htmgt_cfgdata.C +++ b/src/usr/htmgt/htmgt_cfgdata.C @@ -531,32 +531,15 @@ void getOCCRoleMessageData(bool i_master, bool i_firMaster, } -void getPowerCapMessageData(uint8_t* o_data, uint64_t & o_size) +uint16_t getMaxPowerCap(Target *i_sys) { - uint64_t index = 0; - uint16_t pcap = 0; - Target* sys = NULL; - targetService().getTopLevelTarget(sys); - - assert(sys != NULL); - assert(o_data != NULL); - - o_data[index++] = OCC_CFGDATA_PCAP_CONFIG; - o_data[index++] = OCC_CFGDATA_PCAP_CONFIG_VERSION; - - //Minimum Power Cap - pcap = sys->getAttr<ATTR_OPEN_POWER_MIN_POWER_CAP_WATTS>(); - TMGT_INF("getPowerCapMessageData: minimum power cap = %dW", - pcap); - memcpy(&o_data[index], &pcap, 2); - index += 2; - - //System Maximum Power Cap + uint16_t o_maxPcap = 0; bool useDefaultLimit = true; + #ifdef CONFIG_BMC_IPMI // Check if HPC limit was found ATTR_OPEN_POWER_N_PLUS_ONE_HPC_BULK_POWER_LIMIT_WATTS_type hpc_pcap; - if (sys->tryGetAttr + if (i_sys->tryGetAttr <ATTR_OPEN_POWER_N_PLUS_ONE_HPC_BULK_POWER_LIMIT_WATTS>(hpc_pcap)) { if (0 != hpc_pcap) @@ -565,7 +548,7 @@ void getPowerCapMessageData(uint8_t* o_data, uint64_t & o_size) SENSOR::getSensorReadingData redPolicyData; SENSOR::SensorBase redPolicySensor(TARGETING::SENSOR_NAME_REDUNDANT_PS_POLICY, - sys); + i_sys); errlHndl_t err = redPolicySensor.readSensorData(redPolicyData); if (NULL == err) { @@ -576,17 +559,17 @@ void getPowerCapMessageData(uint8_t* o_data, uint64_t & o_size) // with the potential impact of OCC not being able to // lower power fast enough useDefaultLimit = false; - TMGT_INF("getPowerCapMessageData: maximum power cap = %dW" + TMGT_INF("getMaxPowerCap: maximum power cap = %dW" " (HPC/non-redundant PS bulk power limit)", hpc_pcap); - pcap = hpc_pcap; + o_maxPcap = hpc_pcap; } // else redundant policy enabled, use default } else { // error reading policy, commit and use default - TMGT_ERR("getPowerCapMessageData: unable to read power supply" + TMGT_ERR("getMaxPowerCap: unable to read power supply" " redundancy policy sensor, rc=0x%04X", err->reasonCode()); ERRORLOG::errlCommit(err, HTMGT_COMP_ID); @@ -600,11 +583,39 @@ void getPowerCapMessageData(uint8_t* o_data, uint64_t & o_size) if (useDefaultLimit) { // Read the default N+1 bulk power limit (redundant PS policy) - pcap = - sys->getAttr<ATTR_OPEN_POWER_N_PLUS_ONE_BULK_POWER_LIMIT_WATTS>(); - TMGT_INF("getPowerCapMessageData: maximum power cap = %dW " - "(redundant PS bulk power limit)", pcap); + o_maxPcap = i_sys-> + getAttr<ATTR_OPEN_POWER_N_PLUS_ONE_BULK_POWER_LIMIT_WATTS>(); + TMGT_INF("getMaxPowerCap: maximum power cap = %dW " + "(redundant PS bulk power limit)", o_maxPcap); } + + return o_maxPcap; + +} // end getMaxPowerCap() + + +void getPowerCapMessageData(uint8_t* o_data, uint64_t & o_size) +{ + uint64_t index = 0; + uint16_t pcap = 0; + Target* sys = NULL; + targetService().getTopLevelTarget(sys); + + assert(sys != NULL); + assert(o_data != NULL); + + o_data[index++] = OCC_CFGDATA_PCAP_CONFIG; + o_data[index++] = OCC_CFGDATA_PCAP_CONFIG_VERSION; + + //Minimum Power Cap + pcap = sys->getAttr<ATTR_OPEN_POWER_MIN_POWER_CAP_WATTS>(); + TMGT_INF("getPowerCapMessageData: minimum power cap = %dW", + pcap); + memcpy(&o_data[index], &pcap, 2); + index += 2; + + //System Maximum Power Cap + pcap = getMaxPowerCap(sys); memcpy(&o_data[index], &pcap, 2); index += 2; diff --git a/src/usr/htmgt/htmgt_cfgdata.H b/src/usr/htmgt/htmgt_cfgdata.H index 82bbe19c2..f5290bacf 100644 --- a/src/usr/htmgt/htmgt_cfgdata.H +++ b/src/usr/htmgt/htmgt_cfgdata.H @@ -165,6 +165,18 @@ namespace HTMGT /** + * Return the maximum power cap for the system. + * + * Value is read from the MRW based on the Current Power Supply + * Redundancy Policy sensor in the BMC + * + * @param[in] i_sys - pointer to system target + * @returns maximum power cap in watts + */ + uint16_t getMaxPowerCap(TARGETING::Target * i_sys); + + + /** * Fills in the Power Cap Configuration Data message buffer. * * @param[out] o_data - preallocated buffer to fill in |

