From 1bc13e89d35eacba76589ac3c5158d54ce73b35b Mon Sep 17 00:00:00 2001 From: Brian Horton Date: Thu, 16 Oct 2014 11:40:21 -0500 Subject: add SEL/eSEL support in errlmanager, convert errlog to SEL/eSEL format, prepare to send to BMC via IPMI Change-Id: I11e246264840ff756e92b97673e4742b9d03daad RTC: 114908 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14238 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III --- src/include/usr/errl/errlipmi.H | 142 +++++++++++++++++++++++++++++++++++++ src/include/usr/errl/errlmanager.H | 111 +++++++++++------------------ src/include/usr/errl/errlprvt.H | 5 +- 3 files changed, 188 insertions(+), 70 deletions(-) create mode 100644 src/include/usr/errl/errlipmi.H (limited to 'src/include/usr/errl') diff --git a/src/include/usr/errl/errlipmi.H b/src/include/usr/errl/errlipmi.H new file mode 100644 index 000000000..836b0d1a1 --- /dev/null +++ b/src/include/usr/errl/errlipmi.H @@ -0,0 +1,142 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/errl/errlipmi.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014,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 */ +#ifndef ERRLIPMI_H +#define ERRLIPMI_H +/** + * @file errlipmi.H + * + * @brief Error Log for IPMI SEL/eSEL formats + * + * This header file contains the definition of error structures for ipmi + * + */ + +/*****************************************************************************/ +// I n c l u d e s +/*****************************************************************************/ +#include + +namespace ERRORLOG +{ + +// per MegaRAC SP-X spec +// The size of the eSEL is configurable via PRJ +// it can be set to 2KB per eSEL packet. +static const uint32_t ESEL_MAX_SIZE = 2 * KILOBYTE; + +// per MegaRAC SP-X spec +static const uint8_t SEL_RECORD_TYPE = 0xDE; +static const uint8_t ESEL_RECORD_TYPE = 0xDF; + +// per MegaRAC SP-X spec +static const uint8_t ESEL_EVENT_DATA_1 = 0xAA; + + +// per MegaRAC SP-X spec +static const uint16_t SEL_GENERATOR_ID = 0x2000; + +// per MegaRAC SP-X spec +static const uint8_t SEL_FORMAT_VERSION = 0x04; + + +// per IPMI Spec, section 32.1 SEL Event Records +struct selRecord +{ + + // ID used for SEL Record access. The Record ID values 0000h and FFFFh + // have special meaning in the Event Access commands and must not be + // used as Record ID values for stored SEL Event Records. + uint16_t recordID; + + // [7:0] - Record Type + // 02h = system event record + // C0h-DFh = OEM timestamped, bytes 8-16 OEM defined + // E0h-FFh = OEM non-timestamped, bytes 4-16 OEM defined + uint8_t record_type; + + // Time when event was logged. LS byte first. + uint32_t timestamp; + + // RqSA & LUN if event was generated from IPMB. Software ID if event was + // generated from system software. + // Byte 1 + // [7:1] - 7-bit I2C. Slave Address, or 7-bit system software ID + // [0] 0b = ID is IPMB Slave Address + // 1b = system software ID + // Byte 2 + // [7:4] - Channel number. Channel that event message was received over. + // 0h if the event message was received via the system interface, + // primary IPMB, or internally generated by the BMC. + // [3:2] - reserved. Write as 00b. + // [1:0] - IPMB device LUN if byte 1 holds Slave Address. 00b otherwise. + uint16_t generator_id; + + // Event Message format version + // (=04h for events in this specification, + // 03h for IPMI v1.0 Event Messages.) + uint8_t evm_format_version; + + // Sensor Type Code for sensor that generated the event + uint8_t sensor_type; + + // Number of sensor that generated the event + uint8_t sensor_number; + + // Event Dir + // [7 ] 0b = Assertion event. + // 1b = Deassertion event. + // Event Type + // Type of trigger for the event, e.g. critical threshold going high, + // state asserted, etc. Also indicates class of the event. E.g. + // discrete, threshold, or OEM. The Event Type field is encoded + // using the Event/Reading Type Code. + // [6:0] - Event Type Code + + uint8_t event_dir_type; + + uint8_t event_data1; + uint8_t event_data2; + uint8_t event_data3; + + // ctor + selRecord(): + recordID(0), + record_type(0), + timestamp(0), + generator_id(SEL_GENERATOR_ID), + evm_format_version(SEL_FORMAT_VERSION), + sensor_type(0), + sensor_number(0), + event_dir_type(0), + event_data1(0), + event_data2(0), + event_data3(0) + { }; + +} PACKED; + +} // End namespace + +#endif //ERRLIPMI_H diff --git a/src/include/usr/errl/errlmanager.H b/src/include/usr/errl/errlmanager.H index 38291e546..07d4b79af 100644 --- a/src/include/usr/errl/errlmanager.H +++ b/src/include/usr/errl/errlmanager.H @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -80,6 +81,7 @@ enum errlManagerNeeds PNOR, TARG, MBOX, + IPMI, ERRLDISP, } ; @@ -146,7 +148,7 @@ public: * @brief Sends msg to errlmanager telling what resources are ready * * This is called by resources that the ErrlManager needs, which start up - * AFTER ErrlManager starts. Currently, that's PNOR MBOX and TARGeting. + * AFTER ErrlManager starts. * * It is a static function because a module cannot call an interface on a * singleton in another module @@ -221,6 +223,7 @@ private: ERRLOG_ACCESS_MBOX_TYPE = 0x00000035 | MBOX::FIRST_SECURE_MSG, ERRLOG_ACCESS_TARG_TYPE = 0x00000036 | MBOX::FIRST_SECURE_MSG, ERRLOG_ACCESS_ERRLDISP_TYPE = 0x00000037 | MBOX::FIRST_SECURE_MSG, + ERRLOG_ACCESS_IPMI_TYPE = 0x00000038 | MBOX::FIRST_SECURE_MSG, }; /** @@ -300,7 +303,7 @@ private: * @param[in,out] io_err Error log handle to be committed * */ - void sendErrLogToMbox ( errlHndl_t& io_err ); + void sendErrLogToFSP ( errlHndl_t& io_err ); /** * @brief Create a mailbox message with the error log and send it to Fsp. @@ -435,16 +438,27 @@ private: */ void setACKInFlattened(uint32_t i_position); +#ifdef CONFIG_BMC_IPMI + /** + * @brief Create an ipmi message with the error log and send it to BMC + * + * @param[in,out] io_err Error log handle to be committed + * + */ + void sendErrLogToBmc(errlHndl_t &io_err); +#endif + /** * @brief errorlog-into-PNOR variables */ char *iv_pnorAddr; // HBEL section in PNOR uint32_t iv_maxErrlInPnor; // max number of errorlogs that will fit uint32_t iv_pnorOpenSlot; // current open slot available for an errorlog - bool iv_isSpBaseServices; // do we need to send to FSP - bool iv_isMboxEnabled; // are we able to send to FSP - bool iv_nonInfoCommitted; //< Keeps track of any non-informational logs. - bool iv_isErrlDisplayEnabled; // are we able to use the errorDisplay + bool iv_isSpBaseServices; // do we need to send to FSP + bool iv_isMboxEnabled; // are we able to send to FSP + bool iv_isIpmiEnabled; // are we able to send to BMC via IPMI + bool iv_nonInfoCommitted; // Keeps track of any non-informational logs. + bool iv_isErrlDisplayEnabled; // are we able to use the errorDisplay // Errl flags which represent processing needed by the errl // represented as a bit field (8 bits) @@ -454,89 +468,49 @@ private: PNOR_FLAG = 0x01, MBOX_FLAG = 0x02, ERRLDISP_FLAG = 0x04, + IPMI_FLAG = 0x08, + ALL_FLAGS = PNOR_FLAG | MBOX_FLAG + #ifdef CONFIG_BMC_IPMI + | IPMI_FLAG + #endif #ifdef CONFIG_CONSOLE_OUTPUT_ERRORDISPLAY - ALL_FLAGS = PNOR_FLAG | MBOX_FLAG | ERRLDISP_FLAG, - #else - ALL_FLAGS = PNOR_FLAG | MBOX_FLAG, + | ERRLDISP_FLAG #endif }; // List of messages errl manager needs to handle // The unint8_t is a bit field to indiciate what needs to be done - std::list > iv_errlList; - - typedef std::list >::iterator ErrlListItr_t; - - /** - * @brief checks if the pnor flag is set - * - * @param[in] i_pair - pair of errl and bitfield of flags - * @return True if PNOR flag is set - * - */ - static bool _isPnorFlagSet(const std::pair &i_pair) - { - return (i_pair.second & PNOR_FLAG); - } - - /** - * @brief checks if the mbox flag is set - * - * @param[in] i_pair - pair of errl and bitfield of flagst - * @return True if mbox flag is set - * - */ - static bool _isMboxFlagSet(const std::pair &i_pair) - { - return (i_pair.second & MBOX_FLAG); - } + typedef std::pair ErrlFlagPair_t; + typedef std::list ErrlList_t; + typedef ErrlList_t::iterator ErrlListItr_t; + ErrlList_t iv_errlList; /** - * @brief checks if the errldisp flag is set + * @brief checks if the flag is set * * @param[in] i_pair - pair of errl and bitfield of flags - * @return True if errldisp flag is set - * - */ - static bool _isErrlDispFlagSet(const std::pair &i_pair) - { - return (i_pair.second & ERRLDISP_FLAG); - } - - /** - * @brief clears the pnor flag, indicating complete - * - * @param[in/out] io_pair - pair of errl and bitfield of flags - * @return NA - * - */ - static void _clearPnorFlag(std::pair &io_pair) - { - io_pair.second &= ~PNOR_FLAG; - } - - /** - * @brief clears the mbox flag, indicating complete - * - * @param[in/out] io_pair - pair of errl and bitfield of flags - * @return NA + * @param[in] i_flag - specific flag + * @return True if specified flag is set * */ - static void _clearMboxFlag(std::pair &io_pair) + static bool _isFlagSet(const ErrlFlagPair_t &i_pair, + const ERRLOG_FLAGS i_flag) { - io_pair.second &= ~MBOX_FLAG; + return (i_pair.second & i_flag); } /** - * @brief clears the errldisp flag, indicating complete + * @brief clears the flag, indicating complete * * @param[in/out] io_pair - pair of errl and bitfield of flags + * @param[in] i_flag - specific flag * @return NA * */ - static void _clearErrlDispFlag(std::pair &io_pair) + static void _clearFlag(ErrlFlagPair_t &io_pair, + const ERRLOG_FLAGS i_flag) { - io_pair.second &= ~ERRLDISP_FLAG; + io_pair.second &= ~i_flag; } /** @@ -549,8 +523,7 @@ private: * @return True if an erase occurred, otherwise false * */ - bool _updateErrlListIter(std::list< std::pair > - ::iterator & io_it); + bool _updateErrlListIter(ErrlListItr_t & io_it); }; diff --git a/src/include/usr/errl/errlprvt.H b/src/include/usr/errl/errlprvt.H index 5a779187c..b3cc68d91 100644 --- a/src/include/usr/errl/errlprvt.H +++ b/src/include/usr/errl/errlprvt.H @@ -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. */ @@ -44,6 +46,7 @@ class ErrlPrvt // you would expect to be part of ErrlEntry are actually instance data // in this class. friend class ErrlEntry; + friend class ErrlManager; private: -- cgit v1.2.1