diff options
| author | Jaymes Wilks <mjwilks@us.ibm.com> | 2018-08-17 11:24:21 -0500 |
|---|---|---|
| committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-11-12 09:00:37 -0600 |
| commit | 87adeec286402eb648f14d274382fb8b84351467 (patch) | |
| tree | 62f3c86906eac47753f862e8147af53a469e5d3f /src/include | |
| parent | d83a4ee8495c5ad4b823c26b1a09a3c886882494 (diff) | |
| download | talos-hostboot-87adeec286402eb648f14d274382fb8b84351467.tar.gz talos-hostboot-87adeec286402eb648f14d274382fb8b84351467.zip | |
Support openpower-specific I2C device callouts
This change supports the openpower path for adding I2C device
callouts to error logs. The process works as follows:
- Create an I2C device lookup table on first use of I2C callout
- Use that table to map I2C info to the actual device to callout
- Callout any other I2C devices on the bus with lesser priority
- If no I2C match found, callout the I2C master instead
- If an I2C device was found, callout the I2C master as low
Change-Id: Ib7b248ae60e7e834d6165bbdf4bd9b776ea2421b
RTC:94872
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/64833
Reviewed-by: Michael Baiocchi <mbaiocch@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>
Reviewed-by: Nicholas E. Bofferding <bofferdn@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/usr/errl/errlentry.H | 1 | ||||
| -rw-r--r-- | src/include/usr/errl/errli2c.H | 162 | ||||
| -rw-r--r-- | src/include/usr/i2c/eepromif.H | 14 |
3 files changed, 173 insertions, 4 deletions
diff --git a/src/include/usr/errl/errlentry.H b/src/include/usr/errl/errlentry.H index 4ee5f0ebf..3d487e02e 100644 --- a/src/include/usr/errl/errlentry.H +++ b/src/include/usr/errl/errlentry.H @@ -660,7 +660,6 @@ public: const uint8_t i_address, const HWAS::callOutPriority i_priority); - /** * @brief Import flattened error log * diff --git a/src/include/usr/errl/errli2c.H b/src/include/usr/errl/errli2c.H new file mode 100644 index 000000000..bc1617e13 --- /dev/null +++ b/src/include/usr/errl/errli2c.H @@ -0,0 +1,162 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/errl/errli2c.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] 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 ERRLI2C_H +#define ERRLI2C_H +/** + * @file errli2c.H + * + * @brief Error log target matching interface for i2c device callouts + * + * This header file contains the definitions for an i2c device matching info + * data structure and a supporting singleton class to manage the creation of + * a lists of these structures. Once created, the list can be searched for + * targets to call out when an i2c device fails or is unresponsive. + * + */ + +/*****************************************************************************/ +// I n c l u d e s +/*****************************************************************************/ +#include <stdint.h> +#include <limits.h> +#include <vector> + +#include <errl/errlentry.H> +#include <hwas/common/hwasCallout.H> +#include <i2c/eepromif.H> + +namespace ERRORLOG +{ + +/** + * @brief This structure stores information about I2C devices that we need + * in order to match identifying I2C device info with the info + * required for callouts. + */ +struct I2cMatchingInfo_t +{ + TARGETING::EntityPath i2cMasterPath; + uint8_t engine; + uint8_t port; + uint8_t devAddr; + uint8_t chipCount; + EEPROM::eeprom_chip_types_t chipType; + const TARGETING::Target* tgt; + uint8_t targetAncestryDepth; +}; + +/** + * @brief I2c Device Info Matching Info Holding Class + * + * This class provides a container for all of the I2C device info that is used + * to find matching devices for I2C Device Callouts. It is intended to be + * instantiated as a singleton so that the device info gathering process + * happens only once per IPL. + */ +class I2cDevInfos +{ + +public: + + /** + * @brief getInstance returns an instance to a singleton object of type + * I2cDevInfos. This method ensures that the object has truly only + * one instance in the hostboot environment no matter where it is + * called. + * + * @return I2cDevInfos reference to the singleton object + */ + static I2cDevInfos& getInstance(); + + /** + * @brief getDevList returns a reference to the matching info vector. + * + * The calling code can use this list of devices to find a matching device + * and decide what needs to be called out. + */ + const std::vector<I2cMatchingInfo_t>& getDevList() const + { + return iv_i2cdvs; + } + + /** + * @brief I2cDevInfos constructor. + * + * This does the actual work to build the list of I2C Devices with targets + * that can be used for matching. + */ + I2cDevInfos(); + + // Disable compiler-provided default functions + I2cDevInfos(const I2cDevInfos &) = delete; + I2cDevInfos & operator=(const I2cDevInfos &) = delete; + I2cDevInfos (I2cDevInfos&&) = delete; + I2cDevInfos& operator = (I2cDevInfos&&) = delete; + +private: + + // the vector that stores all the matching info + std::vector<I2cMatchingInfo_t> iv_i2cdvs; + + /** + * @brief getDepth returns the number of path elements in the indicated + * target's physical entity path + * + * Used internally by I2cDevInfos class to precalcuate target depths once + * per IPL. Target depths are needed to remove duplicate HW callouts from + * I2C Device Callout error logs. + */ + uint8_t getDepth(const TARGETING::Target* tgt) const; + +}; + + +/** + * @brief Do the handling of an I2c device callout within hostboot for + * non-FSP based systems + * + * @param[in] i_errl errlHndl_t to process. Cannot be nullptr. + * @param[in] i_i2cMaster The i2c master target. Cannot be nullptr. + * Cannot be the master sentinel. + * @param[in] i_engine The i2c device engine + * @param[in] i_port The i2c device port + * @param[in] i_address The i2c device address + * @param[in] i_priority The i2c device callout priority + * + * @return void + */ +void handleI2cDeviceCalloutWithinHostboot( + errlHndl_t i_errl, + const TARGETING::Target *i_i2cMaster, + uint8_t i_engine, + uint8_t i_port, + uint8_t i_address, + HWAS::callOutPriority i_priority); + + +} // End namespace + + +#endif //ERRLI2C_H diff --git a/src/include/usr/i2c/eepromif.H b/src/include/usr/i2c/eepromif.H index 36558cbfe..62618e195 100644 --- a/src/include/usr/i2c/eepromif.H +++ b/src/include/usr/i2c/eepromif.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2013,2017 */ +/* Contributors Listed Below - COPYRIGHT 2013,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -41,9 +41,19 @@ typedef enum SBE_PRIMARY = 2, SBE_BACKUP = 3, LAST_CHIP_TYPE, + INVALID_CHIP_TYPE = LAST_CHIP_TYPE, FIRST_CHIP_TYPE = VPD_PRIMARY } eeprom_chip_types_t; +/* + * @brief Miscellaneous enums for EEPROM + */ +enum +{ + EEPROM_PAGE_SIZE = 0x100, + EEPROM_DEVADDR_INC = 2 +}; + /** * @brief This function tests to see if the VPD_PRIMARY eeprom is present * for the specific target. @@ -83,8 +93,6 @@ struct EepromInfo_t */ void getEEPROMs( std::list<EepromInfo_t>& o_info ); - - }; // end namespace EEPROM #endif // end __EEPROMIF_H |

