diff options
Diffstat (limited to 'src/usr/errl')
-rw-r--r-- | src/usr/errl/errl.mk | 3 | ||||
-rw-r--r-- | src/usr/errl/errlentry.C | 307 | ||||
-rw-r--r-- | src/usr/errl/errlentry_consts.H | 12 | ||||
-rw-r--r-- | src/usr/errl/errli2c.C | 3 | ||||
-rw-r--r-- | src/usr/errl/errlmanager.C | 167 | ||||
-rw-r--r-- | src/usr/errl/errlmanager_common.C | 3 | ||||
-rw-r--r-- | src/usr/errl/errludattribute.C | 84 | ||||
-rw-r--r-- | src/usr/errl/errludlogregister.C | 1 | ||||
-rwxr-xr-x | src/usr/errl/parser/genErrlParsers.pl | 4 | ||||
-rw-r--r-- | src/usr/errl/parser/makefile | 2 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludattributeP.H | 41 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludbacktrace.H | 7 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludcallout.H | 1 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludlogregister.H | 14 | ||||
-rwxr-xr-x | src/usr/errl/plugins/errludparser.H | 4 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludparserfactoryerrl.H | 4 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludwofdata.H | 5 | ||||
-rwxr-xr-x | src/usr/errl/plugins/errluserdetails.H | 91 | ||||
-rw-r--r-- | src/usr/errl/runtime/rt_errlmanager.C | 10 | ||||
-rw-r--r-- | src/usr/errl/runtime/test/test_runtimeDeconfig.H | 14 | ||||
-rw-r--r-- | src/usr/errl/test/errltest.H | 53 |
21 files changed, 611 insertions, 219 deletions
diff --git a/src/usr/errl/errl.mk b/src/usr/errl/errl.mk index 8cab37324..8caf92216 100644 --- a/src/usr/errl/errl.mk +++ b/src/usr/errl/errl.mk @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2015,2018 +# Contributors Listed Below - COPYRIGHT 2015,2019 # [+] International Business Machines Corp. # # @@ -41,3 +41,4 @@ OBJS += errludsensor.o OBJS += errludstate.o OBJS += errlmanager_common.o OBJS += errli2c.o +OBJS += errludattribute.o 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 } diff --git a/src/usr/errl/errlentry_consts.H b/src/usr/errl/errlentry_consts.H index e6784c217..816738010 100644 --- a/src/usr/errl/errlentry_consts.H +++ b/src/usr/errl/errlentry_consts.H @@ -66,7 +66,6 @@ const epubProcToSub_t PROCEDURE_TO_SUBSYS_TABLE[] = { EPUB_PRC_COOLING_SYSTEM_ERR , EPUB_MISC_SUBSYS }, { EPUB_PRC_FW_VERIFICATION_ERR , EPUB_FIRMWARE_SUBSYS }, { EPUB_PRC_GPU_ISOLATION_PROCEDURE, EPUB_CEC_HDW_SUBSYS }, - { EPUB_PRC_NVDIMM_ERR , EPUB_MEMORY_SUBSYS }, }; struct epubTargetTypeToSub_t @@ -103,6 +102,13 @@ const epubTargetTypeToSub_t TARGET_TO_SUBSYS_TABLE[] = { TARGETING::TYPE_TPM , EPUB_CEC_HDW_SUBSYS }, { TARGETING::TYPE_MC , EPUB_MEMORY_SUBSYS }, { TARGETING::TYPE_SMPGROUP , EPUB_CEC_HDW_SUBSYS }, + { TARGETING::TYPE_OMI , EPUB_MEMORY_SUBSYS }, + { TARGETING::TYPE_MCC , EPUB_MEMORY_SUBSYS }, + { TARGETING::TYPE_OMIC , EPUB_MEMORY_SUBSYS }, + { TARGETING::TYPE_OCMB_CHIP , EPUB_MEMORY_SUBSYS }, + { TARGETING::TYPE_MEM_PORT , EPUB_MEMORY_SUBSYS }, + { TARGETING::TYPE_I2C_MUX , EPUB_CEC_HDW_SUBSYS }, + { TARGETING::TYPE_PMIC , EPUB_MEMORY_SUBSYS }, }; struct epubBusTypeToSub_t @@ -120,6 +126,7 @@ const epubBusTypeToSub_t BUS_TO_SUBSYS_TABLE[] = { HWAS::I2C_BUS_TYPE , EPUB_CEC_HDW_I2C_DEVS }, { HWAS::PSI_BUS_TYPE , EPUB_CEC_HDW_SP_PHYP_INTF }, { HWAS::O_BUS_TYPE , EPUB_PROCESSOR_BUS_CTL }, + { HWAS::OMI_BUS_TYPE , EPUB_MEMORY_BUS }, }; struct epubClockTypeToSub_t @@ -159,6 +166,9 @@ const epubPartTypeToSub_t PART_TO_SUBSYS_TABLE[] = { HWAS::PROC_REF_CLOCK , EPUB_CEC_HDW_CLK_CTL }, { HWAS::PCI_REF_CLOCK , EPUB_CEC_HDW_CLK_CTL }, { HWAS::SMP_CABLE , EPUB_CEC_HDW_SUBSYS }, + { HWAS::BPM_CABLE_PART_TYPE , EPUB_MEMORY_SUBSYS }, + { HWAS::NV_CONTROLLER_PART_TYPE , EPUB_MEMORY_SUBSYS }, + { HWAS::BPM_PART_TYPE , EPUB_MEMORY_SUBSYS }, }; struct epubSensorTypeToSub_t diff --git a/src/usr/errl/errli2c.C b/src/usr/errl/errli2c.C index b3838a866..2c814ca58 100644 --- a/src/usr/errl/errli2c.C +++ b/src/usr/errl/errli2c.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -33,7 +33,6 @@ #include <hwas/common/deconfigGard.H> #include <targeting/common/targetservice.H> #include <targeting/common/utilFilter.H> -#include <config.h> #include <attributeenums.H> #include <i2c/eepromif.H> diff --git a/src/usr/errl/errlmanager.C b/src/usr/errl/errlmanager.C index c32c2b2b7..2e787d2e0 100644 --- a/src/usr/errl/errlmanager.C +++ b/src/usr/errl/errlmanager.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2011,2019 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -50,15 +50,18 @@ #include <arch/pirformat.H> #include <errldisplay/errldisplay.H> #include <console/consoleif.H> -#include <config.h> #include <functional> #include <hwas/common/deconfigGard.H> #include <kernel/terminate.H> #include <debugpointers.H> +#include <sys/sync.h> namespace ERRORLOG { +// Used in VERSION partition caching +mutex_t g_errlMutex = MUTEX_INITIALIZER; + extern trace_desc_t* g_trac_errl; #ifdef STORE_ERRL_IN_L3 @@ -103,6 +106,20 @@ bool compareEidToPlid(const uint32_t i_plid, return (i_pair.first->eid() == i_plid); } +const uint8_t* getCachedVersionPartition() +{ + return Singleton<ErrlManager>::instance().getCachedVersionPartition(); +} + +size_t getCachedVersionPartitionSize() +{ + return Singleton<ErrlManager>::instance().getCachedVersionPartitionSize(); +} + +errlHndl_t cacheVersionPartition() +{ + return Singleton<ErrlManager>::instance().cacheVersionPartition(); +} class AtLoadFunctions { @@ -120,6 +137,7 @@ AtLoadFunctions atLoadFunction; /////////////////////////////////////////////////////////////////////////////// ErrlManager::ErrlManager() : iv_pnorReadyForErrorLogs(false), + iv_recvdShutdownEvent(false), iv_hwasProcessCalloutFn(NULL), iv_msgQ(NULL), iv_pnorAddr(NULL), @@ -129,7 +147,9 @@ ErrlManager::ErrlManager() : iv_isMboxEnabled(false), // assume mbox isn't ready yet.. iv_isIpmiEnabled(false), // assume ipmi isn't ready yet.. iv_nonInfoCommitted(false), - iv_isErrlDisplayEnabled(false) + iv_isErrlDisplayEnabled(false), + iv_versionPartitionCache(nullptr), + iv_versionPartitionCacheSize(0) { TRACFCOMP( g_trac_errl, ENTER_MRK "ErrlManager::ErrlManager constructor" ); @@ -270,6 +290,30 @@ void ErrlManager::errlogMsgHndlr () msg_t * theMsg = msg_wait( iv_msgQ ); TRACFCOMP( g_trac_errl, INFO_MRK"Got an error log Msg - Type: 0x%08x", theMsg->type ); + + // if we've been shut down then do nothing except delete the msg or send + // a response depending on the message type. + if(iv_recvdShutdownEvent) + { + TRACFCOMP( g_trac_errl, INFO_MRK "Error log service is shutdown. " + "Message will be ignored."); + switch( theMsg->type ) + { + // Shutdown and flush message types expect a response + case ERRLOG_SHUTDOWN_TYPE: + case ERRLOG_FLUSH_TYPE: + msg_respond ( iv_msgQ, theMsg ); + break; + + // All other messages just need to be freed + default: + msg_free(theMsg); + break; + } + // wait for next message + continue; + } + //Process message just received switch( theMsg->type ) { @@ -1009,6 +1053,9 @@ void ErrlManager::errlogShutdown() // prior to the PNOR resource provider shutting down. PNOR::flush(PNOR::HB_ERRLOGS); + // Remember that we have recieved the shutdown event + iv_recvdShutdownEvent = true; + return; } @@ -1031,4 +1078,118 @@ bool ErrlManager::_updateErrlListIter(ErrlListItr_t & io_it) return l_removed; } +const uint8_t* ErrlManager::getCachedVersionPartition() const +{ + mutex_lock(&g_errlMutex); + const uint8_t* l_versionPtr = iv_versionPartitionCache; + mutex_unlock(&g_errlMutex); + return l_versionPtr; +} + +size_t ErrlManager::getCachedVersionPartitionSize() const +{ + mutex_lock(&g_errlMutex); + size_t l_versionSize = iv_versionPartitionCacheSize; + mutex_unlock(&g_errlMutex); + return l_versionSize; +} + +errlHndl_t ErrlManager::cacheVersionPartition() +{ + errlHndl_t l_errl = nullptr; + bool l_versionPartitionLoaded = false; + + do { + + if(iv_isVersionPartitionCached || + !PNOR::isSectionAvailable(PNOR::VERSION)) + { + // No need to try to cache more than once or if + // there is no VERSION partition + break; + } + +#ifdef CONFIG_SECUREBOOT + l_errl = PNOR::loadSecureSection(PNOR::VERSION); + if(l_errl) + { + TRACFCOMP(g_trac_errl, ERR_MRK"ErrlManager::cacheVersionPartition() - could not load VERSION partition"); + break; + } + + l_versionPartitionLoaded = true; +#endif + + PNOR::SectionInfo_t l_pnorVersionSectionInfo; + l_errl = getSectionInfo(PNOR::VERSION, l_pnorVersionSectionInfo); + if(l_errl) + { + TRACFCOMP(g_trac_errl, ERR_MRK"ErrlManager::cacheVersionPartition() - could not get VERSION section info"); + break; + } + + // Since multiple errls may be at different stages of commit at the same + // time, lock the mutex to prevent atomicity issues + mutex_lock(&g_errlMutex); + + iv_versionPartitionCacheSize = 0; + + const char* l_versionSectionPtr = + reinterpret_cast<char*>(l_pnorVersionSectionInfo.vaddr); + + // The actual size of the text in the VERSION partition is likely to be less + // than the declared size. Calculate the actual size here. + while((l_versionSectionPtr[iv_versionPartitionCacheSize] != '\0') && + (iv_versionPartitionCacheSize < l_pnorVersionSectionInfo.size)) + { + ++iv_versionPartitionCacheSize; + } + iv_versionPartitionCache = new uint8_t[iv_versionPartitionCacheSize]; + + memcpy(const_cast<uint8_t*>(iv_versionPartitionCache), + reinterpret_cast<uint8_t*>(l_pnorVersionSectionInfo.vaddr), + iv_versionPartitionCacheSize); + + mutex_unlock(&g_errlMutex); + + } while(0); + + if(l_versionPartitionLoaded) + { +#ifdef CONFIG_SECUREBOOT + errlHndl_t l_unloadSecErr = PNOR::unloadSecureSection(PNOR::VERSION); + if(l_unloadSecErr) + { + TRACFCOMP(g_trac_errl, ERR_MRK"ErrlManager::cacheVersionPartition() - could not unload VERSION partition"); + if(l_errl) + { + l_unloadSecErr->plid(l_errl->plid()); + errlCommit(l_unloadSecErr, ERRL_COMP_ID); + } + else + { + l_errl = l_unloadSecErr; + l_unloadSecErr = nullptr; + } + } +#endif + } + + if(l_errl) + { + if(iv_versionPartitionCache) + { + delete[] iv_versionPartitionCache; + iv_versionPartitionCache = nullptr; + } + iv_versionPartitionCacheSize = 0; + } + + // Set the cache attrmpted flag regardless of whether we actually + // were able to cache the partition + iv_isVersionPartitionCached = true; + + return l_errl; +} + } // End namespace diff --git a/src/usr/errl/errlmanager_common.C b/src/usr/errl/errlmanager_common.C index e1e965e5a..bd84f2828 100644 --- a/src/usr/errl/errlmanager_common.C +++ b/src/usr/errl/errlmanager_common.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2015,2018 */ +/* Contributors Listed Below - COPYRIGHT 2015,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -23,7 +23,6 @@ /* */ /* IBM_PROLOG_END_TAG */ #include <errl/errlmanager.H> -#include <config.h> #include <hwas/common/hwasCallout.H> #include <errl/errlreasoncodes.H> #ifdef CONFIG_BMC_IPMI diff --git a/src/usr/errl/errludattribute.C b/src/usr/errl/errludattribute.C new file mode 100644 index 000000000..5d031545f --- /dev/null +++ b/src/usr/errl/errludattribute.C @@ -0,0 +1,84 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/errludattribute.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 <stdint.h> +#include <stdio.h> +#include <string.h> +#include <errl/errludattribute.H> +#include <errl/errlreasoncodes.H> +#include <targeting/common/targetservice.H> +#include <targeting/common/trace.H> + +namespace ERRORLOG +{ +using namespace TARGETING; +extern TARG_TD_t g_trac_errl; + + +//------------------------------------------------------------------------------ +ErrlUserDetailsAttribute::ErrlUserDetailsAttribute( + const Target * i_pTarget, uint32_t i_attr) + : iv_pTarget(i_pTarget), iv_dataSize(0) +{ + // Set up ErrlUserDetails instance variables + iv_CompId = ERRL_COMP_ID; + iv_Version = 1; + iv_SubSection = ERRL_UDT_ATTRIBUTE; + // override the default of false + iv_merge = true; + + // first, write out the HUID + addData(ATTR_HUID); + if (i_attr != ATTR_HUID) { + addData(i_attr); + } +} + +//------------------------------------------------------------------------------ +ErrlUserDetailsAttribute::ErrlUserDetailsAttribute( + const Target * i_pTarget) + : iv_pTarget(i_pTarget), iv_dataSize(0) +{ + // Set up ErrlUserDetails instance variables + iv_CompId = ERRL_COMP_ID; + iv_Version = 1; + iv_SubSection = ERRL_UDT_ATTRIBUTE; + // override the default of false + iv_merge = true; + + // first, write out the HUID + addData(ATTR_HUID); +} + +//------------------------------------------------------------------------------ +ErrlUserDetailsAttribute::~ErrlUserDetailsAttribute() +{ } +} // namespace + +// Pull in the auto-generated portion +// ::addData +// ::dumpAll +// Generated by xmltohb.pl +#include <errludattribute_gen.C> + diff --git a/src/usr/errl/errludlogregister.C b/src/usr/errl/errludlogregister.C index 0db5aaca9..e908b0d4d 100644 --- a/src/usr/errl/errludlogregister.C +++ b/src/usr/errl/errludlogregister.C @@ -223,6 +223,7 @@ void ErrlUserDetailsLogRegister::copyRegisterData( case DeviceFW::SCOM: // userif.H case DeviceFW::FSI: // userif.H case DeviceFW::SPD: // userif.H + case DeviceFW::NVDIMM: // userif.H case DeviceFW::XSCOM: // driverif.H case DeviceFW::FSISCOM: // driverif.H case DeviceFW::IBSCOM: // driverif.H diff --git a/src/usr/errl/parser/genErrlParsers.pl b/src/usr/errl/parser/genErrlParsers.pl index 19be84266..2ae0282e5 100755 --- a/src/usr/errl/parser/genErrlParsers.pl +++ b/src/usr/errl/parser/genErrlParsers.pl @@ -996,9 +996,9 @@ close(SUBSYSTEM_TYPES_FILE); # Generate a list of all possible SRCs and their descriptions # ------------------------------------------------------------------ open(OFILE, ">", $srcFileName) or die ("Cannot open: $srcFileName: $!"); -foreach my $sub (sort keys %subsysList) +foreach my $rcVal (sort keys %srcList) { - foreach my $rcVal (sort keys %srcList) + foreach my $sub (sort keys %subsysList) { my $src = "BC$sub$rcVal"; print OFILE "//////////////////////////////////////////////////////\n"; diff --git a/src/usr/errl/parser/makefile b/src/usr/errl/parser/makefile index 905e4e6fd..8db2fc0fc 100644 --- a/src/usr/errl/parser/makefile +++ b/src/usr/errl/parser/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2011,2016 +# Contributors Listed Below - COPYRIGHT 2011,2019 # [+] Google Inc. # [+] International Business Machines Corp. # diff --git a/src/usr/errl/plugins/errludattributeP.H b/src/usr/errl/plugins/errludattributeP.H new file mode 100644 index 000000000..d097ad9e7 --- /dev/null +++ b/src/usr/errl/plugins/errludattributeP.H @@ -0,0 +1,41 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludattributeP.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2019 */ +/* [+] 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 ERRL_UDATTRIBUTEP_H +#define ERRL_UDATTRIBUTEP_H + +/** + * Defines the classes that allow you to parse attribute data + * that was previously saved to an error log with + * ERRORLOG::ErrlUserDetailsAttribute. + */ + +#include "errluserdetails.H" + +// Pull in the auto-generated portion for the parser +// Created by xmltohb.pl +#include <errludattributeP_gen.H> + + +#endif // ERRL_UDATTRIBUTEP_H diff --git a/src/usr/errl/plugins/errludbacktrace.H b/src/usr/errl/plugins/errludbacktrace.H index 898ea8faa..9ecc11511 100644 --- a/src/usr/errl/plugins/errludbacktrace.H +++ b/src/usr/errl/plugins/errludbacktrace.H @@ -5,7 +5,10 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2019 */ +/* [+] International Business Machines Corp. */ +/* [+] YADRO */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -113,7 +116,7 @@ public: for( int i = 0; i < l_count; i++ ) { // endian convert the stack address - uint64_t l_addr = ntohll(*p64); + uint64_t l_addr = ntohll(UINT64_FROM_PTR(p64)); // get nearest symbol const char * l_pSymbol = symTab.nearestSymbol( l_addr ); diff --git a/src/usr/errl/plugins/errludcallout.H b/src/usr/errl/plugins/errludcallout.H index fc45e5590..47cbfd9fd 100644 --- a/src/usr/errl/plugins/errludcallout.H +++ b/src/usr/errl/plugins/errludcallout.H @@ -210,6 +210,7 @@ case HWAS::_type: i_parser.PrintString( "Bus Type", #_type); break; case_BUS_TYPE(I2C_BUS_TYPE) case_BUS_TYPE(PSI_BUS_TYPE) case_BUS_TYPE(O_BUS_TYPE) + case_BUS_TYPE(OMI_BUS_TYPE) default: i_parser.PrintNumber( "Bus Type", "UNKNOWN: 0x%X", ntohl(pData->busType) ); diff --git a/src/usr/errl/plugins/errludlogregister.H b/src/usr/errl/plugins/errludlogregister.H index f795a9643..221458022 100644 --- a/src/usr/errl/plugins/errludlogregister.H +++ b/src/usr/errl/plugins/errludlogregister.H @@ -5,9 +5,10 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2019 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ +/* [+] YADRO */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -79,7 +80,7 @@ public: { // first is the HUID uint32_t *pData = reinterpret_cast<uint32_t *>(pBuf); - if (ntohl(*pData) == 0xFFFFFFFF) + if (ntohl(UINT32_FROM_PTR(pData)) == 0xFFFFFFFF) { i_parser.PrintString("LogRegister", "Target: MASTER_PROCESSOR_CHIP_TARGET_SENTINEL"); @@ -87,7 +88,7 @@ public: else { i_parser.PrintNumber( "LogRegister", - "Target: HUID = 0x%08X", ntohl(*pData) ); + "Target: HUID = 0x%08X", ntohl(UINT32_FROM_PTR(pData)) ); } pData++; pBuf += sizeof(*pData); @@ -122,6 +123,11 @@ public: numArgs = 1; addrParams.push_back(" SPD keyword enumaration"); break; + case DeviceFW::NVDIMM: // userif.H + i_parser.PrintString("AccessType", "DeviceFW::NVDIMM"); + numArgs = 1; + addrParams.push_back(" NVDIMM address"); + break; case DeviceFW::XSCOM: // driverif.H i_parser.PrintString("AccessType", "DeviceFW::XSCOM"); numArgs = 1; @@ -199,7 +205,7 @@ public: for (int32_t i = 0;i < numArgs;i++) { std::vector<char> l_traceEntry(20); - sprintf(&(l_traceEntry[0]),"0x%016llX", ntohll(*pData64)); + sprintf(&(l_traceEntry[0]),"0x%016llX", ntohll(UINT64_FROM_PTR(pData64))); i_parser.PrintString(addrParams[i], &(l_traceEntry[0])); pData64++; diff --git a/src/usr/errl/plugins/errludparser.H b/src/usr/errl/plugins/errludparser.H index ddaadade7..6957d4632 100755 --- a/src/usr/errl/plugins/errludparser.H +++ b/src/usr/errl/plugins/errludparser.H @@ -5,8 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2018 */ +/* Contributors Listed Below - COPYRIGHT 2012,2019 */ /* [+] International Business Machines Corp. */ +/* [+] YADRO */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -84,6 +85,7 @@ static bool myDataParse(\ {\ l_rc = true;\ l_pParser->parse(i_ver, i_parser, i_buffer, i_buflen);\ + delete l_pParser;\ }\ return l_rc;\ }\ diff --git a/src/usr/errl/plugins/errludparserfactoryerrl.H b/src/usr/errl/plugins/errludparserfactoryerrl.H index fbefe231f..d5999c807 100644 --- a/src/usr/errl/plugins/errludparserfactoryerrl.H +++ b/src/usr/errl/plugins/errludparserfactoryerrl.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2012,2018 */ +/* Contributors Listed Below - COPYRIGHT 2012,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -34,7 +34,7 @@ #include "errludstring.H" #include "errludtarget.H" #include "errludbacktrace.H" -#include "errludattribute.H" +#include "errludattributeP.H" #include "errludlogregister.H" #include "errludcallout.H" #include "errludsensor.H" diff --git a/src/usr/errl/plugins/errludwofdata.H b/src/usr/errl/plugins/errludwofdata.H index f792c5485..203a4a14e 100644 --- a/src/usr/errl/plugins/errludwofdata.H +++ b/src/usr/errl/plugins/errludwofdata.H @@ -5,8 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2017,2018 */ +/* Contributors Listed Below - COPYRIGHT 2017,2019 */ /* [+] International Business Machines Corp. */ +/* [+] YADRO */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -98,7 +99,7 @@ public: // addWofCompareDataToErrl() in plat_wof_access.C if ((NULL != i_pBuffer) && (i_buflen >= sizeof(tableEntries))) { - tableEntries = ntohs(*(reinterpret_cast<uint16_t*>(i_pBuffer))); + tableEntries = ntohs(UINT16_FROM_PTR(i_pBuffer)); } // How many entries are really present in this buffer? diff --git a/src/usr/errl/plugins/errluserdetails.H b/src/usr/errl/plugins/errluserdetails.H index 917dcf266..eac453505 100755 --- a/src/usr/errl/plugins/errluserdetails.H +++ b/src/usr/errl/plugins/errluserdetails.H @@ -5,8 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2011,2019 */ /* [+] International Business Machines Corp. */ +/* [+] YADRO */ /* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ @@ -39,6 +40,88 @@ namespace ERRORLOG { /** + * @struct UnalignedData + * @brief Structure used for safe assigment from unaligned pointer, it forces + * the compiler to generate extra instructions and satisfy architectural + * alignment requirements. + */ +template<typename T> struct UnalignedData { + T value; +} __attribute__ ((packed)); + +/** + * @brief Read integral value from unaligned pointer. + * + * @param[in] i_pUint64 - Pointer to uint64_t value + * + * @return uint64_t value from specified pointer + */ +inline uint64_t UINT64_FROM_PTR(const void* i_pUint64) +{ + return reinterpret_cast<const UnalignedData<uint64_t>*>(i_pUint64)->value; +} + +/** + * @brief Read integral value from unaligned pointer. + * + * @param[in] i_pUint32 - Pointer to uint32_t value + * + * @return uint32_t value from specified pointer + */ +inline uint32_t UINT32_FROM_PTR(const void* i_pUint32) +{ + return reinterpret_cast<const UnalignedData<uint32_t>*>(i_pUint32)->value; +} + +/** + * @brief Read integral value from unaligned pointer. + * + * @param[in] i_pUint16 - Pointer to uint16_t value + * + * @return uint16_t value from specified pointer + */ +inline uint16_t UINT16_FROM_PTR(const void* i_pUint16) +{ + return reinterpret_cast<const UnalignedData<uint16_t>*>(i_pUint16)->value; +} + +/** + * @brief Read integral value from unaligned pointer. + * + * @param[in] i_pInt64 - Pointer to int64_t value + * + * @return int64_t value from specified pointer + */ +inline int64_t INT64_FROM_PTR(const void* i_pInt64) +{ + return reinterpret_cast<const UnalignedData<int64_t>*>(i_pInt64)->value; +} + +/** + * @brief Read integral value from unaligned pointer. + * + * @param[in] i_pInt32 - Pointer to int32_t value + * + * @return int32_t value from specified pointer + */ +inline int32_t INT32_FROM_PTR(const void* i_pInt32) +{ + return reinterpret_cast<const UnalignedData<int32_t>*>(i_pInt32)->value; +} + +/** + * @brief Read integral value from unaligned pointer. + * + * @param[in] i_pInt16 - Pointer to int16_t value + * + * @return int16_t value from specified pointer + */ +inline int16_t INT16_FROM_PTR(const void* i_pInt16) +{ + return reinterpret_cast<const UnalignedData<int16_t>*>(i_pInt16)->value; +} + +/** * @brief Returns the uint64_t at the pointed to location in host byte order * * @param[in] i_pUint64 Pointer to a uint64_t in network byte order @@ -47,7 +130,7 @@ namespace ERRORLOG */ inline uint64_t NTH_UINT64(const void* i_pUint64) { - return (ntohll(*(reinterpret_cast<const uint64_t*>(i_pUint64)))); + return (ntohll(UINT64_FROM_PTR(i_pUint64))); } /** @@ -59,7 +142,7 @@ inline uint64_t NTH_UINT64(const void* i_pUint64) */ inline uint32_t NTH_UINT32(const void* i_pUint32) { - return (ntohl(*(reinterpret_cast<const uint32_t*>(i_pUint32)))); + return (ntohl(UINT32_FROM_PTR(i_pUint32))); } /** @@ -71,7 +154,7 @@ inline uint32_t NTH_UINT32(const void* i_pUint32) */ inline uint16_t NTH_UINT16(const void* i_pUint16) { - return (ntohs(*(reinterpret_cast<const uint16_t*>(i_pUint16)))); + return (ntohs(UINT16_FROM_PTR(i_pUint16))); } /** diff --git a/src/usr/errl/runtime/rt_errlmanager.C b/src/usr/errl/runtime/rt_errlmanager.C index 9fb624608..e545641bb 100644 --- a/src/usr/errl/runtime/rt_errlmanager.C +++ b/src/usr/errl/runtime/rt_errlmanager.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2018 */ +/* Contributors Listed Below - COPYRIGHT 2013,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -47,6 +47,8 @@ uint8_t ErrlManager::iv_hiddenErrLogsEnable = extern trace_desc_t* g_trac_errl; +// Maximum size of error log that can be sent to the host +const uint32_t MAX_FSP_ERROR_LOG_LENGTH = 4096; ////////////////////////////////////////////////////////////////////////////// @@ -188,10 +190,14 @@ void ErrlManager::sendMboxMsg ( errlHndl_t& io_err ) if(g_hostInterfaces) { uint32_t l_msgSize = io_err->flattenedSize(); + if (l_msgSize > MAX_FSP_ERROR_LOG_LENGTH) + { + l_msgSize = MAX_FSP_ERROR_LOG_LENGTH; + } if (g_hostInterfaces->sendErrorLog) { uint8_t * temp_buff = new uint8_t [l_msgSize ]; - io_err->flatten ( temp_buff, l_msgSize ); + io_err->flatten ( temp_buff, l_msgSize, true /* truncate */ ); size_t rc = g_hostInterfaces->sendErrorLog(io_err->plid(), l_msgSize, diff --git a/src/usr/errl/runtime/test/test_runtimeDeconfig.H b/src/usr/errl/runtime/test/test_runtimeDeconfig.H index 2f5d37259..0cf1a0a52 100644 --- a/src/usr/errl/runtime/test/test_runtimeDeconfig.H +++ b/src/usr/errl/runtime/test/test_runtimeDeconfig.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -51,8 +51,8 @@ class deconfigureTargetAtRuntimeTest : public CxxTest::TestSuite // pass in a null target pointer TARGETING::Target * l_target = nullptr; - errlHndl_t l_errl = - HWAS::theDeconfigGard().deconfigureTargetAtRuntime( + errlHndl_t l_errl = nullptr; + l_errl = HWAS::theDeconfigGard().deconfigureTargetAtRuntime( l_target, HWAS::DeconfigGard::FULLY_AT_RUNTIME, l_errl); @@ -118,8 +118,8 @@ class deconfigureTargetAtRuntimeTest : public CxxTest::TestSuite l_target = l_cores.at(0); - errlHndl_t l_errl = - HWAS::theDeconfigGard().deconfigureTargetAtRuntime( + errlHndl_t l_errl = nullptr; + l_errl = HWAS::theDeconfigGard().deconfigureTargetAtRuntime( l_target, HWAS::DeconfigGard::SPEC_DECONFIG, l_errl); @@ -179,8 +179,8 @@ class deconfigureTargetAtRuntimeTest : public CxxTest::TestSuite TARGETING::Target * l_target = l_proc.at(0); - errlHndl_t l_errl = - HWAS::theDeconfigGard().deconfigureTargetAtRuntime( + errlHndl_t l_errl = nullptr; + l_errl = HWAS::theDeconfigGard().deconfigureTargetAtRuntime( l_target, HWAS::DeconfigGard::FULLY_AT_RUNTIME, l_errl); diff --git a/src/usr/errl/test/errltest.H b/src/usr/errl/test/errltest.H index ff5df6b65..32e798ac4 100644 --- a/src/usr/errl/test/errltest.H +++ b/src/usr/errl/test/errltest.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* Contributors Listed Below - COPYRIGHT 2011,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -1214,6 +1214,57 @@ public: l_err = NULL; } + /** + * @brief Ensure all callouts have a SUBSYS mapping + * + */ + void testErrl_ensureSubsystemMapping(void) + { + // dummy log to call non-static methods with + errlHndl_t l_err = new ERRORLOG::ErrlEntry( + ERRORLOG::ERRL_SEV_INFORMATIONAL, + ERRORLOG::ERRL_TEST_MOD_ID, + ERRORLOG::ERRL_TEST_REASON_CODE, + 0x494E464F, //INFO + 0); + + // Walk through every BUS_TYPE + for( busTypeEnum bus = (busTypeEnum)(NO_BUS_TYPE+1); + bus < LAST_BUS_TYPE; + bus = (busTypeEnum)(bus+1) ) + { + if( l_err->getSubSystem(bus) == EPUB_MISC_UNKNOWN ) + { + TS_FAIL( "No subsystem returned for BUS_TYPE %d", bus ); + } + } + + // Walk through every PART_TYPE + for( partTypeEnum part = (partTypeEnum)(NO_PART_TYPE+1); + part < LAST_PART_TYPE; + part = (partTypeEnum)(part+1) ) + { + if( l_err->getSubSystem(part) == EPUB_MISC_UNKNOWN ) + { + TS_FAIL( "No subsystem returned for PART_TYPE %d", part ); + } + } + + // Walk through every SENSOR_TYPE + for( sensorTypeEnum sensor = (sensorTypeEnum)(UNKNOWN_SENSOR+1); + sensor < LAST_SENSOR_TYPE; + sensor = (sensorTypeEnum)(sensor+1) ) + { + if( l_err->getSubSystem(sensor) == EPUB_MISC_UNKNOWN ) + { + TS_FAIL( "No subsystem returned for SENSOR_TYPE %d", sensor ); + } + } + + // Note - Can't loop over epubProcedureID because the values are + // sparsely populated + + } }; |