diff options
Diffstat (limited to 'src/usr/scan/test/scantest.H')
-rw-r--r-- | src/usr/scan/test/scantest.H | 102 |
1 files changed, 64 insertions, 38 deletions
diff --git a/src/usr/scan/test/scantest.H b/src/usr/scan/test/scantest.H index 666dcd590..0b15a677a 100644 --- a/src/usr/scan/test/scantest.H +++ b/src/usr/scan/test/scantest.H @@ -48,17 +48,7 @@ public: * */ - void test_SCANreadWrite_proc(void) - { - - - } - -// Skipping the real scan test for now because the SCOM regs are not defined and simics -// is broken for the actions required. - - void skip_SCANreadWrite_proc(void) -// void test_SCANreadWrite_proc(void) + void test_SCANreadWrite_proc(void) { TRACFCOMP( g_trac_scandd, "scanTest::test_SCANreadWrite_proc> Start" ); @@ -70,7 +60,7 @@ public: // Setup some targets to use enum { myPROC0, - centaur0, + memBuf0, NUM_TARGETS }; TARGETING::Target* scan_targets[NUM_TARGETS]; @@ -87,8 +77,22 @@ public: scan_targets[myPROC0] = TARGETING::targetService().toTarget(epath); epath.removeLast(); - epath.addLast(TARGETING::TYPE_MEMBUF,0); - scan_targets[centaur0] = TARGETING::targetService().toTarget(epath); + // target membuf 0 + epath.addLast(TARGETING::TYPE_MEMBUF,4); + scan_targets[memBuf0] = TARGETING::targetService().toTarget(epath); + + //printk("Scan Proc target functional state %X present %X \n", + //scan_targets[myPROC0]->getAttr<TARGETING::ATTR_HWAS_STATE>().functional,scan_targets[myPROC0]->getAttr<TARGETING::ATTR_HWAS_STATE>().present ); + + TARGETING::HwasState l_hwasState; + l_hwasState = scan_targets[myPROC0]->getAttr<TARGETING::ATTR_HWAS_STATE>(); + + l_hwasState.functional = true; + scan_targets[myPROC0]->setAttr<TARGETING::ATTR_HWAS_STATE>(l_hwasState); + + //printk("Scan Proc target functional state after updating is %X present %X \n", + //scan_targets[myPROC0]->getAttr<TARGETING::ATTR_HWAS_STATE>().functional,scan_targets[myPROC0]->getAttr<TARGETING::ATTR_HWAS_STATE>().present ); + for( uint64_t x = 0; x < NUM_TARGETS; x++ ) { @@ -96,32 +100,38 @@ public: if(scan_targets[x] == NULL) { TRACFCOMP( g_trac_scandd, "scanTest::test_SCANreadWrite_proc> scan target is null %d", x ); + scan_targets[x] = NULL; //remove from our list continue; } -/* else if (scan_targets[x]->getAttr<TARGETING::ATTR_HWAS_STATE>().functional != true) + else if ((scan_targets[x]->getAttr<TARGETING::ATTR_SCOM_SWITCHES>().useXscom == 0) && + (scan_targets[x]->getAttr<TARGETING::ATTR_SCOM_SWITCHES>().useFsiScom== 0)) { - TRACFCOMP( g_trac_scandd, "scanTest::test_SCANreadWrite_proc> Target %d is not functional", x ); + TRACFCOMP( g_trac_scandd, "scanTest::test_SCANreadWrite_proc> Target %lX cannot use FSI or Xscom", TARGETING::get_huid(scan_targets[x])); scan_targets[x] = NULL; //remove from our list - } */ + + } + else if (scan_targets[x]->getAttr<TARGETING::ATTR_HWAS_STATE>().functional != true) + { + TRACFCOMP( g_trac_scandd,"scanTest::test_SCANreadWrite_proc> Target %lX is not functional\n",TARGETING::get_huid(scan_targets[x]) ); + scan_targets[x] = NULL; //remove from our list + } } - // scratch data to use - //@fixme: Need to either fabricate some fake registers to use or save off data before modifying scans to avoid - // corrupting the HW. + // Scan data .. struct { TARGETING::Target* target; - uint64_t data; + uint32_t data[8]; uint64_t ring; uint64_t length; - uint64_t flag; // Set to zero now until simics works or the header will fail + uint64_t flag; // used for header check.. } test_data[] = { - { scan_targets[myPROC0], 0x1234123456785678, 0x1103400A, 96, 0x0}, - { scan_targets[centaur0], 0xaaaaaaaaaaaaaaaa, 0x00030088, 436, 0x0}, + { scan_targets[myPROC0], {0x12121212, 0x12341234, 0x12341234, 0x12341234, 0x12341234, 0x12341234, 0x10000000, 0x00000000}, 0x14030803, 197, 0x0}, + { scan_targets[memBuf0], {0x34343434, 0xaaaaaaaa, 0xbbbbbbbb, 0xb0000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 0x01034001, 100, 0x2}, }; const uint64_t NUM_ADDRS = sizeof(test_data)/sizeof(test_data[0]); // allocate space for read data - uint64_t read_data[NUM_ADDRS]; + uint32_t read_data[8]; // write all the test registers for( uint64_t x = 0; x < NUM_ADDRS; x++ ) @@ -130,12 +140,12 @@ public: if(test_data[x].target == NULL) { TRACDCOMP( g_trac_scandd, "scanTest::test_SCANreadWrite_proc> TARGEt does not exist 2 %d", x ); - continue; } size_t op_size = test_data[x].length; + //printk("Before a write for TARGET %X\n", TARGETING::get_huid(test_data[x].target)); TRACDCOMP( g_trac_scandd, "scanTest::test_SCANreadWrite_proc> Before Device Write 2>>> " ); total++; l_err = deviceWrite( test_data[x].target, @@ -154,9 +164,16 @@ public: } } - // read all the test registers + + + // read all the scan data for( uint64_t x = 0; x < NUM_ADDRS; x++ ) { + for (int j = 0; j<8;j++) + { + read_data[j] = 0; + } + //only run if the target exists if(test_data[x].target == NULL) { @@ -167,9 +184,12 @@ public: total++; l_err = deviceRead( test_data[x].target, - &(read_data[x]), + &(read_data), op_size, - DEVICE_SCAN_ADDRESS(test_data[x].ring, test_data[x].length,test_data[x].flag) ); + DEVICE_SCAN_ADDRESS(test_data[x].ring, + test_data[x].length, + test_data[x].flag) ); + if( l_err ) { TRACFCOMP(g_trac_scandd, "scanTest::SCANreadWrite_proc> [%d] Read: Error from device : ring=0x%X, RC=%X", x, test_data[x].ring, l_err->reasonCode() ); @@ -177,12 +197,22 @@ public: fails++; errlCommit(l_err,SCAN_COMP_ID); } -// NOTE:: currently expect fails - else if(read_data[x] != test_data[x].data) + else // read and verify each word read back from the scan read. { - TRACFCOMP(g_trac_scandd, "scanTest::test_SCANreadWrite_proc> [%d] Read: EXPECTED Data miss-match : ring=0x%X, read_data=0x%llx, write_data=0x%llx", x, test_data[x].ring, read_data[x], test_data[x].data); - //TS_FAIL( "scanTest::test_SCANreadWrite_proc> ERROR : Data miss-match between read and expected data" ); - //fails++; + // dont need to check the first word.. that is the header. + for (uint64_t y=1;y < (test_data[x].length/32 + 1);y++) + { + + //printk("scanTest::test_SCANreadWrite_proc> [%ld] Read: Data : ring=0x%lX, read_data=0x%.8x, //write_data=0x%.8x\n", x, test_data[x].ring, read_data[y], test_data[x].data[y]); + + if(read_data[y] != test_data[x].data[y]) + { + TRACFCOMP(g_trac_scandd, + "scanTest::test_SCANreadWrite_proc> [%d] Read: EXPECTED Data miss-match : ring=0x%X, read_data=0x%.8x, write_data=0x%llx", x, test_data[x].ring, read_data[y], test_data[x].data[y]); + TS_FAIL("scanTest::test_SCANreadWrite_proc> ERROR : Data miss-match between read and expected data" ); + fails++; + } + } } } @@ -191,10 +221,6 @@ public: } - - - - }; #endif |