<commit_before>//  IBM_PROLOG_BEGIN_TAG
//  This is an automatically generated prolog.
//
//  $Source: src/usr/scom/test/scomtest.H $
//
//  IBM CONFIDENTIAL
//
//  COPYRIGHT International Business Machines Corp. 2011
//
//  p1
//
//  Object Code Only (OCO) source materials
//  Licensed Internal Code Source Materials
//  IBM HostBoot Licensed Internal Code
//
//  The source code for this program is not published or other-
//  wise divested of its trade secrets, irrespective of what has
//  been deposited with the U.S. Copyright Office.
//
//  Origin: 30
//
//  IBM_PROLOG_END
#ifndef __SCOMTEST_H
#define __SCOMTEST_H

/**
 *  @file scomtest.H
 *
 *  @brief Test case for SCOM code
*/

#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <errl/errltypes.H>
#include <devicefw/userif.H>
#include <fsi/fsiif.H>



extern trace_desc_t* g_trac_scom;


class ScomTest: public CxxTest::TestSuite
{
public:

    /**
     * @brief SCOM test via FSISCOM
     *     
     */
    void test_FSISCOMreadWrite(void)
    {

        TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite> Start" );

        TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite> Disabled due to simics stability issues" );
        return;  //@todo - enable when simics is stable

        uint64_t fails = 0;
        uint64_t total = 0;
        errlHndl_t l_err = NULL;

        //make sure the FSI hardware is initailized (ordering of test cases is not currently guaranteed)
        l_err = FSI::initializeHardware();
        if( l_err )
        {
            TRACFCOMP(g_trac_scom, "ScomTest::test_FSISCOMreadWrite> FSI::initializeHardware failed, RC=0x%X", l_err->reasonCode() );
            TS_FAIL( "ScomTest::test_FSISCOMreadWrite> FsiDD::initializeHardware failed, aborting test case." );
            errlCommit(l_err);
            return;
        }


        TARGETING::Target* fsi_target = NULL;

        // Target Proc 1 - the FSI wrap-back connection in simics
        TARGETING::EntityPath epath(TARGETING::EntityPath::PATH_PHYSICAL);
        epath.addLast(TARGETING::TYPE_SYS,0);
        epath.addLast(TARGETING::TYPE_NODE,0);
        epath.addLast(TARGETING::TYPE_PROC,1);
        fsi_target = TARGETING::targetService().toTarget(epath);

        // scratch data to use
        //@fixme: Need to either fabricate some fake registers to use or save off data before modifying SCOMs to avoid
        //   corrupting the HW.
        struct {
            uint64_t addr;
            uint64_t data;
        } test_data[] = {
            { 0x120F0000 ,0xFEEDB0B000001234}, 
            { 0x120F0166, 0xFEDCBA9876543210}, 
            { 0x00040005, 0x0000000000000000}, 
            { 0x02040004, 0xFFFFFFFFFFFFFFFF}, <commit_msg>FSISCOM test case cleanup for VBU 	-Don't perform test cases if target is not valid or does not support FSI SCOM<commit_after>//  IBM_PROLOG_BEGIN_TAG
//  This is an automatically generated prolog.
//
//  $Source: src/usr/scom/test/scomtest.H $
//
//  IBM CONFIDENTIAL
//
//  COPYRIGHT International Business Machines Corp. 2011
//
//  p1
//
//  Object Code Only (OCO) source materials
//  Licensed Internal Code Source Materials
//  IBM HostBoot Licensed Internal Code
//
//  The source code for this program is not published or other-
//  wise divested of its trade secrets, irrespective of what has
//  been deposited with the U.S. Copyright Office.
//
//  Origin: 30
//
//  IBM_PROLOG_END
#ifndef __SCOMTEST_H
#define __SCOMTEST_H

/**
 *  @file scomtest.H
 *
 *  @brief Test case for SCOM code
*/

#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <errl/errltypes.H>
#include <devicefw/userif.H>
#include <fsi/fsiif.H>



extern trace_desc_t* g_trac_scom;


class ScomTest: public CxxTest::TestSuite
{
public:

    /**
     * @brief SCOM test via FSISCOM
     *     
     */
    void test_FSISCOMreadWrite(void)
    {
        TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite> Start" );

        uint64_t fails = 0;
        uint64_t total = 0;
        errlHndl_t l_err = NULL;

        TARGETING::Target* fsi_target = NULL;

        // Target Proc 1 - the FSI wrap-back connection in simics
        TARGETING::EntityPath epath(TARGETING::EntityPath::PATH_PHYSICAL);
        epath.addLast(TARGETING::TYPE_SYS,0);
        epath.addLast(TARGETING::TYPE_NODE,0);
        epath.addLast(TARGETING::TYPE_PROC,9);
        fsi_target = TARGETING::targetService().toTarget(epath);

        //only run if the target exists and has FSI enabled.
        if(fsi_target == NULL)
        {
            TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite> FSI Target not found, exiting test" );
            return;
        }
        else if((TARGETING::MASTER_PROCESSOR_CHIP_TARGET_SENTINEL == fsi_target) ||
                (fsi_target->getAttr<TARGETING::ATTR_SCOM_SWITCHES>().useXscom))
        {
            TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite> Target is the MASTER Sentinal or is set to use Xscom, exiting test" );
            return;
        }
        else if(0 == fsi_target->getAttr<TARGETING::ATTR_SCOM_SWITCHES>().useFsiScom)
        {
            TRACFCOMP( g_trac_scom, "ScomTest::test_FSISCOMreadWrite> useFsiScom set to zero, exiting test" );
            return;
        }

        // scratch data to use
        //@fixme: Need to either fabricate some fake registers to use or save off data before modifying SCOMs to avoid
        //   corrupting the HW.
        struct {
            uint64_t addr;
            uint64_t data;
        } test_data[] = {
            { 0x120F0000 ,0xFEEDB0B000001234}, 
            { 0x120F0166, 0xFEDCBA9876543210}, 
            { 0x00040005, 0x0000000000000000}, 
            { 0x02040004, 0xFFFFFFFFFFFFFFFF}, 
{'fraction_non_alphanumeric': 0.10179744210162461, 'fraction_numerical': 0.03318354649153128, 'mean_word_length': 2.5988805970149254, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2618584', 'n_tokens_mistral': 2122, 'n_tokens_neox': 1932, 'n_words': 480}