summaryrefslogtreecommitdiffstats
path: root/src/usr/spd
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/spd')
-rwxr-xr-xsrc/usr/spd/spd.C6
-rwxr-xr-xsrc/usr/spd/test/dimmPrestest.H110
-rwxr-xr-xsrc/usr/spd/test/spdtest.H280
3 files changed, 176 insertions, 220 deletions
diff --git a/src/usr/spd/spd.C b/src/usr/spd/spd.C
index a421a14b9..3a4147025 100755
--- a/src/usr/spd/spd.C
+++ b/src/usr/spd/spd.C
@@ -30,9 +30,6 @@
// ----------------------------------------------
// Includes
// ----------------------------------------------
-//#include <string.h>
-//#include <sys/time.h>
-
#include <trace/interface.H>
#include <errl/errlentry.H>
#include <errl/errlmanager.H>
@@ -359,7 +356,8 @@ errlHndl_t spdGetValue ( uint64_t i_keyword,
tmpKwdData,
compareEntries );
- if( entry == &kwdData[arraySize] )
+ if( ( entry == &kwdData[arraySize] ) ||
+ ( i_keyword != entry->keyword ) )
{
TRACFCOMP( g_trac_spd,
ERR_MRK"No matching keyword entry found!" );
diff --git a/src/usr/spd/test/dimmPrestest.H b/src/usr/spd/test/dimmPrestest.H
index 46dad62c5..624e30786 100755
--- a/src/usr/spd/test/dimmPrestest.H
+++ b/src/usr/spd/test/dimmPrestest.H
@@ -80,42 +80,35 @@ class DIMMPresTest: public CxxTest::TestSuite
break;
}
- for( uint32_t dimm = 0; dimm < dimmList.size(); dimm++ )
- {
- cmds++;
- theTarget = dimmList[dimm];
-
- // Check presence
- err = deviceRead( theTarget,
- &present,
- presentSize,
- DEVICE_PRESENT_ADDRESS() );
-
- if( err )
- {
- fails++;
- TS_FAIL( "testDimmPres() - Error returned from DIMM Presence "
- "Detect call!" );
- errlCommit( err,
- SPD_COMP_ID );
- continue;
- }
- else if( presentSize != sizeof(present) )
- {
- fails++;
- TS_FAIL( "testDimmPrs() - Size of Presence buffer is not size "
- "of boolean!" );
- continue;
- }
- else
- {
- // Test was good.
- }
- }
+ // Test only on first DIMM.
+ cmds++;
+ theTarget = dimmList[0];
+
+ // Check presence
+ err = deviceRead( theTarget,
+ &present,
+ presentSize,
+ DEVICE_PRESENT_ADDRESS() );
if( err )
{
- break;
+ fails++;
+ TS_FAIL( "testDimmPres() - Error returned from DIMM Presence "
+ "Detect call!" );
+ errlCommit( err,
+ SPD_COMP_ID );
+ continue;
+ }
+ else if( presentSize != sizeof(present) )
+ {
+ fails++;
+ TS_FAIL( "testDimmPrs() - Size of Presence buffer is not size "
+ "of boolean!" );
+ continue;
+ }
+ else
+ {
+ // Test was good.
}
} while( 0 );
@@ -156,38 +149,31 @@ class DIMMPresTest: public CxxTest::TestSuite
break;
}
- for( uint32_t dimm = 0; dimm < dimmList.size(); dimm++ )
+ // Test on first DIMM only
+ cmds++;
+ theTarget = dimmList[0];
+
+ // Check presence
+ err = deviceRead( theTarget,
+ &present,
+ presentSize,
+ DEVICE_PRESENT_ADDRESS() );
+
+ if( !err )
{
- cmds++;
- theTarget = dimmList[dimm];
-
- // Check presence
- err = deviceRead( theTarget,
- &present,
- presentSize,
- DEVICE_PRESENT_ADDRESS() );
-
- if( !err )
- {
- fails++;
- TS_FAIL( "testDimmPresInvalidSize() - Error not flagged for "
- "invalid size!" );
- errlCommit( err,
- SPD_COMP_ID );
- continue;
- }
- else
- {
- // Delete the error and continue
- delete err;
- err = NULL;
- continue;
- }
+ fails++;
+ TS_FAIL( "testDimmPresInvalidSize() - Error not flagged for "
+ "invalid size!" );
+ errlCommit( err,
+ SPD_COMP_ID );
+ continue;
}
-
- if( err )
+ else
{
- break;
+ // Delete the error and continue
+ delete err;
+ err = NULL;
+ continue;
}
} while( 0 );
diff --git a/src/usr/spd/test/spdtest.H b/src/usr/spd/test/spdtest.H
index 9080f41a2..b8105592e 100755
--- a/src/usr/spd/test/spdtest.H
+++ b/src/usr/spd/test/spdtest.H
@@ -101,104 +101,97 @@ class SPDTest: public CxxTest::TestSuite
break;
}
- for( uint32_t dimm = 0; dimm < dimmList.size(); dimm++ )
+ // Operate on first DIMM.
+ theTarget = dimmList[0];
+ uint8_t * theData = NULL;
+ size_t theSize = 0;
+ uint32_t entry = 0x0;
+
+ // Get the DDR revision
+ uint8_t memType = 0x0;
+ size_t memTypeSize = 0x1;
+ err = deviceRead( theTarget,
+ &memType,
+ memTypeSize,
+ DEVICE_SPD_ADDRESS( SPD::BASIC_MEMORY_TYPE ) );
+
+ if( err )
{
- theTarget = dimmList[dimm];
- uint8_t * theData = NULL;
- size_t theSize = 0;
- uint32_t entry = 0x0;
-
- // Get the DDR revision
- uint8_t memType = 0x0;
- size_t memTypeSize = 0x1;
- err = deviceRead( theTarget,
- &memType,
- memTypeSize,
- DEVICE_SPD_ADDRESS( SPD::BASIC_MEMORY_TYPE ) );
+ fails++;
+ TS_FAIL( "testSpdRead- Failure reading Basic memory type!" );
+ errlCommit( err,
+ SPD_COMP_ID );
+ continue;
+ }
- if( err )
+ for( uint64_t keyword = SPD::SPD_FIRST_KEYWORD;
+ keyword < SPD::SPD_LAST_KEYWORD; keyword++ )
+ {
+ cmds++;
+ if( NULL != theData )
{
- fails++;
- TS_FAIL( "testSpdRead- Failure reading Basic memory type!" );
- errlCommit( err,
- SPD_COMP_ID );
- continue;
+ free( theData );
+ theData = NULL;
}
- for( uint64_t keyword = SPD::SPD_FIRST_KEYWORD;
- keyword < SPD::SPD_LAST_KEYWORD; keyword++ )
+ // Get the required size of the buffer
+ theSize = 0;
+ if( SPD_DDR3 == memType )
{
- cmds++;
- if( NULL != theData )
+ for( entry = 0;
+ entry < (sizeof(ddr3Data)/sizeof(ddr3Data[0]));
+ entry++ )
{
- free( theData );
- theData = NULL;
- }
-
- // Get the required size of the buffer
- theSize = 0;
- if( SPD_DDR3 == memType )
- {
- for( entry = 0;
- entry < (sizeof(ddr3Data)/sizeof(ddr3Data[0]));
- entry++ )
+ if( keyword == ddr3Data[entry].keyword )
{
- if( keyword == ddr3Data[entry].keyword )
- {
- theSize = ddr3Data[entry].length;
- break;
- }
+ theSize = ddr3Data[entry].length;
+ break;
}
}
- else
- {
- // Nothing else supported yet!
- // Not really a fail, just not supported
- cmds--;
- continue;
- }
-
- if( 0x0 == theSize )
- {
- fails++;
- TS_FAIL( "testSpdRead - Keyword (0x%04x) size = 0x0",
- entry );
- continue;
- }
-
- // Allocate the buffer
- theData = static_cast<uint8_t*>(malloc( theSize ));
+ }
+ else
+ {
+ // Nothing else supported yet!
+ // Not really a fail, just not supported
+ cmds--;
+ continue;
+ }
- err = deviceRead( theTarget,
- theData,
- theSize,
- DEVICE_SPD_ADDRESS( keyword ) );
+ if( 0x0 == theSize )
+ {
+ fails++;
+ TS_FAIL( "testSpdRead - Keyword (0x%04x) size = 0x0",
+ entry );
+ continue;
+ }
- if( err )
- {
- fails++;
- TS_FAIL( "testSpdRead - Failure on keyword: %04x",
- keyword );
- errlCommit( err,
- SPD_COMP_ID );
- continue;
- }
+ // Allocate the buffer
+ theData = static_cast<uint8_t*>(malloc( theSize ));
- // Read was successful, print out first 2 bytes of data read
- TRACFCOMP( g_trac_spd,
- "testSpdRead - kwd: 0x%04x, val: %02x%02x, size: %d",
- keyword, theData[0], theData[1], theSize );
+ err = deviceRead( theTarget,
+ theData,
+ theSize,
+ DEVICE_SPD_ADDRESS( keyword ) );
- if( NULL != theData )
- {
- free( theData );
- theData = NULL;
- }
+ if( err )
+ {
+ fails++;
+ TS_FAIL( "testSpdRead - Failure on keyword: %04x",
+ keyword );
+ errlCommit( err,
+ SPD_COMP_ID );
+ continue;
}
- if( err )
+ // Read was successful, print out first 2 bytes of data read
+ TRACFCOMP( g_trac_spd,
+ "testSpdRead - kwd: 0x%04x, val: %02x%02x, size: %d",
+ keyword, theData[0], theData[1], theSize );
+
+ if( NULL != theData )
{
- break;
+ free( theData );
+ theData = NULL;
}
}
@@ -241,35 +234,28 @@ class SPDTest: public CxxTest::TestSuite
break;
}
- for( uint32_t dimm = 0; dimm < dimmList.size(); dimm++ )
- {
- theTarget = dimmList[dimm];
- uint8_t * theData = NULL;
- size_t theSize = 0;
+ // Operate on first DIMM
+ theTarget = dimmList[0];
+ uint8_t * theData = NULL;
+ size_t theSize = 0;
- cmds++;
- err = deviceWrite( theTarget,
- theData,
- theSize,
- DEVICE_SPD_ADDRESS( SPD_FIRST_KEYWORD ) );
+ cmds++;
+ err = deviceWrite( theTarget,
+ theData,
+ theSize,
+ DEVICE_SPD_ADDRESS( SPD_FIRST_KEYWORD ) );
- if( NULL == err )
- {
- // No error returned, failure
- fails++;
- TS_FAIL( "testSpdWrite - No error returned from deviceWrite()" );
- continue;
- }
- else
- {
- delete err;
- err = NULL;
- }
+ if( NULL == err )
+ {
+ // No error returned, failure
+ fails++;
+ TS_FAIL( "testSpdWrite - No error returned from deviceWrite()" );
+ continue;
}
-
- if( err )
+ else
{
- break;
+ delete err;
+ err = NULL;
}
} while( 0 );
@@ -306,34 +292,27 @@ class SPDTest: public CxxTest::TestSuite
break;
}
- for( uint32_t dimm = 0; dimm < dimmList.size(); dimm++ )
- {
- theTarget = dimmList[dimm];
- uint8_t * theData = NULL;
- size_t theSize = 0x0;
+ // Test on first DIMM only.
+ theTarget = dimmList[0];
+ uint8_t * theData = NULL;
+ size_t theSize = 0x0;
- cmds++;
- err = deviceRead( theTarget,
- theData,
- theSize,
- DEVICE_SPD_ADDRESS( SPD::SPD_LAST_KEYWORD ) );
+ cmds++;
+ err = deviceRead( theTarget,
+ theData,
+ theSize,
+ DEVICE_SPD_ADDRESS( SPD::SPD_LAST_KEYWORD ) );
- if( NULL == err )
- {
- fails++;
- TS_FAIL( "testSpdInvalidKeyword - No error returned!" );
- continue;
- }
- else
- {
- delete err;
- err = NULL;
- }
+ if( NULL == err )
+ {
+ fails++;
+ TS_FAIL( "testSpdInvalidKeyword - No error returned!" );
+ continue;
}
-
- if( err )
+ else
{
- break;
+ delete err;
+ err = NULL;
}
} while( 0 );
@@ -370,34 +349,27 @@ class SPDTest: public CxxTest::TestSuite
break;
}
- for( uint32_t dimm = 0; dimm < dimmList.size(); dimm++ )
- {
- theTarget = dimmList[dimm];
- uint8_t * theData = NULL;
- size_t theSize = 0x0; // Invalid size of 0x0
+ // Test on first DIMM only.
+ theTarget = dimmList[0];
+ uint8_t * theData = NULL;
+ size_t theSize = 0x0; // Invalid size of 0x0
- cmds++;
- err = deviceRead( theTarget,
- theData,
- theSize,
- DEVICE_SPD_ADDRESS( SPD::SPD_FIRST_KEYWORD ) );
+ cmds++;
+ err = deviceRead( theTarget,
+ theData,
+ theSize,
+ DEVICE_SPD_ADDRESS( SPD::SPD_FIRST_KEYWORD ) );
- if( NULL == err )
- {
- fails++;
- TS_FAIL( "testSpdInvalidSize - No error for invalid size!" );
- continue;
- }
- else
- {
- delete err;
- err = NULL;
- }
+ if( NULL == err )
+ {
+ fails++;
+ TS_FAIL( "testSpdInvalidSize - No error for invalid size!" );
+ continue;
}
-
- if( err )
+ else
{
- break;
+ delete err;
+ err = NULL;
}
} while( 0 );
OpenPOWER on IntegriCloud