diff options
| author | Dan Crowell <dcrowell@us.ibm.com> | 2013-01-09 12:48:13 -0600 |
|---|---|---|
| committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-02-06 14:18:33 -0600 |
| commit | 7696bed6681d260f46d6878b5201560ed78715af (patch) | |
| tree | 1731e489e444856d0644b17c0b39946988c3f512 /src/usr/hwpf/test | |
| parent | 1ee9befb99004f26dcc81af879ce14907d405ad8 (diff) | |
| download | talos-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/hwpf/test')
| -rw-r--r-- | src/usr/hwpf/test/fapiwinkletest.H | 445 |
1 files changed, 351 insertions, 94 deletions
diff --git a/src/usr/hwpf/test/fapiwinkletest.H b/src/usr/hwpf/test/fapiwinkletest.H index 5ab22fcca..6ada8741f 100644 --- a/src/usr/hwpf/test/fapiwinkletest.H +++ b/src/usr/hwpf/test/fapiwinkletest.H @@ -26,7 +26,6 @@ // set to 1 for doing unit tests, set to 0 for production #define RTC51716 0 -#define RTC39177 0 /** * @file fapiwinkletest.H * @@ -45,6 +44,11 @@ #include <getMvpdRing.H> #include <setMvpdRing.H> +#include <errl/errlmanager.H> +#include <errl/errlentry.H> +#include <devicefw/driverif.H> +#include <trace/interface.H> + // pull in CompressedScanData def from proc_slw_build HWP #include <p8_scan_compression.H> @@ -134,9 +138,14 @@ public: TS_TRACE( "testGetMvpdPdr exit" ); } - // @note: - // ring modifiers are from MVPD #R record, 2012-05-22. - // This will change and the unit test will need to be changed... + // Structure used to save/restore the VPD + typedef struct saveRestoreData_t { + TARGETING::Target* target; + uint8_t* CP00_pdG; + size_t CP00_pdG_size; + uint8_t* CP00_pdR; + size_t CP00_pdR_size; + } saveRestoreData_t; /** * @brief Fetch Repair Rings @@ -149,25 +158,36 @@ public: uint32_t l_ringId = 0; uint32_t l_chipletId = 0; uint32_t l_bufsize = 0x200; -#if RTC51716 // TODO comment out until mvpd test data is fixed. RTC 51716 + errlHndl_t l_errhdl = NULL; + // This data needs to be in sync with the procmvpd.dat file - // the setMvpdFunc tests use the last row, index = 3. The test + // the setMvpdFunc tests use the last row. The test // expects it to be a mid x20 byte ring in the #G keyword struct _testRRstr { - fapi::MvpdRecord record; fapi::MvpdKeyword keyword; uint32_t ringIdval; uint32_t chipletIdval; uint32_t size; + uint32_t rc; } l_ringModifiers[] = { - { MVPD_RECORD_CP00, MVPD_KEYWORD_PDG,0xa4, 0xFF , 0x20 }, //last #G - { MVPD_RECORD_CP00, MVPD_KEYWORD_PDR,0xe0, 0x8 , 0x20 },//first #R - { MVPD_RECORD_CP00, MVPD_KEYWORD_PDR,0xe2, 0x16 ,0x138 },//big #R - { MVPD_RECORD_CP00, MVPD_KEYWORD_PDG,0xa2, 0x8 , 0x20 }, //mid #G + { MVPD_KEYWORD_PDG, 0xa4, 0xFF, 0x20, //last #G + fapi::RC_REPAIR_RING_NOT_FOUND }, + { MVPD_KEYWORD_PDR, 0xe0, 0x08, 0x20, //first #R + FAPI_RC_SUCCESS }, + { MVPD_KEYWORD_PDR, 0xe2, 0x16, 0x20, //big #R + FAPI_RC_SUCCESS }, + { MVPD_KEYWORD_PDG, 0xa2, 0x08, 0x20, //mid #G + FAPI_RC_SUCCESS }, + { MVPD_KEYWORD_PDR, 0xe1, 0x16, 0x20,//big #R + FAPI_RC_SUCCESS }, }; -#endif // RTC 51716 + const size_t VALID_INDEX = 2; + const size_t TEST_INDEX = 4; + TS_TRACE( "testRepairRings entry" ); + std::list<saveRestoreData_t> l_srData; + TARGETING::TargetHandleList l_cpuTargetList; getAllChips(l_cpuTargetList, TYPE_PROC); @@ -183,6 +203,76 @@ public: "target HUID %.8X", TARGETING::get_huid(l_cpu_target)); + //-- Save the entire VPD record to restore later + saveRestoreData_t tmpsave; + tmpsave.target = l_cpu_target; + + // do a read with NULL buffer to get the record size + l_errhdl = deviceRead( l_cpu_target, + NULL, + tmpsave.CP00_pdG_size, + DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00, + MVPD_KEYWORD_PDG ) ); + if( l_errhdl ) + { + TS_FAIL("Error finding size of CP00/#G for %.8X", + TARGETING::get_huid(l_cpu_target)); + errlCommit( l_errhdl, VPD_COMP_ID ); + continue; + } + + // now go get the data + tmpsave.CP00_pdG = new uint8_t[tmpsave.CP00_pdG_size]; + l_errhdl = deviceRead( l_cpu_target, + tmpsave.CP00_pdG, + tmpsave.CP00_pdG_size, + DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00, + MVPD_KEYWORD_PDG ) ); + if( l_errhdl ) + { + TS_FAIL("Error reading CP00/#G from %.8X", + TARGETING::get_huid(l_cpu_target)); + errlCommit( l_errhdl, VPD_COMP_ID ); + delete[] tmpsave.CP00_pdG; + continue; + } + + // do a read with NULL buffer to get the record size + l_errhdl = deviceRead( l_cpu_target, + NULL, + tmpsave.CP00_pdR_size, + DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00, + MVPD_KEYWORD_PDR ) ); + if( l_errhdl ) + { + TS_FAIL("Error finding size of CP00/#R for %.8X", + TARGETING::get_huid(l_cpu_target)); + errlCommit( l_errhdl, VPD_COMP_ID ); + continue; + } + + // now go get the data + tmpsave.CP00_pdR = new uint8_t[tmpsave.CP00_pdR_size]; + l_errhdl = deviceRead( l_cpu_target, + tmpsave.CP00_pdR, + tmpsave.CP00_pdR_size, + DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00, + MVPD_KEYWORD_PDR ) ); + if( l_errhdl ) + { + TS_FAIL("Error reading CP00/#R from %.8X", + TARGETING::get_huid(l_cpu_target)); + errlCommit( l_errhdl, VPD_COMP_ID ); + delete[] tmpsave.CP00_pdR; + continue; + } + + // add to the master list + l_srData.push_back(tmpsave); + + //-- + + // cast OUR type of target to a FAPI type of target. fapi::Target l_fapi_cpu_target( TARGET_TYPE_PROC_CHIP, @@ -190,7 +280,11 @@ public: (const_cast<TARGETING::Target*>(l_cpu_target)) ); // allocate some space to put the record(s) - l_pRingBuf = new uint8_t[ l_bufsize]; + if( l_pRingBuf != NULL ) + { + delete[] l_pRingBuf; + } + l_pRingBuf = new uint8_t[l_bufsize]; // ---------------------------------------------------------------- // Pass in 0 for the ring modifier, should return with "not found" @@ -218,20 +312,17 @@ public: fapi::RC_REPAIR_RING_NOT_FOUND, static_cast<uint32_t>(l_fapirc) ); fapiLogError(l_fapirc); - return; } -#if RTC51716 // TODO comment out until mvpd test data is fixed. RTC 51716 - uint8_t i = 2; // ---------------------------------------------------------------- // Pass in a buffer size that is too small with a valid - // ringId/chipletId, should return with correct length - // and invalid size return code. + // ringId/chipletId, should return error with correct length + // and invalid size return code.. // ---------------------------------------------------------------- TS_TRACE( "testRepairRings: pass buffer too small %d ", i ); l_ringBufsize = 0x0; - l_ringId = l_ringModifiers[i].ringIdval; - l_chipletId = l_ringModifiers[i].chipletIdval; + l_ringId = l_ringModifiers[VALID_INDEX].ringIdval; + l_chipletId = l_ringModifiers[VALID_INDEX].chipletIdval; l_fapirc = getMvpdRing( MVPD_RECORD_CP00, MVPD_KEYWORD_PDR, l_fapi_cpu_target, @@ -246,28 +337,29 @@ public: if ( l_fapirc != fapi::RC_REPAIR_RING_INVALID_SIZE ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL("testRepairRings: expect invalid size FAIL: 0x%x, 0x%x", + TS_FAIL("testRepairRings: expect invalid size FAIL: exp=0x%x, act=0x%x, ring=0x%X", fapi::RC_REPAIR_RING_INVALID_SIZE, - static_cast<uint32_t>(l_fapirc)); + static_cast<uint32_t>(l_fapirc), + l_ringId); fapiLogError(l_fapirc); - return; } - if ( l_ringBufsize != l_ringModifiers[i].size ) + else if ( l_ringBufsize != l_ringModifiers[VALID_INDEX].size ) { - TS_FAIL( "testRepairRings: size mismatch FAIL: 0x%x, 0x%x", - l_ringModifiers[i].size, + TS_FAIL( "testRepairRings: size mismatch FAIL1 on ring 0x%X: exp=0x%x, act=0x%x", + l_ringId, + l_ringModifiers[VALID_INDEX].size, l_ringBufsize ); - return; } + // ---------------------------------------------------------------- // Pass in a NULL pointer with a valid ringId/chipletId, should // return with correct length and successful return code. // ---------------------------------------------------------------- TS_TRACE( "testRepairRings: get size of ring %d ", i ); l_ringBufsize = 0x0; - l_ringId = l_ringModifiers[i].ringIdval; - l_chipletId = l_ringModifiers[i].chipletIdval; + l_ringId = l_ringModifiers[VALID_INDEX].ringIdval; + l_chipletId = l_ringModifiers[VALID_INDEX].chipletIdval; l_fapirc = getMvpdRing( MVPD_RECORD_CP00, MVPD_KEYWORD_PDR, l_fapi_cpu_target, @@ -287,14 +379,13 @@ public: static_cast<uint32_t>(l_fapirc)); fapiLogError(l_fapirc); - return; } - if ( l_ringBufsize != l_ringModifiers[i].size ) + else if ( l_ringBufsize != l_ringModifiers[VALID_INDEX].size ) { - TS_FAIL( "testRepairRings: size mismatch FAIL: 0x%x, 0x%x", - l_ringModifiers[i].size, + TS_FAIL( "testRepairRings: size mismatch FAIL2 on ring 0x%X: exp=0x%x, act=0x%x", + l_ringId, + l_ringModifiers[VALID_INDEX].size, l_ringBufsize ); - return; } // ---------------------------------------------------------------- @@ -302,12 +393,13 @@ public: // ---------------------------------------------------------------- const uint32_t numRings = sizeof(l_ringModifiers)/sizeof(l_ringModifiers[0]); - for (i=0;i<numRings;i++) { + for (size_t i=0;i<numRings;i++) + { TS_TRACE( "testRepairRings: get ring %d", i ); l_ringBufsize = l_bufsize; l_ringId = l_ringModifiers[i].ringIdval; l_chipletId = l_ringModifiers[i].chipletIdval; - l_fapirc = getMvpdRing( l_ringModifiers[i].record, + l_fapirc = getMvpdRing( MVPD_RECORD_CP00, l_ringModifiers[i].keyword, l_fapi_cpu_target, l_chipletId, @@ -317,21 +409,29 @@ public: TS_TRACE("testRepairRings ringId=0x%x chipletId=0x%x size=0x%x", l_ringId, l_chipletId, l_ringBufsize ); - if ( l_fapirc ) + if ( l_fapirc != l_ringModifiers[i].rc ) { // note: uint32_t below is an _operator_ of fapi::ReturnCode - TS_FAIL( "testRepairRings: getMvpdRing rc FAIL: 0x%x, 0x%x", - fapi::FAPI_RC_SUCCESS, - static_cast<uint32_t>(l_fapirc) ); + TS_FAIL( "testRepairRings: getMvpdRing rc FAIL 1: rc=0x%x, ring=0x%X, chiplet=0x%X, i=%d", + static_cast<uint32_t>(l_fapirc), + l_ringId, + l_chipletId, + i ); fapiLogError(l_fapirc); - return; + continue; } + else if( l_fapirc != fapi::FAPI_RC_SUCCESS ) + { + // not an error, but the next check isn't valid + continue; + } + if ( l_ringBufsize != l_ringModifiers[i].size ) { - TS_FAIL( "testRepairRings: size mismatch FAIL: 0x%x, 0x%x", - l_ringModifiers[i].size, - l_ringBufsize ); - return; + TS_FAIL( "testRepairRings: size mismatch FAIL3 on ring %X: exp=0x%x, act=0x%x", + l_ringId, + l_ringModifiers[i].size, + l_ringBufsize ); } // Dump ring buffer here. @@ -339,25 +439,20 @@ public: l_pRingBuf, l_ringBufsize ); } -#endif // RTC 51716 -#if RTC39177 // TODO comment out til mvpd dd supports write. RTC 39177 // ---------------------------------------------------------------- - // update the data. - // TODO write different data, once the DD is written(story 39177) - // read it back to verify, then put the original data back. - // for now, there is a debug byte dump in mvpdRingFunc to - // manually verify in unit test + // write different data, read it back to verify, then put the + // original data back. // ---------------------------------------------------------------- uint32_t l_offset =0; uint8_t l_data = 0; uint8_t *l_pData = NULL; - i = 3; // use data from last fetch test case. - TS_TRACE( "testRepairRings: update in place ring %d", i ); - l_ringId = l_ringModifiers[i].ringIdval; - l_chipletId = l_ringModifiers[i].chipletIdval; - l_ringBufsize = l_ringModifiers[i].size; + // use data from last fetch test case. + TS_TRACE( "testRepairRings: update in place ring %d", TEST_INDEX ); + l_ringId = l_ringModifiers[TEST_INDEX].ringIdval; + l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval; + l_ringBufsize = l_ringModifiers[TEST_INDEX].size; // put in recognizable data for the debug data dump l_pData = l_pRingBuf+sizeof(CompressedScanData); @@ -369,8 +464,8 @@ public: TRACDBIN( g_trac_test, "testRepairRings: updated ring data:", l_pRingBuf, l_ringBufsize ); - l_fapirc = setMvpdRing( l_ringModifiers[i].record, - l_ringModifiers[i].keyword, + l_fapirc = setMvpdRing( MVPD_RECORD_CP00, + l_ringModifiers[TEST_INDEX].keyword, l_fapi_cpu_target, l_chipletId, l_ringId, @@ -380,19 +475,17 @@ public: if ( l_fapirc != fapi::FAPI_RC_SUCCESS ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL( "testRepairRings: setMvpdRing rc FAIL: 0x%x, 0x%x", + TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 1: exp=0x%x, rc=0x%x", fapi::FAPI_RC_SUCCESS, - static_cast<uint32_t>(l_fapirc) ); - + static_cast<uint32_t>(l_fapirc) ); fapiLogError(l_fapirc); - return; } // ---------------------------------------------------------------- // write back a smaller ring to cause a shift left in the record // ---------------------------------------------------------------- - TS_TRACE( "testRepairRings: shrink a ring %d", i ); - l_ringBufsize = l_ringModifiers[i].size-4; + TS_TRACE( "testRepairRings: shrink a ring %d", TEST_INDEX ); + l_ringBufsize = l_ringModifiers[TEST_INDEX].size-4; reinterpret_cast<CompressedScanData *>(l_pRingBuf)-> iv_size = l_ringBufsize; @@ -406,8 +499,8 @@ public: TRACDBIN( g_trac_test, "testRepairRings: updated ring data:", l_pRingBuf, l_ringBufsize ); - l_fapirc = setMvpdRing( l_ringModifiers[i].record, - l_ringModifiers[i].keyword, + l_fapirc = setMvpdRing( MVPD_RECORD_CP00, + l_ringModifiers[TEST_INDEX].keyword, l_fapi_cpu_target, l_chipletId, l_ringId, @@ -417,19 +510,18 @@ public: if ( l_fapirc != fapi::FAPI_RC_SUCCESS ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL( "testRepairRings: setMvpdRing rc FAIL: 0x%x, 0x%x", + TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 2: exp=0x%x, rc=0x%x", fapi::FAPI_RC_SUCCESS, static_cast<uint32_t>(l_fapirc) ); fapiLogError(l_fapirc); - return; } // ---------------------------------------------------------------- // write back a larger ring to cause a shift right in the record // ---------------------------------------------------------------- - TS_TRACE( "testRepairRings: grow a ring %d", i ); - l_ringBufsize = l_ringModifiers[i].size+16; + TS_TRACE( "testRepairRings: grow a ring %d", TEST_INDEX ); + l_ringBufsize = l_ringModifiers[TEST_INDEX].size+16; reinterpret_cast<CompressedScanData *>(l_pRingBuf)-> iv_size = l_ringBufsize; @@ -443,8 +535,8 @@ public: TRACDBIN( g_trac_test, "testRepairRings: updated ring data:", l_pRingBuf, l_ringBufsize ); - l_fapirc = setMvpdRing( l_ringModifiers[i].record, - l_ringModifiers[i].keyword, + l_fapirc = setMvpdRing( MVPD_RECORD_CP00, + l_ringModifiers[TEST_INDEX].keyword, l_fapi_cpu_target, l_chipletId, l_ringId, @@ -454,12 +546,11 @@ public: if ( l_fapirc != fapi::FAPI_RC_SUCCESS ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL( "testRepairRings: setMvpdRing rc FAIL: 0x%x, 0x%x", + TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 3: exp=0x%x, rc=0x%x", fapi::FAPI_RC_SUCCESS, static_cast<uint32_t>(l_fapirc) ); fapiLogError(l_fapirc); - return; } // ---------------------------------------------------------------- @@ -468,7 +559,7 @@ public: TS_TRACE( "testRepairRings: append a ring" ); l_ringId = 0x77; l_chipletId = 0x88; - l_ringBufsize = l_ringModifiers[i].size; + l_ringBufsize = l_ringModifiers[TEST_INDEX].size; reinterpret_cast<CompressedScanData *>(l_pRingBuf)-> iv_size = l_ringBufsize; reinterpret_cast<CompressedScanData *>(l_pRingBuf)-> @@ -486,8 +577,8 @@ public: TRACDBIN( g_trac_test, "testRepairRings: updated ring data:", l_pRingBuf, l_ringBufsize ); - l_fapirc = setMvpdRing( l_ringModifiers[i].record, - l_ringModifiers[i].keyword, + l_fapirc = setMvpdRing( MVPD_RECORD_CP00, + l_ringModifiers[TEST_INDEX].keyword, l_fapi_cpu_target, l_chipletId, l_ringId, @@ -497,14 +588,88 @@ public: if ( l_fapirc != fapi::FAPI_RC_SUCCESS ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL( "testRepairRings: setMvpdRing rc FAIL: 0x%x, 0x%x", + TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 4: exp=0x%x, rc=0x%x", fapi::FAPI_RC_SUCCESS, static_cast<uint32_t>(l_fapirc) ); fapiLogError(l_fapirc); - return; } + // read back data to prove the writes worked + l_ringId = l_ringModifiers[TEST_INDEX].ringIdval; + l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval; + l_ringBufsize = l_ringModifiers[TEST_INDEX].size+16; + l_fapirc = getMvpdRing( MVPD_RECORD_CP00, + l_ringModifiers[TEST_INDEX].keyword, + l_fapi_cpu_target, + l_chipletId, + l_ringId, + l_pRingBuf, + l_ringBufsize ); + + if ( l_fapirc != fapi::FAPI_RC_SUCCESS ) + { + TS_FAIL( "testRepairRings: getMvpdRing rc FAIL 2: 0x%x, 0x%x", + fapi::FAPI_RC_SUCCESS, + static_cast<uint32_t>(l_fapirc) ); + fapiLogError(l_fapirc); + } + else + { + l_pData = l_pRingBuf+sizeof(CompressedScanData); + for( l_offset = 0,l_data=0x30; + l_offset < l_ringBufsize-sizeof(CompressedScanData); + l_offset++) + { + if( l_pData[l_offset] != l_data++ ) + { + TS_FAIL("Mismatch after write on ring %X", + l_ringId); + TRACFBIN(g_trac_test, + "ringdata=", + l_pRingBuf,l_ringBufsize); + } + } + } + + // read back data to prove the writes worked + l_ringId = 0x77; + l_chipletId = 0x88; + l_ringBufsize = l_ringModifiers[TEST_INDEX].size; + l_fapirc = getMvpdRing( MVPD_RECORD_CP00, + l_ringModifiers[TEST_INDEX].keyword, + l_fapi_cpu_target, + l_chipletId, + l_ringId, + l_pRingBuf, + l_ringBufsize ); + + if ( l_fapirc != fapi::FAPI_RC_SUCCESS ) + { + TS_FAIL( "testRepairRings: getMvpdRing rc FAIL 3: 0x%x, 0x%x", + fapi::FAPI_RC_SUCCESS, + static_cast<uint32_t>(l_fapirc) ); + fapiLogError(l_fapirc); + } + else + { + l_pData = l_pRingBuf+sizeof(CompressedScanData); + for (l_offset = 0,l_data=0x50; + l_offset < l_ringBufsize-sizeof(CompressedScanData); + l_offset++) + { + if( l_pData[l_offset] != l_data++ ) + { + TS_FAIL("Mismatch after write on ring %X", + l_ringId); + TRACFBIN(g_trac_test, + "ringdata=", + l_pRingBuf,l_ringBufsize); + } + } + } + + // ---------------------------------------------------------------- // Pass in a buffer size that does not match the exact size // of the ringId/chipletId, should return with correct length @@ -515,8 +680,8 @@ public: l_chipletId, l_ringBufsize ); l_ringBufsize = l_bufsize; - l_ringId = l_ringModifiers[i].ringIdval; - l_chipletId = l_ringModifiers[i].chipletIdval; + l_ringId = l_ringModifiers[TEST_INDEX].ringIdval; + l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval; l_fapirc = setMvpdRing( MVPD_RECORD_CP00, MVPD_KEYWORD_PDR, l_fapi_cpu_target, @@ -528,19 +693,19 @@ public: if ( l_fapirc != fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL("testRepairRings:invalid ring size rc FAIL: 0x%x, 0x%x", + TS_FAIL("testRepairRings:invalid ring size rc FAIL: exp=0x%x, act=0x%x", fapi::RC_REPAIR_RING_INVALID_SIZE, static_cast<uint32_t>(l_fapirc)); fapiLogError(l_fapirc); - return; } + // ---------------------------------------------------------------- // Pass in 0 for the ring modifier, should return with "not found" // error // ---------------------------------------------------------------- TS_TRACE( "testRepairRings: pass in invalid ringId" ); - l_ringBufsize = l_ringModifiers[i].size; + l_ringBufsize = l_ringModifiers[TEST_INDEX].size; l_ringId = 0; // ringId l_chipletId = 0; // chipletId l_fapirc = setMvpdRing( MVPD_RECORD_CP00, @@ -558,20 +723,19 @@ public: if ( l_fapirc != fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL( "testRepairRings: rc FAIL: 0x%x, 0x%x", + TS_FAIL( "testRepairRings: rc FAIL: exp=0x%x, act=0x%x", fapi::RC_REPAIR_RING_NOT_FOUND, static_cast<uint32_t>(l_fapirc) ); fapiLogError(l_fapirc); - return; } // ---------------------------------------------------------------- // Pass in a NULL pointer with a valid ringId/chipletId, should // return with correct length and successful return code. // ---------------------------------------------------------------- - TS_TRACE( "testRepairRings: get size of ring(from set) %d ", i ); + TS_TRACE( "testRepairRings: get size of ring(from set) %d ", TEST_INDEX ); l_ringBufsize = 0x0; - l_ringId = l_ringModifiers[i].ringIdval; - l_chipletId = l_ringModifiers[i].chipletIdval; + l_ringId = l_ringModifiers[TEST_INDEX].ringIdval; + l_chipletId = l_ringModifiers[TEST_INDEX].chipletIdval; l_fapirc = setMvpdRing( MVPD_RECORD_CP00, MVPD_KEYWORD_PDR, l_fapi_cpu_target, @@ -587,17 +751,110 @@ public: if ( l_fapirc != fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER ) { // note: "uint32_t" below is an _operator_ of fapi::ReturnCode - TS_FAIL( "testRepairRings: setMvpdRing rc FAIL: 0x%x, 0x%x", + TS_FAIL( "testRepairRings: setMvpdRing rc FAIL 5: exp=0x%x, act=0x%x", fapi::RC_MVPD_RING_FUNC_INVALID_PARAMETER, static_cast<uint32_t>(l_fapirc)); fapiLogError(l_fapirc); - return; } -#endif // RTC 39177 - // delete allocated space + + // ---------------------------------------------------------------- + // Pass in an invalid chiplet id with a valid ring, should fail + // ---------------------------------------------------------------- + l_ringBufsize = l_bufsize; + l_ringId = l_ringModifiers[TEST_INDEX].ringIdval; + l_chipletId = 0x22; + TS_TRACE("testRepairRing:invalid chiplet ring=0x%X chiplet=0x%X size=0x%x", + l_ringId, + l_chipletId, + l_ringBufsize ); + l_fapirc = getMvpdRing( MVPD_RECORD_CP00, + MVPD_KEYWORD_PDR, + l_fapi_cpu_target, + l_chipletId, + l_ringId, + l_pRingBuf, + l_ringBufsize ); + + if ( l_fapirc != fapi::RC_REPAIR_RING_NOT_FOUND ) + { + // note: "uint32_t" below is an _operator_ of fapi::ReturnCode + TS_FAIL("testRepairRings:invalid chipletid rc FAIL: exp=0x%x, act=0x%x", + fapi::RC_REPAIR_RING_NOT_FOUND, + static_cast<uint32_t>(l_fapirc)); + + fapiLogError(l_fapirc); + } + + } + + //-- Put the original data back into the vpd + for( std::list<saveRestoreData_t>::iterator sv = l_srData.begin(); + sv != l_srData.end(); + ++sv ) + { + if( sv->target == NULL ) + { + continue; + } + + if( sv->CP00_pdG != NULL ) + { + l_errhdl = deviceWrite( sv->target, + sv->CP00_pdG, + sv->CP00_pdG_size, + DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00, + MVPD_KEYWORD_PDG ) ); + if( l_errhdl ) + { + TS_FAIL("Error restoring CP00/#G to %.8X", + TARGETING::get_huid(sv->target)); + errlCommit( l_errhdl, VPD_COMP_ID ); + } + delete[] sv->CP00_pdG; + sv->CP00_pdG = NULL; + } + + if( sv->CP00_pdR != NULL ) + { + l_errhdl = deviceWrite( sv->target, + sv->CP00_pdR, + sv->CP00_pdR_size, + DEVICE_MVPD_ADDRESS( MVPD_RECORD_CP00, + MVPD_KEYWORD_PDR ) ); + if( l_errhdl ) + { + TS_FAIL("Error restoring CP00/#R to %.8X", + TARGETING::get_huid(sv->target)); + errlCommit( l_errhdl, VPD_COMP_ID ); + } + delete[] sv->CP00_pdR; + sv->CP00_pdR = NULL; + } + } + //-- + + // delete allocated space + if( l_pRingBuf ) + { delete[] l_pRingBuf; } + for( std::list<saveRestoreData_t>::iterator sv = l_srData.begin(); + sv != l_srData.end(); + ++sv ) + { + if( sv->CP00_pdG != NULL ) + { + delete[] sv->CP00_pdG; + sv->CP00_pdG = NULL; + } + if( sv->CP00_pdR != NULL ) + { + delete[] sv->CP00_pdR; + sv->CP00_pdR = NULL; + } + } + TS_TRACE( "testRepairRings exit" ); } |

