summaryrefslogtreecommitdiffstats
path: root/src/usr/vpd/test
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2013-01-09 12:48:13 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-02-06 14:18:33 -0600
commit7696bed6681d260f46d6878b5201560ed78715af (patch)
tree1731e489e444856d0644b17c0b39946988c3f512 /src/usr/vpd/test
parent1ee9befb99004f26dcc81af879ce14907d405ad8 (diff)
downloadtalos-hostboot-7696bed6681d260f46d6878b5201560ed78715af.tar.gz
talos-hostboot-7696bed6681d260f46d6878b5201560ed78715af.zip
Enable MVPD Writes
Add support for writing MVPD keywords to both PNOR and out to the EEPROM (via FSP mailbox). Also enabled a few more test cases related to MVPD. Added MER0 record to the standalone procmvpd.dat file and enabled the support in the code. Change-Id: If16c2863a11daaac3363fcf30bb2c92ad3e92b41 RTC: 39177 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2962 Tested-by: Jenkins Server Reviewed-by: ADAM R. MUHLE <armuhle@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/vpd/test')
-rwxr-xr-xsrc/usr/vpd/test/mvpdtest.H186
-rwxr-xr-xsrc/usr/vpd/test/spdtest.H277
2 files changed, 380 insertions, 83 deletions
diff --git a/src/usr/vpd/test/mvpdtest.H b/src/usr/vpd/test/mvpdtest.H
index 9480f2881..a7685550e 100755
--- a/src/usr/vpd/test/mvpdtest.H
+++ b/src/usr/vpd/test/mvpdtest.H
@@ -66,43 +66,19 @@ mvpdTestData mvpdData[] =
{ CRP0, ED },
{ CRP0, TE },
{ CRP0, DD },
-// { CRP0, pdP }, // TODO - no #P in test data, pull for now RTC 51716
+// { CRP0, pdP }, // TODO - no #P in test data
{ CRP0, ST },
-// { CRP0, DN, 0x03 }, // TODO - This doesn't match documentation,
-// pulling out for now
{ CP00, VD },
{ CP00, PG },
-// { CP00, PK }, // TODO - no PK in test data. pull for now RTC 51716
+// { CP00, PK }, // TODO - no PK in test data
{ CP00, pdR },
{ CP00, pdG },
{ CP00, pdV },
{ CP00, pdH },
-// { CP00, pdP }, // TODO - no #P in test data, pull for now RTC 51716
+// { CP00, pdP }, // TODO - no #P in test data
{ CP00, SB },
{ CP00, MK },
{ CP00, PB },
-/* // TODO no LRP0,LRP1,LRP2,LRP3 in test data, pull for now RTC 51716
- { LRP0, VD },
- { LRP0, pdV },
- { LRP0, pdP },
- { LRP0, pdM },
- { LRP0, CH },
- { LRP1, VD },
- { LRP1, pdV },
- { LRP1, pdP },
- { LRP1, pdM },
- { LRP1, CH },
- { LRP2, VD },
- { LRP2, pdV },
- { LRP2, pdP },
- { LRP2, pdM },
- { LRP2, CH },
- { LRP3, VD },
- { LRP3, pdV },
- { LRP3, pdP },
- { LRP3, pdM },
- { LRP3, CH },
-*/
{ LRP4, VD },
{ LRP4, pdV },
{ LRP4, pdP },
@@ -118,7 +94,7 @@ mvpdTestData mvpdData[] =
{ LRP6, pdP },
{ LRP6, pdM },
{ LRP6, CH },
-/* // TODO no LRP7,LRP8,LRP9,LRPA,LRPB,LWPO,LWP1,LWP2,LWP3 in test data, pull for now RTC 51716
+/* // TODO no LRP7,LRP8,LRP9,LRPA,LRPB,LWPO,LWP1,LWP2,LWP3 in test data
{ LRP7, VD },
{ LRP7, pdV },
{ LRP7, pdP },
@@ -188,7 +164,7 @@ mvpdTestData mvpdData[] =
{ LWP6, pd2 },
{ LWP6, pd3 },
{ LWP6, IN },
-/* // TODO no LWP7,LWP8,LWP9,LWPA,LWPB in test data, pull for now RTC 51716
+/* // TODO no LWP7,LWP8,LWP9,LWPA,LWPB in test data
{ LWP7, VD },
{ LWP7, pd2 },
{ LWP7, pd3 },
@@ -233,7 +209,10 @@ mvpdTestData mvpdData[] =
{ VINI, HE },
{ VINI, CT },
{ VINI, HW },
- // TODO - Add VWML when available.
+
+ { VWML, pdI },
+
+ { MER0, pdI },
};
void getProcTargets( TargetHandleList & o_procList )
@@ -400,13 +379,16 @@ class MVPDTest: public CxxTest::TestSuite
errlHndl_t err = NULL;
uint64_t cmds = 0x0;
uint64_t fails = 0x0;
+ uint8_t* testData = NULL;
+ uint8_t* origData = NULL;
+ uint8_t* verifyData = NULL;
TRACFCOMP( g_trac_mvpd,
ENTER_MRK"testMvpdWrite()" );
do
{
- TARGETING::Target * theTarget = NULL;
+ TARGETING::Target * theTgt = NULL;
// Get the processor targets
TargetHandleList procList;
@@ -422,11 +404,10 @@ class MVPDTest: public CxxTest::TestSuite
}
// Use the first Proc in the list
- theTarget = procList[0];
+ theTgt = procList[0];
// check to see if the target is functional
- if
- (!theTarget->getAttr<TARGETING::ATTR_HWAS_STATE>().functional)
+ if(!theTgt->getAttr<TARGETING::ATTR_HWAS_STATE>().functional)
{
TRACFCOMP( g_trac_mvpd,
@@ -435,35 +416,142 @@ class MVPDTest: public CxxTest::TestSuite
continue; // add continue because target is non functional
}
- size_t theSize = 1;
- uint8_t * theData = new uint8_t[theSize];
+ // first figure out how big the keyword is
+ cmds++;
+ size_t theSize = 0;
+ err = deviceRead( theTgt,
+ testData,
+ theSize,
+ DEVICE_MVPD_ADDRESS(VWML,pdI) );
+ if( err )
+ {
+ fails++;
+ TRACFCOMP( g_trac_mvpd,
+ ERR_MRK"testMvpdWrite() - failure getting size of VWML/#I, RC=%.4X",
+ err->reasonCode() );
+ TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ continue;
+ }
+ // save off the original data
+ origData = new uint8_t[theSize];
cmds++;
- err = deviceWrite( theTarget,
- theData,
+ err = deviceRead( theTgt,
+ origData,
+ theSize,
+ DEVICE_MVPD_ADDRESS(VWML,pdI) );
+ if( err )
+ {
+ fails++;
+ TRACFCOMP( g_trac_mvpd,
+ ERR_MRK"testMvpdWrite() - failure reading VWML/#I, RC=%.4X",
+ err->reasonCode() );
+ TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ continue;
+ }
+ TRACFBIN( g_trac_mvpd, "orig=", origData, theSize );
+
+ // fill it up with some dummy data
+ testData = new uint8_t[theSize];
+ for( size_t x=0; x<theSize; x++ )
+ {
+ testData[x] = x;
+ }
+
+ // write the new data in
+ cmds++;
+ err = deviceWrite( theTgt,
+ testData,
theSize,
- DEVICE_MVPD_ADDRESS( CRP0,
- pdP ) );
+ DEVICE_MVPD_ADDRESS(VWML,pdI) );
+ if( err )
+ {
+ fails++;
+ TRACFCOMP( g_trac_mvpd,
+ ERR_MRK"testMvpdWrite() - failure writing VWML/#I, RC=%.4X",
+ err->reasonCode() );
+ TS_FAIL( "testMvpdWrite() - Failure calling deviceWrite!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ continue;
+ }
- if( NULL == err )
+ // verify the data got written
+ cmds++;
+ verifyData = new uint8_t[theSize];
+ err = deviceRead( theTgt,
+ verifyData,
+ theSize,
+ DEVICE_MVPD_ADDRESS(VWML,pdI) );
+ if( err )
{
fails++;
- TS_FAIL( "testMvpdWrite - Expected error from write "
- "attempt since its not supported!" );
+ TRACFCOMP( g_trac_mvpd,
+ ERR_MRK"testMvpdWrite() - failure reading VWML/#I to verify, RC=%.4X",
+ err->reasonCode() );
+ TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ continue;
}
- else
+ TRACFBIN( g_trac_mvpd, "verif=", verifyData, theSize );
+
+ // compare what we read to what we wrote
+ if( memcmp( testData, verifyData, theSize ) )
{
- delete err;
- err = NULL;
+ fails++;
+ TRACFBIN( g_trac_mvpd, "wrote=", testData, theSize );
+ TRACFBIN( g_trac_mvpd, "read=", verifyData, theSize );
+ TS_FAIL( "testMvpdWrite - Data mismatch!" );
}
- if( NULL != theData )
+ // put the original data back to be a good citizen
+ cmds++;
+ err = deviceWrite( theTgt,
+ origData,
+ theSize,
+ DEVICE_MVPD_ADDRESS(VWML,pdI) );
+ if( err )
{
- delete theData;
- theData = NULL;
+ fails++;
+ TRACFCOMP( g_trac_mvpd,
+ ERR_MRK"testMvpdWrite() - failure writing original data back into VWML/#I, RC=%.4X",
+ err->reasonCode() );
+ TS_FAIL( "testMvpdWrite() - Failure calling deviceRead!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ continue;
}
+
} while( 0 );
+ if( NULL != testData )
+ {
+ delete[] testData;
+ testData = NULL;
+ }
+
+ if( NULL != origData )
+ {
+ delete[] origData;
+ origData = NULL;
+ }
+
+ if( NULL != verifyData )
+ {
+ delete[] verifyData;
+ verifyData = NULL;
+ }
+
+ if( cmds == 0 )
+ {
+ TS_FAIL( "testMvpdWrite - No tests ran, something is wrong..." );
+ }
+
TRACFCOMP( g_trac_mvpd,
"testMvpdWrite - %d/%d fails",
fails, cmds );
diff --git a/src/usr/vpd/test/spdtest.H b/src/usr/vpd/test/spdtest.H
index 38b53bf23..5ef8a6107 100755
--- a/src/usr/vpd/test/spdtest.H
+++ b/src/usr/vpd/test/spdtest.H
@@ -207,6 +207,11 @@ class SPDTest: public CxxTest::TestSuite
theData = NULL;
}
+ if( cmds == 0 )
+ {
+ TS_FAIL( "testSpdRead - No tests ran, something is wrong..." );
+ }
+
TRACFCOMP( g_trac_spd,
"testSpdRead - %d/%d fails",
fails, cmds );
@@ -215,16 +220,17 @@ class SPDTest: public CxxTest::TestSuite
/**
* @brief Test a SPD Write
*/
- void testSpdWrite ( void )
+ void testSpdWriteDQ ( void )
{
errlHndl_t err = NULL;
uint64_t cmds = 0x0;
uint64_t fails = 0x0;
- uint8_t * theData = NULL;
+ uint8_t * testData = NULL;
uint8_t * origData = NULL;
+ uint8_t * verifyData = NULL;
TRACFCOMP( g_trac_spd,
- ENTER_MRK"testSpdWrite()" );
+ ENTER_MRK"testSpdWriteDQ()" );
do
{
@@ -238,7 +244,7 @@ class SPDTest: public CxxTest::TestSuite
( NULL == dimmList[0] ) )
{
TRACFCOMP( g_trac_spd,
- "testSpdWrite - No DIMMs found!" );
+ "testSpdWriteDQ - No DIMMs found!" );
break;
}
@@ -255,7 +261,7 @@ class SPDTest: public CxxTest::TestSuite
if( err )
{
fails++;
- TS_FAIL( "testSpdWrite - failed to read memtype!" );
+ TS_FAIL( "testSpdWriteDQ - failed to read memtype!" );
errlCommit( err,
VPD_COMP_ID );
break;
@@ -279,98 +285,301 @@ class SPDTest: public CxxTest::TestSuite
{
fails++;
TRACFCOMP( g_trac_spd,
- "testSpdWrite - memory type: 0x%04x",
+ "testSpdWriteDQ - memory type: 0x%04x",
memType );
- TS_FAIL( "testSpdWrite - Unsupported Memory Type!" );
+ TS_FAIL( "testSpdWriteDQ - Unsupported Memory Type!" );
errlCommit( err,
VPD_COMP_ID );
break;
}
// Allocate data buffer
- theData = static_cast<uint8_t*>(malloc( theSize ));
+ origData = static_cast<uint8_t*>(malloc( theSize ));
// Read the data out first
err = deviceRead( theTarget,
- theData,
+ origData,
theSize,
DEVICE_SPD_ADDRESS( DIMM_BAD_DQ_DATA ) );
if( err )
{
fails++;
- TS_FAIL( "testSpdWrite - failed to read DIMM Bad DQ data!" );
+ TS_FAIL( "testSpdWriteDQ - failed to read DIMM Bad DQ data!" );
errlCommit( err,
VPD_COMP_ID );
break;
}
- origData = static_cast<uint8_t*>(malloc( theSize ));
- memcpy( origData, theData, theSize );
+ // fill it up with some dummy data
+ testData = static_cast<uint8_t*>(malloc( theSize ));
+ for( size_t x=0; x<theSize; x++ )
+ {
+ testData[x] = x;
+ }
- // Write the data back
+ // Write the test data in
err = deviceWrite( theTarget,
- theData,
+ testData,
theSize,
DEVICE_SPD_ADDRESS( DIMM_BAD_DQ_DATA ) );
if( err )
{
- // No error returned, failure
fails++;
- TS_FAIL( "testSpdWrite - Error writing data to DIMM Bad DQ "
+ TS_FAIL( "testSpdWriteDQ - Error writing data to DIMM Bad DQ "
"data" );
break;
}
- else
- {
- delete err;
- err = NULL;
- }
// Read the data out again to check it
+ verifyData = static_cast<uint8_t*>(malloc( theSize ));
err = deviceRead( theTarget,
- theData,
+ verifyData,
theSize,
DEVICE_SPD_ADDRESS( DIMM_BAD_DQ_DATA ) );
if( err )
{
fails++;
- TS_FAIL( "testSpdWrite - failed to read DIMM Bad DQ data! [2]" );
+ TS_FAIL( "testSpdWriteDQ - failed to read DIMM Bad DQ data! [2]" );
errlCommit( err,
VPD_COMP_ID );
break;
}
- if( memcmp( theData, origData, theSize ) )
+ if( memcmp( testData, verifyData, theSize ) )
{
fails++;
- TS_FAIL( "testSpdWrite - DIMM Bad DQ data does not match what we wrote!" );
- TRACFBIN( g_trac_spd, "orig=", origData, theSize );
- TRACFBIN( g_trac_spd, "read=", theData, theSize );
+ TS_FAIL( "testSpdWriteDQ - DIMM Bad DQ data does not match what we wrote!" );
+ TRACFBIN( g_trac_spd, "wrote=", testData, theSize );
+ TRACFBIN( g_trac_spd, "read=", verifyData, theSize );
}
+ // put the original data back to be a good citizen
+ err = deviceWrite( theTarget,
+ origData,
+ theSize,
+ DEVICE_SPD_ADDRESS( DIMM_BAD_DQ_DATA ) );
+
+ if( err )
+ {
+ fails++;
+ TS_FAIL( "testSpdWriteDQ - Error writing original data back to DIMM Bad DQ "
+ "data" );
+ break;
+ }
+
+
} while( 0 );
- if( NULL != theData )
+ if( NULL != testData )
{
- free( theData );
- theData = NULL;
+ delete testData;
+ testData = NULL;
}
if( NULL != origData )
{
- free( origData );
- theData = NULL;
+ delete origData;
+ origData = NULL;
+ }
+
+ if( NULL != verifyData )
+ {
+ delete verifyData;
+ verifyData = NULL;
+ }
+
+ if( cmds == 0 )
+ {
+ TS_FAIL( "testSpdWriteDQ - No tests ran, something is wrong..." );
}
TRACFCOMP( g_trac_spd,
- "testSpdWrite - %d/%d fails",
+ "testSpdWriteDQ - %d/%d fails",
fails, cmds );
}
/**
+ * @brief Test a SPD Write to a value that is less than 1 byte
+ *
+ * Note - There are no writable keywords that fit this criteria
+ * so this test is disabled by default. To enable, modify the
+ * table in spdDDR3.H to make something writable.
+ */
+ void _testSpdWriteSmall ( void )
+ {
+ errlHndl_t err = NULL;
+ uint64_t cmds = 0x0;
+ uint64_t fails = 0x0;
+ uint8_t* testData = NULL;
+ uint8_t* origData = NULL;
+
+ TRACFCOMP( g_trac_spd,
+ ENTER_MRK"testSpdWriteSmall()" );
+
+ do
+ {
+ TARGETING::Target * theTarget = NULL;
+
+ // Get DIMM Targets
+ TargetHandleList dimmList;
+ getDIMMTargets( dimmList );
+
+ if( ( 0 == dimmList.size() ) ||
+ ( NULL == dimmList[0] ) )
+ {
+ TRACFCOMP( g_trac_spd,
+ "testSpdWriteSmall - No DIMMs found!" );
+ break;
+ }
+
+ // Operate on first DIMM
+ cmds++;
+ theTarget = dimmList[0];
+
+ // Get Memory Type
+ uint8_t memType = 0x0;
+ err = getMemType( theTarget,
+ memType );
+ if( err )
+ {
+ fails++;
+ TS_FAIL( "testSpdWriteSmall - failed to read memtype!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ break;
+ }
+
+ // Get the size
+ size_t theSize = 0;
+ uint16_t theKeyword = INVALID_SPD_KEYWORD;
+ if( SPD_DDR3 == memType )
+ {
+ for( uint32_t entry = 0;
+ entry < (sizeof(ddr3Data)/sizeof(ddr3Data[0]));
+ entry++ )
+ {
+ if( ddr3Data[entry].writable
+ && ddr3Data[entry].useBitMask )
+ {
+ theSize = ddr3Data[entry].length;
+ theKeyword = ddr3Data[entry].keyword;
+ TRACFCOMP( g_trac_spd,
+ "testSpdWriteSmall - Using keyword 0x%04x",
+ theKeyword );
+ break;
+ }
+ }
+ }
+ else
+ {
+ fails++;
+ TRACFCOMP( g_trac_spd,
+ "testSpdWriteSmall - memory type: 0x%04x",
+ memType );
+ TS_FAIL( "testSpdWriteSmall - Unsupported Memory Type!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ break;
+ }
+
+ cmds++;
+ if( theKeyword == INVALID_SPD_KEYWORD )
+ {
+ fails++;
+ TS_FAIL( "testSpdWriteSmall - Could not find a keyword to work with!" );
+ break;
+ }
+
+ // Read the data out
+ cmds++;
+ origData = new uint8_t[theSize];
+ err = deviceRead( theTarget,
+ origData,
+ theSize,
+ DEVICE_SPD_ADDRESS( theKeyword ) );
+ if( err )
+ {
+ fails++;
+ TS_FAIL( "testSpdWriteSmall - failed to read keyword!" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ break;
+ }
+
+ // fill test array up with some dummy data
+ testData = new uint8_t[theSize];
+ for( size_t x=0; x<theSize; x++ )
+ {
+ testData[x] = 0x55;
+ }
+
+ // Write the test data
+ cmds++;
+ err = deviceWrite( theTarget,
+ testData,
+ theSize,
+ DEVICE_SPD_ADDRESS( theKeyword ) );
+ if( !err )
+ {
+ fails++;
+ TS_FAIL( "testSpdWriteSmall - Did not get expected error writing data" );
+
+ // Put the original data back to be a good citizen
+ cmds++;
+ err = deviceWrite( theTarget,
+ origData,
+ theSize,
+ DEVICE_SPD_ADDRESS( theKeyword ) );
+ if( err )
+ {
+ fails++;
+ TS_FAIL( "testSpdWriteSmall - Error writing original data back" );
+ }
+
+ break;
+ }
+ else
+ {
+ cmds++;
+ if( err->reasonCode() != VPD::VPD_UNSUPPORTED_WRITE )
+ {
+ fails++;
+ TRACFCOMP( g_trac_spd,
+ "testSpdWriteSmall - RC from write = 0x%04x",
+ err->reasonCode() );
+ TS_FAIL( "testSpdWriteSmall - Did not get VPD_UNSUPPORTED_WRITE error writing data" );
+ }
+
+ delete err;
+ }
+
+ } while( 0 );
+
+ if( NULL != testData )
+ {
+ delete[] testData;
+ testData = NULL;
+ }
+
+ if( NULL != origData )
+ {
+ delete[] origData;
+ origData = NULL;
+ }
+
+ if( cmds == 0 )
+ {
+ TS_FAIL( "testSpdWriteSmall - No tests ran, something is wrong..." );
+ }
+
+ TRACFCOMP( g_trac_spd,
+ "testSpdWriteSmall - %d/%d fails",
+ fails, cmds );
+ }
+ /**
* @brief Test an invalid Keyword to a DIMM target.
*/
void testSpdInvalidKeyword ( void )
@@ -542,7 +751,7 @@ class SPDTest: public CxxTest::TestSuite
err = NULL;
}
} while( 0 );
-
+
TRACFCOMP( g_trac_spd,
"testSpdInvalidWrite - %d/%d fails",
fails, cmds );
OpenPOWER on IntegriCloud