diff options
author | Matt Derksen <mderkse1@us.ibm.com> | 2017-07-18 16:14:51 -0500 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2017-07-28 16:27:18 -0400 |
commit | e7955db9ace86b83313545014a805c9678034839 (patch) | |
tree | 2f453735fa33ab699e2afa28e10765ba0f40ea05 | |
parent | f85d893d45c80ceec577cdd22e74bf89302af4e1 (diff) | |
download | blackbird-hostboot-e7955db9ace86b83313545014a805c9678034839.tar.gz blackbird-hostboot-e7955db9ace86b83313545014a805c9678034839.zip |
Add fault sensor information into IPMI error logs
Fault sensor number, FRU ID, and priority added to hardware callouts.
Change-Id: I8e4d815a4a3b26db29f852d6160dcf4b12452660
RTC:134069
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/43604
Reviewed-by: Martin Gloff <mgloff@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
-rw-r--r-- | src/include/usr/errl/errlentry.H | 12 | ||||
-rw-r--r-- | src/include/usr/errl/errlreasoncodes.H | 5 | ||||
-rw-r--r-- | src/include/usr/errl/errludsensor.H | 79 | ||||
-rw-r--r-- | src/usr/errl/errl.mk | 3 | ||||
-rw-r--r-- | src/usr/errl/errlentry.C | 84 | ||||
-rw-r--r-- | src/usr/errl/errludsensor.C | 69 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludcallout.H | 2 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludparserfactoryerrl.H | 6 | ||||
-rw-r--r-- | src/usr/errl/plugins/errludsensor.H | 125 |
9 files changed, 381 insertions, 4 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H index 13e9620f2..fd30b00be 100644 --- a/src/include/usr/errl/errlentry.H +++ b/src/include/usr/errl/errlentry.H @@ -736,6 +736,18 @@ private: * @param[in] i_target The target to get the numbers for */ void addPartAndSerialNumbersToErrLog(const TARGETING::Target * i_target); + + /** + * @brief called by addHwCallout to retrieve the FRU ID and sensor ID + * from the current target. If the current target does not contain + * ATTR_FRU_ID, find the first parent that does and add the attribute + * to the error log. + * + * @param[in] i_target The target to get the IDs for + * @param[in] i_priority This target's callout priority + */ + void addSensorDataToErrLog(TARGETING::Target * i_target, + HWAS::callOutPriority i_priority ); #endif /** diff --git a/src/include/usr/errl/errlreasoncodes.H b/src/include/usr/errl/errlreasoncodes.H index 7473a4768..1e7f2ea77 100644 --- a/src/include/usr/errl/errlreasoncodes.H +++ b/src/include/usr/errl/errlreasoncodes.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2017 */ +/* [+] 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. */ @@ -71,6 +73,7 @@ namespace ERRORLOG ERRL_UDT_LOGREGISTER = 0x05, ERRL_UDT_CALLOUT = 0x06, ERRL_UDT_PRINTK = 0x07, + ERRL_UDT_SENSOR = 0x08, }; }; diff --git a/src/include/usr/errl/errludsensor.H b/src/include/usr/errl/errludsensor.H new file mode 100644 index 000000000..435e2ab00 --- /dev/null +++ b/src/include/usr/errl/errludsensor.H @@ -0,0 +1,79 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/errl/errludsensor.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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_UDSENSOR_H +#define ERRL_UDSENSOR_H + +/** + * @file errludsensor.H + * + * Defines the ErrlUserDetailsSensor class that adds fault sensor + * information to an error log as user detail data + */ + +#include <errl/errluserdetails.H> +#include <stdint.h> + + +//Forward reference +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsSensor + * + * Adds fault sensor number and fru id to an error log as user detail data + */ +class ErrlUserDetailsSensor : public ErrlUserDetails +{ +public: + /** + * @brief Constructor + * + * @param i_fru_id: FRU ID of part called out + * @param i_sensor_number: faulty sensor number + * @param i_priority: Priority callout of the part + * + * Creates a Fault Sensor UserDetail, storing the faulty sensor + * number for the hw callout. User must call addToLog() in order + * to push the data to the error log. + */ + ErrlUserDetailsSensor(TARGETING::ATTR_FRU_ID_type i_fru_id, + uint8_t i_sensor_number, + HWAS::callOutPriority i_priority); + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsSensor(); + +private: + // Disabled + ErrlUserDetailsSensor(const ErrlUserDetailsSensor &); + ErrlUserDetailsSensor & operator=(const ErrlUserDetailsSensor &); +}; + +} + +#endif diff --git a/src/usr/errl/errl.mk b/src/usr/errl/errl.mk index c75263dc1..43bbd5df6 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,2016 +# Contributors Listed Below - COPYRIGHT 2015,2017 # [+] International Business Machines Corp. # # @@ -37,4 +37,5 @@ OBJS += errludstring.o OBJS += errludbacktrace.o OBJS += errludlogregister.o OBJS += errludcallout.o +OBJS += errludsensor.o OBJS += errlmanager_common.o diff --git a/src/usr/errl/errlentry.C b/src/usr/errl/errlentry.C index 3c5cdb638..251b24b6c 100644 --- a/src/usr/errl/errlentry.C +++ b/src/usr/errl/errlentry.C @@ -55,7 +55,10 @@ #include <attributeenums.H> #include "errlentry_consts.H" #include <util/misc.H> - +#ifdef CONFIG_BMC_IPMI +#include <ipmi/ipmisensor.H> +#include <errl/errludsensor.H> +#endif // Hostboot Image ID string extern char hbi_ImageId; @@ -671,10 +674,88 @@ void ErrlEntry::checkHiddenLogsEnable( ) ErrlUserDetailsAttribute( l_target, TARGETING::ATTR_SERIAL_NUMBER).addToLog(this); + }while( 0 ); TRACDCOMP(g_trac_errl, EXIT_MRK"ErrlEntry::addPartAndSerialNumbersToErrLog()"); } + + +// 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) +{ + TARGETING::ATTR_FRU_ID_type l_fruid = 0; // set to invalid FRU ID + TARGETING::TargetHandleList l_parentList; + TARGETING::Target * l_target = i_target; + + uint16_t level = 0; // just a basic parent level counter + + TRACDCOMP(g_trac_errl,"Looking for FRU ID starting at HUID 0x%X target", + TARGETING::get_huid(i_target)); + + bool foundFru = i_target->tryGetAttr<TARGETING::ATTR_FRU_ID>(l_fruid); + while (!foundFru) + { + level++; + + // Get immediate parent + TARGETING::targetService().getAssociated( + l_parentList, + l_target, + TARGETING::TargetService::PARENT, + TARGETING::TargetService::IMMEDIATE); + + if (l_parentList.size() != 1) + { + TRACDCOMP(g_trac_errl,"%d No Parent for HUID 0x%X target", + level, TARGETING::get_huid(l_target)); + break; + } + + l_target = l_parentList[0]; + + if (l_target->tryGetAttr<TARGETING::ATTR_FRU_ID>(l_fruid)) + { + // Found 1st parent with a FRU ID + foundFru = true; + } + + l_parentList.clear(); // clear out old entry + + } // end while + + if (foundFru) + { + TRACDCOMP(g_trac_errl,"level %d FRU ID 0x%X found for target HUID 0x%X", + level, l_fruid, TARGETING::get_huid(l_target)); + } + else + { + TRACFCOMP(g_trac_errl,"Failed to find a FRU ID for target HUID 0x%X. Looked at %d levels.", + TARGETING::get_huid(i_target), level); + } + + return l_fruid; +} + +void ErrlEntry::addSensorDataToErrLog(TARGETING::Target * i_target, + HWAS::callOutPriority i_priority ) +{ + TRACDCOMP(g_trac_errl, + ENTER_MRK"ErrlEntry::addSensorDataToErrLog(HUID 0x%X, priority %d)", + TARGETING::get_huid(i_target), i_priority); + + uint8_t l_sensorNum = SENSOR::getFaultSensorNumber(i_target); + TARGETING::ATTR_FRU_ID_type l_fru_id = getFRU_ID(i_target); + + // Add the sensor details to the error log + ErrlUserDetailsSensor(l_fru_id, l_sensorNum, i_priority).addToLog(this); + + TRACDCOMP(g_trac_errl, EXIT_MRK"ErrlEntry::addSensorDataToErrLog()"); +} + + #endif /////////////////////////////////////////////////////////////////////////////// @@ -733,6 +814,7 @@ void ErrlEntry::commit( compId_t i_committerComponent ) { #ifdef CONFIG_BMC_IPMI addPartAndSerialNumbersToErrLog( l_target ); + addSensorDataToErrLog( l_target, l_ud->priority); #endif } else diff --git a/src/usr/errl/errludsensor.C b/src/usr/errl/errludsensor.C new file mode 100644 index 000000000..25b4c7dca --- /dev/null +++ b/src/usr/errl/errludsensor.C @@ -0,0 +1,69 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/errludsensor.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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 */ +/** + * @file errludsensor.C + * + * @brief Implementation of ErrlUserDetailsSensor + */ +#include <errl/errludsensor.H> +#include <errl/errlreasoncodes.H> + +namespace ERRORLOG +{ + + ErrlUserDetailsSensor::ErrlUserDetailsSensor( + TARGETING::ATTR_FRU_ID_type i_fru_id, + uint8_t i_sensor_number, + HWAS::callOutPriority i_priority) + { + typedef struct { + TARGETING::ATTR_FRU_ID_type fru; + uint8_t pad[3]; + uint8_t sensorNum; + HWAS::callOutPriority priority; + } sensorDetails_t; + + sensorDetails_t l_sensorDetails; + + l_sensorDetails.fru = i_fru_id; + l_sensorDetails.sensorNum = i_sensor_number; + memset(l_sensorDetails.pad, 0, sizeof(l_sensorDetails.pad)); + l_sensorDetails.priority = i_priority; + + uint8_t* l_buf = reinterpret_cast<uint8_t*>( + reallocUsrBuf(sizeof(l_sensorDetails))); + memcpy(l_buf, &l_sensorDetails, sizeof(l_sensorDetails)); + + // Set up ErrlUserDetails instance variables + iv_CompId = ERRL_COMP_ID; + iv_Version = 1; + iv_SubSection = ERRL_UDT_SENSOR; + } + + ErrlUserDetailsSensor::~ErrlUserDetailsSensor() + { + + } +} diff --git a/src/usr/errl/plugins/errludcallout.H b/src/usr/errl/plugins/errludcallout.H index f13570ab3..95e147083 100644 --- a/src/usr/errl/plugins/errludcallout.H +++ b/src/usr/errl/plugins/errludcallout.H @@ -322,6 +322,8 @@ case HWAS::_type: i_parser.PrintString( "Priority", #_type); break; #undef case_PRIORITY } // parse + friend class ErrlUserDetailsParserSensor; + private: // Disabled ErrlUserDetailsParserCallout(const ErrlUserDetailsParserCallout &); diff --git a/src/usr/errl/plugins/errludparserfactoryerrl.H b/src/usr/errl/plugins/errludparserfactoryerrl.H index 608be0577..1db49a8dc 100644 --- a/src/usr/errl/plugins/errludparserfactoryerrl.H +++ b/src/usr/errl/plugins/errludparserfactoryerrl.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* [+] 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. */ @@ -35,6 +37,7 @@ #include "errludattribute.H" #include "errludlogregister.H" #include "errludcallout.H" +#include "errludsensor.H" namespace ERRORLOG { @@ -60,6 +63,7 @@ public: registerParser<ErrlUserDetailsParserAttribute>(ERRL_UDT_ATTRIBUTE); registerParser<ErrlUserDetailsParserLogRegister>(ERRL_UDT_LOGREGISTER); registerParser<ErrlUserDetailsParserCallout>(ERRL_UDT_CALLOUT); + registerParser<ErrlUserDetailsParserSensor>(ERRL_UDT_SENSOR); } private: diff --git a/src/usr/errl/plugins/errludsensor.H b/src/usr/errl/plugins/errludsensor.H new file mode 100644 index 000000000..cdca6631e --- /dev/null +++ b/src/usr/errl/plugins/errludsensor.H @@ -0,0 +1,125 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/errl/plugins/errludsensor.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] 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_UDSENSOR_H +#define ERRL_UDSENSOR_H + +/** + * @file errludsensor.H + * + * Defines the ErrlUserDetailsParserSensor class that parses faulty + * sensor user detail in an error log + */ + +#include "errluserdetails.H" +#include <targeting/common/target.H> + +namespace ERRORLOG +{ + +/** + * @class ErrlUserDetailsParserSensor + * + * Parses Faulty sensor type and number user detail in an error log + */ +class ErrlUserDetailsParserSensor :public ErrlUserDetailsParser +{ +public: + /** + * @brief Constructor + */ + ErrlUserDetailsParserSensor() {} + + /** + * @brief Destructor + */ + virtual ~ErrlUserDetailsParserSensor() {} + + /** + * @brief Parses sensor user detail data from an error log + * + * @param i_version Version of the data + * @param i_parse ErrlUsrParser object for outputting information + * @param i_pBuffer Pointer to buffer containing sesnor detail data + * @param i_buflen Length of the buffer + */ + virtual void parse(errlver_t i_version, + ErrlUsrParser & i_parser, + void * i_pBuffer, + const uint32_t i_buflen) const + { + typedef struct { + TARGETING::ATTR_FRU_ID_type fru; + uint8_t pad[3]; + uint8_t sensorNum; + HWAS::callOutPriority priority; + } sensorDetails_t; + + if(i_buflen == sizeof(sensorDetails_t)) + { + sensorDetails_t* outputData = + static_cast<sensorDetails_t*>(i_pBuffer); + i_parser.PrintNumber("Faulty FRU ID", "0x%02X", + ntohl(outputData->fru)); + i_parser.PrintNumber("Faulty Sensor Number", "0x%02X", + outputData->sensorNum); + + switch (ntohl(outputData->priority)) + { +#define case_PRIORITY(_type) \ +case HWAS::_type: i_parser.PrintString( "Priority", #_type); break; + case_PRIORITY(SRCI_PRIORITY_NONE) + case_PRIORITY(SRCI_PRIORITY_LOW) + case_PRIORITY(SRCI_PRIORITY_MEDC) + case_PRIORITY(SRCI_PRIORITY_MEDB) + case_PRIORITY(SRCI_PRIORITY_MEDA) + case_PRIORITY(SRCI_PRIORITY_MED) + case_PRIORITY(SRCI_PRIORITY_HIGH) + default: + i_parser.PrintNumber( "Priority", "UNKNOWN: 0x%X", + ntohl(outputData->priority) ); + break; + } // switch priority +#undef case_PRIORITY + + } + else + { + i_parser.PrintNumber("Sensor Buffer length", "0x%X", i_buflen); + i_parser.PrintNumber("Expected length", "0x%X", + sizeof(sensorDetails_t)); + i_parser.PrintHexDump(i_pBuffer, i_buflen); + } + } + +private: + // Disabled + ErrlUserDetailsParserSensor(const ErrlUserDetailsParserSensor &); + ErrlUserDetailsParserSensor & operator=( + const ErrlUserDetailsParserSensor &); +}; + +} + +#endif |