diff options
author | Andres Lugo-Reyes <aalugore@us.ibm.com> | 2016-10-04 14:43:01 -0500 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2016-12-09 11:23:15 -0500 |
commit | d311df36656590b7f9a0dd674e81e2e87b4952f4 (patch) | |
tree | 1c5b7491ffab69fb567e9fa79532d73afa8b202f | |
parent | 1074ed361ea8d975e5eb330046c64077d229404f (diff) | |
download | talos-hostboot-d311df36656590b7f9a0dd674e81e2e87b4952f4.tar.gz talos-hostboot-d311df36656590b7f9a0dd674e81e2e87b4952f4.zip |
HTMGT: OCC Initialization
Contains the changes for p9 OCC init. Mostly
a port from p8. New cmd/rsp buffers and data format
for packets. This commit also makes HTMGT fapi2
compatible.
Change-Id: I6182163e569ac97f06e3ddfbb69deab90e849de3
RTC:133945
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31010
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christopher J. Cain <cjcain@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
-rw-r--r-- | src/include/usr/occ/occAccess.H | 1 | ||||
-rw-r--r-- | src/usr/htmgt/genPstate.C | 188 | ||||
-rw-r--r-- | src/usr/htmgt/genPstate.H | 51 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt.C | 344 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_activate.C | 2 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_cfgdata.C | 869 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_cfgdata.H | 35 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_common.mk | 5 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_memthrottles.C | 68 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_occ.C | 159 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_occ.H | 1 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_occcmd.C | 31 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_occcmd.H | 8 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_poll.C | 17 | ||||
-rw-r--r-- | src/usr/htmgt/htmgt_poll.H | 5 | ||||
-rw-r--r-- | src/usr/htmgt/test/htmgtcfgtest.H | 26 | ||||
-rw-r--r-- | src/usr/htmgt/test/pstatetest.H | 205 | ||||
-rw-r--r-- | src/usr/ipmi/ipmisensor.C | 2 | ||||
-rw-r--r-- | src/usr/makefile | 2 | ||||
-rw-r--r-- | src/usr/targeting/common/xmltohb/attribute_types_hb.xml | 9 |
20 files changed, 677 insertions, 1351 deletions
diff --git a/src/include/usr/occ/occAccess.H b/src/include/usr/occ/occAccess.H index bed2d7559..30519a89b 100644 --- a/src/include/usr/occ/occAccess.H +++ b/src/include/usr/occ/occAccess.H @@ -28,7 +28,6 @@ #include <config.h> #include <errl/errlentry.H> #include <targeting/common/commontargeting.H> -#include <fapi.H> namespace HBOCC { diff --git a/src/usr/htmgt/genPstate.C b/src/usr/htmgt/genPstate.C deleted file mode 100644 index 7ceb6de5d..000000000 --- a/src/usr/htmgt/genPstate.C +++ /dev/null @@ -1,188 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/htmgt/genPstate.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2016 */ -/* [+] 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 */ -#include "genPstate.H" -#include "htmgt_utility.H" -#include <htmgt/htmgt_reasoncodes.H> -#include <assert.h> - -// Targeting support -#include <targeting/common/commontargeting.H> -#include <targeting/common/utilFilter.H> -#include <targeting/common/attributes.H> -#include <targeting/common/targetservice.H> - -// occ hwp support -#include <freqVoltageSvc.H> -#include <pstates.h> - -using namespace TARGETING; - -namespace HTMGT -{ -errlHndl_t genPstateTables(bool i_normalTables) -{ - errlHndl_t err = NULL; - - // pstate table attribute must be big enough to hold the pstate structure - CPPASSERT(sizeof(ATTR_PSTATE_TABLE_type) >= sizeof(PstateSuperStructure)); - // normal and mfg pstate tables are the same size - CPPASSERT(sizeof(ATTR_PSTATE_TABLE_type) == - sizeof(ATTR_PSTATE_TABLE_MFG_type)); - - TargetHandleList processors; - - getChipResources(processors, - TYPE_PROC, - UTIL_FILTER_FUNCTIONAL); - - for(TargetHandleList::const_iterator - procItr = processors.begin(); - procItr != processors.end(); - ++procItr) - { - Target * procTarget = *procItr; - - TargetHandleList occs; - getChildChiplets(occs, - procTarget, - TYPE_OCC, - true); - - if(occs.size() > 0) - { - const char * tableType = i_normalTables?"normal":"mfg"; - PstateSuperStructure pstate_data; - Target * occTarget = occs[0]; - ATTR_HUID_type huid = occTarget->getAttr<ATTR_HUID>(); - - TMGT_INF("genPstateTables: Building %s pstate tables for " - "huid 0x%x", tableType, huid); - - err = FREQVOLTSVC::runP8BuildPstateDataBlock( procTarget, - &pstate_data); - - if(err) - { - TMGT_ERR( "genPstateTables: Failed to" - " generate PSTATE data for OCC " - "(huid=%x).", - huid - ); - - // collectTrace is called by the calling routine (htmgt.C). - break; - - } - else - { - TMGT_INF("genPstateTables: %s pstate tables completed for " - "huid 0x%x", tableType, huid); - if (i_normalTables) - { - ATTR_PSTATE_TABLE_type * pstateData = - reinterpret_cast<ATTR_PSTATE_TABLE_type*> - (&pstate_data); - - occTarget->setAttr<ATTR_PSTATE_TABLE>(*pstateData); - } - else - { - ATTR_PSTATE_TABLE_MFG_type * pstateData = - reinterpret_cast<ATTR_PSTATE_TABLE_MFG_type*> - (&pstate_data); - - occTarget->setAttr<ATTR_PSTATE_TABLE_MFG>(*pstateData); - } - } - } - } - return err; -} - - -bool getPstateTable(const bool i_normalTables, - const uint8_t i_proc, - uint16_t & o_dataLen, - uint8_t * o_dataPtr) -{ - bool copied = false; - - TargetHandleList processors; - getChipResources(processors, - TYPE_PROC, - UTIL_FILTER_FUNCTIONAL); - for(TargetHandleList::const_iterator - procItr = processors.begin(); - procItr != processors.end(); - ++procItr) - { - Target * procTarget = *procItr; - const uint8_t procInstance = - procTarget->getAttr<TARGETING::ATTR_POSITION>(); - if (i_proc == procInstance) - { - const uint8_t l_occ = 0; - TargetHandleList occs; - getChildChiplets(occs, - procTarget, - TYPE_OCC, - true); - Target * occTarget = occs[l_occ]; - ATTR_HUID_type huid = occTarget->getAttr<ATTR_HUID>(); - // Read data from attribute for specified occ - if (i_normalTables) - { - TMGT_INF("Dumping PStateTable for Proc%d OCC%d (HUID 0x%08X)", - i_proc, l_occ, huid); - ATTR_PSTATE_TABLE_type * pstateDataPtr = - reinterpret_cast<ATTR_PSTATE_TABLE_type*>(o_dataPtr); - - occTarget->tryGetAttr<ATTR_PSTATE_TABLE>(*pstateDataPtr); - o_dataLen = sizeof(ATTR_PSTATE_TABLE_type); - copied = true; - } - else - { - TMGT_INF("Dumping MFG PStateTable for Proc%d OCC%d" - " (HUID 0x%08X)", i_proc, l_occ, huid); - ATTR_PSTATE_TABLE_MFG_type * pstateDataPtr = - reinterpret_cast<ATTR_PSTATE_TABLE_MFG_type*>(o_dataPtr); - - occTarget->tryGetAttr<ATTR_PSTATE_TABLE_MFG>(*pstateDataPtr); - o_dataLen = sizeof(ATTR_PSTATE_TABLE_MFG_type); - copied = true; - } - - // Just dump for first OCC - break; - } - } - - return copied; - -} // end getPstateTable() - - -}; // end namespace diff --git a/src/usr/htmgt/genPstate.H b/src/usr/htmgt/genPstate.H deleted file mode 100644 index 46512d4a9..000000000 --- a/src/usr/htmgt/genPstate.H +++ /dev/null @@ -1,51 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/htmgt/genPstate.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,2016 */ -/* [+] 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 */ -#ifndef GENPSTATE_H -#define GENPSTATE_H - -#include<errl/errlentry.H> - -namespace HTMGT -{ - -/** - * @brief Build the pstate tables - * @post Sets pstate table data into PSTATE_TABLE attribute for each OCC. - * @note Attributes will not be written if the corresponding pstate table - * could not be generated. - * @note this function is only available at IPL time - * @param[in] i_normalTables true to generate normal pstate tables - * false to generate mfg pstate tables - * @return error log handle on error, otherwise NULL - */ -errlHndl_t genPstateTables(bool i_normalTables); - -bool getPstateTable(const bool i_normalTables, - const uint8_t i_proc, - uint16_t & o_dataLen, - uint8_t * o_dataPtr); - -}; -#endif diff --git a/src/usr/htmgt/htmgt.C b/src/usr/htmgt/htmgt.C index a7895ee65..7f49a9f40 100644 --- a/src/usr/htmgt/htmgt.C +++ b/src/usr/htmgt/htmgt.C @@ -28,7 +28,6 @@ #include "htmgt_activate.H" #include "htmgt_cfgdata.H" #include "htmgt_utility.H" -#include "genPstate.H" #include "htmgt_memthrottles.H" #include "htmgt_poll.H" #include <devicefw/userif.H> @@ -78,13 +77,6 @@ namespace HTMGT do { #ifndef __HOSTBOOT_RUNTIME - // Build normal pstate tables (once per IPL) - l_err = genPstateTables(true); - if(l_err) - { - break; - } - // Calc memory throttles (once per IPL) calcMemThrottles(); #endif @@ -506,16 +498,6 @@ namespace HTMGT // } //} } - else if ((i_data[0] == ATTR_PSTATE) || (i_data[0] == ATTR_PSTATE_MFG)) - { - uint8_t selectedOcc = 0; - if (i_length >= 2) - { - selectedOcc = i_data[1]; - } - getPstateTable((i_data[0] == ATTR_PSTATE), - selectedOcc, o_attrLength, o_attrData); - } else { TMGT_ERR("dumpAttribute: Invalid attribute specified 0x%02X " @@ -542,223 +524,171 @@ namespace HTMGT htmgtReasonCode failingSrc = HTMGT_RC_NO_ERROR; o_rspLength = 0; - if ((i_cmdLength > 0) && (NULL != i_cmdData)) + err = OccManager::buildOccs(); + if (NULL == err) { - switch (i_cmdData[0]) + if ((i_cmdLength > 0) && (NULL != i_cmdData)) { - case PASSTHRU_OCC_STATUS: - TMGT_INF("passThruCommand: OCC Status"); - OccManager::getOccData(o_rspLength, o_rspData); - break; + switch (i_cmdData[0]) + { + case PASSTHRU_OCC_STATUS: + TMGT_INF("passThruCommand: OCC Status"); + OccManager::getOccData(o_rspLength, o_rspData); + break; - case PASSTHRU_GENERATE_MFG_PSTATE: - if (i_cmdLength == 1) - { - TMGT_INF("passThruCommand: Generate MFG pstate tables", - i_cmdData[1]); - err = genPstateTables(false); - } - else - { - TMGT_ERR("passThruCommand: invalid generate pstate " - "command length %d", i_cmdLength); - /*@ - * @errortype - * @reasoncode HTMGT_RC_INVALID_LENGTH - * @moduleid HTMGT_MOD_PASS_THRU - * @userdata1 command data[0-7] - * @userdata2 command data length - * @devdesc Invalid pass thru command data length - */ - failingSrc = HTMGT_RC_INVALID_LENGTH; - } - break; - case PASSTHRU_LOAD_PSTATE: - if (i_cmdLength == 2) - { - const uint8_t pstateType = i_cmdData[1]; - if ((0 == pstateType) || (1 == pstateType)) + case PASSTHRU_INTERNAL_FLAG: + if (i_cmdLength == 1) { - TMGT_INF("passThruCommand: Load pstate tables " - "(type: %d)", pstateType); - // 0 = Normal Pstate Tables - err = OccManager::loadPstates(0 == pstateType); + // get internal flag value + o_rspLength = 4; + UINT32_PUT(o_rspData, get_int_flags()); + } + else if (i_cmdLength == 5) + { + // set internal flag value + TMGT_INF("passThruCommand: Updating internal flags " + "from 0x%08X to 0x%08X", + get_int_flags(), UINT32_GET(&i_cmdData[1])); + set_int_flags(UINT32_GET(&i_cmdData[1])); } else { - TMGT_ERR("passThruCommand: invalid pstate type " - "specified: %d", pstateType); - /*@ - * @errortype - * @reasoncode HTMGT_RC_INVALID_PARAMETER - * @moduleid HTMGT_MOD_PASS_THRU - * @userdata1 command data[0-7] - * @userdata2 command data length - * @devdesc Invalid load pstate table type - */ - failingSrc = HTMGT_RC_INVALID_PARAMETER; + TMGT_ERR("passThruCommand: invalid internal flag " + "length %d", i_cmdLength); + failingSrc = HTMGT_RC_INVALID_LENGTH; } - } - else - { - TMGT_ERR("passThruCommand: invalid load pstate " - "command length %d", i_cmdLength); - failingSrc = HTMGT_RC_INVALID_LENGTH; - } - break; + break; - case PASSTHRU_INTERNAL_FLAG: - if (i_cmdLength == 1) - { - // get internal flag value - o_rspLength = 4; - UINT32_PUT(o_rspData, get_int_flags()); - } - else if (i_cmdLength == 5) - { - // set internal flag value - TMGT_INF("passThruCommand: Updating internal flags " - "from 0x%08X to 0x%08X", - get_int_flags(), UINT32_GET(&i_cmdData[1])); - set_int_flags(UINT32_GET(&i_cmdData[1])); - } - else - { - TMGT_ERR("passThruCommand: invalid internal flag " - "length %d", i_cmdLength); - failingSrc = HTMGT_RC_INVALID_LENGTH; - } - break; - - case PASSTHRU_SEND_OCC_COMMAND: - if (i_cmdLength >= 3) - { - const uint8_t occInstance = i_cmdData[1]; - const occCommandType occCmd = - (occCommandType)i_cmdData[2]; - const uint16_t dataLen = i_cmdLength-3; - Occ *occPtr = OccManager::getOcc(occInstance); - if (occPtr) + case PASSTHRU_SEND_OCC_COMMAND: + if (i_cmdLength >= 3) { - TMGT_INF("passThruCommand: Send OCC%d command " - "0x%02X (%d bytes)", - occInstance, occCmd, dataLen); - OccCmd cmd(occPtr, occCmd, dataLen, &i_cmdData[3]); - err = cmd.sendOccCmd(); - if (err != NULL) + const uint8_t occInstance = i_cmdData[1]; + const occCommandType occCmd = + (occCommandType)i_cmdData[2]; + const uint16_t dataLen = i_cmdLength-3; + Occ *occPtr = OccManager::getOcc(occInstance); + if (occPtr) { - TMGT_ERR("passThruCommand: OCC%d cmd 0x%02X " - "failed with rc 0x%04X", - occInstance, occCmd, - err->reasonCode()); + TMGT_INF("passThruCommand: Send OCC%d command " + "0x%02X (%d bytes)", + occInstance, occCmd, dataLen); + OccCmd cmd(occPtr, occCmd, dataLen, &i_cmdData[3]); + err = cmd.sendOccCmd(); + if (err != NULL) + { + TMGT_ERR("passThruCommand: OCC%d cmd 0x%02X " + "failed with rc 0x%04X", + occInstance, occCmd, + err->reasonCode()); + } + else + { + uint8_t *rspPtr = NULL; + o_rspLength = cmd.getResponseData(rspPtr); + memcpy(o_rspData, rspPtr, o_rspLength); + TMGT_INF("passThruCommand: OCC%d rsp status " + "0x%02X (%d bytes)", occInstance, + o_rspData[2], o_rspLength); + } } else { - uint8_t *rspPtr = NULL; - o_rspLength = cmd.getResponseData(rspPtr); - memcpy(o_rspData, rspPtr, o_rspLength); - TMGT_INF("passThruCommand: OCC%d rsp status " - "0x%02X (%d bytes)", occInstance, - o_rspData[2], o_rspLength); + TMGT_ERR("passThruCommand: Unable to find OCC%d", + occInstance); + /*@ + * @errortype + * @reasoncode HTMGT_RC_OCC_UNAVAILABLE + * @moduleid HTMGT_MOD_PASS_THRU + * @userdata1 command data[0-7] + * @userdata2 command data length + * @devdesc Specified OCC not available + */ + failingSrc = HTMGT_RC_OCC_UNAVAILABLE; } } else { - TMGT_ERR("passThruCommand: Unable to find OCC%d", - occInstance); - /*@ - * @errortype - * @reasoncode HTMGT_RC_OCC_UNAVAILABLE - * @moduleid HTMGT_MOD_PASS_THRU - * @userdata1 command data[0-7] - * @userdata2 command data length - * @devdesc Specified OCC not available - */ - failingSrc = HTMGT_RC_OCC_UNAVAILABLE; + TMGT_ERR("passThruCommand: invalid OCC command " + "length %d", i_cmdLength); + failingSrc = HTMGT_RC_INVALID_LENGTH; } - } - else - { - TMGT_ERR("passThruCommand: invalid OCC command " - "length %d", i_cmdLength); - failingSrc = HTMGT_RC_INVALID_LENGTH; - } - break; + break; - case PASSTHRU_CLEAR_RESET_COUNTS: - TMGT_INF("passThruCommand: Clear all OCC reset counts"); - OccManager::clearResetCounts(); - break; - - case PASSTHRU_EXIT_SAFE_MODE: - { - TMGT_INF("passThruCommand: Clear Safe Mode"); - // Clear OCC reset counts and failed flags + case PASSTHRU_CLEAR_RESET_COUNTS: + TMGT_INF("passThruCommand: Clear all OCC reset counts"); OccManager::clearResetCounts(); - // Clear safe mode reason - OccManager::updateSafeModeReason(0, 0); - // Clear system safe mode flag/attribute - TARGETING::Target* sys = NULL; - TARGETING::targetService().getTopLevelTarget(sys); - const uint8_t safeMode = 0; - // Mark system as NOT being in safe mode - if(sys) + break; + + case PASSTHRU_EXIT_SAFE_MODE: { - sys->setAttr<TARGETING::ATTR_HTMGT_SAFEMODE> - (safeMode); + TMGT_INF("passThruCommand: Clear Safe Mode"); + // Clear OCC reset counts and failed flags + OccManager::clearResetCounts(); + // Clear safe mode reason + OccManager::updateSafeModeReason(0, 0); + // Clear system safe mode flag/attribute + TARGETING::Target* sys = NULL; + TARGETING::targetService().getTopLevelTarget(sys); + const uint8_t safeMode = 0; + // Mark system as NOT being in safe mode + if(sys) + { + sys->setAttr<TARGETING::ATTR_HTMGT_SAFEMODE> + (safeMode); + } + // Reset the OCCs (do not increment reset count + // or attempt comm with OCC since they are in reset) + TMGT_INF("passThruCommand: Calling resetOccs"); + err = OccManager::resetOccs(NULL, true, true); + if (err != NULL) + { + TMGT_ERR("passThruCommand: resetOccs failed " + "with rc 0x%04X", err->reasonCode()); + } } - // Reset the OCCs (do not increment reset count - // or attempt comm with OCC since they are in reset) - TMGT_INF("passThruCommand: Calling resetOccs"); - err = OccManager::resetOccs(NULL, true, true); - if (err != NULL) + break; + + case PASSTHRU_DUMP_ATTRIBUTE: + if (i_cmdLength >= 2) { - TMGT_ERR("passThruCommand: resetOccs failed " - "with rc 0x%04X", err->reasonCode()); + TMGT_INF("passThruCommand: Dump Attribute 0x%02X", + i_cmdData[1]); + err = dumpAttribute(i_cmdLength-1, &i_cmdData[1], + o_rspLength, o_rspData); } - } - break; + else + { + TMGT_ERR("passThruCommand: invalid dump attribute " + "command length %d", i_cmdLength); + failingSrc = HTMGT_RC_INVALID_LENGTH; + } + break; - case PASSTHRU_DUMP_ATTRIBUTE: - if (i_cmdLength >= 2) - { - TMGT_INF("passThruCommand: Dump Attribute 0x%02X", - i_cmdData[1]); - err = dumpAttribute(i_cmdLength-1, &i_cmdData[1], - o_rspLength, o_rspData); - } - else - { - TMGT_ERR("passThruCommand: invalid dump attribute " - "command 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); - /*@ - * @errortype - * @reasoncode HTMGT_RC_INVALID_DATA - * @moduleid HTMGT_MOD_PASS_THRU - * @userdata1 command data[0-7] - * @userdata2 command data length - * @devdesc Invalid pass thru command - */ - failingSrc = HTMGT_RC_INVALID_DATA; - break; - } + default: + TMGT_ERR("passThruCommand: Invalid command 0x%08X " + "(%d bytes)", UINT32_GET(i_cmdData), i_cmdLength); + /*@ + * @errortype + * @reasoncode HTMGT_RC_INVALID_DATA + * @moduleid HTMGT_MOD_PASS_THRU + * @userdata1 command data[0-7] + * @userdata2 command data length + * @devdesc Invalid pass thru command + */ + failingSrc = HTMGT_RC_INVALID_DATA; + break; + } - if ((HTMGT_RC_NO_ERROR != failingSrc) && (NULL == err)) - { - bldErrLog(err, HTMGT_MOD_PASS_THRU, - failingSrc, - UINT32_GET(i_cmdData), - UINT32_GET(&i_cmdData[4]), - 0, i_cmdLength, - ERRORLOG::ERRL_SEV_INFORMATIONAL); + if ((HTMGT_RC_NO_ERROR != failingSrc) && (NULL == err)) + { + bldErrLog(err, HTMGT_MOD_PASS_THRU, + failingSrc, + UINT32_GET(i_cmdData), + UINT32_GET(&i_cmdData[4]), + 0, i_cmdLength, + ERRORLOG::ERRL_SEV_INFORMATIONAL); + } } } diff --git a/src/usr/htmgt/htmgt_activate.C b/src/usr/htmgt/htmgt_activate.C index 528f10aa1..a581596a4 100644 --- a/src/usr/htmgt/htmgt_activate.C +++ b/src/usr/htmgt/htmgt_activate.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ diff --git a/src/usr/htmgt/htmgt_cfgdata.C b/src/usr/htmgt/htmgt_cfgdata.C index bdd530b28..80dfa0729 100644 --- a/src/usr/htmgt/htmgt_cfgdata.C +++ b/src/usr/htmgt/htmgt_cfgdata.C @@ -29,10 +29,8 @@ #include "htmgt_utility.H" #include "htmgt_poll.H" #include "ipmi/ipmisensor.H" -#include "fapiPlatAttributeService.H" #include <htmgt/htmgt_reasoncodes.H> - - +#include <fapi2_attribute_service.H> using namespace TARGETING; @@ -43,11 +41,6 @@ using namespace TARGETING; namespace HTMGT { - void getWofCoreFrequencyData(const TargetHandle_t i_occ, - uint8_t* o_data, - uint64_t & o_size); - void getWofVrmEfficiencyData(uint8_t* o_data, - uint64_t & o_size); bool G_wofSupported = true; @@ -134,12 +127,6 @@ namespace HTMGT cmdDataLen = OCC_MAX_DATA_LENGTH; switch(format) { - case OCC_CFGDATA_PSTATE_SSTRUCT: - getPstateTableMessageData(occ->getTarget(), - cmdData, - cmdDataLen); - break; - case OCC_CFGDATA_FREQ_POINT: getFrequencyPointMessageData(cmdData, cmdDataLen); @@ -162,11 +149,6 @@ namespace HTMGT cmdData, cmdDataLen); break; - case OCC_CFGDATA_FIR_SCOMS: - TMGT_ERR("NO FIR SCOMS AVAILABLE YET"); - cmdDataLen = 0; - break; - case OCC_CFGDATA_PCAP_CONFIG: getPowerCapMessageData(cmdData, cmdDataLen); break; @@ -186,15 +168,14 @@ namespace HTMGT cmdDataLen); break; - case OCC_CFGDATA_WOF_CORE_FREQ: - getWofCoreFrequencyData(occ->getTarget(), - cmdData, cmdDataLen); - break; - - case OCC_CFGDATA_WOF_VRM_EFF: - getWofVrmEfficiencyData(cmdData, cmdDataLen); + /* @TODO Uncomment once OCC support is there + * AVSBus Support RTC: 137620 + case OCC_CFGDATA_AVSBUS_CONFIG: + getAVSBusConfigMessageData( occ->getTarget(), + cmdData, + cmdDataLen ); break; - + */ default: TMGT_ERR("sendOccConfigData: Unsupported" " format type 0x%02X", @@ -210,7 +191,7 @@ namespace HTMGT OccCmd cmd(occ, OCC_CMD_SETUP_CFG_DATA, cmdDataLen, cmdData); errlHndl_t l_err = cmd.sendOccCmd(); - if (l_err != NULL) + if (l_err != nullptr) { TMGT_ERR("sendOccConfigData: OCC%d cfg " "format 0x%02X failed with rc=0x%04X", @@ -255,25 +236,69 @@ namespace HTMGT /** OCC configuration data message versions */ enum occCfgDataVersion { - OCC_CFGDATA_PSTATE_VERSION = 0x10, - OCC_CFGDATA_FREQ_POINT_VERSION = 0x11, - OCC_CFGDATA_APSS_VERSION = 0x10, - OCC_CFGDATA_MEM_CONFIG_VERSION = 0x10, - OCC_CFGDATA_PCAP_CONFIG_VERSION = 0x10, - OCC_CFGDATA_SYS_CONFIG_VERSION = 0x10, - OCC_CFGDATA_MEM_THROTTLE_VERSION = 0x10, - OCC_CFGDATA_TCT_CONFIG_VERSION = 0x10, - OCC_CFGDATA_WOF_CORE_FREQ_VERSION = 0x10, - OCC_CFGDATA_WOF_VRM_EFF_VERSION = 0x10 + OCC_CFGDATA_FREQ_POINT_VERSION = 0x20, + OCC_CFGDATA_APSS_VERSION = 0x20, + OCC_CFGDATA_MEM_CONFIG_VERSION = 0x20, + OCC_CFGDATA_PCAP_CONFIG_VERSION = 0x20, + OCC_CFGDATA_SYS_CONFIG_VERSION = 0x20, + OCC_CFGDATA_MEM_THROTTLE_VERSION = 0x20, + OCC_CFGDATA_TCT_CONFIG_VERSION = 0x20, + OCC_CFGDATA_AVSBUS_CONFIG_VERSION = 0X01, }; + +// Utility function for writing Memory Config data +void writeMemConfigData( uint8_t *& o_data, + TARGETING::Target * i_target, + TARGETING::SENSOR_NAME i_sensorState, + TARGETING::SENSOR_NAME i_sensorTemp, + uint8_t i_centPos, + uint8_t i_dimmPos, + uint8_t i_i2cPort, + uint8_t i_i2cDevAddr, + uint64_t & io_index ) +{ + + // Hardware Sensor ID + uint32_t l_sensor = UTIL::getSensorNumber( i_target, + i_sensorState ); + size_t l_dataSize = sizeof(l_sensor); + + memcpy(&o_data[io_index], + reinterpret_cast<uint8_t*>(&l_sensor), + l_dataSize); + io_index += l_dataSize; + + // Temperature Sensor ID + l_sensor = UTIL::getSensorNumber( i_target, + i_sensorTemp ); + memcpy(&o_data[io_index], + reinterpret_cast<uint8_t*>(&l_sensor), + l_dataSize); + io_index += l_dataSize; + + // Centaur # + o_data[io_index++] = i_centPos; + + // DIMM # (0xFF if i_target is centaur) + o_data[io_index++] = i_dimmPos; + + // DIMM i2c port (0 or 1) - Reserved for Cumulus + o_data[io_index++] = i_i2cPort; + + // DIMM Temp i2c address - Reserved for Cumulus + o_data[io_index++] = i_i2cDevAddr; + +} + + void getMemConfigMessageData(const TargetHandle_t i_occ, bool i_monitoringEnabled, uint8_t* o_data, uint64_t & o_size) { uint64_t index = 0; - assert(o_data != NULL); + assert(o_data != nullptr); o_data[index++] = OCC_CFGDATA_MEM_CONFIG; o_data[index++] = OCC_CFGDATA_MEM_CONFIG_VERSION; @@ -292,107 +317,151 @@ void getMemConfigMessageData(const TargetHandle_t i_occ, TargetHandleList centaurs; TargetHandleList mbas; TargetHandleList dimms; - TargetHandleList::const_iterator centaur; - TargetHandleList::const_iterator mba; - TargetHandleList::const_iterator dimm; uint8_t centPos = 0; uint8_t dimmPos = 0; uint8_t numSets = 0; - uint16_t sensor = 0; - ConstTargetHandle_t proc = getParentChip(i_occ); - assert(proc != NULL); - getChildAffinityTargets(centaurs, proc, CLASS_CHIP, TYPE_MEMBUF); + ConstTargetHandle_t proc = getParentChip(i_occ); + assert(proc != nullptr); - TRACUCOMP("Proc 0x%X has %d centaurs", - proc->getAttr<ATTR_HUID>(), - centaurs.size()); + // Save Processor Model for later + ATTR_MODEL_type l_procModel = proc->getAttr<ATTR_MODEL>(); - for (centaur=centaurs.begin(); centaur!=centaurs.end(); ++centaur) + if( l_procModel == MODEL_CUMULUS ) { - numSets++; - - //Do the entry for the Centaur itself - - //Reserved - memset(&o_data[index], 0, 4); - index += 4; - - //Hardware Sensor ID - sensor = UTIL::getSensorNumber(*centaur, - SENSOR_NAME_MEMBUF_STATE); - memcpy(&o_data[index], &sensor, 2); - index += 2; + getChildAffinityTargets(centaurs, proc, CLASS_CHIP, TYPE_MEMBUF); - //Temperature Sensor ID - sensor = UTIL::getSensorNumber(*centaur, - SENSOR_NAME_MEMBUF_TEMP); - memcpy(&o_data[index], &sensor, 2); - index += 2; + TRACUCOMP("Proc 0x%X has %d centaurs", + proc->getAttr<ATTR_HUID>(), + centaurs.size()); - //Centaur # - centPos = (*centaur)->getAttr<ATTR_POSITION>(); - // ATTR_POSITION is system wide. Must be 0-7 on each OCC - centPos = centPos % 8; - o_data[index++] = centPos; - //Dimm # (0xFF since a centaur) - o_data[index++] = 0xFF; - - //Reserved - memset(&o_data[index], 0, 2); - index += 2; - - - mbas.clear(); - getChildAffinityTargets(mbas, *centaur, - CLASS_UNIT, TYPE_MBA); - - for (mba=mbas.begin(); mba!=mbas.end(); ++mba) + for ( const auto & centaur : centaurs ) { - dimms.clear(); - getChildAffinityTargets(dimms, *mba, - CLASS_LOGICAL_CARD, TYPE_DIMM); + numSets++; + + // TODO: RTC 163359 - OCC centaur support + // Get the Centaur position + centPos = centaur->getAttr<ATTR_POSITION>(); + // ATTR_POSISTION is system wide. Must be 0-7 on each OCC + centPos = centPos%8; + + //Do the entry for the Centaur itself + writeMemConfigData( o_data, + centaur, + SENSOR_NAME_MEMBUF_STATE, + SENSOR_NAME_MEMBUF_TEMP, + centPos, + 0xFF, //0xFF since a centaur + 0, //Reserved for CUMULUS + 0, //" " + index ); + + + mbas.clear(); + getChildAffinityTargets(mbas, centaur, + CLASS_UNIT, TYPE_MBA); + + for ( const auto & mba : mbas ) + { + dimms.clear(); + getChildAffinityTargets(dimms, mba, + CLASS_LOGICAL_CARD, TYPE_DIMM); - TRACUCOMP("MBA 0x%X has %d DIMMs", - (*mba)->getAttr<ATTR_HUID>(), dimms.size()); + TRACUCOMP("MBA 0x%X has %d DIMMs", + mba->getAttr<ATTR_HUID>(), dimms.size()); - for (dimm=dimms.begin(); dimm!=dimms.end(); ++dimm) - { - //Fill in the DIMM entry - numSets++; + for ( const auto & dimm : dimms ) + { + numSets++; + + // get the DIMM # + dimmPos = getOCCDIMMPos( mba, dimm ); + + // Fill in the DIMM entry + writeMemConfigData( o_data, + dimm, + SENSOR_NAME_DIMM_STATE, + SENSOR_NAME_DIMM_TEMP, + centPos, + dimmPos, + 0, //Reserved for CUMULUS + 0, //" " + index ); - //Reserved - memset(&o_data[index], 0, 4); - index += 4; + } + } + } + } + else if( l_procModel == MODEL_NIMBUS ) + { + //TODO Sending hard coded data for now until + //ATTR_TEMP_I2C_CONFIG is populated + + //TEMP push in 00dd0002 dddd0002 ff 03 00 34 Data. !!!! + o_data[index++] = 0x00; //Hardware Sensor ID + o_data[index++] = 0xdd; + o_data[index++] = 0x00; + o_data[index++] = 0x02; + o_data[index++] = 0xdd; //Temperature Sensor ID + o_data[index++] = 0xdd; + o_data[index++] = 0x00; + o_data[index++] = 0x02; + o_data[index++] = 0xff; //Nimbus + o_data[index++] = 0x03; //Nimbus PIB I2C Master Engine + o_data[index++] = 0x01; //Nimbus DIMM I2C port + o_data[index++] = 0x34; //Nimbus DIMM Temperature I2C Address + ++numSets ; + //TEMP push in 00dd0000 dddd0000 ff 03 00 30 Data. !!!! + o_data[index++] = 0x00; //Hardware Sensor ID + o_data[index++] = 0xdd; + o_data[index++] = 0x00; + o_data[index++] = 0x00; + o_data[index++] = 0xdd; //Temperature Sensor ID + o_data[index++] = 0xdd; + o_data[index++] = 0x00; + o_data[index++] = 0x00; + o_data[index++] = 0xff; //Nimbus + o_data[index++] = 0x03; //Nimbus PIB I2C Master Engine + o_data[index++] = 0x01; //Nimbus DIMM I2C port + o_data[index++] = 0x30; //Nimbus DIMM Temperature I2C Address + ++numSets ; + +/* + // DIMMs are wired directly to the proc in Nimbus + dimms.clear(); + getChildAffinityTargets( dimms, + proc, + CLASS_LOGICAL_CARD, + TYPE_DIMM ); + + for( const auto & dimm : dimms ) + { + numSets++; - //Hardware Sensor ID - sensor = UTIL::getSensorNumber(*dimm, - SENSOR_NAME_DIMM_STATE); - memcpy(&o_data[index], &sensor, 2); - index += 2; + // Get PIB I2C Master engine for this dimm + ATTR_TEMP_I2C_CONFIG_type tempI2cCfgData = + dimm->getAttr<ATTR_TEMP_I2C_CONFIG>(); - //Temperature Sensor ID - sensor = UTIL::getSensorNumber(*dimm, - SENSOR_NAME_DIMM_TEMP); - memcpy(&o_data[index], &sensor, 2); - index += 2; - //Centaur # - o_data[index++] = centPos; + uint8_t pibI2cMasterEngine = 0x03; - //DIMM # - dimmPos = getOCCDIMMPos(*mba, *dimm); - o_data[index++] = dimmPos; + // Fill in the DIMM entry + writeMemConfigData( o_data, + dimm, + SENSOR_NAME_DIMM_STATE, + SENSOR_NAME_DIMM_TEMP, + 0xFF, // No centaurs in Nimbus + tempI2cCfgData.engine, + tempI2cCfgData.port, + tempI2cCfgData.devAddr, + index ); - //Reserved - memset(&o_data[index], 0, 2); - index += 2; - } } +*/ } TMGT_INF("getMemConfigMessageData: returning %d" @@ -419,80 +488,73 @@ void getMemConfigMessageData(const TargetHandle_t i_occ, void getMemThrottleMessageData(const TargetHandle_t i_occ, uint8_t* o_data, uint64_t & o_size) { - uint8_t centPos = 0; - uint8_t mbaPos = 0; uint8_t numSets = 0; uint64_t index = 0; - uint16_t numerator = 0; ConstTargetHandle_t proc = getParentChip(i_occ); - assert(proc != NULL); - assert(o_data != NULL); + assert(proc != nullptr); + assert(o_data != nullptr); + + TargetHandleList centaurs; o_data[index++] = OCC_CFGDATA_MEM_THROTTLE; o_data[index++] = OCC_CFGDATA_MEM_THROTTLE_VERSION; index++; //Will fill in numSets at the end - - TargetHandleList centaurs; - TargetHandleList mbas; - TargetHandleList::const_iterator centaur; - TargetHandleList::const_iterator mba; - getChildAffinityTargets(centaurs, proc, CLASS_CHIP, TYPE_MEMBUF); //Next, the following format repeats per set/MBA: - //Byte 0: Centaur position 0-7 - //Byte 1: MBA Position 0-1 - //Bytes 2-3: min OT N_PER_MBA - //bytes 4-5: redundant power N_PER_MBA - //bytes 6-7: redundant power N_PER_CHIP - //bytes 8-9: oversubscription N_PER_MBA - //bytes 10-11: oversubscription N_PER_CHIP - - - for (centaur=centaurs.begin(); centaur!=centaurs.end(); ++centaur) + //Byte 0: Cumulus: Centaur position 0-7 + // Nimbus : Memory Controller + //Byte 1: Cumulus: MBA Position 0-1 + // Nimbus : Memory Controller's physical Port # 0-3 + //Bytes 2-3: min N_PER_MBA + //Bytes 4-5: Max mem power with throttle @Min + //Bytes 6-7: Turbo N_PER_MBA + //Bytes 8-9: Turbo N_PER_CHIP + //Bytes 10-11: Max mem power with throttle @Turbo + //Bytes 12-13: Power Capping N_PER_MBA + //Bytes 14-15: Power Capping N_PER_MBA + //Bytes 16-17: Max mem power with throttle @PowerCapping + //Bytes 18-19: Nominal Power N_PER_MBA + //Bytes 20-21: Nominal Power N_PER_CHIP + //Bytes 22-23: Max mem power with throttle @Nominal + //Bytes 24-29: Reserved + + // Hard coding until we can get mem throttle cfg data + for (uint8_t entry = 0; entry < 2; ++entry) { - centPos = (*centaur)->getAttr<ATTR_POSITION>(); - // ATTR_POSITION is system wide. Must 0-7 on each OCC - centPos = centPos % 8; - - mbas.clear(); - getChildAffinityTargets(mbas, *centaur, - CLASS_UNIT, TYPE_MBA); - - for (mba=mbas.begin(); mba!=mbas.end(); ++mba) - { - numSets++; - mbaPos = (*mba)->getAttr<ATTR_CHIP_UNIT>(); - - TRACUCOMP("centPos = %d, mbaPos = %d", - centPos, mbaPos); - - o_data[index++] = centPos; - o_data[index++] = mbaPos; - - numerator = (*mba)->getAttr<ATTR_OT_MIN_N_PER_MBA>(); - memcpy(&o_data[index], &numerator, 2); - index += 2; - - numerator = (*mba)->getAttr<ATTR_N_PLUS_ONE_N_PER_MBA>(); - memcpy(&o_data[index], &numerator, 2); - index += 2; - - numerator = (*mba)->getAttr<ATTR_N_PLUS_ONE_N_PER_CHIP>(); - memcpy(&o_data[index], &numerator, 2); - index += 2; - - numerator = (*mba)->getAttr<ATTR_OVERSUB_N_PER_MBA>(); - memcpy(&o_data[index], &numerator, 2); - index += 2; - - numerator = (*mba)->getAttr<ATTR_OVERSUB_N_PER_CHIP>(); - memcpy(&o_data[index], &numerator, 2); - index += 2; - } - + o_data[index++] = 0x00; //MC01 + o_data[index++] = entry; // Port + o_data[index++] = 0x44; // Min N Per MBA + o_data[index++] = 0x44; + o_data[index++] = 0x01; // Max mem pwr at min throttle + o_data[index++] = 0x00; + o_data[index++] = 0x45; // Turbo N per MBA + o_data[index++] = 0x56; + o_data[index++] = 0x55; // Turbo N per chip + o_data[index++] = 0x5F; + o_data[index++] = 0x01; // Max mem pwr at turbo + o_data[index++] = 0x10; + o_data[index++] = 0x45; // Power capping N per MBA + o_data[index++] = 0x56; + o_data[index++] = 0x55; // Power capping N per chip + o_data[index++] = 0x5F; + o_data[index++] = 0x01; // Max mem pwr at power capping + o_data[index++] = 0x20; + o_data[index++] = 0x45; // Nominal N per MBA + o_data[index++] = 0x56; + o_data[index++] = 0x55; // Nominal N per chip + o_data[index++] = 0x5F; + o_data[index++] = 0x01; // Max mem pwr at Nominal + o_data[index++] = 0x30; + o_data[index++] = 0x00; // reserved - must be non-zero until OCC code updated + o_data[index++] = 0x00; + o_data[index++] = 0x00; + o_data[index++] = 0x00; + o_data[index++] = 0x00; + o_data[index++] = 0x00; + ++numSets ; } @@ -511,7 +573,7 @@ void getMemThrottleMessageData(const TargetHandle_t i_occ, void getOCCRoleMessageData(bool i_master, bool i_firMaster, uint8_t* o_data, uint64_t & o_size) { - assert(o_data != NULL); + assert(o_data != nullptr); o_data[0] = OCC_CFGDATA_OCC_ROLE; @@ -550,7 +612,7 @@ uint16_t getMaxPowerCap(Target *i_sys) redPolicySensor(TARGETING::SENSOR_NAME_REDUNDANT_PS_POLICY, i_sys); errlHndl_t err = redPolicySensor.readSensorData(redPolicyData); - if (NULL == err) + if (nullptr == err) { // 0x02 == Asserted bit (redundant policy is enabled) if ((redPolicyData.event_status & 0x02) == 0x00) @@ -598,28 +660,36 @@ void getPowerCapMessageData(uint8_t* o_data, uint64_t & o_size) { uint64_t index = 0; uint16_t pcap = 0; - Target* sys = NULL; + Target* sys = nullptr; targetService().getTopLevelTarget(sys); - assert(sys != NULL); - assert(o_data != NULL); + assert(sys != nullptr); + assert(o_data != nullptr); o_data[index++] = OCC_CFGDATA_PCAP_CONFIG; o_data[index++] = OCC_CFGDATA_PCAP_CONFIG_VERSION; - //Minimum Power Cap + + // Minimum Soft Power Cap + // Note: BMC does not currently support soft power capping. + // Sending hard power cap instead pcap = sys->getAttr<ATTR_OPEN_POWER_MIN_POWER_CAP_WATTS>(); - TMGT_INF("getPowerCapMessageData: minimum power cap = %dW", + TMGT_INF("getPowerCapMessageData: minimum soft power cap =%dW", + pcap); + + // Minimum Hard Power Cap + pcap = sys->getAttr<ATTR_OPEN_POWER_MIN_POWER_CAP_WATTS>(); + TMGT_INF("getPowerCapMessageData: minimum hard power cap = %dW", pcap); memcpy(&o_data[index], &pcap, 2); index += 2; - //System Maximum Power Cap + // System Maximum Power Cap pcap = getMaxPowerCap(sys); memcpy(&o_data[index], &pcap, 2); index += 2; - //Oversubscription Power Cap + // Quick Power Drop Power Cap pcap = sys->getAttr<ATTR_OPEN_POWER_N_BULK_POWER_LIMIT_WATTS>(); TMGT_INF("getPowerCapMessageData: oversubscription power cap = %dW", pcap); @@ -636,7 +706,7 @@ void getSystemConfigMessageData(const TargetHandle_t i_occ, uint8_t* o_data, { uint64_t index = 0; uint16_t sensor = 0; - assert(o_data != NULL); + assert(o_data != nullptr); o_data[index++] = OCC_CFGDATA_SYS_CONFIG; o_data[index++] = OCC_CFGDATA_SYS_CONFIG_VERSION; @@ -647,8 +717,8 @@ void getSystemConfigMessageData(const TargetHandle_t i_occ, uint8_t* o_data, //processor sensor ID ConstTargetHandle_t proc = getParentChip(i_occ); sensor = UTIL::getSensorNumber(proc, SENSOR_NAME_PROC_STATE); - memcpy(&o_data[index], &sensor, 2); - index += 2; + memcpy(&o_data[index], &sensor, 4); + index += 4; //Next 12*4 bytes are for core sensors. //If a new processor with more cores comes along, @@ -657,14 +727,14 @@ void getSystemConfigMessageData(const TargetHandle_t i_occ, uint8_t* o_data, TargetHandleList::iterator coreIt; getChildChiplets(cores, proc, TYPE_CORE, false); - uint16_t tempSensor = 0; - uint16_t freqSensor = 0; + uint32_t tempSensor = 0; + uint32_t freqSensor = 0; for (uint64_t core=0; core<CFGDATA_CORES; core++) { tempSensor = 0; freqSensor = 0; - if (core < cores.size()) + if ( core < cores.size() ) { tempSensor = UTIL::getSensorNumber(cores[core], SENSOR_NAME_CORE_TEMP); @@ -674,18 +744,18 @@ void getSystemConfigMessageData(const TargetHandle_t i_occ, uint8_t* o_data, } //Core Temp Sensor ID - memcpy(&o_data[index], &tempSensor, 2); - index += 2; + memcpy(&o_data[index], &tempSensor, 4); + index += 4; //Core Frequency Sensor ID - memcpy(&o_data[index], &freqSensor, 2); - index += 2; + memcpy(&o_data[index], &freqSensor, 4); + index += 4; } - TargetHandle_t sys = NULL; + TargetHandle_t sys = nullptr; TargetHandleList nodes; targetService().getTopLevelTarget(sys); - assert(sys != NULL); + assert(sys != nullptr); getChildAffinityTargets(nodes, sys, CLASS_ENC, TYPE_NODE); assert(!nodes.empty()); TargetHandle_t node = nodes[0]; @@ -693,13 +763,13 @@ void getSystemConfigMessageData(const TargetHandle_t i_occ, uint8_t* o_data, //Backplane sensor ID sensor = UTIL::getSensorNumber(node, SENSOR_NAME_BACKPLANE_FAULT); - memcpy(&o_data[index], &sensor, 2); - index += 2; + memcpy(&o_data[index], &sensor, 4); + index += 4; //APSS sensor ID sensor = UTIL::getSensorNumber(sys, SENSOR_NAME_APSS_FAULT); - memcpy(&o_data[index], &sensor, 2); - index += 2; + memcpy(&o_data[index], &sensor, 4); + index += 4; o_size = index; } @@ -709,41 +779,112 @@ void getThermalControlMessageData(uint8_t* o_data, uint64_t & o_size) { uint64_t index = 0; - Target* sys = NULL; - targetService().getTopLevelTarget(sys); + uint8_t l_numSets = 0; + Target* l_sys = nullptr; + targetService().getTopLevelTarget(l_sys); - assert(sys != NULL); - assert(o_data != NULL); + assert(l_sys != nullptr); + assert(o_data != nullptr); o_data[index++] = OCC_CFGDATA_TCT_CONFIG; o_data[index++] = OCC_CFGDATA_TCT_CONFIG_VERSION; - //3 data sets following (proc, Centaur, DIMM), and - //each will get a FRU type, DVS temp, error temp, - //and max read timeout - o_data[index++] = 3; + // Get the master processor target to get the system type + Target* l_masterProc = nullptr; + targetService().masterProcChipTargetHandle( l_masterProc ); + ATTR_MODEL_type l_systemType = l_masterProc->getAttr<ATTR_MODEL>(); + + + // Processor Core Weight + o_data[index++] = 14; + + // Processor Quad Weight + // TODO: Writing 10 for now + o_data[index++] = 10; + + + // data sets following (proc, Centaur(Cumulus only), DIMM), and + // each will get a FRU type, DVS temp, error temp, + // and max read timeout + size_t l_numSetsOffset = index++; + // Note: Bytes 4 and 5 of each data set represent the PowerVM DVFS and ERROR + // Resending the regular DVFS and ERROR for now + + // Processor o_data[index++] = CFGDATA_FRU_TYPE_PROC; - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_PROC_DVFS_TEMP_DEG_C>(); - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_PROC_ERROR_TEMP_DEG_C>(); - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_PROC_READ_TIMEOUT_SEC>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_PROC_DVFS_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_PROC_ERROR_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_PROC_DVFS_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_PROC_ERROR_TEMP_DEG_C>(); - o_data[index++] = CFGDATA_FRU_TYPE_MEMBUF; - o_data[index++] = sys-> - getAttr<ATTR_OPEN_POWER_MEMCTRL_THROTTLE_TEMP_DEG_C>(); - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_MEMCTRL_ERROR_TEMP_DEG_C>(); - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_MEMCTRL_READ_TIMEOUT_SEC>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_PROC_READ_TIMEOUT_SEC>(); + l_numSets++; - o_data[index++] = CFGDATA_FRU_TYPE_DIMM; - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_DIMM_THROTTLE_TEMP_DEG_C>(); - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_DIMM_ERROR_TEMP_DEG_C>(); - o_data[index++] = sys->getAttr<ATTR_OPEN_POWER_DIMM_READ_TIMEOUT_SEC>(); + // If Nimbus, skip non-existent Centaurs + if( l_systemType != MODEL_NIMBUS ) + { + // Centaur + o_data[index++] = CFGDATA_FRU_TYPE_MEMBUF; + o_data[index++] = l_sys-> + getAttr<ATTR_OPEN_POWER_MEMCTRL_THROTTLE_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_MEMCTRL_ERROR_TEMP_DEG_C>(); + o_data[index++] = l_sys-> + getAttr<ATTR_OPEN_POWER_MEMCTRL_THROTTLE_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_MEMCTRL_ERROR_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_MEMCTRL_READ_TIMEOUT_SEC>(); + l_numSets++; + } + // Dimm + o_data[index++] = CFGDATA_FRU_TYPE_DIMM; + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_DIMM_THROTTLE_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_DIMM_ERROR_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_DIMM_THROTTLE_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_DIMM_ERROR_TEMP_DEG_C>(); + o_data[index++] = l_sys->getAttr<ATTR_OPEN_POWER_DIMM_READ_TIMEOUT_SEC>(); + l_numSets++; + + o_data[l_numSetsOffset] = l_numSets; o_size = index; + +} + + +void getAVSBusConfigMessageData( const TargetHandle_t i_occ, + uint8_t * o_data, + uint64_t & o_size ) +{ + uint8_t l_vddBusNum = 0; + uint8_t l_vddRail = 0; + uint8_t l_vdnBusNum = 0; + uint8_t l_vdnRail = 0; + uint64_t index = 0; + + assert( o_data != nullptr ); + + // Get the parent processor + ConstTargetHandle_t l_proc = getParentChip( i_occ ); + + l_vddBusNum = l_proc->getAttr<ATTR_VDD_AVSBUS_BUSNUM>(); + l_vddRail = l_proc->getAttr<ATTR_VDD_AVSBUS_RAIL>(); + l_vdnBusNum = l_proc->getAttr<ATTR_VDN_AVSBUS_BUSNUM>(); + l_vdnRail = l_proc->getAttr<ATTR_VDN_AVSBUS_RAIL>(); + + // Populate the data + o_data[index++] = OCC_CFGDATA_AVSBUS_CONFIG; + o_data[index++] = OCC_CFGDATA_AVSBUS_CONFIG_VERSION; + o_data[index++] = l_vddBusNum; + o_data[index++] = l_vddRail; + o_data[index++] = l_vdnBusNum; + o_data[index++] = l_vdnRail; + + o_size = index; } + void getFrequencyPointMessageData(uint8_t* o_data, uint64_t & o_size) { @@ -752,92 +893,18 @@ void getFrequencyPointMessageData(uint8_t* o_data, uint16_t turbo = 0; uint16_t ultra = 0; uint16_t nominal = 0; - Target* sys = NULL; + Target* sys = nullptr; targetService().getTopLevelTarget(sys); - assert(sys != NULL); - assert(o_data != NULL); + assert(sys != nullptr); + assert(o_data != nullptr); - int32_t biasFactor = 0; - if (false == OccManager::isNormalPstate()) - { - // Only apply bias if using mfg pstate tables - Occ *master = OccManager::getMasterOcc(); - if (NULL != master) - { - errlHndl_t err = NULL; - TARGETING::TargetHandle_t occTarget = master->getTarget(); - ConstTargetHandle_t procTarget = getParentChip(occTarget); - assert(procTarget != NULL); - const fapi::Target fapiTarget(fapi::TARGET_TYPE_PROC_CHIP, - (const_cast<TARGETING::Target*>(procTarget))); - uint32_t biasUp = 0; - uint32_t biasDown = 0; - int rc = FAPI_ATTR_GET(ATTR_FREQ_EXT_BIAS_UP,&fapiTarget,biasUp); - rc |= FAPI_ATTR_GET(ATTR_FREQ_EXT_BIAS_DOWN,&fapiTarget,biasDown); - if (0 == rc) - { - if ((biasDown > 0) && (biasUp == 0)) - { - TMGT_INF("FREQ_EXT_BIAS_DOWN=%d (in 0.5%% units)",biasDown); - biasFactor = -(biasDown); - } - else if ((biasUp > 0) && (biasDown == 0)) - { - biasFactor = biasUp; - TMGT_INF("FREQ_EXT_BIAS_UP=%d (in 0.5%% units)", biasUp); - } - else if ((biasUp > 0) && (biasDown > 0)) - { - TMGT_ERR("Invalid bias values: BIAS_UP=%d and BIAS_DOWN=%d", - biasUp, biasDown); - /*@ - * @errortype - * @reasoncode HTMGT_RC_INVALID_PARAMETER - * @moduleid HTMGT_MOD_CFG_FREQ_POINTS - * @userdata1 ATTR_FREQ_EXT_BIAS_UP - * @userdata2 ATTR_FREQ_EXT_BIAS_DOWN - * @devdesc Invalid ATTR_FREQ_EXT_BIAS attribute values - */ - bldErrLog(err, HTMGT_MOD_CFG_FREQ_POINTS, - HTMGT_RC_INVALID_PARAMETER, - 0, biasUp, 0, biasDown, - ERRORLOG::ERRL_SEV_UNRECOVERABLE); - ERRORLOG::errlCommit(err, HTMGT_COMP_ID); - } - } - else - { - TMGT_ERR("Unable to read ATTR_FREQ_EXT_BIAS values rc=%d", rc); - /*@ - * @errortype - * @reasoncode HTMGT_RC_ATTRIBUTE_ERROR - * @moduleid HTMGT_MOD_CFG_FREQ_POINTS - * @userdata1[0-31] rc - * @userdata1[32-63] ATTR_FREQ_EXT_BIAS_UP - * @userdata2 ATTR_FREQ_EXT_BIAS_DOWN - * @devdesc Unable to read FREQ_EXT_BIAS attributes - */ - bldErrLog(err, HTMGT_MOD_CFG_FREQ_POINTS, - HTMGT_RC_ATTRIBUTE_ERROR, - rc, biasUp, 0, biasDown, - ERRORLOG::ERRL_SEV_UNRECOVERABLE); - ERRORLOG::errlCommit(err, HTMGT_COMP_ID); - } - } - } o_data[index++] = OCC_CFGDATA_FREQ_POINT; o_data[index++] = OCC_CFGDATA_FREQ_POINT_VERSION; //Nominal Frequency in MHz nominal = sys->getAttr<ATTR_NOMINAL_FREQ_MHZ>(); - if (biasFactor) - { - TMGT_INF("Pre-biased Nominal=%dMhz", nominal); - // % change = (biasFactor/2) / 100 - nominal += ((nominal * biasFactor) / 200); - } memcpy(&o_data[index], &nominal, 2); index += 2; @@ -852,20 +919,6 @@ void getFrequencyPointMessageData(uint8_t* o_data, if (0 != wofSupported) { ultra = sys->getAttr<ATTR_ULTRA_TURBO_FREQ_MHZ>(); - if (0 != ultra) - { - if (biasFactor) - { - TMGT_INF("Pre-biased Ultra=%dMhz", ultra); - // % change = (biasFactor/2) / 100 - ultra += ((ultra * biasFactor) / 200); - } - } - else - { - TMGT_INF("getFrequencyPoint: WOF enabled, but freq is 0"); - G_wofSupported = false; - } } else { @@ -881,12 +934,6 @@ void getFrequencyPointMessageData(uint8_t* o_data, turbo = nominal; G_wofSupported = false; } - if (biasFactor) - { - TMGT_INF("Pre-biased Turbo=%dMhz", turbo); - // % change = (biasFactor/2) / 100 - turbo += ((turbo * biasFactor) / 200); - } //Turbo Frequency in MHz memcpy(&o_data[index], &turbo, 2); @@ -894,12 +941,7 @@ void getFrequencyPointMessageData(uint8_t* o_data, //Minimum Frequency in MHz min = sys->getAttr<ATTR_MIN_FREQ_MHZ>(); - if (biasFactor) - { - TMGT_INF("Pre-biased Min=%dMhz", min); - // % change = (biasFactor/2) / 100 - min += ((min * biasFactor) / 200); - } + memcpy(&o_data[index], &min, 2); index += 2; @@ -907,6 +949,14 @@ void getFrequencyPointMessageData(uint8_t* o_data, memcpy(&o_data[index], &ultra, 2); index += 2; + // Reserved (Static Power Save in PowerVM) + memset(&o_data[index], 0, 2); + index += 2; + + // Reserved (FFO in PowerVM) + memset(&o_data[index], 0, 2); + index += 2; + TMGT_INF("Frequency Points: Min %d, Nominal %d, Turbo %d, Ultra %d MHz", min, nominal, turbo, ultra); @@ -914,49 +964,11 @@ void getFrequencyPointMessageData(uint8_t* o_data, } -void getPstateTableMessageData(const TargetHandle_t i_occTarget, - uint8_t* o_data, - uint64_t & io_size) -{ - // normal and mfg pstate tables are the same size: see genPstateTables() - uint64_t msg_size = sizeof(ATTR_PSTATE_TABLE_type) + 4; - assert(io_size >= msg_size); - - if(io_size > msg_size) - { - io_size = msg_size; - } - - o_data[0] = OCC_CFGDATA_PSTATE_SSTRUCT; - o_data[1] = 0; // reserved - o_data[2] = 0; // reserved - o_data[3] = 0; // reserved - - if (OccManager::isNormalPstate()) - { - TMGT_INF("getPstateTableMessageData: Sending normal tables"); - // Read data from attribute for specified occ - ATTR_PSTATE_TABLE_type * pstateDataPtr = - reinterpret_cast<ATTR_PSTATE_TABLE_type*>(o_data + 4); - - i_occTarget->tryGetAttr<ATTR_PSTATE_TABLE>(*pstateDataPtr); - } - else - { - TMGT_INF("getPstateTableMessageData: Sending MFG tables"); - ATTR_PSTATE_TABLE_MFG_type * pstateDataPtr = - reinterpret_cast<ATTR_PSTATE_TABLE_MFG_type*>(o_data + 4); - - i_occTarget->tryGetAttr<ATTR_PSTATE_TABLE_MFG>(*pstateDataPtr); - } -} - - void getApssMessageData(uint8_t* o_data, uint64_t & o_size) { - Target* sys = NULL; + Target* sys = nullptr; targetService().getTopLevelTarget(sys); ATTR_ADC_CHANNEL_FUNC_IDS_type function; @@ -978,7 +990,7 @@ void getApssMessageData(uint8_t* o_data, //The APSS function below hardcodes 16 channels, //so everything better agree. CPPASSERT(sizeof(function) == 16); - const uint16_t (*sensors)[16] = NULL; + const uint32_t (*sensors)[16] = nullptr; #ifdef CONFIG_BMC_IPMI errlHndl_t err = SENSOR::getAPSSChannelSensorNumbers(sensors); @@ -987,7 +999,7 @@ void getApssMessageData(uint8_t* o_data, TMGT_ERR("getApssMessageData: Call to getAPSSChannelSensorNumbers " "failed."); ERRORLOG::errlCommit(err, HTMGT_COMP_ID); - sensors = NULL; + sensors = nullptr; } #endif @@ -996,7 +1008,7 @@ void getApssMessageData(uint8_t* o_data, o_data[2] = 0; o_data[3] = 0; uint64_t idx = 4; - uint16_t sensorId = 0; + uint32_t sensorId = 0; for(uint64_t channel = 0; channel < sizeof(function); ++channel) { @@ -1004,12 +1016,12 @@ void getApssMessageData(uint8_t* o_data, idx += sizeof(uint8_t); sensorId = 0; - if (sensors != NULL) + if (sensors != nullptr) { sensorId = (*sensors)[channel]; } - memcpy(o_data+idx,&sensorId,sizeof(uint16_t)); // Sensor ID - idx += sizeof(uint16_t); + memcpy(o_data+idx,&sensorId,sizeof(uint32_t)); // Sensor ID + idx += sizeof(uint32_t); o_data[idx] = ground[channel]; // Ground Select idx += sizeof(uint8_t); @@ -1045,121 +1057,6 @@ void getApssMessageData(uint8_t* o_data, o_size = idx; } -void getWofCoreFrequencyData(const TargetHandle_t i_occ, - uint8_t * o_data, - uint64_t & o_size) -{ - assert(o_data != NULL); - uint64_t index = 0; - Target* sys = NULL; - targetService().getTopLevelTarget(sys); - assert(sys != NULL); - ConstTargetHandle_t proc = getParentChip(i_occ); - assert(proc != NULL); - - // Count the number of cores that are good on each chip without - // regard to being GARDED. Cores that are deconfigured do not - // affect this number. This is the number of present cores - // (max - partial bad). - TARGETING::TargetHandleList l_presCoreList; - getChildAffinityTargetsByState(l_presCoreList, - proc, - TARGETING::CLASS_UNIT, - TARGETING::TYPE_CORE, - TARGETING::UTIL_FILTER_PRESENT); - const uint8_t maxCoresPerChip = l_presCoreList.size(); - - o_data[index++] = OCC_CFGDATA_WOF_CORE_FREQ; - o_data[index++] = OCC_CFGDATA_WOF_CORE_FREQ_VERSION; - o_data[index++] = maxCoresPerChip; - memset(&o_data[index], 0, 3); // reserved - index += 3; - - uint8_t numRows = 0; - uint8_t numColumns = 0; - const uint16_t tablesize=sizeof(ATTR_WOF_FREQUENCY_UPLIFT_SELECTED_type); - if (G_wofSupported) - { - numRows = 22; - numColumns = 13; - TMGT_INF("getWofCoreFrequencyData: %d rows, %d cols (0x%04X bytes)", - numRows, numColumns, tablesize); - assert(tablesize == numRows * numColumns * 2); - } - o_data[index++] = numRows; - o_data[index++] = numColumns; - - if (G_wofSupported) - { - // Host Boot will determine correct chip sort and pick correct - // frequncy uplift table - ATTR_WOF_FREQUENCY_UPLIFT_SELECTED_type * upliftTable = - reinterpret_cast<ATTR_WOF_FREQUENCY_UPLIFT_SELECTED_type*> - (&o_data[index]); - - proc->tryGetAttr<ATTR_WOF_FREQUENCY_UPLIFT_SELECTED>(*upliftTable); - TMGT_BIN("WOF CoreFrequency Data", upliftTable, tablesize); - - // first table entry must be 0s - memset(&o_data[index], 0, 2); - - index += tablesize; - } - - o_size = index; - -} // end getWofCoreFrequencyData() - - -void getWofVrmEfficiencyData(uint8_t* o_data, - uint64_t & o_size) -{ - assert(o_data != NULL); - uint64_t index = 0; - Target* sys = NULL; - targetService().getTopLevelTarget(sys); - assert(sys != NULL); - - o_data[index++] = OCC_CFGDATA_WOF_VRM_EFF; - o_data[index++] = OCC_CFGDATA_WOF_VRM_EFF_VERSION; - memset(&o_data[index], 0, 4); // reserved - index += 4; - - uint8_t numRows = 0; - uint8_t numColumns = 0; - const uint16_t tablesize = sizeof(ATTR_WOF_REGULATOR_EFFICIENCIES_type); - if (G_wofSupported) - { - numRows = 3; - numColumns = 14; - TMGT_INF("getWofVrmEfficiencyData: %d rows, %d cols (0x%04X bytes)", - numRows, numColumns, tablesize); - assert(tablesize == numRows * numColumns * 2); - } - o_data[index++] = numRows; - o_data[index++] = numColumns; - - if (G_wofSupported) - { - // VRM efficiency table is unique per system - - ATTR_WOF_REGULATOR_EFFICIENCIES_type * regEffDataPtr = - reinterpret_cast<ATTR_WOF_REGULATOR_EFFICIENCIES_type*> - (&o_data[index]); - - sys->tryGetAttr<ATTR_WOF_REGULATOR_EFFICIENCIES>(*regEffDataPtr); - TMGT_BIN("WOF VRM Efficiency Data", regEffDataPtr, tablesize); - - // first table entry must be 0s - memset(&o_data[index], 0, 2); - - index += tablesize; - } - - o_size = index; - -} // end getWofVrmEfficiencyData() - } diff --git a/src/usr/htmgt/htmgt_cfgdata.H b/src/usr/htmgt/htmgt_cfgdata.H index f5290bacf..a6c746805 100644 --- a/src/usr/htmgt/htmgt_cfgdata.H +++ b/src/usr/htmgt/htmgt_cfgdata.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -36,18 +36,15 @@ namespace HTMGT enum occCfgDataFormat { OCC_CFGDATA_NO_REQUEST = 0x00, // no request for config data - OCC_CFGDATA_PSTATE_SSTRUCT = 0x01, // Psate Super Structure OCC_CFGDATA_FREQ_POINT = 0x02, // Frequency Operating Points OCC_CFGDATA_OCC_ROLE = 0x03, // OCC Role OCC_CFGDATA_APSS_CONFIG = 0x04, // APSS Config OCC_CFGDATA_MEM_CONFIG = 0x05, // Memory Configuration - OCC_CFGDATA_FIR_SCOMS = 0x06, // FIR Scoms Table OCC_CFGDATA_PCAP_CONFIG = 0x07, // PCAP Config OCC_CFGDATA_SYS_CONFIG = 0x0F, // System Configuration OCC_CFGDATA_MEM_THROTTLE = 0x12, // Memory Throttle Settings OCC_CFGDATA_TCT_CONFIG = 0x13, // Thermal Control Treshold - OCC_CFGDATA_WOF_CORE_FREQ = 0x30, // WOF Core Frequency Data - OCC_CFGDATA_WOF_VRM_EFF = 0x31, // WOF VRM Efficiency Data + OCC_CFGDATA_AVSBUS_CONFIG = 0x14, // AVSBus Config OCC_CFGDATA_FORMAT_END, // Marker to indicate last entry OCC_CFGDATA_CLEAR_ALL = 0xFF, // Clear All Active Config Data @@ -59,7 +56,7 @@ namespace HTMGT //KVM mode + single node OCC_CFGDATA_OPENPOWER_SYSTEMTYPE = 0x81, - CFGDATA_CORES = 12, + CFGDATA_CORES = 24, CFGDATA_FRU_TYPE_PROC = 0x00, CFGDATA_FRU_TYPE_MEMBUF = 0x01, @@ -97,19 +94,17 @@ namespace HTMGT } }; + // TODO: RTC 164403 add AVSBUS cfg data once OCC support is in place const occCfgDataTable_t occCfgDataTable[] = { { OCC_CFGDATA_SYS_CONFIG, TARGET_ALL, TO_20SEC, CFGSTATE_ALL }, { OCC_CFGDATA_APSS_CONFIG, TARGET_ALL, TO_20SEC, CFGSTATE_ALL }, { OCC_CFGDATA_OCC_ROLE, TARGET_ALL, TO_20SEC,CFGSTATE_STANDBY }, - { OCC_CFGDATA_PSTATE_SSTRUCT, TARGET_ALL, TO_20SEC, CFGSTATE_SBYOBS }, { OCC_CFGDATA_FREQ_POINT, TARGET_MASTER,TO_20SEC, CFGSTATE_SBYOBS }, { OCC_CFGDATA_MEM_CONFIG, TARGET_ALL, TO_20SEC, CFGSTATE_ALL }, { OCC_CFGDATA_PCAP_CONFIG, TARGET_MASTER, TO_20SEC, CFGSTATE_ALL }, { OCC_CFGDATA_MEM_THROTTLE, TARGET_ALL, TO_20SEC, CFGSTATE_ALL }, { OCC_CFGDATA_TCT_CONFIG, TARGET_ALL, TO_20SEC, CFGSTATE_ALL }, - { OCC_CFGDATA_WOF_CORE_FREQ, TARGET_ALL, TO_20SEC, CFGSTATE_SBYOBS }, - { OCC_CFGDATA_WOF_VRM_EFF, TARGET_ALL, TO_20SEC, CFGSTATE_SBYOBS } }; const size_t OCC_CONFIG_TABLE_SIZE = sizeof(occCfgDataTable) / sizeof(occCfgDataTable_t); @@ -210,6 +205,17 @@ namespace HTMGT /** + * Fills in the AVSBus Configuration Data message buffer + * + * @param[in] i_occ - the OCC target + * @param[out] o_data - preallocated buffer to fill in + * @param[out] o_size - set to the message size + * @pre o_data is large enough. + */ + void getAVSBusConfigMessageData(const TARGETING::TargetHandle_t i_occ, + uint8_t* o_data, uint64_t & o_size); + + /** * Fill in the Frequency Point Configuration Data * message buffer. * @@ -221,17 +227,6 @@ namespace HTMGT uint64_t & o_size); /** - * Read pstate data from attribute and build occcmd message - * @param[in] The OCC TARGETING::Target - * @param[out] The occ cmd message - * @param[in/out] In: Byte size of the o_data area. Out: Byte size of - * the occ cmd message. - */ - void getPstateTableMessageData(const TARGETING::TargetHandle_t i_occTarget, - uint8_t* o_data, - uint64_t & io_size); - - /** * Generate the APSS configuration message * @param[out] The APSS cfg message * @param[in/out] In: Byte size of the o_data area. Out: Byte size of diff --git a/src/usr/htmgt/htmgt_common.mk b/src/usr/htmgt/htmgt_common.mk index 043af9334..ba585a5bb 100644 --- a/src/usr/htmgt/htmgt_common.mk +++ b/src/usr/htmgt/htmgt_common.mk @@ -24,6 +24,10 @@ # IBM_PROLOG_END_TAG EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer +EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/fapi2 +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/utils/imageProcs +EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc # common objects between hostboot and hbrt OBJS += htmgt.o @@ -34,4 +38,3 @@ OBJS += htmgt_poll.o OBJS += htmgt_utility.o OBJS += htmgt_cfgdata.o OBJS += occError.o -OBJS += genPstate.o diff --git a/src/usr/htmgt/htmgt_memthrottles.C b/src/usr/htmgt/htmgt_memthrottles.C index f731a98c3..b87addd14 100644 --- a/src/usr/htmgt/htmgt_memthrottles.C +++ b/src/usr/htmgt/htmgt_memthrottles.C @@ -30,10 +30,8 @@ #include <targeting/common/utilFilter.H> #include <targeting/common/attributes.H> #include <targeting/common/targetservice.H> -#include <fapi.H> -#include <fapiPlatHwpInvoker.H> -#include <mss_bulk_pwr_throttles.H> -#include <mss_util_to_throttle.H> +#include <fapi2.H> + using namespace TARGETING; @@ -60,7 +58,6 @@ void memPowerThrottleOT(TargetHandleList & i_mbas, const uint32_t i_nSafeModeMBA, const uint8_t i_utilization) { - TargetHandleList::iterator mba; bool useSafeMode = false; bool throttleError = false; uint32_t nUtilBased = 0; @@ -72,9 +69,9 @@ void memPowerThrottleOT(TargetHandleList & i_mbas, targetService().getTopLevelTarget(sys); assert(sys != NULL); - for (mba=i_mbas.begin(); mba!=i_mbas.end(); ++mba) + for( const auto & mba : i_mbas ) { - mbaHuid = (*mba)->getAttr<ATTR_HUID>(); + mbaHuid = mba->getAttr<ATTR_HUID>(); useSafeMode = true; nUtilBased = 0; @@ -84,14 +81,14 @@ void memPowerThrottleOT(TargetHandleList & i_mbas, //possible throttle setting based on the minimum //utilization percentage. errlHndl_t err = NULL; - const fapi::Target fapiTarget(fapi::TARGET_TYPE_MBA_CHIPLET, - const_cast<Target*>(*mba)); + const fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTarget(mba); //Set this so the procedure can use it - (*mba)->setAttr<ATTR_MSS_DATABUS_UTIL_PER_MBA>(i_utilization); + mba->setAttr<ATTR_MSS_DATABUS_UTIL_PER_MBA>(i_utilization); +/* TODO: RTC 155033 - Memory Throttle Settings FAPI_INVOKE_HWP(err, mss_util_to_throttle, fapiTarget); - +*/ if (err) { //Ignore the error and just use safe @@ -106,7 +103,7 @@ void memPowerThrottleOT(TargetHandleList & i_mbas, else { //get the procedure output - nUtilBased = (*mba)->getAttr<ATTR_MSS_UTIL_N_PER_MBA>(); + nUtilBased = mba->getAttr<ATTR_MSS_UTIL_N_PER_MBA>(); if (0 != nUtilBased) { @@ -156,7 +153,7 @@ void memPowerThrottleOT(TargetHandleList & i_mbas, TMGT_INF("memPowerThrottleOT: MBA 0x%X: N Util OT = 0x%X", mbaHuid, nUtilBased); - (*mba)->setAttr<ATTR_OT_MIN_N_PER_MBA>(nUtilBased); + mba->setAttr<ATTR_OT_MIN_N_PER_MBA>(nUtilBased); } @@ -181,7 +178,7 @@ void memPowerThrottleOT(TargetHandleList & i_mbas, * @param[out] o_nChip - set to the N_PER_CHIP numerator value * (don't use if safemode=true) */ -void doMBAThrottleCalc(TargetHandle_t i_mba, +void doMBAThrottleCalc(TARGETING::Target * i_mba, const uint32_t i_wattTarget, const uint8_t i_utilization, bool & o_useSafeMode, @@ -194,15 +191,19 @@ void doMBAThrottleCalc(TargetHandle_t i_mba, o_nMBA = 0; o_nChip = 0; + TARGETING::ATTR_MSS_MEM_WATT_TARGET_type l_wattArray = {{i_wattTarget, + i_wattTarget}, + {i_wattTarget, + i_wattTarget}}; //Set the values the procedures need - i_mba->setAttr<ATTR_MSS_MEM_WATT_TARGET>(i_wattTarget); + i_mba->setAttr<ATTR_MSS_MEM_WATT_TARGET>(l_wattArray); i_mba->setAttr<ATTR_MSS_DATABUS_UTIL_PER_MBA>(i_utilization); - const fapi::Target fapiTarget(fapi::TARGET_TYPE_MBA_CHIPLET, - i_mba); + const fapi2::Target<fapi2::TARGET_TYPE_MBA> fapiTarget(i_mba); +/* TODO This hwp is changing for p9 FAPI_INVOKE_HWP(err, mss_bulk_pwr_throttles, fapiTarget); - +*/ if (err) { TMGT_ERR("doMBAThrottleCalc: Failed call to mss_bulk_pwr_throttles" @@ -245,8 +246,9 @@ void doMBAThrottleCalc(TargetHandle_t i_mba, //Make sure the calculated throttles meet the min //utilization, if provided. - FAPI_INVOKE_HWP(err, mss_util_to_throttle, fapiTarget); - +/* TODO this hwp is changing for p9 + FAPI_INVOKE_HWP(err, mss_util_to_throttle, fapiTarget); +*/ if (err) { TMGT_ERR("doMBAThrottleCalc: Failed call to " @@ -323,7 +325,6 @@ void memPowerThrottleRedPower(TargetHandleList & i_mbas, const uint8_t i_efficiency) { Target* sys = NULL; - TargetHandleList::iterator mba; uint32_t power = 0; uint32_t wattTarget = 0; uint32_t nChip = 0; @@ -352,13 +353,13 @@ void memPowerThrottleRedPower(TargetHandleList & i_mbas, TMGT_INF("memPowerThrottleRedPower: power = %d, wattTarget = %d", power, wattTarget); - for (mba=i_mbas.begin(); mba!=i_mbas.end(); ++mba) + for( const auto & mba : i_mbas ) { useSafeMode = false; nMBA = nChip = 0; //Run the calculations - doMBAThrottleCalc(*mba, wattTarget, i_utilization, + doMBAThrottleCalc(mba, wattTarget, i_utilization, useSafeMode, nMBA, nChip); if (useSafeMode) @@ -367,16 +368,16 @@ void memPowerThrottleRedPower(TargetHandleList & i_mbas, nChip = i_nSafeModeChip; TMGT_INF("memPowerThrottleRedPower: MBA 0x%X using safemode " "numerator", - (*mba)->getAttr<ATTR_HUID>()); + mba->getAttr<ATTR_HUID>()); } //Set the attributes we'll send to OCC later TMGT_INF("memPowerThrottleRedPower: MBA 0x%X: N_PER_MBA = 0x%X, " "N_PER_CHIP = 0x%X", - (*mba)->getAttr<ATTR_HUID>(), nMBA, nChip); + mba->getAttr<ATTR_HUID>(), nMBA, nChip); - (*mba)->setAttr<ATTR_N_PLUS_ONE_N_PER_MBA>(nMBA); - (*mba)->setAttr<ATTR_N_PLUS_ONE_N_PER_CHIP>(nChip); + mba->setAttr<ATTR_N_PLUS_ONE_N_PER_MBA>(nMBA); + mba->setAttr<ATTR_N_PLUS_ONE_N_PER_CHIP>(nChip); } @@ -403,7 +404,6 @@ void memPowerThrottleOverSub(TargetHandleList & i_mbas, const uint8_t i_efficiency) { Target* sys = NULL; - TargetHandleList::iterator mba; uint32_t power = 0; uint32_t wattTarget = 0; uint32_t nChip = 0; @@ -432,13 +432,13 @@ void memPowerThrottleOverSub(TargetHandleList & i_mbas, TMGT_INF("memPowerThrottleOverSub: power = %d, wattTarget = %d", power, wattTarget); - for (mba=i_mbas.begin(); mba!=i_mbas.end(); ++mba) + for ( const auto & mba : i_mbas ) { useSafeMode = false; nMBA = nChip = 0; //Run the calculations - doMBAThrottleCalc(*mba, wattTarget, i_utilization, + doMBAThrottleCalc(mba, wattTarget, i_utilization, useSafeMode, nMBA, nChip); if (useSafeMode) @@ -447,16 +447,16 @@ void memPowerThrottleOverSub(TargetHandleList & i_mbas, nChip = i_nSafeModeChip; TMGT_INF("memPowerThrottleOverSub: MBA 0x%X using safemode " "numerator", - (*mba)->getAttr<ATTR_HUID>()); + mba->getAttr<ATTR_HUID>()); } //Set the attributes we'll send to OCC later TMGT_INF("memPowerThrottleOverSub: MBA 0x%X: N_PER_MBA = 0x%X, " "N_PER_CHIP = 0x%X", - (*mba)->getAttr<ATTR_HUID>(), nMBA, nChip); + mba->getAttr<ATTR_HUID>(), nMBA, nChip); - (*mba)->setAttr<ATTR_OVERSUB_N_PER_MBA>(nMBA); - (*mba)->setAttr<ATTR_OVERSUB_N_PER_CHIP>(nChip); + mba->setAttr<ATTR_OVERSUB_N_PER_MBA>(nMBA); + mba->setAttr<ATTR_OVERSUB_N_PER_CHIP>(nChip); } diff --git a/src/usr/htmgt/htmgt_occ.C b/src/usr/htmgt/htmgt_occ.C index 7fd212ac3..173090aab 100644 --- a/src/usr/htmgt/htmgt_occ.C +++ b/src/usr/htmgt/htmgt_occ.C @@ -302,13 +302,11 @@ namespace HTMGT iv_occMaster = NULL; if (iv_occArray.size() > 0) { - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - pOcc < iv_occArray.end(); - pOcc++) + for( const auto & occ : iv_occArray ) { TMGT_INF("removeAllOccs: Removing OCC%d", - (*pOcc)->getInstance()); - delete (*pOcc); + occ->getInstance()); + delete occ; } iv_occArray.clear(); } @@ -341,21 +339,20 @@ namespace HTMGT if (pProcs.size() > 0) { // for each functional processor - for(TARGETING::TargetHandleList::iterator proc = pProcs.begin(); - proc != pProcs.end(); - ++proc) + for(const auto & proc : pProcs ) { // Instance number for this Processor/OCC const uint8_t instance = - (*proc)->getAttr<TARGETING::ATTR_POSITION>(); + proc->getAttr<TARGETING::ATTR_POSITION>(); TMGT_INF("_buildOccs: PROC%d is functional", instance); // Get HOMER virtual address uint8_t * homer = (uint8_t*) - ((*proc)->getAttr<TARGETING::ATTR_HOMER_VIRT_ADDR>()); + (proc->getAttr<TARGETING::ATTR_HOMER_VIRT_ADDR>()); const uint8_t * homerPhys = (uint8_t*) - ((*proc)->getAttr<TARGETING::ATTR_HOMER_PHYS_ADDR>()); + (proc->getAttr<TARGETING::ATTR_HOMER_PHYS_ADDR>()); TMGT_INF("_buildOccs: homer = 0x%08llX (virt) / 0x%08llX (phys)" " for Proc%d", homer, homerPhys, instance); +//TODO: Remove once Boston Simics Model works with OCC #ifdef SIMICS_TESTING // Starting of OCCs is not supported in SIMICS, so fake out // HOMER memory area for testing @@ -378,20 +375,20 @@ namespace HTMGT if ((NULL != homer) && (NULL != homerPhys)) { // Get functional OCC (one per proc) - TARGETING::TargetHandleList pOccs; - getChildChiplets(pOccs, *proc, TARGETING::TYPE_OCC); - if (pOccs.size() > 0) + TARGETING::TargetHandleList occs; + getChildChiplets(occs, proc, TARGETING::TYPE_OCC); + if (occs.size() > 0) { const unsigned long huid = - pOccs[0]->getAttr<TARGETING::ATTR_HUID>(); + occs[0]->getAttr<TARGETING::ATTR_HUID>(); const bool masterCapable = - pOccs[0]-> + occs[0]-> getAttr<TARGETING::ATTR_OCC_MASTER_CAPABLE>(); TMGT_INF("_buildOccs: Found OCC%d - HUID: 0x%0lX, " "masterCapable: %c, homer: 0x%0lX", instance, huid, masterCapable?'Y':'N', homer); - _addOcc(instance, masterCapable, homer, pOccs[0]); + _addOcc(instance, masterCapable, homer, occs[0]); } else { @@ -429,14 +426,12 @@ namespace HTMGT if (NULL != iv_occMaster) { // update master occsPresent bit for each slave OCC - for(occList_t::const_iterator occ = iv_occArray.begin(); - occ != iv_occArray.end(); - ++occ) + for( const auto & occ : iv_occArray ) { - if((*occ) != iv_occMaster) + if(occ != iv_occMaster) { iv_occMaster-> - updateOccPresentBits((*occ)->getPresentBits()); + updateOccPresentBits(occ->getPresentBits()); } } } @@ -544,13 +539,11 @@ namespace HTMGT Occ * OccManager::_getOcc(const uint8_t i_instance) { Occ *targetOcc = NULL; - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - pOcc < iv_occArray.end(); - pOcc++) + for( const auto & occ : iv_occArray ) { - if ((*pOcc)->getInstance() == i_instance) + if (occ->getInstance() == i_instance) { - targetOcc = (*pOcc); + targetOcc = occ; break; } } @@ -650,15 +643,13 @@ namespace HTMGT } // Make sure all OCCs went to active state - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - pOcc < iv_occArray.end(); - pOcc++) + for( const auto & occ : iv_occArray ) { - if (requestedState != (*pOcc)->getState()) + if (requestedState != occ->getState()) { TMGT_ERR("_setOccState: OCC%d is not in 0x%02X " "state", - (*pOcc)->getInstance(), requestedState); + occ->getInstance(), requestedState); /*@ * @errortype * @moduleid HTMGT_MOD_OCCMGR_SET_STATE @@ -670,8 +661,8 @@ namespace HTMGT */ bldErrLog(l_err, HTMGT_MOD_OCCMGR_SET_STATE, HTMGT_RC_OCC_UNEXPECTED_STATE, - requestedState, (*pOcc)->getState(), - 0, (*pOcc)->getInstance(), + requestedState, occ->getState(), + 0, occ->getInstance(), ERRORLOG::ERRL_SEV_INFORMATIONAL); break; } @@ -752,19 +743,17 @@ namespace HTMGT } } - for(occList_t::const_iterator occ = iv_occArray.begin(); - occ != iv_occArray.end(); - ++occ) + for(const auto & occ : iv_occArray ) { - if((*occ)->getTarget() == i_failedOccTarget) + if(occ->getTarget() == i_failedOccTarget) { - (*occ)->failed(true); + occ->failed(true); } if (false == i_skipComm) { // Send reset prep cmd to all OCCs - if((*occ)->resetPrep()) + if(occ->resetPrep()) { atThreshold = true; } @@ -787,11 +776,9 @@ namespace HTMGT // else failed OCC reset count will be incremented automatically // Update OCC states to RESET - for(occList_t::const_iterator occ = iv_occArray.begin(); - occ != iv_occArray.end(); - ++occ) + for( const auto & occ : iv_occArray ) { - (*occ)->iv_state = OCC_STATE_RESET; + occ->iv_state = OCC_STATE_RESET; } uint64_t retryCount = OCC_RESET_COUNT_THRESHOLD; @@ -831,12 +818,10 @@ namespace HTMGT if(!atThreshold && !err) { - for(occList_t::const_iterator occ = iv_occArray.begin(); - occ != iv_occArray.end(); - ++occ) + for( const auto & occ : iv_occArray ) { // After OCCs have been reset, clear flags - (*occ)->postResetClear(); + occ->postResetClear(); } TMGT_INF("_resetOccs: Calling HBOCC::activateOCCs"); @@ -935,9 +920,7 @@ namespace HTMGT uint8_t retryCount = 0; bool throttleErrors = false; - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - pOcc < iv_occArray.end(); - pOcc++) + for( const auto & occ : iv_occArray ) { bool occReady = false; uint16_t lastCheckpoint = 0x0000; @@ -950,7 +933,7 @@ namespace HTMGT errlHndl_t l_err = NULL; const uint16_t l_length = 8; ecmdDataBufferBase l_buffer(l_length*8); // convert to bits - l_err = HBOCC::readSRAM((*pOcc)->getTarget(), + l_err = HBOCC::readSRAM(occ->getTarget(), OCC_RSP_SRAM_ADDR, l_buffer); if (NULL == l_err) @@ -961,13 +944,13 @@ namespace HTMGT { TMGT_INF("_waitForOccCheckpoint: OCC%d Checkpoint " "0x%04X", - (*pOcc)->getInstance(), checkpoint); + occ->getInstance(), checkpoint); lastCheckpoint = checkpoint; } if (0x0EFF == checkpoint) { TMGT_INF("_waitForOccCheckpoint OCC%d ready!", - (*pOcc)->getInstance()); + occ->getInstance()); occReady = true; break; @@ -980,7 +963,7 @@ namespace HTMGT throttleErrors = true; TMGT_ERR("_waitForOccCheckpoint: error trying to " "read OCC%d SRAM (rc=0x%04X)", - (*pOcc)->getInstance(), + occ->getInstance(), l_err->reasonCode()); ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID); } @@ -995,10 +978,10 @@ namespace HTMGT if (!occReady) { TMGT_CONSOLE("Final OCC%d Checkpoint NOT reached (0x%04X)", - (*pOcc)->getInstance(), lastCheckpoint); + occ->getInstance(), lastCheckpoint); TMGT_ERR("_waitForOccCheckpoint OCC%d still NOT ready! " "(last checkpoint=0x%04X)", - (*pOcc)->getInstance(), lastCheckpoint); + occ->getInstance(), lastCheckpoint); errlHndl_t l_err = NULL; /*@ * @errortype @@ -1010,10 +993,10 @@ namespace HTMGT */ bldErrLog(l_err, HTMGT_MOD_WAIT_FOR_CHECKPOINT, HTMGT_RC_OCC_NOT_READY, - 0, (*pOcc)->getInstance(), 0, lastCheckpoint, + 0, occ->getInstance(), 0, lastCheckpoint, ERRORLOG::ERRL_SEV_PREDICTIVE); - (*pOcc)->collectCheckpointScomData(l_err); + occ->collectCheckpointScomData(l_err); if (NULL == checkpointElog) { // return the first elog @@ -1025,7 +1008,7 @@ namespace HTMGT ERRORLOG::errlCommit(l_err, HTMGT_COMP_ID); } TMGT_ERR("waitForOccCheckpoint OCC%d still NOT ready!", - (*pOcc)->getInstance()); + occ->getInstance()); } } } @@ -1059,11 +1042,9 @@ namespace HTMGT { bool needsReset = false; - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - pOcc < iv_occArray.end(); - pOcc++) + for( const auto & occ : iv_occArray ) { - if ((*pOcc)->needsReset()) + if (occ->needsReset()) { needsReset = true; break; @@ -1079,11 +1060,9 @@ namespace HTMGT { bool failed = false; - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - pOcc < iv_occArray.end(); - pOcc++) + for( const auto & occ : iv_occArray ) { - if ((*pOcc)->iv_failed) + if (occ->iv_failed) { failed = true; break; @@ -1140,23 +1119,21 @@ namespace HTMGT index += 4; // Now add OCC specific data (for each OCC) - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - (pOcc < iv_occArray.end()) && (index+16 < 4096); - pOcc++) + for( const auto & occ : iv_occArray ) { - o_data[index++] = (*pOcc)->getInstance(); - o_data[index++] = (*pOcc)->getState(); - o_data[index++] = (*pOcc)->getRole(); - o_data[index++] = (*pOcc)->iv_masterCapable; - o_data[index++] = (*pOcc)->iv_commEstablished; + o_data[index++] = occ->getInstance(); + o_data[index++] = occ->getState(); + o_data[index++] = occ->getRole(); + o_data[index++] = occ->iv_masterCapable; + o_data[index++] = occ->iv_commEstablished; index += 3; // reserved for expansion - o_data[index++] = (*pOcc)->iv_failed; - o_data[index++] = (*pOcc)->needsReset(); - o_data[index++] = (*pOcc)->iv_resetReason; - o_data[index++] = (*pOcc)->iv_resetCount; - if ((*pOcc)->iv_lastPollValid) + o_data[index++] = occ->iv_failed; + o_data[index++] = occ->needsReset(); + o_data[index++] = occ->iv_resetReason; + o_data[index++] = occ->iv_resetCount; + if (occ->iv_lastPollValid) { - memcpy(&o_data[index], (*pOcc)->iv_lastPollResponse, 4); + memcpy(&o_data[index], occ->iv_lastPollResponse, 4); } else { @@ -1190,11 +1167,8 @@ namespace HTMGT { occStateId currentState = OCC_STATE_NO_CHANGE; - for(occList_t::const_iterator occ_itr = iv_occArray.begin(); - (occ_itr != iv_occArray.end()); - ++occ_itr) + for(const auto & occ : iv_occArray ) { - Occ * occ = *occ_itr; if (OCC_STATE_NO_CHANGE == currentState) { currentState = occ->getState(); @@ -1230,20 +1204,19 @@ namespace HTMGT { sys->tryGetAttr<TARGETING::ATTR_HTMGT_SAFEMODE>(safeMode); } - for (std::vector<Occ*>::iterator pOcc = iv_occArray.begin(); - pOcc < iv_occArray.end(); - pOcc++) + + for( const auto & occ : iv_occArray ) { - if ((*pOcc)->iv_resetCount != 0) + if (occ->iv_resetCount != 0) { TMGT_INF("_clearResetCounts: Clearing OCC%d reset count " "(was %d)", - (*pOcc)->getInstance(), (*pOcc)->iv_resetCount); - (*pOcc)->iv_resetCount = 0; + occ->getInstance(), occ->iv_resetCount); + occ->iv_resetCount = 0; if (safeMode) { // Clear OCC flags (failed, commEstablished, etc) - (*pOcc)->postResetClear(); + occ->postResetClear(); } } } diff --git a/src/usr/htmgt/htmgt_occ.H b/src/usr/htmgt/htmgt_occ.H index eaef25059..869378146 100644 --- a/src/usr/htmgt/htmgt_occ.H +++ b/src/usr/htmgt/htmgt_occ.H @@ -112,6 +112,7 @@ namespace HTMGT * @param[in] i_masterCapable Is OCC capable of being master * @param[in] i_homer Virtual address of HOMER * @param[in] i_target OCC target pointer + * @param[in] i_role The role of this OCC */ Occ(const uint8_t i_instance, const bool i_masterCapable, diff --git a/src/usr/htmgt/htmgt_occcmd.C b/src/usr/htmgt/htmgt_occcmd.C index 83e950bdc..5d190f7ce 100644 --- a/src/usr/htmgt/htmgt_occcmd.C +++ b/src/usr/htmgt/htmgt_occcmd.C @@ -262,15 +262,7 @@ namespace HTMGT break; default: - if ((OCC_CMD_SETUP_CFG_DATA==iv_OccCmd.cmdType) && - (iv_OccCmd.dataLength > 0) && - ((iv_OccCmd.cmdData[0] == - OCC_CFGDATA_PSTATE_SSTRUCT))) - { - // Dont trace Pstate data (unless full tracing) - o_cmdWasTraced = (G_debug_trace & - DEBUG_TRACE_OCCCMD_FULL); - } + // Do nothing break; } } @@ -626,19 +618,20 @@ namespace HTMGT const occPollRspStruct_t poll_rsp_data = { // Status 0x8B = Master, AttnEnabled, ObsReady, ActReady 0x8B, - 0, // extStatus; - 0x01, // occsPresent; - 0, // requestedCfg; - 0, // state; - 0x0000, // reserved; - 0, // errorId; + 0, // extStatus; + 0x01, // occsPresent; + 0, // requestedCfg; + 0, // state; + 0, // mode + 0, // IPSStatus + 0, // errorId; 0x00000000, // errorAddress; - 0x0000, // errorLength; - 0x0000, // reserved2; + 0x0000, // errorLength; + 0x0000, // reserved2; { "occ825_simicsFF" }, // codeLevel[16]; { 'S', 'E', 'N', 'S', 'O', 'R' }, // sensor[6]; - 0, // numBlocks; - 0x01 // version; + 0, // numBlocks; + 0x01 // version; //uint8_t sensorData[4049]; }; UINT16_PUT(&rspBuffer[3], dataLength); diff --git a/src/usr/htmgt/htmgt_occcmd.H b/src/usr/htmgt/htmgt_occcmd.H index a75dd5528..1335b00ed 100644 --- a/src/usr/htmgt/htmgt_occcmd.H +++ b/src/usr/htmgt/htmgt_occcmd.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -36,10 +36,10 @@ namespace HTMGT { - const uint32_t OCC_CMD_ADDR = 0x001EE000; - const uint32_t OCC_RSP_ADDR = 0x001EF000; + const uint32_t OCC_CMD_ADDR = 0x000E0000; + const uint32_t OCC_RSP_ADDR = 0x000E1000; const uint32_t OCC_MAX_DATA_LENGTH = 0x00001000; - const uint32_t OCC_RSP_SRAM_ADDR = 0xFFFF7000; + const uint32_t OCC_RSP_SRAM_ADDR = 0xFFFBF000; // The following header lengths include the 2 byte checksum const uint16_t OCC_CMD_HDR_LENGTH = 6; diff --git a/src/usr/htmgt/htmgt_poll.C b/src/usr/htmgt/htmgt_poll.C index 2bba2aca3..4456d89f7 100644 --- a/src/usr/htmgt/htmgt_poll.C +++ b/src/usr/htmgt/htmgt_poll.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -46,18 +46,15 @@ namespace HTMGT errlHndl_t OccManager::_sendOccPoll(const bool i_flushAllErrors, TARGETING::Target * i_occTarget) { - errlHndl_t err = NULL; + errlHndl_t l_err = NULL; TMGT_INF("sendOccPoll(flush=%c)", i_flushAllErrors?'y':'n'); - for(occList_t::const_iterator occ_itr = iv_occArray.begin(); - (occ_itr != iv_occArray.end()) && (NULL == err); - ++occ_itr) + for( const auto & l_occ : iv_occArray ) { - Occ * occ = *occ_itr; - if(NULL == i_occTarget || occ->iv_target == i_occTarget) + if(NULL == i_occTarget || l_occ->iv_target == i_occTarget) { - err = occ->pollForErrors(i_flushAllErrors); + l_err = l_occ->pollForErrors(i_flushAllErrors); } } @@ -66,7 +63,7 @@ namespace HTMGT TMGT_ERR("_sendOccPoll(): OCCs need to be reset"); } - return err; + return l_err; } @@ -94,7 +91,7 @@ namespace HTMGT do { // create 1 byte buffer for poll command data - const uint8_t l_cmdData[1] = { 0x10 /*version*/ }; + const uint8_t l_cmdData[1] = { 0x20 /*version*/ }; OccCmd cmd(this, OCC_CMD_POLL, diff --git a/src/usr/htmgt/htmgt_poll.H b/src/usr/htmgt/htmgt_poll.H index faf133028..01cdf17bd 100644 --- a/src/usr/htmgt/htmgt_poll.H +++ b/src/usr/htmgt/htmgt_poll.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -54,7 +54,8 @@ namespace HTMGT uint8_t occsPresent; uint8_t requestedCfg; uint8_t state; - uint16_t reserved; + uint8_t mode; + uint8_t IPSStatus; uint8_t errorId; uint32_t errorAddress; uint16_t errorLength; diff --git a/src/usr/htmgt/test/htmgtcfgtest.H b/src/usr/htmgt/test/htmgtcfgtest.H index 57bc5bf67..753b68f2e 100644 --- a/src/usr/htmgt/test/htmgtcfgtest.H +++ b/src/usr/htmgt/test/htmgtcfgtest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2015 */ +/* Contributors Listed Below - COPYRIGHT 2014,2016 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -452,30 +452,6 @@ public: } - void testReadPstateTable( void ) - { - TS_TRACE(ENTER_MRK"HTMGT::testReadPstateTable"); - - TargetHandleList occs; - TargetHandleList::iterator occ; - size_t size = sizeof(ATTR_PSTATE_TABLE_type) + 4; - uint8_t data[size]; - - getAllChiplets(occs, TYPE_OCC, true); - - for(occ=occs.begin(); occ !=occs.end(); ++occ) - { - size = sizeof(ATTR_PSTATE_TABLE_type) + 4; - memset(data, 0, size); - getPstateTableMessageData(*occ, data, size); - - if(size != sizeof(ATTR_PSTATE_TABLE_type) + 4) - { - TS_FAIL("Wrong pstate table size. %d", - size); - } - } - } void testApssConfigData() { diff --git a/src/usr/htmgt/test/pstatetest.H b/src/usr/htmgt/test/pstatetest.H deleted file mode 100644 index ed67f6bb6..000000000 --- a/src/usr/htmgt/test/pstatetest.H +++ /dev/null @@ -1,205 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/usr/htmgt/test/pstatetest.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2014,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 */ -#ifndef __PSTATETEST_H -#define __PSTATETEST_H - -#include <cxxtest/TestSuite.H> -#include <errl/errlentry.H> -#include <errl/errlmanager.H> - -#include <targeting/common/targetservice.H> -#include <targeting/common/attributes.H> -#include <targeting/common/commontargeting.H> -#include <targeting/common/utilFilter.H> -#include <targeting/common/util.H> - -#include <fapi.H> -#include <fapiPlatHwpInvoker.H> - -#include <vfs/vfs.H> -#include <pstates.h> -#include <proc_get_voltage.H> -#include <mss_bulk_pwr_throttles.H> -#include <mss_util_to_throttle.H> -#include <mss_throttle_to_power.H> -#include <mss_eff_config_thermal.H> -#include "../genPstate.H" - -using namespace TARGETING; - -class pstateTest: public CxxTest::TestSuite -{ - public: - - // TODO RTC: 123180 VPD needs to be fixed in simics before a valid - // pstate table can be built in simics. - void DISABLE_test_verifyPstate( void ) - { - errlHndl_t l_errl = NULL; - bool pstateLibLoadedLocally = false; - bool htmgtLibLoadedLocally = false; - - if(!VFS::module_is_loaded( "libpstates.so" ) ) - { - l_errl = VFS::module_load( "libpstates.so" ); - if( l_errl ) - { - TS_FAIL("Could not load pstate module" ); - errlCommit(l_errl,HTMGT_COMP_ID); - } - else - { - pstateLibLoadedLocally = true; - } - } - - if(!VFS::module_is_loaded("libhtmgt.so")) - { - l_errl = VFS::module_load("libhtmgt.so"); - if( l_errl ) - { - TS_FAIL("Could not load libhtmgt.so module"); - errlCommit(l_errl,HTMGT_COMP_ID); - } - else - { - htmgtLibLoadedLocally = true; - } - } - - // generate normal pstate tables - l_errl = genPstateTables(true); - - if( l_errl ) - { - errlCommit(l_errl,HTMGT_COMP_ID); - TS_FAIL("verifyNormalPstate failed"); - } - - // generate mfg pstate tables - l_errl = genPstateTables(false); - - if( l_errl ) - { - errlCommit(l_errl,HTMGT_COMP_ID); - TS_FAIL("verifyMfgPstate failed"); - } - - // TODO RTC 123180 check eyecatcher in pstate table - - if(pstateLibLoadedLocally) - { - VFS::module_unload( "libpstates.so" ); - } - - if(htmgtLibLoadedLocally) - { - VFS::module_unload( "libhtmgt.so" ); - } - - } - - // test to call procedures HTMGT will need - void test_procedures( void ) - { - errlHndl_t l_errl = NULL; - - bool mccfgLibLoadedLocally = false; - - if(!VFS::module_is_loaded( "libmc_config.so" ) ) - { - l_errl = VFS::module_load( "libmc_config.so" ); - if( l_errl ) - { - TS_FAIL("Could not load mc_config module" ); - errlCommit(l_errl,HTMGT_COMP_ID); - } - else - { - mccfgLibLoadedLocally = true; - } - } - - TARGETING::TargetHandleList l_mbaTargetList; - getAllChiplets(l_mbaTargetList, TYPE_MBA); - - for (TargetHandleList::const_iterator l_mba_iter = l_mbaTargetList.begin(); - l_mba_iter != l_mbaTargetList.end(); ++l_mba_iter) - - { - const TARGETING::Target* l_mba_target = *l_mba_iter; - - const fapi::Target l_fapi_mba_target - (fapi::TARGET_TYPE_MBA_CHIPLET, - (const_cast<TARGETING::Target*>(l_mba_target))); - - // mss_eff_config_thermal sets up the attributes needed by - // the hw procedures that follow it. - FAPI_INVOKE_HWP( l_errl, - mss_eff_config_thermal, - l_fapi_mba_target); - if( l_errl ) - { - errlCommit(l_errl, HTMGT_COMP_ID); - TS_FAIL("Call to mss_eff_config_thermal failed"); - } - - FAPI_INVOKE_HWP( l_errl, - mss_bulk_pwr_throttles, - l_fapi_mba_target); - if( l_errl ) - { - errlCommit(l_errl, HTMGT_COMP_ID); - TS_FAIL("Call to mss_bulk_pwr_throttles failed"); - } - - FAPI_INVOKE_HWP( l_errl, - mss_util_to_throttle, - l_fapi_mba_target); - if( l_errl ) - { - errlCommit(l_errl, HTMGT_COMP_ID); - TS_FAIL("Call to mss_util_to_throttle failed"); - } - - - FAPI_INVOKE_HWP( l_errl, - mss_throttle_to_power, - l_fapi_mba_target); - if( l_errl ) - { - errlCommit(l_errl, HTMGT_COMP_ID); - TS_FAIL("Call to mss_throttle_to_power failed"); - } - } - - if(mccfgLibLoadedLocally) - { - VFS::module_unload( "libmc_config.so" ); - } - } -}; - -#endif diff --git a/src/usr/ipmi/ipmisensor.C b/src/usr/ipmi/ipmisensor.C index d4eb6560f..d4ef0e67c 100644 --- a/src/usr/ipmi/ipmisensor.C +++ b/src/usr/ipmi/ipmisensor.C @@ -1156,7 +1156,7 @@ namespace SENSOR // interface to retrieve the APSS channel sensor numbers. errlHndl_t getAPSSChannelSensorNumbers( - const uint16_t (* &o_sensor_numbers)[16]) + const uint32_t (* &o_sensor_numbers)[16]) { TARGETING::TargetHandle_t l_sys; diff --git a/src/usr/makefile b/src/usr/makefile index f2a98719f..96537fe87 100644 --- a/src/usr/makefile +++ b/src/usr/makefile @@ -64,7 +64,7 @@ SUBDIRS += lpc.d SUBDIRS += console.d SUBDIRS += errldisplay.d SUBDIRS += ipmi.d -#SUBDIRS += htmgt.d +SUBDIRS += htmgt.d SUBDIRS += diag.d SUBDIRS += xz.d SUBDIRS += $(if $(CONFIG_ENABLE_HDAT_IN_HOSTBOOT),hdat.d,) diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml index d59bb2db8..80feae689 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml @@ -629,10 +629,11 @@ <persistency>non-volatile</persistency> <readable/> </attribute> + <attribute> <id>OPEN_POWER_MIN_POWER_CAP_WATTS</id> <description> - Minimum power cap in Watts + Minimum hard power cap in Watts </description> <simpleType> <uint64_t></uint64_t> @@ -640,6 +641,7 @@ <persistency>non-volatile</persistency> <readable/> </attribute> + <attribute> <id>OPEN_POWER_N_PLUS_ONE_BULK_POWER_LIMIT_WATTS</id> <description> @@ -652,6 +654,7 @@ <persistency>non-volatile</persistency> <readable/> </attribute> + <attribute> <id>OPEN_POWER_N_PLUS_ONE_HPC_BULK_POWER_LIMIT_WATTS</id> <description> @@ -701,16 +704,18 @@ <persistency>non-volatile</persistency> <readable/> </attribute> + <attribute> <id>ADC_CHANNEL_SENSOR_NUMBERS</id> <description>ADC Channel IPMI sensor numbers. 16 channels.</description> <simpleType> - <uint16_t></uint16_t> + <uint32_t></uint32_t> <array>16</array> </simpleType> <persistency>non-volatile</persistency> <readable/> </attribute> + <attribute> <id>ADC_CHANNEL_GNDS</id> <description>ADC Channel ground. 16 channels.</description> |