summaryrefslogtreecommitdiffstats
path: root/src/usr/i2c/test
diff options
context:
space:
mode:
authorMike Baiocchi <baiocchi@us.ibm.com>2013-11-25 10:23:04 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-01-09 18:00:58 -0600
commitb35a7f31ac2bb296aa7e7bb231e686549b36ba3b (patch)
tree61111cc258f32f2574be7550959153a3633bd4ef /src/usr/i2c/test
parentc7e0df0b86a229449ff2be99c20d91595a86f36d (diff)
downloadtalos-hostboot-b35a7f31ac2bb296aa7e7bb231e686549b36ba3b.tar.gz
talos-hostboot-b35a7f31ac2bb296aa7e7bb231e686549b36ba3b.zip
Update I2C and EEPROM Device Drivers Error Paths
This commit removes the retry path from the I2C Device Driver and adds two to the EEPROM Device Driver. This will provide more flexibility to I2C DD use in the future, while keeping the current level of EEPROM DD robustness. Change-Id: I2b2aa3ed83557a5f2d9523cd55a7486924205e2f RTC: 89667 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7508 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/i2c/test')
-rwxr-xr-xsrc/usr/i2c/test/eepromddtest.H58
-rwxr-xr-xsrc/usr/i2c/test/i2ctest.H56
2 files changed, 65 insertions, 49 deletions
diff --git a/src/usr/i2c/test/eepromddtest.H b/src/usr/i2c/test/eepromddtest.H
index 4cd4fad37..fdf55dd8d 100755
--- a/src/usr/i2c/test/eepromddtest.H
+++ b/src/usr/i2c/test/eepromddtest.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2013 */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
/* */
/* p1 */
/* */
@@ -76,24 +76,28 @@ class EEPROMTest: public CxxTest::TestSuite
} testData[] =
{
-
// MVPD of processor - chip 0
- // Write:
- { 0x0000, VPD_PRIMARY, 0xfedcba9876543210, 8, false },
- // Read:
- { 0x0000, VPD_PRIMARY, 0xfedcba9876543210, 8, true },
+ // Read - Only
+ { 0x0000, VPD_PRIMARY, 0x000f17ba00000000, 4, true },
// SBE Primary of processor - chip 2
- // Write:
- { 0x0100, SBE_PRIMARY, 0xaabb000000000000, 2, false },
+ // Write: over 128-byte page boundary:
+ { 0x017F, SBE_PRIMARY, 0xaabb000000000000, 2, false },
+ // Read:
+ { 0x017F, SBE_PRIMARY, 0xaabb000000000000, 2, true },
+
+ // SBE Backup of processor - chip 3
+ // Write: over 256-byte page boundary:
+ { 0x01FD, SBE_BACKUP, 0x1122334400000000, 4, false },
// Read:
- { 0x0100, SBE_PRIMARY, 0xaabb000000000000, 2, true },
+ { 0x01FD, SBE_BACKUP, 0x1122334400000000, 4, true },
// SBE Backup of processor - chip 3
- // Write:
- { 0x00F0, SBE_BACKUP, 0x1122334400000000, 4, false },
+ // Write: inside 128 page boundary:
+ { 0x005B, SBE_BACKUP, 0xbad5adcabf0b7000, 7, false },
// Read:
- { 0x00F0, SBE_BACKUP, 0x1122334400000000, 4, true },
+ { 0x005B, SBE_BACKUP, 0xbad5adcabf0b7000, 7, true },
+
};
const uint32_t NUM_CMDS = sizeof(testData)/sizeof(testData[0]);
@@ -157,7 +161,7 @@ class EEPROMTest: public CxxTest::TestSuite
{
uint64_t data;
- // if a read, initialize data, else, set data to write
+ // if a read, clear data; else, set data to write
if( testData[i].rnw )
{
data = 0x0ull;
@@ -214,12 +218,12 @@ class EEPROMTest: public CxxTest::TestSuite
/**
* @brief EEPROM Read/Write Large Test
- * This test will read and write 1KB of data to SBE Backup
+ * This test will read and write 603 bytes of data to SBE Backup
* VPD. It will attempt to restore the original data at
* the end of the test.
*
- * Note: 1st 1K of SBE EEPROM data is currently blank, so this
- * test will read and write to that address space
+ * Note: 1st 768 bytes of SBE EEPROM data is currently blank, so
+ * this test will read and write below that address space
*/
void testEEPROMReadWriteLarge ( void )
{
@@ -228,12 +232,15 @@ class EEPROMTest: public CxxTest::TestSuite
int num_ops = 0;
int cmds = 0;
- // Create 1KB buffers
- size_t testBufLen = 1024;
+ // Create 603-byte buffers
+ size_t testBufLen = 603;
uint8_t testBuffer[testBufLen];
uint8_t new_data[testBufLen];
uint8_t original_data[testBufLen];
+ // Use small offset to force more complicated page-boundary testing
+ uint8_t offset = 0x11;
+
TRACFCOMP( g_trac_eeprom,
"testEEPROMReadWriteLarge - Start" );
@@ -255,7 +262,7 @@ class EEPROMTest: public CxxTest::TestSuite
TargetHandleList fullList;
fullList.push_back( testTarget );
- // 5 operations of 1K data per target (details below)
+ // 5 operations per target (details below)
const uint32_t NUM_CMDS = 5;
// Number of total operations
@@ -297,10 +304,9 @@ class EEPROMTest: public CxxTest::TestSuite
}
- // Valid Buffer, so memcpy the first 1KB
+ // Valid Buffer, so memcpy the first 603 bytes
memcpy( new_data, tmp_ptr, testBufLen );
-
/************************************************************/
/* Loop through targets and perform operations */
/************************************************************/
@@ -318,11 +324,9 @@ class EEPROMTest: public CxxTest::TestSuite
// Before starting, clear original data buffer
memset(original_data, 0x0, testBufLen);
-
for (uint8_t j = 1; j <= NUM_CMDS; j++)
{
-
- // Details: 5 operations of 1K data per target
+ // Details: 5 operations per target
// 1) Read Original Data and Save It
// 2) Write New Data
// 3) Read New Data and Compare
@@ -356,7 +360,8 @@ class EEPROMTest: public CxxTest::TestSuite
fullList[0],
testBuffer,
testBufLen,
- DEVICE_EEPROM_ADDRESS(SBE_BACKUP,0x0));
+ DEVICE_EEPROM_ADDRESS(SBE_BACKUP,
+ offset));
if( err )
{
@@ -550,7 +555,6 @@ class EEPROMTest: public CxxTest::TestSuite
// Set max length and offset
dataSize = 0xFFFFFFFFFFFFFFFF;
offset = 0xFFFFFFFFFFFFFFFF;
-
num_ops++;
err = deviceOp( DeviceFW::WRITE,
testTarget,
@@ -578,7 +582,7 @@ class EEPROMTest: public CxxTest::TestSuite
} while( 0 );
TRACFCOMP( g_trac_eeprom,
- "testEEPROMInvalidChip - End: %d/%d fails",
+ "testEEPROMOverflow - End: %d/%d fails",
fails, num_ops );
}
diff --git a/src/usr/i2c/test/i2ctest.H b/src/usr/i2c/test/i2ctest.H
index 0224d8dd8..46e5efd59 100755
--- a/src/usr/i2c/test/i2ctest.H
+++ b/src/usr/i2c/test/i2ctest.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2013 */
+/* COPYRIGHT International Business Machines Corp. 2011,2014 */
/* */
/* p1 */
/* */
@@ -68,7 +68,6 @@ class I2CTest: public CxxTest::TestSuite
*/
void testI2CDirect ( void )
{
-
errlHndl_t err = NULL;
int cmds = 0;
int fails = 0;
@@ -115,58 +114,58 @@ class I2CTest: public CxxTest::TestSuite
// Read/Write SBE Primary: Murano-0, port-0
// Safe to write to first 0x300: 0x0-0x2FF
- { 0x00, 0x00, 0xAC, 0x0000ababcdcdefef,
- 8, false, TARGETING::TYPE_PROC }, // Write data to 0x0000
+ { 0x00, 0x00, 0xAC, 0x0020ababcdcdefef,
+ 8, false, TARGETING::TYPE_PROC }, // Write data to 0x0020
- { 0x00, 0x00, 0xAC, 0x0000000000000000,
+ { 0x00, 0x00, 0xAC, 0x0020000000000000,
2, false, TARGETING::TYPE_PROC }, // Write addr for read
{ 0x00, 0x00, 0xAc, 0xababcdcdefef0000,
6, true, TARGETING::TYPE_PROC }, // Read data back
- { 0x00, 0x00, 0xAC, 0x0003000000000000,
+ { 0x00, 0x00, 0xAC, 0x0023000000000000,
2, false, TARGETING::TYPE_PROC }, // Write addr for read
{ 0x00, 0x00, 0xAC, 0xcdefef0000000000,
3, true, TARGETING::TYPE_PROC }, // Read data back
- { 0x00, 0x00, 0xAC, 0x0005ee1200000000,
- 4, false, TARGETING::TYPE_PROC }, // Write data to 0x0005
+ { 0x00, 0x00, 0xAC, 0x0025831200000000,
+ 4, false, TARGETING::TYPE_PROC }, // Write data to 0x0025
- { 0x00, 0x00, 0xAC, 0x0005000000000000,
+ { 0x00, 0x00, 0xAC, 0x0024000000000000,
2, false, TARGETING::TYPE_PROC }, // Write addr for read
- { 0x00, 0x00, 0xAC, 0xee12000000000000,
- 2, true, TARGETING::TYPE_PROC }, // Read data back
+ { 0x00, 0x00, 0xAC, 0xef83120000000000,
+ 3, true, TARGETING::TYPE_PROC }, // Read data back
// Read/Write SBE Backup: Murano-0, port-0
// Safe to write to first 0x300: 0x0-0x2FF
- { 0x00, 0x00, 0xAE, 0x0000ababcdcdefef,
- 8, false, TARGETING::TYPE_PROC }, // Write data to 0x0000
+ { 0x00, 0x00, 0xAE, 0x0030ababcdcdefef,
+ 8, false, TARGETING::TYPE_PROC }, // Write data to 0x0030
- { 0x00, 0x00, 0xAE, 0x0000000000000000,
+ { 0x00, 0x00, 0xAE, 0x0030000000000000,
2, false, TARGETING::TYPE_PROC }, // Write addr for read
{ 0x00, 0x00, 0xAE, 0xababcdcdefef0000,
6, true, TARGETING::TYPE_PROC }, // Read data back
- { 0x00, 0x00, 0xAE, 0x0003000000000000,
+ { 0x00, 0x00, 0xAE, 0x0033000000000000,
2, false, TARGETING::TYPE_PROC }, // Write addr for read
{ 0x00, 0x00, 0xAE, 0xcdefef0000000000,
3, true, TARGETING::TYPE_PROC }, // Read data back
- { 0x00, 0x00, 0xAE, 0x0005ee1200000000,
- 4, false, TARGETING::TYPE_PROC }, // Write data to 0x0005
+ { 0x00, 0x00, 0xAE, 0x0035971200000000,
+ 4, false, TARGETING::TYPE_PROC }, // Write data to 0x0035
- { 0x00, 0x00, 0xAE, 0x0005000000000000,
+ { 0x00, 0x00, 0xAE, 0x0034000000000000,
2, false, TARGETING::TYPE_PROC }, // Write addr for read
- { 0x00, 0x00, 0xAE, 0xee12000000000000,
- 2, true, TARGETING::TYPE_PROC }, // Read data back
+ { 0x00, 0x00, 0xAE, 0xef97120000000000,
+ 3, true, TARGETING::TYPE_PROC }, // Read data back
// MEMBUF TESTS
@@ -310,6 +309,13 @@ class I2CTest: public CxxTest::TestSuite
continue;
}
+ // If a write op, wait 5ms for EEPROM to write data
+ // to its internal memory
+ if (testData[i].rnw == false)
+ {
+ nanosleep(0,5 * NS_PER_MSEC); // 5 msec
+ }
+
// compare data for the read, but ignore case where
// data = I2C_TEST_IGNORE_DATA_COMPARE
if( ( testData[i].rnw ) &&
@@ -346,7 +352,6 @@ class I2CTest: public CxxTest::TestSuite
*/
void testI2COffset ( void )
{
-
errlHndl_t err = NULL;
int cmds = 0;
int fails = 0;
@@ -492,7 +497,6 @@ class I2CTest: public CxxTest::TestSuite
// Before starting, clear original data buffer
original_data = 0x0ull;
-
for (uint8_t j = 1; j <= 5; j++)
{
@@ -535,6 +539,14 @@ class I2CTest: public CxxTest::TestSuite
continue;
}
+
+ // If a write op, wait 5ms for EEPROM to write data
+ // to its internal memory
+ if ( (j%2) == 0 )
+ {
+ nanosleep(0,5 * NS_PER_MSEC); // 5 msec
+ }
+
// Handle loop-specific results
// For Loop 1: save original data
OpenPOWER on IntegriCloud