diff options
Diffstat (limited to 'src/usr/hwas')
-rw-r--r-- | src/usr/hwas/common/hwas.C | 88 | ||||
-rw-r--r-- | src/usr/hwas/hwasPlat.C | 101 | ||||
-rw-r--r-- | src/usr/hwas/test/hwas1test.H | 53 |
3 files changed, 145 insertions, 97 deletions
diff --git a/src/usr/hwas/common/hwas.C b/src/usr/hwas/common/hwas.C index 38cc9d4a5..0aaa0246b 100644 --- a/src/usr/hwas/common/hwas.C +++ b/src/usr/hwas/common/hwas.C @@ -2495,67 +2495,57 @@ void calculateEffectiveEC() errlHndl_t markDisabledMcas() { errlHndl_t l_errl = nullptr; - uint8_t lxData[HWAS::VPD_CRP0_LX_DATA_LENGTH]; + uint8_t lxData[HWAS::VPD_CRP0_LX_HDR_DATA_LENGTH]; HWAS_INF("markDisabledMcas entry"); do { - //Get all functional chips - TARGETING::TargetHandleList l_procList; - getAllChips(l_procList, TYPE_PROC); + //Get the functional MCAs + TargetHandleList l_mcaList; + getAllChiplets(l_mcaList, TYPE_MCA, true); - //Loop through all functional procs - for(auto l_proc : l_procList) + for (auto l_mca : l_mcaList) { - //Get the functional MCAs for this proc - TargetHandleList l_mcaList; - getChildChiplets(l_mcaList, l_proc, TYPE_MCA, true); - - for (auto l_mca : l_mcaList) - { - // fill the Lx data buffer with zeros - memset(lxData, 0x00, VPD_CRP0_LX_DATA_LENGTH); + // fill the Lx data buffer with zeros + memset(lxData, 0x00, VPD_CRP0_LX_HDR_DATA_LENGTH); #ifdef __HOSTBOOT_MODULE - //@TODO RTC:167294 Need to remove conditional after - // additional implementation - //Read Lx keyword for associated proc and MCA - l_errl = platReadLx(l_proc, - l_mca, - lxData); + //@TODO RTC:167294 Need to remove conditional after + // additional implementation + //Read Lx keyword for associated proc and MCA + l_errl = platReadLx(l_mca, + lxData); #endif - if (l_errl) - { - // commit the error but keep going - errlCommit(l_errl, HWAS_COMP_ID); - } + if (l_errl) + { + // commit the error but keep going + errlCommit(l_errl, HWAS_COMP_ID); + } - if (lxData[VPD_CRP0_LX_FREQ_INDEP_INDEX - + VPD_CRP0_LX_PORT_DISABLED] != 0) - { - // Since port is disabled, MCA is not functional, but - // it's present. - enableHwasState(l_mca, - true, // present - false, // not functional - DeconfigGard::DECONFIGURED_BY_DISABLED_PORT - ); - HWAS_DBG("MCA %.8X - marked present, not functional", - l_mca->getAttr<ATTR_HUID>()); - - TargetInfo l_TargetInfo; - l_TargetInfo.affinityPath = - l_mca->getAttr<ATTR_AFFINITY_PATH>(); - l_TargetInfo.pThisTarget = l_mca; - l_TargetInfo.type = l_mca->getAttr<ATTR_TYPE>(); - l_TargetInfo.reason = - DeconfigGard::DECONFIGURED_BY_DISABLED_PORT; - - // Deconfigure child targets for this MCA - deconfigPresentByAssoc(l_TargetInfo); - } + if (lxData[VPD_CRP0_LX_FREQ_INDEP_INDEX + + VPD_CRP0_LX_PORT_DISABLED] != 0) + { + // Since port is disabled, MCA is not functional, but + // it's present. + enableHwasState(l_mca, + true, // present + false, // not functional + DeconfigGard::DECONFIGURED_BY_DISABLED_PORT); + HWAS_DBG("MCA %.8X - marked present, not functional", + l_mca->getAttr<ATTR_HUID>()); + + TargetInfo l_TargetInfo; + l_TargetInfo.affinityPath = + l_mca->getAttr<ATTR_AFFINITY_PATH>(); + l_TargetInfo.pThisTarget = l_mca; + l_TargetInfo.type = l_mca->getAttr<ATTR_TYPE>(); + l_TargetInfo.reason = + DeconfigGard::DECONFIGURED_BY_DISABLED_PORT; + + // Deconfigure child targets for this MCA + deconfigPresentByAssoc(l_TargetInfo); } } diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C index 63068b630..22da95bb7 100644 --- a/src/usr/hwas/hwasPlat.C +++ b/src/usr/hwas/hwasPlat.C @@ -305,74 +305,93 @@ errlHndl_t platReadPR(const TargetHandle_t &i_target, //****************************************************************************** // platReadLx function //****************************************************************************** -errlHndl_t platReadLx(const TargetHandle_t &i_proc, - const TargetHandle_t &i_mca, +errlHndl_t platReadLx(const TargetHandle_t &i_mca, void *o_lxData) { errlHndl_t errl = nullptr; - uint8_t l_chip_unit = i_mca->getAttr<TARGETING::ATTR_CHIP_UNIT>(); - uint8_t l_x = VPD_CRP0_LX_MIN_X + l_chip_unit; + uint8_t l_chip_unit; + uint8_t l_x; + const TARGETING::Target* l_proc; - HWAS_DBG( "i_proc %.8X, i_mca %.8X, Lx = L%1d", - i_proc->getAttr<ATTR_HUID>(), - i_mca->getAttr<ATTR_HUID>(), - l_x); - - //Look for an invalid x value - if( l_x > VPD_CRP0_LX_MAX_X) + if (!(i_mca->tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_chip_unit))) { - HWAS_ERR("Invalid Lx with x=%1d for MCA %.8X on %.8X", - l_x, - i_mca->getAttr<ATTR_HUID>(), - i_proc->getAttr<ATTR_HUID>()); + HWAS_ERR("Bad MCA target"); /*@ * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE * @moduleid HWAS::MOD_PLAT_READLX - * @reasoncode HWAS::RC_BAD_LX - * @userdata1[0:31] Target proc HUID - * @userdata1[32:63] Target MCA HUID - * @userdata2 Value of x for Lx keyword - * @devdesc platReadLx> Invalid Lx keyword + * @reasoncode HWAS::RC_BAD_MCA + * @userdata1 0 + * @userdata2 0 + * @devdesc platReadLx> Bad MCA target */ - errl = new ERRORLOG::ErrlEntry( - ERRORLOG::ERRL_SEV_UNRECOVERABLE, + errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, HWAS::MOD_PLAT_READLX, - HWAS::RC_BAD_LX, - TWO_UINT32_TO_UINT64( - TARGETING::get_huid(i_proc), - TARGETING::get_huid(i_mca)), - l_x); + HWAS::RC_BAD_MCA, + 0, + 0); // make code the highest callout errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, HWAS::SRCI_PRIORITY_HIGH); } + else + { + l_x = VPD_CRP0_LX_MIN_X + l_chip_unit; + + HWAS_DBG( "i_mca %.8X, Lx = L%1d", + i_mca->getAttr<ATTR_HUID>(), + l_x); + + //Check for an invalid x value + if( l_x > VPD_CRP0_LX_MAX_X) + { + HWAS_ERR("Invalid Lx with x=%1d for MCA %.8X", + l_x, + i_mca->getAttr<ATTR_HUID>()); + /*@ + * @errortype ERRORLOG::ERRL_SEV_UNRECOVERABLE + * @moduleid HWAS::MOD_PLAT_READLX + * @reasoncode HWAS::RC_BAD_LX + * @userdata1 Target MCA HUID + * @userdata2 Value of x for Lx keyword + * @devdesc platReadLx> Invalid Lx keyword + */ + errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE, + HWAS::MOD_PLAT_READLX, + HWAS::RC_BAD_LX, + TARGETING::get_huid(i_mca), + l_x); + + // make code the highest callout + errl->addProcedureCallout(HWAS::EPUB_PRC_HB_CODE, + HWAS::SRCI_PRIORITY_HIGH); + } + else + { + l_proc = getParentChip( i_mca ); + + HWAS_DBG( "i_mca %.8X, Lx = L%1d, l_proc %.8X", + i_mca->getAttr<ATTR_HUID>(), + l_x, + l_proc->getAttr<ATTR_HUID>()); + } + } if (errl == nullptr) { // no error, so we got a valid chip unit value back // call deviceRead() to find the Lx record - uint8_t lxRaw[VPD_CRP0_LX_HDR_LENGTH + VPD_CRP0_LX_DATA_LENGTH]; - size_t lxSize = sizeof(lxRaw); - - errl = deviceRead(i_proc, lxRaw, lxSize, + size_t l_lxLength = VPD_CRP0_LX_HDR_DATA_LENGTH; + errl = deviceRead((TARGETING::Target*)l_proc, o_lxData, l_lxLength, DEVICE_MVPD_ADDRESS(MVPD::CRP0, MVPD::L1 + l_chip_unit)); if (errl != nullptr) { // trace the error condition - HWAS_INF( "i_proc %.8X, i_mca %.8X - failed L%1d read", - i_proc->getAttr<ATTR_HUID>(), + HWAS_INF( "l_proc %.8X, i_mca %.8X - failed L%1d read", + l_proc->getAttr<ATTR_HUID>(), i_mca->getAttr<ATTR_HUID>(), l_x); } - else - { - // skip past the header - void *lxData = static_cast<void *>(&lxRaw[0]); - HWAS_DBG_BIN("Lx record", lxData, VPD_CRP0_LX_DATA_LENGTH); - // copy the data back into the caller's buffer - memcpy(o_lxData, lxData, VPD_CRP0_LX_DATA_LENGTH); - } } return errl; diff --git a/src/usr/hwas/test/hwas1test.H b/src/usr/hwas/test/hwas1test.H index cf7461623..08a9c1425 100644 --- a/src/usr/hwas/test/hwas1test.H +++ b/src/usr/hwas/test/hwas1test.H @@ -1545,6 +1545,8 @@ public: using namespace HWAS; using namespace TARGETING; + TS_INFO( "testHWASpervStates entry" ); + // find top level target Target * pSys; targetService().getTopLevelTarget(pSys); @@ -1638,30 +1640,67 @@ public: TS_INFO( "testHWASplatReadLx entry" ); // call platReadLx with target that isn't in the VPD - errlHndl_t l_errl; + errlHndl_t l_errl = nullptr; + // Get system target Target* pSys; targetService().getTopLevelTarget(pSys); + // Get processor targets TARGETING::TargetHandleList l_procList; getAllChips(l_procList, TYPE_PROC); - TargetHandleList l_mcaList; - getChildChiplets(l_mcaList, *(l_procList.begin()), TYPE_MCA, true); + // Get children of first processor target + TargetHandleList l_childList; + getChildChiplets(l_childList, *(l_procList.begin()), TYPE_NA, false); - uint8_t lxData[HWAS::VPD_CRP0_LX_DATA_LENGTH]; + uint8_t lxData[HWAS::VPD_CRP0_LX_HDR_DATA_LENGTH]; - l_errl = HWAS::platReadLx(pSys, *(l_mcaList.begin()), lxData); + // Try using system target which does not have a chip unit attribute + l_errl = HWAS::platReadLx(pSys, lxData); + // Check that an error log is returned if (l_errl) { // error log is expected case, delete it delete l_errl; + l_errl = nullptr; } else { - TS_FAIL("testHWASplatReadLx>" - "No error from platReadLx(pSys, *(l_mcaList.begin())."); + TS_FAIL("testHWASplatReadLx> No error from platReadLx(pSys)."); + } + + // Find a target that has a large chip unit and use that target + for( const auto & l_child_target: l_childList ) + { + uint8_t l_chip_unit; + if (l_child_target-> + tryGetAttr<TARGETING::ATTR_CHIP_UNIT>(l_chip_unit)) + { + // Check if chip unit attribute is large enough + if(l_chip_unit >= HWAS::VPD_CRP0_LX_MAX_X) + { + // Try using target which has larger than expected chip unit + l_errl = HWAS::platReadLx(l_child_target, lxData); + + // Check that an error log is returned + if (l_errl) + { + // error log is expected case, delete it + delete l_errl; + l_errl = nullptr; + } + else + { + TS_FAIL("testHWASplatReadLx> No error from " + "platReadLx(l_child_target 0x%8X).", + l_child_target->getAttr<ATTR_HUID>()); + } + + break; + } + } } TS_INFO( "testHWASplatReadLx exit" ); |