summaryrefslogtreecommitdiffstats
path: root/src/usr/i2c
diff options
context:
space:
mode:
authorTerry J. Opie <opiet@us.ibm.com>2012-03-26 10:14:39 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-03-27 16:16:39 -0500
commit548d17a3c263373ce3d8ecbd948cb2a0e56bdb9f (patch)
treeceab067092bb86ac1d7354b1d5dc1c8d5e27cb15 /src/usr/i2c
parent40f9b6bf88061c23a8a788f41c96d05c567587c7 (diff)
downloadtalos-hostboot-548d17a3c263373ce3d8ecbd948cb2a0e56bdb9f.tar.gz
talos-hostboot-548d17a3c263373ce3d8ecbd948cb2a0e56bdb9f.zip
Fix I2C/EEPROM tests to work when there are no I2C Targets
Change-Id: I22112ca863b19759eec9080742148bd71751b144 RTC: 39190 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/793 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/i2c')
-rwxr-xr-xsrc/usr/i2c/test/eepromddtest.H19
-rwxr-xr-xsrc/usr/i2c/test/i2ctest.H35
2 files changed, 54 insertions, 0 deletions
diff --git a/src/usr/i2c/test/eepromddtest.H b/src/usr/i2c/test/eepromddtest.H
index 1be82c462..d71cdc88a 100755
--- a/src/usr/i2c/test/eepromddtest.H
+++ b/src/usr/i2c/test/eepromddtest.H
@@ -38,6 +38,7 @@
#include <targeting/predicates/predicatectm.H>
#include <targeting/predicates/predicatepostfixexpr.H>
#include <targeting/util.H>
+#include "i2ctest.H"
extern trace_desc_t* g_trac_eeprom;
@@ -134,6 +135,12 @@ class EEPROMTest: public CxxTest::TestSuite
for( uint32_t j = 0; j < fullList.size(); j++ )
{
+ // Skip this target if EEPROM isn't available.
+ if( !isI2CAvailable( fullList[j] ) )
+ {
+ continue;
+ }
+
for( uint32_t i = 0; i < NUM_CMDS; i++ )
{
uint64_t data;
@@ -210,6 +217,12 @@ class EEPROMTest: public CxxTest::TestSuite
tS.masterProcChipTargetHandle( testTarget );
assert(testTarget != NULL);
+ // Skip this target if EEPROM isn't available.
+ if( !isI2CAvailable( testTarget ) )
+ {
+ continue;
+ }
+
num_ops++;
err = deviceOp( DeviceFW::LAST_OP_TYPE,
testTarget,
@@ -256,6 +269,12 @@ class EEPROMTest: public CxxTest::TestSuite
tS.masterProcChipTargetHandle( testTarget );
assert(testTarget != NULL);
+ // Skip this target if EEPROM isn't available.
+ if( !isI2CAvailable( testTarget ) )
+ {
+ continue;
+ }
+
num_ops++;
err = deviceOp( DeviceFW::WRITE,
testTarget,
diff --git a/src/usr/i2c/test/i2ctest.H b/src/usr/i2c/test/i2ctest.H
index f2ff71f5d..e9ab1212a 100755
--- a/src/usr/i2c/test/i2ctest.H
+++ b/src/usr/i2c/test/i2ctest.H
@@ -42,6 +42,29 @@ extern trace_desc_t* g_trac_i2c;
using namespace TARGETING;
+bool isI2CAvailable( TARGETING::Target * i_target )
+{
+ bool avail = true;
+ EepromAddrInfo0 eepromData;
+ if( i_target->tryGetAttr<ATTR_EEPROM_ADDR_INFO0>( eepromData ) )
+ {
+ if( ( 0x80 == eepromData.port ) &&
+ ( 0x80 == eepromData.devAddr ) &&
+ ( 0x80 == eepromData.engine ) )
+ {
+ // Default values, thus, not present
+ avail = false;
+ }
+ }
+ else
+ {
+ // Didn't find attribute, thus, not present
+ avail = false;
+ }
+
+ return avail;
+}
+
class I2CTest: public CxxTest::TestSuite
{
public:
@@ -193,6 +216,12 @@ class I2CTest: public CxxTest::TestSuite
break;
};
+ // Check to see if I2C function is there
+ if( !isI2CAvailable( theTarget ) )
+ {
+ continue;
+ }
+
// do the operation
cmds++;
err = deviceOp( (testData[i].rnw ? DeviceFW::READ : DeviceFW::WRITE),
@@ -300,6 +329,12 @@ class I2CTest: public CxxTest::TestSuite
tS.masterProcChipTargetHandle( testTarget );
assert(testTarget != NULL);
+ // Check to see if I2C function is there
+ if( !isI2CAvailable( testTarget ) )
+ {
+ continue;
+ }
+
num_ops++;
err = deviceOp( DeviceFW::LAST_OP_TYPE,
testTarget,
OpenPOWER on IntegriCloud