summaryrefslogtreecommitdiffstats
path: root/src/include/usr/i2c
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2015-01-12 10:26:06 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-02-11 12:27:46 -0600
commit52561adeaa1c8d846e363d8386ca99a1ad89196b (patch)
treed4df89c98939044536f0262bd08ae8fa4c0dbb0d /src/include/usr/i2c
parent35019a5b9b1916840c5551acd758bcded0596dc9 (diff)
downloadtalos-hostboot-52561adeaa1c8d846e363d8386ca99a1ad89196b.tar.gz
talos-hostboot-52561adeaa1c8d846e363d8386ca99a1ad89196b.zip
Report I2C devices in devtree
Report all I2C masters, busses and end devices in the devtree. Current support includes the following devices: -Processor module vpd (primary and backup) -Processor SBE SEEPROM (x2) -Memory buffer VPD -DIMM SPD Change-Id: Ic0e08c208331ce9701de27111cc2e9f54a81fcf7 RTC: 117996 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15203 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Michael Baiocchi <baiocchi@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/usr/i2c')
-rw-r--r--src/include/usr/i2c/eepromif.H35
-rw-r--r--src/include/usr/i2c/i2cif.H30
2 files changed, 63 insertions, 2 deletions
diff --git a/src/include/usr/i2c/eepromif.H b/src/include/usr/i2c/eepromif.H
index 7300ead04..d4d847777 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,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2015 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -25,6 +25,8 @@
#ifndef __EEPROMIF_H
#define __EEPROMIF_H
+#include <list>
+
namespace EEPROM
{
@@ -38,7 +40,8 @@ typedef enum
VPD_BACKUP = 1,
SBE_PRIMARY = 2,
SBE_BACKUP = 3,
- LAST_CHIP_TYPE
+ LAST_CHIP_TYPE,
+ FIRST_CHIP_TYPE = VPD_PRIMARY
} eeprom_chip_types_t;
/**
@@ -51,6 +54,34 @@ typedef enum
*/
bool eepromPresence ( TARGETING::Target * i_target );
+/**
+ * @brief Define a set of information about all EEPROMs in the
+ * system (primarily used to populate the devtree)
+ */
+struct EepromInfo_t
+{
+ TARGETING::Target* i2cMaster; //< I2C Master chip
+ uint64_t engine; //< I2C engine (relative to master chip)
+ uint64_t port; //< I2C port (relative to engine)
+ uint64_t busFreq; //< Bus speed in Hz
+ uint64_t devAddr; //< I2C device address (relative to port)
+ uint64_t sizeKB; //< Size in KB
+ uint64_t addrBytes; //< Number of bytes required for addressing
+ eeprom_chip_types_t device; //< Identifies role of eeprom
+ TARGETING::Target* assocTarg; //< Target associated with this device
+};
+
+/**
+ * @brief Return a set of information related to every unique
+ * EEPROM in the system
+ *
+ * @param[out] o_info - list of EEPROM Information
+ *
+ * @return errlHndl_t - Null if successful, otherwise a pointer to
+ * the error log.
+ */
+void getEEPROMs( std::list<EepromInfo_t>& o_info );
+
}; // end namespace EEPROM
diff --git a/src/include/usr/i2c/i2cif.H b/src/include/usr/i2c/i2cif.H
index 7d678cb87..c219fca29 100644
--- a/src/include/usr/i2c/i2cif.H
+++ b/src/include/usr/i2c/i2cif.H
@@ -25,6 +25,11 @@
#ifndef __I2CIF_H
#define __I2CIF_H
+// Handy macros to check i2c ranges
+// Pass in an instance of a TARGETING::ATTR_I2C_BUS_SPEED_ARRAY_type
+#define I2C_BUS_MAX_ENGINE(var) (sizeof(var)/sizeof(var[0]))
+#define I2C_BUS_MAX_PORT(var) (sizeof(var[0])/sizeof(var[0][0]))
+
namespace I2C
{
@@ -146,6 +151,31 @@ enum i2cSetAccessModeType
void i2cSetAccessMode( i2cSetAccessModeType i_setModeType );
+
+/**
+ * @brief Define a set of information about the I2C masters
+ * (primarily used to populate the devtree)
+ */
+struct MasterInfo_t
+{
+ uint64_t scomAddr; //< Base scom address for control regs
+ uint8_t engine; //< Engine number
+ uint32_t freq; //< Clock frequency of master in Hz
+};
+
+/**
+ * @brief Return a set of information related to each I2C master on
+ * the given target chip
+ *
+ * @param[in] i_chip - I2C Master chip (proc or membuf)
+ * @param[out] o_info - list of I2C Information
+ *
+ * @return errlHndl_t - Null if successful, otherwise a pointer to
+ * the error log.
+ */
+void getMasterInfo( const TARGETING::Target* i_chip,
+ std::list<MasterInfo_t>& o_info );
+
}; // end namespace I2C
#endif // end __I2CIF_H
OpenPOWER on IntegriCloud