diff options
Diffstat (limited to 'src/usr/htmgt/htmgt.C')
-rw-r--r-- | src/usr/htmgt/htmgt.C | 322 |
1 files changed, 167 insertions, 155 deletions
diff --git a/src/usr/htmgt/htmgt.C b/src/usr/htmgt/htmgt.C index e2e508025..502b661e0 100644 --- a/src/usr/htmgt/htmgt.C +++ b/src/usr/htmgt/htmgt.C @@ -55,7 +55,7 @@ namespace HTMGT void processOccStartStatus(const bool i_startCompleted, TARGETING::Target * i_failedOccTarget) { - TMGT_INF(">>processOccStartStatus(%d,0x%p)", + TMGT_INF(">>processOccStartStatus(%d,%p)", i_startCompleted, i_failedOccTarget); errlHndl_t l_err = NULL; uint32_t l_huid = 0; @@ -88,7 +88,11 @@ namespace HTMGT #endif // Make sure OCCs are ready for communication - OccManager::waitForOccCheckpoint(); + l_err = OccManager::waitForOccCheckpoint(); + if (l_err) + { + break; + } #ifdef __HOSTBOOT_RUNTIME // TODO RTC 124738 Final solution TBD @@ -222,7 +226,7 @@ namespace HTMGT // Notify HTMGT that an OCC has an error to report void processOccError(TARGETING::Target * i_procTarget) { - TMGT_INF(">>processOccError(0x%p)", i_procTarget); + TMGT_INF(">>processOccError(%p)", i_procTarget); TARGETING::Target* sys = NULL; TARGETING::targetService().getTopLevelTarget(sys); @@ -298,7 +302,7 @@ namespace HTMGT // Notify HTMGT that an OCC has failed and needs to be reset void processOccReset(TARGETING::Target * i_proc) { - TMGT_INF(">>processOccReset(0x%p)", i_proc); + TMGT_INF(">>processOccReset(%p)", i_proc); errlHndl_t errl = NULL; TARGETING::Target * failedOccTarget = NULL; @@ -314,12 +318,14 @@ namespace HTMGT return; } - // Get functional OCC (one per proc) - TARGETING::TargetHandleList pOccs; - getChildChiplets(pOccs, i_proc, TARGETING::TYPE_OCC); - if (pOccs.size() > 0) + if (i_proc) { - failedOccTarget = pOccs[0]; + TARGETING::TargetHandleList pOccs; + getChildChiplets(pOccs, i_proc, TARGETING::TYPE_OCC); + if (pOccs.size() > 0) + { + failedOccTarget = pOccs[0]; + } } if(NULL != failedOccTarget) @@ -464,183 +470,190 @@ 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; - - 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; + switch (i_cmdData[0]) + { + case PASSTHRU_OCC_STATUS: + TMGT_INF("passThruCommand: OCC Status"); + OccManager::getOccData(o_rspLength, o_rspData); + break; - case PASSTHRU_LOAD_PSTATE: - if (i_cmdLength == 2) - { - const uint8_t pstateType = i_cmdData[1]; - if ((0 == pstateType) || (1 == pstateType)) + case PASSTHRU_GENERATE_MFG_PSTATE: + if (i_cmdLength == 1) { - TMGT_INF("passThruCommand: Load pstate tables " - "(type: %d)", pstateType); - // 0 = Normal Pstate Tables - err = OccManager::loadPstates(0 == pstateType); + TMGT_INF("passThruCommand: Generate MFG pstate " + "tables", i_cmdData[1]); + err = genPstateTables(false); } else { - TMGT_ERR("passThruCommand: invalid pstate type " - "specified: %d", pstateType); + TMGT_ERR("passThruCommand: invalid generate pstate " + "command length %d", i_cmdLength); /*@ * @errortype - * @reasoncode HTMGT_RC_INVALID_PARAMETER + * @reasoncode HTMGT_RC_INVALID_LENGTH * @moduleid HTMGT_MOD_PASS_THRU * @userdata1 command data[0-7] * @userdata2 command data length - * @devdesc Invalid load pstate table type + * @devdesc Invalid pass thru command data len */ - failingSrc = HTMGT_RC_INVALID_PARAMETER; + 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_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_LOAD_PSTATE: + if (i_cmdLength == 2) { - 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 pstateType = i_cmdData[1]; + if ((0 == pstateType) || (1 == pstateType)) { - TMGT_ERR("passThruCommand: OCC%d cmd 0x%02X " - "failed with rc 0x%04X", - occInstance, occCmd, - err->reasonCode()); + TMGT_INF("passThruCommand: Load pstate tables " + "(type: %d)", pstateType); + // 0 = Normal Pstate Tables + err = OccManager::loadPstates(0 == pstateType); } 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: 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; } } 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 load pstate " + "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; - - case PASSTHRU_CLEAR_RESET_COUNTS: - TMGT_INF("passThruCommand: Clear all OCC reset counts"); - OccManager::clearResetCounts(); - break; + break; - case PASSTHRU_EXIT_SAFE_MODE: - { - 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; - if(sys) + case PASSTHRU_SEND_OCC_COMMAND: + if (i_cmdLength >= 3) { - sys->setAttr<TARGETING::ATTR_HTMGT_SAFEMODE> - (safeMode); + 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_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 + { + 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; + } } - // 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) + else { - TMGT_ERR("passThruCommand: resetOccs failed " - "with rc 0x%04X", err->reasonCode()); + TMGT_ERR("passThruCommand: invalid OCC command " + "length %d", i_cmdLength); + failingSrc = HTMGT_RC_INVALID_LENGTH; } - } - break; + 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; - } + case PASSTHRU_CLEAR_RESET_COUNTS: + TMGT_INF("passThruCommand: Clear all OCC reset counts"); + OccManager::clearResetCounts(); + 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); + case PASSTHRU_EXIT_SAFE_MODE: + { + 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; + 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()); + } + } + 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); + } } } @@ -648,6 +661,5 @@ namespace HTMGT } // end passThruCommand() - } |