From 0db8285dd2c26790529646b0b2eb9b07bf2f0d68 Mon Sep 17 00:00:00 2001 From: Sheldon Bailey Date: Thu, 4 May 2017 11:56:12 -0500 Subject: HTMGT: Support for MFG CMDs Change-Id: I8453db169745577d350f4f971d65b781ec634df0 RTC:172167 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40219 Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Reviewed-by: Martha Broyles Reviewed-by: Christopher J. Cain Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- src/usr/htmgt/htmgt.C | 154 ++++++++++++++++++++++++-------------- src/usr/htmgt/htmgt_cfgdata.C | 3 +- src/usr/htmgt/htmgt_cfgdata.H | 6 +- src/usr/htmgt/htmgt_occ.C | 15 +++- src/usr/htmgt/htmgt_occ.H | 10 ++- src/usr/htmgt/htmgt_poll.C | 6 +- src/usr/htmgt/htmgt_utility.C | 3 +- src/usr/htmgt/htmgt_utility.H | 12 ++- src/usr/htmgt/test/htmgtcfgtest.H | 2 +- 9 files changed, 137 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/usr/htmgt/htmgt.C b/src/usr/htmgt/htmgt.C index c9463dd38..d44f1dec3 100644 --- a/src/usr/htmgt/htmgt.C +++ b/src/usr/htmgt/htmgt.C @@ -480,48 +480,6 @@ namespace HTMGT } // end enableOccActuation() - - errlHndl_t dumpAttribute(const uint16_t i_length, - const uint8_t * i_data, - uint16_t & o_attrLength, - uint8_t * o_attrData) - { - errlHndl_t err = nullptr; - uint32_t attrId = 0; - - if ((i_data[0] == ATTR_RAW) && (i_length == 5)) - { - // Dump attribute based on raw ID - - attrId = UINT32_GET(&i_data[1]); - TMGT_INF("Attempting to read attribute 0x%08X", attrId); - //if (TARGETING::AttributeTank::attributeExists(attrId)) - //{ - // if (TARGETING::AttributeTank::getAttribute(attrId, - // TARGETING::TYPE_SYS, AttributeTank::ATTR_POS_NA, - // AttributeTank::ATTR_UNIT_POS_NA, - // AttributeTank::ATTR_NODE_NA, attrPtr)) - // { - // // // Got attribute! - // } - //} - } - else - { - TMGT_ERR("dumpAttribute: Invalid attribute specified 0x%02X " - "(length %d)", i_data[0], i_length); - bldErrLog(err, HTMGT_MOD_PASS_THRU, - HTMGT_RC_INVALID_PARAMETER, - UINT32_GET(&i_data[0]), - UINT32_GET(&i_data[4]), - 0, i_length, - ERRORLOG::ERRL_SEV_INFORMATIONAL); - } - return err; - } - - - // Send pass-thru command to HTMGT errlHndl_t passThruCommand(uint16_t i_cmdLength, uint8_t * i_cmdData, @@ -544,7 +502,6 @@ namespace HTMGT OccManager::getOccData(o_rspLength, o_rspData); break; - case PASSTHRU_INTERNAL_FLAG: if (i_cmdLength == 1) { @@ -556,8 +513,8 @@ namespace HTMGT { // set internal flag value TMGT_INF("passThruCommand: Updating internal flags " - "from 0x%08X to 0x%08X", - get_int_flags(), UINT32_GET(&i_cmdData[1])); + "from 0x%08X to 0x%08X", + get_int_flags(), UINT32_GET(&i_cmdData[1])); set_int_flags(UINT32_GET(&i_cmdData[1])); } else @@ -651,31 +608,116 @@ namespace HTMGT err = OccManager::resetOccs(NULL, true, true); if (err != NULL) { - TMGT_ERR("passThruCommand: resetOccs failed " - "with rc 0x%04X", err->reasonCode()); + TMGT_ERR("passThruCommand: Exit Save Mode " + "resetOccs failed with rc 0x%04X", + err->reasonCode()); } } break; - case PASSTHRU_DUMP_ATTRIBUTE: - if (i_cmdLength >= 2) + case PASSTHRU_RESET_PM_COMPLEX: + TMGT_INF("passThruCommand: Reset PM Complex"); + + err = OccManager::resetOccs(nullptr, true, true); + if(err) { - TMGT_INF("passThruCommand: Dump Attribute 0x%02X", - i_cmdData[1]); - err = dumpAttribute(i_cmdLength-1, &i_cmdData[1], - o_rspLength, o_rspData); + TMGT_ERR("passThruCommand: Reset PM Complex FAIL " + "with rc 0x%04X", err->reasonCode() ); + } + break; + + //HOLD for future need. case PASSTHRU_QUERY_MODE_FUNCTION: + // TMGT_INF("passThruCommand: Query mode or function"); + + // break; + + case PASSTHRU_ENA_DIS_OPAL_STATE: + { + TMGT_INF("passThruCommand: enable/disable OPAL STATE"); + + if (i_cmdLength == 2) + { + //0 = disable OPAL mode (i.e. run as PowerVM) + if (i_cmdData[1] == 0) + { + G_opalMode = OCC_CFGDATA_OPENPOWER_POWERVM; + } + //1 = enable OPAL mode + else if (i_cmdData[1] == 1) + { + G_opalMode = OCC_CFGDATA_OPENPOWER_OPALVM; + } + else + { + TMGT_ERR("passThruCommand: Invalid requested OPAL" + " mode 0x%02X ", i_cmdData[1] ); + /*@ + * @errortype + * @reasoncode HTMGT_RC_INVALID_PARAMETER + * @moduleid HTMGT_MOD_PASS_THRU + * @userdata1 command data[0-7] + * @userdata2 command data length + * @devdesc Invalid pass thru command + */ + failingSrc = HTMGT_RC_INVALID_PARAMETER; + } + if(failingSrc == HTMGT_RC_NO_ERROR) + { + TMGT_INF("passThruCommand: OCC State set(0x%02X)" + " RESET-OCC ", G_opalMode ); + err = OccManager::resetOccs(nullptr,true,true); + if(err) + { + TMGT_ERR("passThruCommand: OCC MODE change " + "Reset PM Complex FAIL with rc 0x%04X", + err->reasonCode()); + } + } } else { - TMGT_ERR("passThruCommand: invalid dump attribute " - "command length %d", i_cmdLength); + TMGT_ERR("passThruCommand: invalid OCC State " + "length %d", i_cmdLength); failingSrc = HTMGT_RC_INVALID_LENGTH; } + } + break; + + case PASSTHRU_SET_OCC_STATE: + { + TMGT_INF("passThruCommand: Set OCC State"); + occStateId l_targetState = (occStateId)i_cmdData[1]; + //Validate state requested is supported. + if( (l_targetState == OCC_STATE_OBSERVATION) || + (l_targetState == OCC_STATE_ACTIVE) || + (l_targetState == OCC_STATE_CHARACTERIZATION) ) + { + // Set state for all OCCs + err = OccManager::setOccState(l_targetState); + if (nullptr == err) + { + TMGT_INF("passThruCommand: OCC states " + "updated to 0x%02X", l_targetState); + } + else + { + TMGT_ERR("passThruCommand: OCC state change" + " FAIL with rc 0x%04X", + err->reasonCode()); + } + } + else + { + TMGT_ERR("passThruCommand: Invalid requested " + "state 0x%08X ", l_targetState ); + failingSrc = HTMGT_RC_INVALID_PARAMETER; + } + } break; default: TMGT_ERR("passThruCommand: Invalid command 0x%08X " - "(%d bytes)", UINT32_GET(i_cmdData), i_cmdLength); + "(%d bytes)", UINT32_GET(i_cmdData), i_cmdLength); /*@ * @errortype * @reasoncode HTMGT_RC_INVALID_DATA diff --git a/src/usr/htmgt/htmgt_cfgdata.C b/src/usr/htmgt/htmgt_cfgdata.C index a876a4535..96c41cf58 100644 --- a/src/usr/htmgt/htmgt_cfgdata.C +++ b/src/usr/htmgt/htmgt_cfgdata.C @@ -43,6 +43,7 @@ namespace HTMGT { bool G_wofSupported = true; + uint8_t G_opalMode = OCC_CFGDATA_OPENPOWER_OPALVM; // Send config format data to all OCCs void sendOccConfigData(const occCfgDataFormat i_requestedFormat) @@ -694,7 +695,7 @@ void getSystemConfigMessageData(const TargetHandle_t i_occ, uint8_t* o_data, o_data[index++] = OCC_CFGDATA_SYS_CONFIG_VERSION; //System Type - o_data[index++] = OCC_CFGDATA_OPENPOWER_SYSTEMTYPE; + o_data[index++] = G_opalMode; //processor sensor ID ConstTargetHandle_t proc = getParentChip(i_occ); diff --git a/src/usr/htmgt/htmgt_cfgdata.H b/src/usr/htmgt/htmgt_cfgdata.H index c96e8b10c..2e0fde5bb 100644 --- a/src/usr/htmgt/htmgt_cfgdata.H +++ b/src/usr/htmgt/htmgt_cfgdata.H @@ -61,8 +61,10 @@ namespace HTMGT enum // constants { - //KVM mode + single node - OCC_CFGDATA_OPENPOWER_SYSTEMTYPE = 0x81, + //KVM or OPAL mode + single node + OCC_CFGDATA_OPENPOWER_OPALVM = 0x81, + //PowerVM mode + single node + OCC_CFGDATA_OPENPOWER_POWERVM = 0x01, CFGDATA_CORES = 24, diff --git a/src/usr/htmgt/htmgt_occ.C b/src/usr/htmgt/htmgt_occ.C index 95ae8197a..207697be7 100644 --- a/src/usr/htmgt/htmgt_occ.C +++ b/src/usr/htmgt/htmgt_occ.C @@ -655,7 +655,8 @@ namespace HTMGT } if ((requestedState == OCC_STATE_ACTIVE) || - (requestedState == OCC_STATE_OBSERVATION)) + (requestedState == OCC_STATE_OBSERVATION) || + (requestedState == OCC_STATE_CHARACTERIZATION) ) { // Function is only called on initial IPL and when user/mfg // requests a new state, so we can update target here. @@ -768,11 +769,16 @@ namespace HTMGT TMGT_CONSOLE("OCCs are now running in ACTIVE " "state"); } - else + else if (OCC_STATE_OBSERVATION == requestedState) { TMGT_CONSOLE("OCCs are now running in OBSERVATION " "state"); } + else if (OCC_STATE_CHARACTERIZATION == requestedState) + { + TMGT_CONSOLE("OCCs are now running in " + "CHARACTERIZATION state"); + } } } @@ -924,6 +930,11 @@ namespace HTMGT { TMGT_ERR("_resetOCCs: loadAndStartPMAll failed. "); err->collectTrace("HTMGT"); + processOccStartStatus(false, l_proc_target); + } + else + { + processOccStartStatus(true, l_proc_target); } } else if (!err) // Reset Threshold reached and no other err diff --git a/src/usr/htmgt/htmgt_occ.H b/src/usr/htmgt/htmgt_occ.H index a4be47d54..c1e45d641 100644 --- a/src/usr/htmgt/htmgt_occ.H +++ b/src/usr/htmgt/htmgt_occ.H @@ -53,10 +53,12 @@ namespace HTMGT OCC_STATE_OBSERVATION = 0x02, OCC_STATE_ACTIVE = 0x03, OCC_STATE_SAFE = 0x04, - OCC_STATE_RESET = 0x05, - OCC_STATE_IN_TRANSITION = 0x07, - OCC_STATE_LOADING = 0x08, - OCC_STATE_UNKNOWN = 0x09, + OCC_STATE_CHARACTERIZATION = 0x05, + // the following states are internal to TMGT + OCC_STATE_RESET = 0x85, + OCC_STATE_IN_TRANSITION = 0x87, + OCC_STATE_LOADING = 0x88, + OCC_STATE_UNKNOWN = 0x89, }; enum occRole diff --git a/src/usr/htmgt/htmgt_poll.C b/src/usr/htmgt/htmgt_poll.C index 8b3dc2585..a3d5d2238 100644 --- a/src/usr/htmgt/htmgt_poll.C +++ b/src/usr/htmgt/htmgt_poll.C @@ -260,7 +260,8 @@ namespace HTMGT } if ((OCC_STATE_ACTIVE == pollRsp->state) || - (OCC_STATE_OBSERVATION == pollRsp->state)) + (OCC_STATE_OBSERVATION == pollRsp->state) || + (OCC_STATE_CHARACTERIZATION == pollRsp->state)) { errlHndl_t l_err = NULL; @@ -358,6 +359,3 @@ namespace HTMGT } // end namespace - - - diff --git a/src/usr/htmgt/htmgt_utility.C b/src/usr/htmgt/htmgt_utility.C index 5edbc512b..bf10ffe98 100644 --- a/src/usr/htmgt/htmgt_utility.C +++ b/src/usr/htmgt/htmgt_utility.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2016 */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -147,6 +147,7 @@ namespace HTMGT case OCC_STATE_ACTIVE: return("ACTIVE"); break; case OCC_STATE_SAFE: return("SAFE"); break; case OCC_STATE_RESET: return("RESET"); break; + case OCC_STATE_CHARACTERIZATION: return("CHARACTERIZATION"); break; case OCC_STATE_IN_TRANSITION: return("IN TRANSITION"); break; case OCC_STATE_LOADING: return("LOADING"); break; case OCC_STATE_UNKNOWN: return("UNKNOWN"); break; diff --git a/src/usr/htmgt/htmgt_utility.H b/src/usr/htmgt/htmgt_utility.H index 721c1d916..7872a1f78 100644 --- a/src/usr/htmgt/htmgt_utility.H +++ b/src/usr/htmgt/htmgt_utility.H @@ -97,6 +97,11 @@ namespace HTMGT // Debug flags extern uint32_t G_debug_data; + + // Global to set OCC into OpalVM or PowerVM mode + extern uint8_t G_opalMode; //defined in htmgt_cfgdata.C + + enum debugTraceTypes { // Types are bit flags so can enable multiple at once @@ -150,9 +155,10 @@ namespace HTMGT PASSTHRU_SEND_OCC_COMMAND = 0x03, // send raw OCC command PASSTHRU_CLEAR_RESET_COUNTS = 0x04, PASSTHRU_EXIT_SAFE_MODE = 0x05, - PASSTHRU_GENERATE_MFG_PSTATE = 0x81, - PASSTHRU_LOAD_PSTATE = 0x82, - PASSTHRU_DUMP_ATTRIBUTE = 0x83 + PASSTHRU_RESET_PM_COMPLEX = 0x06, + //HOLD for future need. PASSTHRU_QUERY_MODE_FUNCTION = 0x07, + PASSTHRU_ENA_DIS_OPAL_STATE = 0x08, + PASSTHRU_SET_OCC_STATE = 0x09, }; enum htmgtAttrName diff --git a/src/usr/htmgt/test/htmgtcfgtest.H b/src/usr/htmgt/test/htmgtcfgtest.H index aa3adfb20..776d24e2a 100644 --- a/src/usr/htmgt/test/htmgtcfgtest.H +++ b/src/usr/htmgt/test/htmgtcfgtest.H @@ -375,7 +375,7 @@ public: } - if (data[2] != OCC_CFGDATA_OPENPOWER_SYSTEMTYPE) + if (data[2] != OCC_CFGDATA_OPENPOWER_OPALVM) { TS_FAIL("wrong system type 0x%X for system config data command", data[2]); -- cgit v1.2.1