diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/htmgt/htmgt.C | 30 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_cfgdata.C | 89 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_cfgdata.H | 12 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_memthrottles.C | 30 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_utility.H | 1 |
5 files changed, 143 insertions, 19 deletions
diff --git a/src/usr/htmgt/htmgt.C b/src/usr/htmgt/htmgt.C index 462c38cce..50006aaa0 100644 --- a/src/usr/htmgt/htmgt.C +++ b/src/usr/htmgt/htmgt.C @@ -727,6 +727,36 @@ namespace HTMGT } break; + case PASSTHRU_OCC_CFG_DATA: + if (i_cmdLength == 3) + { + const uint8_t occInstance = i_cmdData[1]; + const uint8_t format = i_cmdData[2]; + Occ *occPtr = OccManager::getOcc(occInstance); + if (occPtr) + { + TMGT_INF("passThruCommand: OCC%d config format " + "0x%02X", + occInstance, format); + readConfigData(occPtr, format, + o_rspLength, o_rspData); + } + else + { + TMGT_ERR("passThruCommand: Unable to find " + "OCC%d", occInstance); + failingSrc = HTMGT_RC_OCC_UNAVAILABLE; + } + } + else + { + TMGT_ERR("passThruCommand: invalid data length %d", + i_cmdLength); + failingSrc = HTMGT_RC_INVALID_LENGTH; + } + break; + + default: TMGT_ERR("passThruCommand: Invalid command 0x%08X " "(%d bytes)", UINT32_GET(i_cmdData), i_cmdLength); diff --git a/src/usr/htmgt/htmgt_cfgdata.C b/src/usr/htmgt/htmgt_cfgdata.C index 59c6c855e..7ac807e40 100644 --- a/src/usr/htmgt/htmgt_cfgdata.C +++ b/src/usr/htmgt/htmgt_cfgdata.C @@ -475,7 +475,7 @@ void getMemThrottleMessageData(const TargetHandle_t i_occ, //Get all functional MCSs TargetHandleList mcs_list; getAllChiplets(mcs_list, TYPE_MCS, true); - TMGT_INF("calcMemThrottles: found %d MCSs", mcs_list.size()); + TMGT_INF("getMemThrottleMessageData: found %d MCSs", mcs_list.size()); o_data[index++] = OCC_CFGDATA_MEM_THROTTLE; o_data[index++] = 0x20; // version; @@ -508,8 +508,8 @@ void getMemThrottleMessageData(const TargetHandle_t i_occ, { uint32_t mcs_huid = 0xFFFFFFFF; mcs_target->tryGetAttr<TARGETING::ATTR_HUID>(mcs_huid); - TMGT_ERR("calcMemThrottles: Unable to determine MCS unit for HUID" - " 0x%04X", mcs_huid); + TMGT_ERR("getMemThrottleMessageData: Unable to determine MCS unit" + " for HUID 0x%04X", mcs_huid); continue; } ConstTargetHandle_t proc_target = getParentChip(mcs_target); @@ -550,7 +550,7 @@ void getMemThrottleMessageData(const TargetHandle_t i_occ, (npm_redun[mca_rel_pos] == 0) || (npm_pcap[mca_rel_pos] == 0)) { - TMGT_ERR("calcMemThrottles: MCS%d/MCA%d [%d]" + TMGT_ERR("getMemThrottleMessageData: MCS%d/MCA%d [%d]" " - Ignored due to null throttle", mcs_unit, mca_unit, mca_rel_pos); TMGT_ERR("N/slot: Min=%d, Turbo=%d, Pcap=%d", @@ -560,13 +560,13 @@ void getMemThrottleMessageData(const TargetHandle_t i_occ, } if (mca_rel_pos >= TMGT_MAX_MCA_PER_MCS) { - TMGT_ERR("calcMemThrottles: OCC%d / MCS%d / MCA%d" + TMGT_ERR("getMemThrottleMessageData: OCC%d / MCS%d / MCA%d" " - Ignored due invalid MCA position: %d", i_occ_instance, mcs_unit, mca_unit, mca_rel_pos); continue; } - TMGT_INF("calcMemThrottles: OCC%d / MCS%d / MCA%d [%d]", - i_occ_instance, mcs_unit, mca_unit, mca_rel_pos); + TMGT_INF("getMemThrottleMessageData: OCC%d / MCS%d / MCA%d [%d]" + , i_occ_instance, mcs_unit, mca_unit, mca_rel_pos); // OCC expects phyMC=0 for (MCS0-1) and 1 for (MCS2-3) // MCS MCA MCA OCC OCC // unit unit relPos phyMC phyPort @@ -1517,4 +1517,79 @@ bool check_wof_support(uint16_t & o_turbo, uint16_t & o_ultra) } // end check_wof_support() +// Debug function to return config format data +void readConfigData(Occ * i_occ, + const uint8_t i_format, + uint16_t & o_cfgDataLength, + uint8_t *o_cfgDataPtr) +{ + uint64_t cfgDataLength = 0; + switch(i_format) + { + case OCC_CFGDATA_FREQ_POINT: + getFrequencyPointMessageData(o_cfgDataPtr, + cfgDataLength); + break; + + case OCC_CFGDATA_OCC_ROLE: + getOCCRoleMessageData(OCC_ROLE_MASTER == + i_occ->getRole(), + OCC_ROLE_FIR_MASTER == + i_occ->getRole(), + o_cfgDataPtr, cfgDataLength); + break; + + case OCC_CFGDATA_APSS_CONFIG: + getApssMessageData(o_cfgDataPtr, cfgDataLength); + break; + + case OCC_CFGDATA_MEM_CONFIG: + getMemConfigMessageData(i_occ->getTarget(), + o_cfgDataPtr, cfgDataLength); + break; + + case OCC_CFGDATA_PCAP_CONFIG: + getPowerCapMessageData(o_cfgDataPtr, cfgDataLength); + break; + + case OCC_CFGDATA_SYS_CONFIG: + getSystemConfigMessageData(i_occ->getTarget(), + o_cfgDataPtr, cfgDataLength); + break; + + case OCC_CFGDATA_MEM_THROTTLE: + { + const uint8_t occInstance = i_occ->getInstance(); + getMemThrottleMessageData(i_occ->getTarget(), + occInstance, o_cfgDataPtr, + cfgDataLength); + } + break; + + case OCC_CFGDATA_TCT_CONFIG: + getThermalControlMessageData(o_cfgDataPtr, + cfgDataLength); + break; + + case OCC_CFGDATA_AVSBUS_CONFIG: + getAVSBusConfigMessageData(i_occ->getTarget(), + o_cfgDataPtr, + cfgDataLength ); + break; + + case OCC_CFGDATA_GPU_CONFIG: + getGPUConfigMessageData(i_occ->getTarget(), + o_cfgDataPtr, + cfgDataLength); + break; + + default: + TMGT_ERR("readConfigData: Unsupported i_format type 0x%02X", + i_format); + } + o_cfgDataLength = cfgDataLength; + +} // end readConfigData() + + } diff --git a/src/usr/htmgt/htmgt_cfgdata.H b/src/usr/htmgt/htmgt_cfgdata.H index d5091257d..84d936dfa 100644 --- a/src/usr/htmgt/htmgt_cfgdata.H +++ b/src/usr/htmgt/htmgt_cfgdata.H @@ -281,5 +281,17 @@ namespace HTMGT * @param[out] ultra Ultra Turbo frequency in MHz (0 = no support) */ bool check_wof_support(uint16_t & turbo, uint16_t & ultra); + + /** + * Fill specified buffer with requested config format data + * @param[in] i_occ OCC object that data is requested + * @param[in] i_format config format being requested + * @param[out] o_cfgDataLength Length of data being returned + * @param[in/out] o_cfgDataPtr Buffer containing config data + */ + void readConfigData(Occ * i_occ, + const uint8_t i_format, + uint16_t & o_cfgDataLength, + uint8_t *o_cfgDataPtr); }; #endif diff --git a/src/usr/htmgt/htmgt_memthrottles.C b/src/usr/htmgt/htmgt_memthrottles.C index cb9dca192..c75175de6 100644 --- a/src/usr/htmgt/htmgt_memthrottles.C +++ b/src/usr/htmgt/htmgt_memthrottles.C @@ -243,14 +243,16 @@ errlHndl_t memPowerThrottleRedPower( power = (power * i_efficiency) / 100; } - //Find the Watt target for each MCS - if (i_fapi_target_list.size()) + //Find the Watt target for each present DIMM + TargetHandleList dimm_list; + getAllLogicalCards(dimm_list, TYPE_DIMM, false); + if (dimm_list.size()) { - wattTarget = power / i_fapi_target_list.size(); + wattTarget = power / dimm_list.size(); } - TMGT_INF("memPowerThrottleRedPower: N+1 power: %dW / %dcW per MCS", - power/100, wattTarget); + TMGT_INF("memPowerThrottleRedPower: N+1 power: %dW / %dcW per DIMM " + "(%d DIMMs)", power/100, wattTarget, dimm_list.size()); //Calculate the throttles err = call_bulk_pwr_throttles(i_fapi_target_list, @@ -258,7 +260,7 @@ errlHndl_t memPowerThrottleRedPower( i_utilization); if (NULL == err) { - G_mem_power_min_throttles = 0; + uint32_t tot_mem_power_cw = 0; for(auto & mcs_fapi_target : i_fapi_target_list) { // Read HWP output parms: @@ -271,8 +273,8 @@ errlHndl_t memPowerThrottleRedPower( mcs_fapi_target, l_port); FAPI_ATTR_GET(fapi2::ATTR_MSS_PORT_MAXPOWER, mcs_fapi_target, l_power); - // Calculate memory power at min throttles (in Watts) - G_mem_power_min_throttles += (l_power[0] + l_power[1])/100; + // Calculate memory power at min throttles + tot_mem_power_cw += l_power[0] + l_power[1]; // Update MCS data (to be sent to OCC) TARGETING::Target * mcs_target = @@ -292,6 +294,8 @@ errlHndl_t memPowerThrottleRedPower( occ_instance, mcs_unit, l_slot[0], l_slot[1], l_port[0], l_port[1], l_power[0], l_power[1]); } + // Convert memory power to Watts + G_mem_power_min_throttles = tot_mem_power_cw / 100; TMGT_INF("memPowerThrottleRedPower: Total Redundant Memory Power: %dW", G_mem_power_min_throttles); } @@ -330,7 +334,7 @@ errlHndl_t memPowerThrottlePowercap( } if (NULL == err) { - G_mem_power_max_throttles = 0; + uint32_t tot_mem_power_cw = 0; for(auto & mcs_fapi_target : i_fapi_target_list) { TARGETING::Target * mcs_target = @@ -383,8 +387,8 @@ errlHndl_t memPowerThrottlePowercap( mcs_target->setAttr<ATTR_POWERCAP_N_PER_MBA>(l_slot); mcs_target->setAttr<ATTR_POWERCAP_N_PER_CHIP>(l_port); mcs_target->setAttr<ATTR_POWERCAP_MEM_POWER>(l_power); - // Calculate memory power at max throttles (in Watts) - G_mem_power_max_throttles += (l_power[0] + l_power[1]) / 100; + // Calculate memory power at max throttles + tot_mem_power_cw += l_power[0] + l_power[1]; // Trace Results TMGT_INF("memPowerThrottlePowercap: PCAP: OCC%d/MCS%d - " @@ -392,6 +396,8 @@ errlHndl_t memPowerThrottlePowercap( occ_instance, mcs_unit, l_slot[0], l_slot[1], l_port[0], l_port[1], l_power[0], l_power[1]); } + // Convert memory power to Watts + G_mem_power_max_throttles = tot_mem_power_cw / 100; TMGT_INF("memPowerThrottlePowercap: Total PowerCap Memory" " Power: %dW (@max throttles)", G_mem_power_max_throttles); } @@ -529,7 +535,7 @@ errlHndl_t calcMemThrottles() assert(proc_target != nullptr); occ_instance = proc_target->getAttr<TARGETING::ATTR_POSITION>(); TMGT_INF("calcMemThrottles: OCC%d, MCS%d HUID:0x%08X has %d" - " functional MCSs", + " functional MCAs", occ_instance, mcs_unit, mcs_huid, mca_list.size()); // Convert to FAPI target and add to list diff --git a/src/usr/htmgt/htmgt_utility.H b/src/usr/htmgt/htmgt_utility.H index 3b4606c35..b773d624b 100644 --- a/src/usr/htmgt/htmgt_utility.H +++ b/src/usr/htmgt/htmgt_utility.H @@ -173,6 +173,7 @@ namespace HTMGT //HOLD for future need. PASSTHRU_QUERY_MODE_FUNCTION = 0x07, PASSTHRU_ENA_DIS_OPAL_STATE = 0x08, PASSTHRU_SET_OCC_STATE = 0x09, + PASSTHRU_OCC_CFG_DATA = 0x0C, }; enum htmgtAttrName |