diff options
Diffstat (limited to 'src/include/usr')
-rw-r--r-- | src/include/usr/errl/errlipmi.H | 142 | ||||
-rw-r--r-- | src/include/usr/errl/errlmanager.H | 25 | ||||
-rw-r--r-- | src/include/usr/errl/errlsctn.H | 3 | ||||
-rw-r--r-- | src/include/usr/errl/errlsctnhdr.H | 3 | ||||
-rw-r--r-- | src/include/usr/errl/errlud.H | 3 | ||||
-rw-r--r-- | src/include/usr/hwas/common/hwasCallout.H | 29 | ||||
-rw-r--r-- | src/include/usr/ipmi/ipmiif.H | 5 | ||||
-rw-r--r-- | src/include/usr/ipmi/ipmisel.H | 264 |
8 files changed, 313 insertions, 161 deletions
diff --git a/src/include/usr/errl/errlipmi.H b/src/include/usr/errl/errlipmi.H deleted file mode 100644 index 836b0d1a1..000000000 --- a/src/include/usr/errl/errlipmi.H +++ /dev/null @@ -1,142 +0,0 @@ -/* 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 <stdint.h> - -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 07d4b79af..a5fcc136b 100644 --- a/src/include/usr/errl/errlmanager.H +++ b/src/include/usr/errl/errlmanager.H @@ -39,7 +39,6 @@ #include <util/singleton.H> #include <errl/errlentry.H> #include <errldisplay/errldisplay.H> -#include <errl/errlipmi.H> #include <sys/sync.h> #include <kernel/timemgr.H> #include <hbotcompid.H> @@ -156,13 +155,15 @@ public: static void errlResourceReady(errlManagerNeeds i_needs); /** - * @brief Sends msg to errlmanager telling what resources are ready + * @brief Sends msg to errlmanager to ack sending of errl to BMC * - * This is called by resources that the ErrlManager needs, which start up - * AFTER ErrlManager starts. Currently, that's PNOR MBOX and TARGeting. + * This is called by ipmi code once the SEL for the indicated errorlog + * has been successfully sent to the BMC * + * It is a static function because a module cannot call an interface on a + * singleton in another module */ - void sendResourcesMsg(errlManagerNeeds i_needs); + static void errlAckErrorlog(uint32_t i_eid); /** * @brief Returns the HWAS ProcessCallout function pointer @@ -250,6 +251,20 @@ private: ErrlManager(const ErrlManager& i_right); ErrlManager& operator=(const ErrlManager& i_right); + /** + * @brief Sends msg to errlmanager telling what resources are ready + * + * called by static errlResourceReady function. + */ + void sendResourcesMsg(errlManagerNeeds i_needs); + + /** + * @brief Sends msg to errlmanager telling which errlog to ack + * + * called by static errlAckErrorlog function. + */ + void sendAckErrorlog(uint32_t i_eid); + /** * @brief Access PNOR and get the address and size of the HBEL section in * PNOR; sets the iv_pnorAddr, iv_maxErrlInPnor, iv_pnorOpenSlot variables; diff --git a/src/include/usr/errl/errlsctn.H b/src/include/usr/errl/errlsctn.H index 295786614..367e5de89 100644 --- a/src/include/usr/errl/errlsctn.H +++ b/src/include/usr/errl/errlsctn.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -59,6 +59,7 @@ namespace ERRORLOG */ class ErrlSctn { + friend class ErrlManager; friend class ERRORLOGDISPLAY::ErrLogDisplay; diff --git a/src/include/usr/errl/errlsctnhdr.H b/src/include/usr/errl/errlsctnhdr.H index 6d72018d1..bed8d3fcd 100644 --- a/src/include/usr/errl/errlsctnhdr.H +++ b/src/include/usr/errl/errlsctnhdr.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -69,6 +69,7 @@ class ErrlSctnHdr friend class ErrlUD; friend class ErrlSrc; friend class ErrlEntry; + friend class ErrlManager; friend class ERRORLOGDISPLAY::ErrLogDisplay; diff --git a/src/include/usr/errl/errlud.H b/src/include/usr/errl/errlud.H index d7c10cc0f..3e243049f 100644 --- a/src/include/usr/errl/errlud.H +++ b/src/include/usr/errl/errlud.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2015 */ /* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ @@ -54,6 +54,7 @@ class ErrlUD : public ErrlSctn // you would expect to be part of ErrlEntry are actually instance data // in this class. friend class ErrlEntry; + friend class ErrlManager; friend class ERRORLOGDISPLAY::ErrLogDisplay; diff --git a/src/include/usr/hwas/common/hwasCallout.H b/src/include/usr/hwas/common/hwasCallout.H index 3c6813dc7..f8611c0e8 100644 --- a/src/include/usr/hwas/common/hwasCallout.H +++ b/src/include/usr/hwas/common/hwasCallout.H @@ -93,6 +93,7 @@ enum epubProcedureID // from srci/fsp/srci.H enum callOutPriority { + SRCI_PRIORITY_NONE = 0, SRCI_PRIORITY_LOW = 1, SRCI_PRIORITY_MEDC = 2, SRCI_PRIORITY_MEDB = 3, @@ -161,23 +162,37 @@ typedef struct callout_ud // two Targets will follow }; struct { // type == CLOCK_CALLOUT - clockTypeEnum clockType; // uint32_t - DeconfigEnum clkDeconfigState; // uint32_t - GARD_ErrorType clkGardErrorType; // uint32_t + clockTypeEnum clockType; // uint32_t + DeconfigEnum clkDeconfigState; // uint32_t + GARD_ErrorType clkGardErrorType; // uint32_t // one Target will follow }; struct { // type == PART_CALLOUT - partTypeEnum partType; // uint32_t + partTypeEnum partType; // uint32_t DeconfigEnum partDeconfigState; // uint32_t GARD_ErrorType partGardErrorType; // uint32_t // one Target will follow }; - }; + }; // union } callout_ud_t; #ifndef PARSER /** + * @brief retrieveTarget will convert the EntityPath to a Target + * + * @param[in] io_uData pointer to the userdetail data + * @param[in] o_pTarget target that is found + * @param[in] io_errl Error log handle reference + * + * @return true if error and o_pTarget data not valid, + * false no error, o_pTarget data valid + */ +bool retrieveTarget(uint8_t * & io_uData, + TARGETING::Target * & o_pTarget, + errlHndl_t i_errl); + +/** * @brief processCallout process the userdetail for a callout, calling * the deconfigure and/or GARD funcationality as appropriate * @@ -295,11 +310,7 @@ errlHndl_t platHandlePartCallout( DeconfigEnum i_deconfigState = DECONFIG, GARD_ErrorType i_gardErrorType = GARD_Fatal); - #endif // not PARSER - - }; // end namespace - #endif diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H index 29867f5eb..19d62c114 100644 --- a/src/include/usr/ipmi/ipmiif.H +++ b/src/include/usr/ipmi/ipmiif.H @@ -78,7 +78,8 @@ namespace IPMI NETFUN_STORAGE = (0x0a << 2), NETFUN_TRANPORT = (0x0c << 2), NETFUN_GRPEXT = (0x2c << 2), - NETFUN_IBM = (0x3a << 2), + NETFUN_AMI = (0x32 << 2), + NETFUN_IBM = (0x3a << 2), // Overload the OEM netfun for a "none" netfun. We use this as a // default for objects which will have their netfun filled in @@ -218,7 +219,7 @@ namespace IPMI //AMI-specific storage messages inline const command_t partial_add_esel(void) - { return std::make_pair(NETFUN_STORAGE, 0x32); } + { return std::make_pair(NETFUN_AMI, 0xf0); } // event messages inline const command_t platform_event(void) diff --git a/src/include/usr/ipmi/ipmisel.H b/src/include/usr/ipmi/ipmisel.H new file mode 100644 index 000000000..82d86bf6f --- /dev/null +++ b/src/include/usr/ipmi/ipmisel.H @@ -0,0 +1,264 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/ipmi/ipmisel.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 __IPMI_IPMISEL_H +#define __IPMI_IPMISEL_H + +/** + * @file ipmisel.H + * @brief IPMI system error log transport definition + */ + +#include <stdint.h> +#include <builtins.h> +#include <ipmi/ipmiif.H> + +/** + * + */ + +namespace IPMISEL +{ + enum msg_type + { + MSG_SEND_ESEL, + MSG_STATE_SHUTDOWN, + MSG_LAST_TYPE = MSG_STATE_SHUTDOWN, + }; + + enum sel_size_constants + { + // size of the partial_add_esel request (command) data + PARTIAL_ADD_ESEL_REQ = 7, + + // per MegaRAC SP-X spec + // The size of the eSEL is configurable via PRJ + // it can be set to 2KB per eSEL packet. + ESEL_MAX_SIZE = 2 * KILOBYTE, + }; + + /** + * @brief Send the eSEL data to the BMC + * @param[in] pointer to eSEL data + * @param[in] size of eSEL data + * @param[in] eid of errorlog for this eSEL (for ack) + * @param[in] event_dir_type for this eSEL + * @param[in] sensorType that caused the error/eSEL + * @param[in] sensorNumber that caused the error/eSEL + */ + void sendESEL(uint8_t* i_eselData, uint32_t i_dataSize, + uint32_t i_eid, uint8_t i_eventDirType, + uint8_t i_sensorType, uint8_t i_sensorNumber); + + // per IPMI Spec, section 32.1 SEL Event Records + enum sel_record_type + { + record_type_system_event = 0x02, + record_type_ami_esel = 0xDF, + }; + + enum sel_evm_format_version + { + format_ipmi_version_1_0 = 0x03, + format_ipmi_version_2_0 = 0x04, + }; + + enum sel_event_dir_type + { + event_unspecified = 0x00, + event_threshhold = 0x01, + event_state = 0x03, + event_predictive = 0x04, + event_limit = 0x05, + event_permformance = 0x06, + }; + + enum sel_event_data + { + event_data1_ami = 0xAA, + }; + + enum sel_generator_id + { + generator_id_ami = 0x2000, + }; + + 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(0), + evm_format_version(0), + sensor_type(0), + sensor_number(0), + event_dir_type(0), + event_data1(0), + event_data2(0), + event_data3(0) + { }; + + } PACKED; // selRecord + + // local structure needed to pass data between sendESEL command and the sel + // thread + struct eselInitData + { + size_t dataSize; + uint8_t eSel[sizeof(selRecord)]; + uint8_t *eSelExtra; + + // ctor + eselInitData(selRecord* i_eSEL, + uint8_t* i_extraData, uint32_t i_dataSize) + { + dataSize = i_dataSize; + memcpy(eSel,i_eSEL,sizeof(selRecord)); + eSelExtra = new uint8_t[i_dataSize]; + memcpy(eSelExtra, i_extraData, i_dataSize); + } + + // dtor + ~eselInitData() + { + delete eSelExtra; + } + }; +} // namespace IPMISEL + +class IpmiSEL +{ + public: + + /** + * Thread start routine for the resource provider + * @param[in] void*, unused + */ + static void* start(void* unused); + + /** + * Default constructor + */ + IpmiSEL(void); + + /** + * Destructor + */ + ~IpmiSEL(void); + + /** + * @brief Get the message queue associated with this FRU + * @param[in] void + * @return, a msg_q_t which is the message queue + */ + msg_q_t msgQueue(void) const + { return iv_msgQ; } + + private: + /** + * Entry point for the SEL transport definition + */ + void execute(void); + + /** + * @brief parse the msg and call send_esel to send the esel (handles if + * the SEL reservation is lost) + * @param[in] i_msg + */ + void process_esel(msg_t *i_msg) const; + + /** + * @brief do the actual ipmi calls to send the esel data to the bmc + * @param[in] i_data esel data + * @param[in] o_err any error generated during the send + * @param[in] o_cc ipmi completion code from last sendrecv + */ + void send_esel(IPMISEL::eselInitData * i_data, + errlHndl_t &o_err, IPMI::completion_code &o_cc) const; + + msg_q_t iv_msgQ; //!< ipmi message queue + + //Disallow copying of this class. + IpmiSEL& operator=(const IpmiSEL&); + IpmiSEL(const IpmiSEL&); +}; + +#endif |