From b03dc1b8e4b20a8039775e474bd9ebf2503bf48c Mon Sep 17 00:00:00 2001 From: Stephen Cprek Date: Wed, 11 Feb 2015 10:54:03 -0600 Subject: Runtime error log support in OpenPOWER Change-Id: I1bb13fede249ee09a65541cd04c6449b1bb555b2 RTC: 122885 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15712 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton Reviewed-by: Corey V. Swenson Reviewed-by: Daniel M. Crowell Reviewed-by: A. Patrick Williams III --- src/usr/errl/errl.mk | 41 ++++++++++ src/usr/errl/errlmanager.C | 110 -------------------------- src/usr/errl/errlmanager_common.C | 144 ++++++++++++++++++++++++++++++++++ src/usr/errl/makefile | 22 ++---- src/usr/errl/runtime/makefile | 25 +++--- src/usr/errl/runtime/rt_errlmanager.C | 17 ++-- 6 files changed, 211 insertions(+), 148 deletions(-) create mode 100644 src/usr/errl/errl.mk create mode 100644 src/usr/errl/errlmanager_common.C (limited to 'src/usr/errl') diff --git a/src/usr/errl/errl.mk b/src/usr/errl/errl.mk new file mode 100644 index 000000000..f87b6c217 --- /dev/null +++ b/src/usr/errl/errl.mk @@ -0,0 +1,41 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/errl/errl.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2015 +# [+] 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 +# common objects between hostboot and runtime hostboot +OBJS += errlentry.o +OBJS += errlsctn.o +OBJS += errlsctnhdr.o +OBJS += errlprvt.o +OBJS += errluh.o +OBJS += errlud.o +OBJS += errlsrc.o +OBJS += errluserdetails.o +OBJS += backtrace.o +OBJS += errludtarget.o +OBJS += errludstring.o +OBJS += errludbacktrace.o +OBJS += errludattribute.o +OBJS += errludlogregister.o +OBJS += errludcallout.o +OBJS += $(if $(CONFIG_BMC_IPMI),errlmanager_common.o) \ No newline at end of file diff --git a/src/usr/errl/errlmanager.C b/src/usr/errl/errlmanager.C index 77a2eacae..f1aa208be 100644 --- a/src/usr/errl/errlmanager.C +++ b/src/usr/errl/errlmanager.C @@ -35,7 +35,6 @@ // I n c l u d e s /*****************************************************************************/ #include -#include #include #include #include @@ -50,9 +49,6 @@ #include #include #include -#include -#include -#include #include #include @@ -1320,110 +1316,4 @@ bool ErrlManager::_updateErrlListIter(ErrlListItr_t & io_it) return l_removed; } -#ifdef CONFIG_BMC_IPMI -void ErrlManager::sendErrLogToBmc(errlHndl_t &io_err) -{ - TRACFCOMP(g_trac_errl, ENTER_MRK - "sendErrLogToBmc errlogId 0x%.8x", io_err->eid()); - - do { - - // if it's an INFORMATIONAL log, we don't want to waste the cycles - if (io_err->sev() == ERRORLOG::ERRL_SEV_INFORMATIONAL) - { - TRACFCOMP( g_trac_errl, INFO_MRK - "sendErrLogToBmc: %.8X is INFORMATIONAL; skipping", - io_err->eid()); - break; - } - - // look thru the errlog for any Callout UserDetail sections - // to determine the sensor information for the SEL - uint8_t l_sensorNumber = TARGETING::UTIL::INVALID_IPMI_SENSOR; - uint8_t l_sensorType = TARGETING::UTIL::INVALID_IPMI_SENSOR; - HWAS::callOutPriority l_priority = HWAS::SRCI_PRIORITY_NONE; - for(std::vector::const_iterator - it = io_err->iv_SectionVector.begin(); - it != io_err->iv_SectionVector.end(); - it++ ) - { - HWAS::callout_ud_t *l_ud = - reinterpret_cast((*it)->iv_pData); - - // if this is a CALLOUT that will have a target - if ((ERRL_COMP_ID == (*it)->iv_header.iv_compId) && - (1 == (*it)->iv_header.iv_ver) && - (ERRL_UDT_CALLOUT == (*it)->iv_header.iv_sst) && - (HWAS::HW_CALLOUT == l_ud->type) - ) - { - // if this callout is higher than any previous - if (l_ud->priority > l_priority) - { - // get the sensor number for the target - uint8_t * l_uData = (uint8_t *)(l_ud + 1); - TARGETING::Target *l_target = NULL; - bool l_err = HWAS::retrieveTarget(l_uData, - l_target, io_err); - if (!l_err) - { - // got a target, now get the sensor number - l_sensorNumber = - SENSOR::getFaultSensorNumber(l_target); - - // and update the priority - l_priority = l_ud->priority; - } - } - } - } // for each SectionVector - -#if 0 -// TODO: RTC 119440 - if (l_sensorNumber != TARGETING::UTLI::INVALID_IPMI_SENSOR) - { - l_sensorType = SENSOR::getSensorType(l_sensorNumber); - } -#endif - - // flatten into buffer, truncate to max eSEL size - uint32_t l_pelSize = io_err->flattenedSize(); - if (l_pelSize > (IPMISEL::ESEL_MAX_SIZE - sizeof(IPMISEL::selRecord))) - { - TRACFCOMP( g_trac_errl, INFO_MRK - "sendErrLogToBmc: msg size %d > %d, truncating.", - l_pelSize, IPMISEL::ESEL_MAX_SIZE); - l_pelSize = IPMISEL::ESEL_MAX_SIZE - sizeof(IPMISEL::selRecord); - } - - uint8_t *l_pelData = new uint8_t[l_pelSize]; - uint32_t l_errSize = io_err->flatten (l_pelData, - l_pelSize, true /* truncate */); - - if (l_errSize ==0) - { - // flatten didn't work - TRACFCOMP( g_trac_errl, ERR_MRK - "sendErrLogToBmc: could not flatten data - not sending"); - delete [] l_pelData; - break; - } - - // send it to the BMC over IPMI - TRACFCOMP(g_trac_errl, INFO_MRK - "sendErrLogToBmc: sensor %.2x/%.2x, size %d", - l_sensorType, l_sensorNumber, l_pelSize); - IPMISEL::sendESEL(l_pelData, l_pelSize, - io_err->eid(), IPMISEL::event_unspecified, - l_sensorType, l_sensorNumber); - - // free the buffer - delete [] l_pelData; - - } while(0); - - TRACFCOMP(g_trac_errl, EXIT_MRK "sendErrLogToBmc"); -} // sendErrLogToBmc -#endif - } // End namespace diff --git a/src/usr/errl/errlmanager_common.C b/src/usr/errl/errlmanager_common.C new file mode 100644 index 000000000..aeec2fbd8 --- /dev/null +++ b/src/usr/errl/errlmanager_common.C @@ -0,0 +1,144 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/errlmanager_common.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015 */ +/* [+] 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 +#include +#include +#include +#include +#include + +namespace ERRORLOG +{ + +extern trace_desc_t* g_trac_errl; + +#ifdef CONFIG_BMC_IPMI +void ErrlManager::sendErrLogToBmc(errlHndl_t &io_err) +{ + TRACFCOMP(g_trac_errl, ENTER_MRK + "sendErrLogToBmc errlogId 0x%.8x", io_err->eid()); + + do { + + // if it's an INFORMATIONAL log, we don't want to waste the cycles + if (io_err->sev() == ERRORLOG::ERRL_SEV_INFORMATIONAL) + { + TRACFCOMP( g_trac_errl, INFO_MRK + "sendErrLogToBmc: %.8X is INFORMATIONAL; skipping", + io_err->eid()); + break; + } + + // look thru the errlog for any Callout UserDetail sections + // to determine the sensor information for the SEL + uint8_t l_sensorNumber = SENSOR::INVALID_SENSOR; + uint8_t l_sensorType = SENSOR::INVALID_SENSOR; + HWAS::callOutPriority l_priority = HWAS::SRCI_PRIORITY_NONE; + for(std::vector::const_iterator + it = io_err->iv_SectionVector.begin(); + it != io_err->iv_SectionVector.end(); + it++ ) + { + HWAS::callout_ud_t *l_ud = + reinterpret_cast((*it)->iv_pData); + + // if this is a CALLOUT that will have a target + if ((ERRL_COMP_ID == (*it)->iv_header.iv_compId) && + (1 == (*it)->iv_header.iv_ver) && + (ERRL_UDT_CALLOUT == (*it)->iv_header.iv_sst) && + (HWAS::HW_CALLOUT == l_ud->type) + ) + { + // if this callout is higher than any previous + if (l_ud->priority > l_priority) + { + // get the sensor number for the target + uint8_t * l_uData = (uint8_t *)(l_ud + 1); + TARGETING::Target *l_target = NULL; + bool l_err = HWAS::retrieveTarget(l_uData, + l_target, io_err); + if (!l_err) + { + // got a target, now get the sensor number + l_sensorNumber = + SENSOR::getFaultSensorNumber(l_target); + + // and update the priority + l_priority = l_ud->priority; + } + } + } + } // for each SectionVector + +#if 0 +// TODO: RTC 119440 + if (l_sensorNumber != SENSOR::INVALID_SENSOR) + { + l_sensorType = SENSOR::getSensorType(l_sensorNumber); + } +#endif + + // flatten into buffer, truncate to max eSEL size + uint32_t l_pelSize = io_err->flattenedSize(); + if (l_pelSize > (IPMISEL::ESEL_MAX_SIZE - sizeof(IPMISEL::selRecord))) + { + TRACFCOMP( g_trac_errl, INFO_MRK + "sendErrLogToBmc: msg size %d > %d, truncating.", + l_pelSize, IPMISEL::ESEL_MAX_SIZE); + l_pelSize = IPMISEL::ESEL_MAX_SIZE - sizeof(IPMISEL::selRecord); + } + + uint8_t *l_pelData = new uint8_t[l_pelSize]; + uint32_t l_errSize = io_err->flatten (l_pelData, + l_pelSize, true /* truncate */); + + if (l_errSize ==0) + { + // flatten didn't work + TRACFCOMP( g_trac_errl, ERR_MRK + "sendErrLogToBmc: could not flatten data - not sending"); + delete [] l_pelData; + break; + } + + // send it to the BMC over IPMI + TRACFCOMP(g_trac_errl, INFO_MRK + "sendErrLogToBmc: sensor %.2x/%.2x, size %d", + l_sensorType, l_sensorNumber, l_pelSize); + IPMISEL::sendESEL(l_pelData, l_pelSize, + io_err->eid(), IPMISEL::event_unspecified, + l_sensorType, l_sensorNumber); + + // free the buffer + delete [] l_pelData; + + } while(0); + + TRACFCOMP(g_trac_errl, EXIT_MRK "sendErrLogToBmc"); +} // sendErrLogToBmc + +#endif + +} // end namespace \ No newline at end of file diff --git a/src/usr/errl/makefile b/src/usr/errl/makefile index 65758abca..d942214f7 100644 --- a/src/usr/errl/makefile +++ b/src/usr/errl/makefile @@ -5,7 +5,9 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2011,2014 +# Contributors Listed Below - COPYRIGHT 2011,2015 +# [+] 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. @@ -23,22 +25,10 @@ ROOTPATH = ../../.. MODULE = errl -OBJS += errlentry.o +#include common ojects between hostboot and runtime hostboot +include errl.mk + OBJS += errlmanager.o -OBJS += errlsctn.o -OBJS += errlsctnhdr.o -OBJS += errlprvt.o -OBJS += errluh.o -OBJS += errlud.o -OBJS += errlsrc.o -OBJS += errluserdetails.o -OBJS += backtrace.o -OBJS += errludtarget.o -OBJS += errludstring.o -OBJS += errludbacktrace.o -OBJS += errludattribute.o -OBJS += errludlogregister.o -OBJS += errludcallout.o OBJS += errludprintk.o SUBDIRS += test.d diff --git a/src/usr/errl/runtime/makefile b/src/usr/errl/runtime/makefile index b3c0ebefa..14212597f 100644 --- a/src/usr/errl/runtime/makefile +++ b/src/usr/errl/runtime/makefile @@ -5,7 +5,9 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2013,2014 +# Contributors Listed Below - COPYRIGHT 2013,2015 +# [+] 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. @@ -24,23 +26,14 @@ HOSTBOOT_RUNTIME = 1 ROOTPATH = ../../../.. MODULE = errl_rt -OBJS += errlentry.o +#include common ojects between hostboot and runtime hostboot +include ../errl.mk + +VPATH += ${ROOTPATH}/src/usr/hwas/common + OBJS += rt_errlmanager.o -OBJS += errlsctn.o -OBJS += errlsctnhdr.o -OBJS += errlprvt.o -OBJS += errluh.o -OBJS += errlud.o -OBJS += errlsrc.o -OBJS += errluserdetails.o -OBJS += backtrace.o -OBJS += errludtarget.o -OBJS += errludstring.o -OBJS += errludbacktrace.o -OBJS += errludattribute.o -OBJS += errludcallout.o OBJS += rt_vfs.o -OBJS += errludlogregister.o +OBJS += $(if $(CONFIG_BMC_IPMI),hwasCallout.o) SUBDIRS += test.d diff --git a/src/usr/errl/runtime/rt_errlmanager.C b/src/usr/errl/runtime/rt_errlmanager.C index fcb469e6e..23258c8ec 100644 --- a/src/usr/errl/runtime/rt_errlmanager.C +++ b/src/usr/errl/runtime/rt_errlmanager.C @@ -125,15 +125,20 @@ void ErrlManager::sendMboxMsg ( errlHndl_t& io_err ) TRACFCOMP( g_trac_errl, ENTER_MRK"ErrlManager::sendToHypervisor" ); do { - uint32_t l_msgSize = io_err->flattenedSize(); - - uint8_t * temp_buff = new uint8_t [l_msgSize ]; - io_err->flatten ( temp_buff, l_msgSize ); - +#ifdef CONFIG_BMC_IPMI + TRACFCOMP(g_trac_errl,INFO_MRK"Send msg to BMC for errlogId [0x%08x]", + io_err->plid() ); + // convert to SEL/eSEL and send to BMC over IPMI + sendErrLogToBmc(io_err); +#else TRACDCOMP(g_trac_errl, INFO_MRK"Send msg to FSP for errlogId [0x%08x]", io_err->plid() ); + uint32_t l_msgSize = io_err->flattenedSize(); + uint8_t * temp_buff = new uint8_t [l_msgSize ]; + io_err->flatten ( temp_buff, l_msgSize ); + if(g_hostInterfaces && g_hostInterfaces->sendErrorLog) { int rc = g_hostInterfaces->sendErrorLog(io_err->plid(), @@ -157,8 +162,8 @@ void ErrlManager::sendMboxMsg ( errlHndl_t& io_err ) io_err->plid() ); } - delete [] temp_buff; +#endif delete io_err; io_err = NULL; -- cgit v1.2.1