diff options
Diffstat (limited to 'src/usr/errl/errlentry.C')
-rw-r--r-- | src/usr/errl/errlentry.C | 307 |
1 files changed, 125 insertions, 182 deletions
diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C index 61eeb15f2..78e1f9bc6 100644 --- a/src/usr/errl/errlentry.C +++ b/src/usr/errl/errlentry.C @@ -49,7 +49,6 @@ #include <errl/errludstate.H> #include <errl/errli2c.H> #include <trace/interface.H> -#include <config.h> #include "../trace/entry.H" #include <util/align.H> @@ -60,7 +59,6 @@ #include <targeting/common/targetservice.H> #include <targeting/common/utilFilter.H> #include <targeting/common/commontargeting.H> -#include <config.h> #include <initservice/initserviceif.H> #include <attributeenums.H> #include "errlentry_consts.H" @@ -405,18 +403,6 @@ void ErrlEntry::addPartCallout(const TARGETING::Target *i_target, i_target, i_partType, i_priority, i_deconfigState, i_gardErrorType); - // Need targeting for nvdimm check - if(Util::isTargetingLoaded() && TARGETING::targetService().isInitialized()) - { - // Add procedure callout to replace the cable to the NVDIMM - if( (i_target->getAttr<TARGETING::ATTR_TYPE>() == TARGETING::TYPE_DIMM) - && ( isNVDIMM(i_target) ) ) - { - addProcedureCallout( HWAS::EPUB_PRC_NVDIMM_ERR, - HWAS::SRCI_PRIORITY_HIGH ); - } - } - const void* pData = nullptr; uint32_t size = 0; TARGETING::EntityPath* ep = nullptr; @@ -599,42 +585,7 @@ void ErrlEntry::addHwCallout(const TARGETING::Target *i_target, i_deconfigState, i_gardErrorType); #endif - // Add procedure callout to replace the cable to the NVDIMM - if( isNVDIMM(i_target) ) - { - addProcedureCallout( HWAS::EPUB_PRC_NVDIMM_ERR, - HWAS::SRCI_PRIORITY_HIGH ); - } - TARGETING::EntityPath ep; - TARGETING::TYPE l_type = i_target->getAttr<TARGETING::ATTR_TYPE>(); - - TARGETING::TYPE l_type_ecid = l_type; - const TARGETING::Target* l_parentTarget = i_target; - if((l_type_ecid != TARGETING::TYPE_MEMBUF) && - (l_type_ecid != TARGETING::TYPE_PROC) && - (l_type_ecid != TARGETING::TYPE_NODE) - ) - { - //since this returns NULL if the parent is not found, - // we need a placeholder - const TARGETING::Target* l_tempParentTarget = - getParentChip(l_parentTarget); - if(l_tempParentTarget != NULL) - { - l_parentTarget = l_tempParentTarget; - l_type_ecid = l_parentTarget->getAttr<TARGETING::ATTR_TYPE>(); - } - } - //if we have found a type_membuf or type_proc, store the ecid - //otherwise, (type_node), do nothing. - if(l_type_ecid == TARGETING::TYPE_MEMBUF || - l_type_ecid == TARGETING::TYPE_PROC) - { - ErrlUserDetailsAttribute(l_parentTarget, - TARGETING::ATTR_ECID).addToLog(this); - } - ep = i_target->getAttr<TARGETING::ATTR_PHYS_PATH>(); // size is total EntityPath size minus unused path elements @@ -704,99 +655,24 @@ void ErrlEntry::addVersionInfo() if ( !INITSERVICE::spBaseServicesEnabled() && PNOR::isSectionAvailable(PNOR::VERSION)) { - -// Setting variables only used in config secureboot -#ifdef CONFIG_SECUREBOOT - bool l_secureSectionLoaded = false; - errlHndl_t l_errl_loadSecureSection = nullptr; -#endif - - errlHndl_t l_errl = nullptr; - do { - -#ifdef CONFIG_SECUREBOOT - l_errl_loadSecureSection = PNOR::loadSecureSection(PNOR::VERSION); - if (l_errl_loadSecureSection) - { - TRACFCOMP( g_trac_errl, - "addVersionInfo: Failed to load secure VERSION"); - // Since an error occurred while attempting to add version info - // to another error log there is nothing that can be done with - // this error since attempting to commit it will lead to an - // infinite loop of committing the error and then recalling this - // function. If this error occurred then the VERSION partition - // is not added and the error log commit continues. - delete l_errl_loadSecureSection; - l_errl_loadSecureSection = nullptr; - break; - } - else - { - l_secureSectionLoaded = true; - } -#endif - - // Get PNOR Version - PNOR::SectionInfo_t l_pnorVersionInfo; - l_errl = getSectionInfo(PNOR::VERSION, l_pnorVersionInfo); - - if (l_errl) - { - TRACFCOMP( g_trac_errl, - "addVersionInfo: Failed to getSectionInfo"); - // Since an error occurred while attempting to add version info - // to another error log there is nothing that can be done with - // this error since attempting to commit it will lead to an - // infinite loop of committing the error and then recalling this - // function. If this error occurred then the VERSION partition - // is not added and the error log commit continues. - delete l_errl; - l_errl = nullptr; - break; - } - const uint8_t* l_versionData = - reinterpret_cast<uint8_t*>(l_pnorVersionInfo.vaddr); - - size_t l_numberOfBytes = 0; + ERRORLOG::getCachedVersionPartition(); + size_t l_versionSize = + ERRORLOG::getCachedVersionPartitionSize(); - // Determine the size of the version data. The max size is the given - // size in the SectionInfo but can be less. - while ((static_cast<char>(l_versionData[l_numberOfBytes]) != '\0') - && l_numberOfBytes < l_pnorVersionInfo.size) + if(!l_versionData || !l_versionSize) { - ++l_numberOfBytes; + break; } - char l_pVersionString[l_numberOfBytes + 1]={0}; + char l_pVersionString[l_versionSize + 1]={0}; - memcpy(l_pVersionString, l_versionData, l_numberOfBytes); + memcpy(l_pVersionString, l_versionData, l_versionSize); ErrlUserDetailsString(l_pVersionString).addToLog(this); } while(0); - -#ifdef CONFIG_SECUREBOOT - if (l_secureSectionLoaded) - { - l_errl_loadSecureSection = PNOR::unloadSecureSection(PNOR::VERSION); - if(l_errl_loadSecureSection) - { - TRACFCOMP( g_trac_errl, - "addVersionInfo: Failed to unload secure VERSION"); - // Since an error occurred while attempting to add version info - // to another error log there is nothing that can be done with - // this error since attempting to commit it will lead to an - // infinite loop of committing the error and then recalling this - // function. If this error occurred then the VERSION partition - // is not added and the error log commit continues. - delete l_errl_loadSecureSection; - l_errl_loadSecureSection = nullptr; - } - } -#endif - } // End of IPL only block @@ -947,75 +823,142 @@ void ErrlEntry::checkHiddenLogsEnable( ) } /////////////////////////////////////////////////////////////////////////////// -// Called by addHwCallout to get the part and serial numbers from the current -// target so that it can be appended to the error log -#ifdef CONFIG_BMC_IPMI - void ErrlEntry::addPartAndSerialNumbersToErrLog -(const TARGETING::Target * i_target) +// Called by addHwCallout to retrieve various pieces of card +// and/or chip data, e.g. part number, serial number, ecid. +void ErrlEntry::addPartIdInfoToErrLog + (const TARGETING::Target * i_target) { - TRACDCOMP(g_trac_errl, ENTER_MRK"ErrlEntry::addPartAndSerialNumbersToErrLog()"); + TRACDCOMP(g_trac_errl, ENTER_MRK"ErrlEntry::addPartIdInfoToErrLog()"); - - // Get the type of the target const TARGETING::Target * l_target = i_target; - TARGETING::TYPE l_type = l_target->getAttr<TARGETING::ATTR_TYPE>(); + const TARGETING::Target * l_targetPrev = nullptr; + ErrlUserDetailsAttribute* l_attrdata = nullptr; - do + //Add the part number to the error log. + TARGETING::TargetHandleList l_parentList; + TARGETING::ATTR_PART_NUMBER_type l_PN = {}; + while( !l_target->tryGetAttr<TARGETING::ATTR_PART_NUMBER>(l_PN) ) { - if((l_type != TARGETING::TYPE_PROC ) && - (l_type != TARGETING::TYPE_DIMM ) && - (l_type != TARGETING::TYPE_MEMBUF )) + // Get immediate parent + TARGETING::targetService().getAssociated( + l_parentList, + l_target, + TARGETING::TargetService::PARENT, + TARGETING::TargetService::IMMEDIATE); + + // never found a match... + if (l_parentList.size() != 1) { - TARGETING::PredicatePostfixExpr l_procDimmMembuf; - TARGETING::TargetHandleList l_pList; + l_target = nullptr; + break; + } - TARGETING::PredicateCTM l_procs(TARGETING::CLASS_CHIP, - TARGETING::TYPE_PROC); + l_target = l_parentList[0]; + l_parentList.clear(); // clear out old entry + } // end while + if( l_target ) + { + l_attrdata = new ErrlUserDetailsAttribute(l_target); + l_attrdata->addData(TARGETING::ATTR_PART_NUMBER); + l_targetPrev = l_target; + } - TARGETING::PredicateCTM l_dimms(TARGETING::CLASS_CARD, - TARGETING::TYPE_DIMM); + // Note - it is extremely likely that we will end up with the same + // target for PN and SN, but since this is error path only we're + // opting for thoroughness over efficiency. - TARGETING::PredicateCTM l_membufs(TARGETING::CLASS_CHIP, - TARGETING::TYPE_MEMBUF); + //Add the serial number to the error log. + l_target = i_target; + TARGETING::ATTR_SERIAL_NUMBER_type l_SN = {}; + while( !l_target->tryGetAttr<TARGETING::ATTR_SERIAL_NUMBER>(l_SN) ) + { + // Get immediate parent + TARGETING::targetService().getAssociated( + l_parentList, + l_target, + TARGETING::TargetService::PARENT, + TARGETING::TargetService::IMMEDIATE); - l_procDimmMembuf.push(&l_procs).push(&l_dimms).Or() - .push(&l_membufs).Or(); + // never found a match... + if (l_parentList.size() != 1) + { + l_target = nullptr; + break; + } - // Search for any parents with TYPE_PROC, TYPE_DIMM, or TYPE_MEMBUF - TARGETING::targetService().getAssociated( l_pList, l_target, - TARGETING::TargetService::PARENT, - TARGETING::TargetService::ALL, - &l_procDimmMembuf); - // If no parent of desired type is present, break - if(!l_pList.size()) - { - TRACFCOMP(g_trac_errl, "Error! errlentry.C::addPartAndSerialNumbersToErrLog - No parent containing Serial/Part numbers found."); - break; - } - else - { - // We have found the parent - l_target = l_pList[0]; - } + l_target = l_parentList[0]; + l_parentList.clear(); // clear out old entry + } // end while + if( l_target ) + { + // not likely to happen, but just in case... + if( l_attrdata && (l_targetPrev != l_target) ) + { + // got a new target, commit the previous data and start over + l_attrdata->addToLog(this); + delete l_attrdata; + l_attrdata = nullptr; + } + if( !l_attrdata ) + { + l_attrdata = new ErrlUserDetailsAttribute(l_target); + } + + l_attrdata->addData(TARGETING::ATTR_SERIAL_NUMBER); + l_targetPrev = l_target; + } + + //Add the ECID to the error log. + l_target = i_target; + TARGETING::ATTR_ECID_type l_ECID = {}; + while( !l_target->tryGetAttr<TARGETING::ATTR_ECID>(l_ECID) ) + { + // Get immediate parent + TARGETING::targetService().getAssociated( + l_parentList, + l_target, + TARGETING::TargetService::PARENT, + TARGETING::TargetService::IMMEDIATE); + // never found a match... + if (l_parentList.size() != 1) + { + l_target = nullptr; + break; } - // We have made it here so we have found a target that contains - // ATTR_SERIAL_NUMBER and ATTR_PART_NUMBER - //Add the part number to the error log. - ErrlUserDetailsAttribute( l_target, - TARGETING::ATTR_PART_NUMBER).addToLog(this); - //Add the serial number to the error log. - ErrlUserDetailsAttribute( l_target, - TARGETING::ATTR_SERIAL_NUMBER).addToLog(this); + l_target = l_parentList[0]; + l_parentList.clear(); // clear out old entry + } // end while + if( l_target ) + { + // not likely to happen, but just in case... + if( l_attrdata && (l_targetPrev != l_target) ) + { + // got a new target, commit the previous data and start over + l_attrdata->addToLog(this); + delete l_attrdata; + l_attrdata = nullptr; + } + if( !l_attrdata ) + { + l_attrdata = new ErrlUserDetailsAttribute(l_target); + } + l_attrdata->addData(TARGETING::ATTR_ECID); + l_targetPrev = l_target; + } - }while( 0 ); + if( l_attrdata ) + { + l_attrdata->addToLog(this); + delete l_attrdata; + } - TRACDCOMP(g_trac_errl, EXIT_MRK"ErrlEntry::addPartAndSerialNumbersToErrLog()"); + TRACDCOMP(g_trac_errl, EXIT_MRK"ErrlEntry::addPartIdInfoToErrLog()"); } - +#ifdef CONFIG_BMC_IPMI // Find the FRU ID associated with target. // Returns first FRU ID found as it navigates the target's parent hierarchy TARGETING::ATTR_FRU_ID_type getFRU_ID(TARGETING::Target * i_target) @@ -1154,8 +1097,8 @@ void ErrlEntry::commit( compId_t i_committerComponent ) this); if(!l_err) { + addPartIdInfoToErrLog( l_target ); #ifdef CONFIG_BMC_IPMI - addPartAndSerialNumbersToErrLog( l_target ); addSensorDataToErrLog( l_target, l_ud->priority); #endif } |