summaryrefslogtreecommitdiffstats
path: root/src/usr/pnor/test
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2012-02-07 09:49:21 -0600
committerDaniel M. Crowell <dcrowell@us.ibm.com>2012-02-28 13:06:28 -0600
commitca733abd8cc5ff4e05e1bf958239c9b06710632c (patch)
tree34c3f527282e31cf3b9ba8bc46648a4f84762dad /src/usr/pnor/test
parentdf05b815a80fc2475aa0396ae140903beaa9dde1 (diff)
downloadtalos-hostboot-ca733abd8cc5ff4e05e1bf958239c9b06710632c.tar.gz
talos-hostboot-ca733abd8cc5ff4e05e1bf958239c9b06710632c.zip
RTC Story 36901 - Use LPC Memory
This includes a hack to allow access to our fake PNOR data via the ECCB scom registers. This hack will be removed once Simics provides a real ECCB model. Changes to INTR testcase were needed due to bugs exposed by the timing changes when enabling this new code. Note that the default operating mode will remain LPC_MEM because the current version of the ECCB model causes the IPL to take close to 10 minutes to complete. Change-Id: Icc236bffd52ba8214ec920f9a496adec138e54d9 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/692 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/test')
-rw-r--r--src/usr/pnor/test/pnorddtest.H541
1 files changed, 525 insertions, 16 deletions
diff --git a/src/usr/pnor/test/pnorddtest.H b/src/usr/pnor/test/pnorddtest.H
index eb874904a..dd7034889 100644
--- a/src/usr/pnor/test/pnorddtest.H
+++ b/src/usr/pnor/test/pnorddtest.H
@@ -36,11 +36,20 @@
#include <devicefw/userif.H>
#include <kernel/console.H>
#include <sys/time.h>
+#include "../pnordd.H"
+#include <list>
+#include <targeting/util.H>
-#define BASE_SCRATCH_SPACE 2*1024*1024+1024*512 //2.5MB offset in fake PNOR
+#define BASE_SCRATCH_SPACE (2*1024*1024+1024*512) //2.5MB offset in fake PNOR
extern trace_desc_t* g_trac_pnor;
-using namespace TARGETING;
+
+/*
+ Note - Some of these tests will run against non-singleton instances of the
+ PNOR DD to allow full testing of the different operating modes while leaving
+ the default mode in place for performance reasons. That will change when we
+ get to a complete PNOR model in sim or hardware.
+ */
class PnorDdTest : public CxxTest::TestSuite
{
@@ -53,14 +62,12 @@ class PnorDdTest : public CxxTest::TestSuite
*/
void test_readwrite(void)
{
- //@TODO: make this table driven so it can test more values
- //@TODO: Add some more interesting tests
-
- TARGETING::Target* l_testTarget = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
+ TARGETING::Target* l_testTarget =
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
size_t l_size = sizeof(uint64_t);
errlHndl_t l_err = NULL;
uint64_t fails = 0;
- uint64_t total = 8;
+ uint64_t total = 0;
do{
TS_TRACE("PnorDdTest::test_readwrite: starting");
@@ -73,12 +80,14 @@ class PnorDdTest : public CxxTest::TestSuite
&l_writeData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD write 1: deviceWrite() failed! Error committed.");
errlCommit(l_err,PNOR_COMP_ID);
fails++;
}
+ total++;
if(l_size != sizeof(uint64_t))
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD write 1: Write length not expected value. Addr: 0x%llx, Exp: %d, Act: %d", l_address,
@@ -94,12 +103,14 @@ class PnorDdTest : public CxxTest::TestSuite
&l_writeData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD write 2: deviceWrite() failed! Error committed.");
errlCommit(l_err,PNOR_COMP_ID);
fails++;
}
+ total++;
if(l_size != sizeof(uint64_t))
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD write 2: Write length not expected value. Addr: 0x%llx, Exp: %d, Act: %d", l_address,
@@ -115,18 +126,21 @@ class PnorDdTest : public CxxTest::TestSuite
&l_readData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 1: deviceRead() failed! Error committed.");
errlCommit(l_err,PNOR_COMP_ID);
fails++;
}
+ total++;
if(l_readData != 0x12345678FEEDB0B0)
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 1: Read data not expected value. Addr: 0x%llx, ExpData: 0x12345678FEEDB0B0, ActData: 0x%llx",
l_address, (long long unsigned)l_readData);
fails++;
}
+ total++;
if(l_size != sizeof(uint64_t))
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 1: Read length not expected value. Addr: 0x%llx, Exp: %d, Act: %d", l_address,
@@ -141,20 +155,21 @@ class PnorDdTest : public CxxTest::TestSuite
&l_readData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 2: deviceRead() failed! Error committed.");
errlCommit(l_err,PNOR_COMP_ID);
fails++;
- break;
}
+ total++;
if(l_readData != 0xFEEDBEEF000ABCDE)
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 2: Read data not expected value. Addr: 0x%llx, ExpData: 0xFEEDBEEF000ABCDE, ActData: 0x%llx",
l_address, (long long unsigned)l_readData );
fails++;
- break;
}
+ total++;
if(l_size != sizeof(uint64_t))
{
TS_FAIL("PnorDdTest::test_readwrite: PNORDD read 2: Read length not expected value. Addr: 0x%llx, Exp: %d, Act: %d", l_address,
@@ -174,11 +189,12 @@ class PnorDdTest : public CxxTest::TestSuite
*/
void test_smartwrite(void)
{
- TARGETING::Target* l_testTarget = MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
+ TARGETING::Target* l_testTarget =
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
size_t l_size = sizeof(uint64_t);
errlHndl_t l_err = NULL;
uint64_t fails = 0;
- uint64_t total = 8;
+ uint64_t total = 0;
do{
TS_TRACE("PnorDdTest::test_smartwrite: starting");
@@ -191,6 +207,7 @@ class PnorDdTest : public CxxTest::TestSuite
&l_writeData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_smartwrite: PNORDD write 1: deviceWrite() failed! Error committed.");
@@ -205,6 +222,7 @@ class PnorDdTest : public CxxTest::TestSuite
&l_writeData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_smartwrite: PNORDD write 2: deviceWrite() failed! Error committed.");
@@ -219,6 +237,7 @@ class PnorDdTest : public CxxTest::TestSuite
&l_writeData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address+sizeof(uint64_t)));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_smartwrite: PNORDD write 3: deviceWrite() failed! Error committed.");
@@ -233,6 +252,7 @@ class PnorDdTest : public CxxTest::TestSuite
&l_writeData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_smartwrite: PNORDD write 4: deviceWrite() failed! Error committed.");
@@ -240,19 +260,21 @@ class PnorDdTest : public CxxTest::TestSuite
fails++;
}
- // Perform PnorDD read
+ // Perform PnorDD read of the data we just wrote
uint64_t l_readData = 0;
l_size = sizeof(uint64_t);
l_err = deviceRead(l_testTarget,
&l_readData,
l_size,
DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
if (l_err)
{
TS_FAIL("PnorDdTest::test_smartwrite: PNORDD read: deviceRead() failed! Error committed.");
errlCommit(l_err,PNOR_COMP_ID);
fails++;
}
+ total++;
if(l_readData != l_writeData)
{
TS_FAIL("PnorDdTest::test_smartwrite: PNORDD read: Read data not expected value. Addr: 0x%llx, ExpData: 0x%llx, ActData: 0x%llx",
@@ -260,11 +282,499 @@ class PnorDdTest : public CxxTest::TestSuite
fails++;
}
+ // Perform PnorDD read of the data after what we just wrote
+ // verifies that we restored the rest of the block
+ l_readData = 0;
+ l_size = sizeof(uint64_t);
+ l_err = deviceRead(l_testTarget,
+ &l_readData,
+ l_size,
+ DEVICE_PNOR_ADDRESS(0, l_address+sizeof(uint64_t)));
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite: PNORDD read: deviceRead() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_readData != 0x1234567887654321)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite: PNORDD read: Read data not expected value. Addr: 0x%llx, ExpData: 0x%llx, ActData: 0x%llx",
+ l_address, 0x1234567887654321, l_readData);
+ fails++;
+ }
+
+ }while(0);
+
+ TRACFCOMP(g_trac_pnor, "PnorDdTest::test_smartwrite> %d/%d fails", fails, total );
+ }
+
+ /**
+ * @brief PNOR DD Cross-Block testcase
+ * Access some data that crosses an erase block boundary
+ */
+ void test_crossblock(void)
+ {
+ TARGETING::Target* l_testTarget =
+ TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL;
+ size_t l_size = sizeof(uint64_t);
+ errlHndl_t l_err = NULL;
+ uint64_t fails = 0;
+ uint64_t total = 0;
+
+ do{
+ TS_TRACE("PnorDdTest::test_crossblock: starting");
+
+ // Find the nearest erase-block (4K) boundary
+ uint64_t l_boundary = (BASE_SCRATCH_SPACE+4096)
+ - (BASE_SCRATCH_SPACE%4096);
+ uint64_t l_address = 0;
+
+ // Perform PnorDD Write 1 - write through boundary
+ l_address = l_boundary - sizeof(uint32_t);
+ uint64_t l_writeData = 0x6666666699999999;
+ l_size = sizeof(uint64_t);
+ l_err = deviceWrite(l_testTarget,
+ &l_writeData,
+ l_size,
+ DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_crossblock: PNORDD write 1: deviceWrite() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+
+ // Perform PnorDD Read 1 - verify previous write
+ l_address = l_boundary - sizeof(uint32_t);
+ uint64_t l_readData = 0x0;
+ l_size = sizeof(uint64_t);
+ l_err = deviceRead(l_testTarget,
+ &l_readData,
+ l_size,
+ DEVICE_PNOR_ADDRESS(0, l_address));
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_crossblock: PNORDD Read 1: deviceRead() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_readData != l_writeData)
+ {
+ TS_FAIL("PnorDdTest::test_crossblock: PNORDD read: Read data not expected value. Addr: 0x%.llx, ExpData: 0x%.llx, ActData: 0x%llx", l_address, l_writeData, l_readData);
+ fails++;
+ }
+
+ }while(0);
+
+ TRACFCOMP(g_trac_pnor, "PnorDdTest::test_crossblock> %d/%d fails", fails, total );
+ }
+
+ /**
+ * @brief PNOR DD readWriteTest modes
+ * Same as test_readwrite but forcing the use of all supported modes
+ */
+ void test_readwrite_modes(void)
+ {
+ PnorDD* pnordd = NULL;
+ size_t l_size = sizeof(uint64_t);
+ errlHndl_t l_err = NULL;
+ uint64_t fails = 0;
+ uint64_t total = 0;
+
+ do{
+ TS_TRACE("PnorDdTest::test_readwrite_modes: starting");
+
+ // list of all modes to test
+ std::list<PnorDD::PnorMode_t> supported_modes;
+ supported_modes.push_back(PnorDD::MODEL_MEMCPY);
+ supported_modes.push_back(PnorDD::MODEL_LPC_MEM);
+ if( !TARGETING::is_vpo() )
+ {
+ supported_modes.push_back(PnorDD::MODEL_FLAT_ECCB);
+ }
+
+ uint64_t scratch_space = BASE_SCRATCH_SPACE;
+
+ // loop through all of the supported modes
+ for( std::list<PnorDD::PnorMode_t>::iterator m
+ = supported_modes.begin();
+ m != supported_modes.end();
+ ++m )
+ {
+ scratch_space += 0x100;
+
+ if( pnordd )
+ {
+ delete pnordd;
+ }
+ pnordd = new PnorDD(*m);
+
+ // Perform PnorDD Write 1
+ uint64_t l_address = scratch_space;
+ uint64_t l_writeData = 0x12345678FEEDB0B0;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->writeFlash(&l_writeData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD write 1: writeFlash() failed! Error committed. mode=%d",
+ *m);
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_size != sizeof(uint64_t))
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD write 1: Write length not expected value. Addr: 0x%llx, Exp: %d, Act: %d, mode=%d",
+ l_address, sizeof(uint64_t), l_size, *m);
+ fails++;
+ }
+
+ // Perform PnorDD Write 2
+ l_address = scratch_space+0x08;
+ l_writeData = 0xFEEDBEEF000ABCDE;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->writeFlash(&l_writeData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD write 2: writeFlash() failed! Error committed. mode=%d",
+ *m);
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_size != sizeof(uint64_t))
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD write 2: Write length not expected value. Addr: 0x%llx, Exp: %d, Act: %d, mode=%d",
+ l_address, sizeof(uint64_t), l_size, *m);
+ fails++;
+ }
+
+ // Perform PnorDD read 1
+ l_address = scratch_space;
+ uint64_t l_readData = 0;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->readFlash(&l_readData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD read 1: readFlash() failed! Error committed. mode=%d",
+ *m);
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_readData != 0x12345678FEEDB0B0)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD read 1: Read data not expected value. Addr: 0x%llx, ExpData: 0x12345678FEEDB0B0, ActData: 0x%llx, mode=%d",
+ l_address, (long long unsigned)l_readData, *m);
+ fails++;
+ }
+ total++;
+ if(l_size != sizeof(uint64_t))
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD read 1: Read length not expected value. Addr: 0x%llx, Exp: %d, Act: %d, mode=%d",
+ l_address, sizeof(uint64_t), l_size, *m);
+ fails++;
+ }
+
+ // Perform PnorDD read 2
+ l_address = scratch_space+0x08;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->readFlash(&l_readData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD read 2: readFlash() failed! Error committed. mode=%d",
+ *m);
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_readData != 0xFEEDBEEF000ABCDE)
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD read 2: Read data not expected value. Addr: 0x%llx, ExpData: 0xFEEDBEEF000ABCDE, ActData: 0x%llx, mode=%d",
+ l_address, (long long unsigned)l_readData, *m);
+ fails++;
+ }
+ total++;
+ if(l_size != sizeof(uint64_t))
+ {
+ TS_FAIL("PnorDdTest::test_readwrite_modes: PNORDD read 2: Read length not expected value. Addr: 0x%llx, Exp: %d, Act: %d, mode=%d",
+ l_address, sizeof(uint64_t), l_size, *m);
+ fails++;
+ }
+ }
+
+ }while(0);
+
+ TRACFCOMP(g_trac_pnor, "PnorDdTest::test_readwrite_modes> %d/%d fails", fails, total );
+
+ if( pnordd )
+ {
+ delete pnordd;
+ }
+ }
+
+ /**
+ * @brief PNOR DD smart write/erase test
+ * Same as test_smartwrite but forcing the use of all supported modes
+ */
+ void test_smartwrite_modes(void)
+ {
+ PnorDD* pnordd = NULL;
+ size_t l_size = sizeof(uint64_t);
+ errlHndl_t l_err = NULL;
+ uint64_t fails = 0;
+ uint64_t total = 0;
+
+ do{
+ TS_TRACE("PnorDdTest::test_smartwrite_modes: starting");
+
+ // list of all modes to test
+ std::list<PnorDD::PnorMode_t> supported_modes;
+ supported_modes.push_back(PnorDD::MODEL_MEMCPY);
+ supported_modes.push_back(PnorDD::MODEL_LPC_MEM);
+ if( !TARGETING::is_vpo() )
+ {
+ supported_modes.push_back(PnorDD::MODEL_FLAT_ECCB);
+ }
+
+ uint64_t scratch_space = BASE_SCRATCH_SPACE;
+
+ // loop through all of the supported modes
+ for( std::list<PnorDD::PnorMode_t>::iterator m
+ = supported_modes.begin();
+ m != supported_modes.end();
+ ++m )
+ {
+ scratch_space += 0x100;
+
+ if( pnordd )
+ {
+ delete pnordd;
+ }
+ pnordd = new PnorDD(*m);
+
+ // Perform PnorDD Write 1
+ uint64_t l_address = scratch_space+0x20;
+ uint64_t l_writeData = 0xAAAAAAAA55555555;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->writeFlash(&l_writeData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD write 1: writeFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+
+ // Perform PnorDD Write 2 - no erase
+ l_writeData = 0xAAAAAAAAFFFFFFFF;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->writeFlash(&l_writeData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD write 2: writeFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+
+ // Perform PnorDD Write 3 - put some words after the next write
+ l_writeData = 0x1234567887654321;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->writeFlash(&l_writeData,
+ l_size,
+ l_address+sizeof(uint64_t));
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD write 3: writeFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+
+ // Perform PnorDD Write 4 - requires erase
+ l_writeData = 0x8888888811111111;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->writeFlash(&l_writeData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD write 4: writeFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+
+ // Perform PnorDD read of the data we just wrote
+ uint64_t l_readData = 0;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->readFlash(&l_readData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD read: readFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_readData != l_writeData)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD read: Read data not expected value. Addr: 0x%llx, ExpData: 0x%llx, ActData: 0x%llx",
+ l_address, l_writeData, l_readData);
+ fails++;
+ }
+
+ // Perform PnorDD read of the data after what we just wrote
+ // verifies that we restored the rest of the block
+ l_readData = 0;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->readFlash(&l_readData,
+ l_size,
+ l_address+sizeof(uint64_t));
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD read: readFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_readData != 0x1234567887654321)
+ {
+ TS_FAIL("PnorDdTest::test_smartwrite_modes: PNORDD read: Read data not expected value. Addr: 0x%llx, ExpData: 0x%llx, ActData: 0x%llx",
+ l_address, 0x1234567887654321, l_readData);
+ fails++;
+ }
+ }
+
}while(0);
+ if( pnordd )
+ {
+ delete pnordd;
+ }
+
TRACFCOMP(g_trac_pnor, "PnorDdTest::test_smartwrite> %d/%d fails", fails, total );
}
-
+
+ /**
+ * @brief PNOR DD Cross-Block testcase
+ * Same as test_crossblock but forcing the use of all supported modes
+ */
+ void test_crossblock_modes(void)
+ {
+ PnorDD* pnordd = NULL;
+ size_t l_size = sizeof(uint64_t);
+ errlHndl_t l_err = NULL;
+ uint64_t fails = 0;
+ uint64_t total = 0;
+
+ do{
+ TS_TRACE("PnorDdTest::test_crossblock_modes: starting");
+
+ // list of all modes to test
+ std::list<PnorDD::PnorMode_t> supported_modes;
+ supported_modes.push_back(PnorDD::MODEL_MEMCPY);
+ supported_modes.push_back(PnorDD::MODEL_LPC_MEM);
+ if( !TARGETING::is_vpo() )
+ {
+ supported_modes.push_back(PnorDD::MODEL_FLAT_ECCB);
+ }
+
+ uint64_t scratch_space = BASE_SCRATCH_SPACE;
+
+ // loop through all of the supported modes
+ for( std::list<PnorDD::PnorMode_t>::iterator m
+ = supported_modes.begin();
+ m != supported_modes.end();
+ ++m )
+ {
+ scratch_space += 4096;
+
+ if( pnordd )
+ {
+ delete pnordd;
+ }
+ pnordd = new PnorDD(*m);
+
+ // Find the nearest erase-block (4K) boundary
+ uint64_t l_boundary = (BASE_SCRATCH_SPACE+4096)
+ - (BASE_SCRATCH_SPACE%4096);
+ uint64_t l_address = 0;
+
+ // Perform PnorDD Write 1 - write through boundary
+ l_address = l_boundary - sizeof(uint32_t);
+ uint64_t l_writeData = 0x6666666699999999;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->writeFlash(&l_writeData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_crossblock_modes: PNORDD write 1: writeFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+
+ // Perform PnorDD Read 1 - verify previous write
+ l_address = l_boundary - sizeof(uint32_t);
+ uint64_t l_readData = 0x0;
+ l_size = sizeof(uint64_t);
+ l_err = pnordd->readFlash(&l_readData,
+ l_size,
+ l_address);
+ total++;
+ if (l_err)
+ {
+ TS_FAIL("PnorDdTest::test_crossblock_modes: PNORDD Read 1: readFlash() failed! Error committed.");
+ errlCommit(l_err,PNOR_COMP_ID);
+ fails++;
+ }
+ total++;
+ if(l_readData != l_writeData)
+ {
+ TS_FAIL("PnorDdTest::test_crossblock_modes: PNORDD read: Read data not expected value. Addr: 0x%.llx, ExpData: 0x%.llx, ActData: 0x%llx", l_address, l_writeData, l_readData);
+ fails++;
+ }
+ }
+ }while(0);
+
+ if( pnordd )
+ {
+ delete pnordd;
+ }
+
+ TRACFCOMP(g_trac_pnor, "PnorDdTest::test_crossblock_modes> %d/%d fails", fails, total );
+ }
+
+
+};
+
/*Not really a real test, just using to verify ext image is loading properly.
Leaving it commented out because the test-case will not dynamically find the extended image based on the TOC
// void testPnorDD2(void)
@@ -283,7 +793,7 @@ Leaving it commented out because the test-case will not dynamically find the ext
l_err = deviceRead(l_testTarget,
&l_readData,
l_size,
- DEVICE_PNOR_ADDRESS(0, l_address));
+ DEVICE_PNOR_ADDRESS(0, l_address);
if (l_err)
{
TS_FAIL("testPnorDD2: PNORDD read fakeext: deviceRead() failed! Error committed.");
@@ -302,7 +812,7 @@ Leaving it commented out because the test-case will not dynamically find the ext
l_err = deviceRead(l_testTarget,
&l_readData,
l_size,
- DEVICE_PNOR_ADDRESS(0, l_address));
+ DEVICE_PNOR_ADDRESS(0, l_address);
if (l_err)
{
TS_FAIL("testPnorDD2: PNORDD read fakeext: deviceRead() failed! Error committed.");
@@ -324,7 +834,6 @@ Leaving it commented out because the test-case will not dynamically find the ext
};
*/
-};
#endif
OpenPOWER on IntegriCloud