summaryrefslogtreecommitdiffstats
path: root/src/usr/i2c/i2c.C
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/usr/i2c/i2c.C
parent35019a5b9b1916840c5551acd758bcded0596dc9 (diff)
downloadblackbird-hostboot-52561adeaa1c8d846e363d8386ca99a1ad89196b.tar.gz
blackbird-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/usr/i2c/i2c.C')
-rwxr-xr-xsrc/usr/i2c/i2c.C26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/usr/i2c/i2c.C b/src/usr/i2c/i2c.C
index 5b1af57ef..35de15ca3 100755
--- a/src/usr/i2c/i2c.C
+++ b/src/usr/i2c/i2c.C
@@ -78,9 +78,9 @@ TRAC_INIT( & g_trac_i2cr, "I2CR", KILOBYTE );
#define CENTAUR_MASTER_ENGINES 1 // Number of Engines in a Centaur
// Derived from ATTR_I2C_BUS_SPEED_ARRAY[engine][port] attribute
-const TARGETING::ATTR_I2C_BUS_SPEED_ARRAY_type var = {{NULL}};
-#define I2C_BUS_ATTR_MAX_ENGINE sizeof(var)/sizeof(var[0])
-#define I2C_BUS_ATTR_MAX_PORT sizeof(var[0])/sizeof(var[0][0])
+const TARGETING::ATTR_I2C_BUS_SPEED_ARRAY_type g_var = {{NULL}};
+#define I2C_BUS_ATTR_MAX_ENGINE I2C_BUS_MAX_ENGINE(g_var)
+#define I2C_BUS_ATTR_MAX_PORT I2C_BUS_MAX_PORT(g_var)
// ----------------------------------------------
@@ -2984,5 +2984,25 @@ errlHndl_t i2cRegisterOp ( DeviceFW::OperationType i_opType,
return err;
}
+/**
+ * @brief Return a set of information related to each I2C master on
+ * the given target chip
+ */
+void getMasterInfo( const TARGETING::Target* i_chip,
+ std::list<MasterInfo_t>& o_info )
+{
+ TRACDCOMP(g_trac_i2c,"getMasterInfo(%.8X)",TARGETING::get_huid(i_chip));
+ for( uint32_t engine = 0;
+ engine < I2C_BUS_ATTR_MAX_ENGINE;
+ engine++ )
+ {
+ MasterInfo_t info;
+ info.scomAddr = 0x000A0000 + engine*0x20;
+ info.engine = engine;
+ info.freq = i2cGetNestFreq()*1000*1000; //convert MHz->Hz
+
+ o_info.push_back(info);
+ }
+}
} // end namespace I2C
OpenPOWER on IntegriCloud