summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C
blob: 2c1c86d36d9b03a2a21ae8c7dbd171211e64bbb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/rule/prdfRuleChip.C $      */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2004,2014              */
/*                                                                        */
/* 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 otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#include <prdfMfgThresholdMgr.H>

#ifndef __HOSTBOOT_MODULE
  #include <utilreg.H> // for UtilReg
  #include <prdfSdcFileControl.H> //for SyncAnalysis
#endif

#include <prdfGlobal.H> // for SystemPtr.
#include <prdfErrlUtil.H>

#include <prdfRuleChip.H>
#include <prdfPluginMap.H>
#include <prdrCommon.H> // for enums.
#include <prdfScanFacility.H> // for ScanFacility
#include <iipResolutionFactory.h> // for ResolutionFactory
#include <iipCaptureData.h> // for CaptureData
#include <iipServiceDataCollector.h> // for ServiceDataCollector
#include <prdfErrorSignature.H> // for ErrorSignature
#include <prdfPfa5Data.h> // for errl user data flags.
#include <iipSystem.h> // for System
#include <prdfRasServices.H>

namespace PRDF
{


RuleChip::RuleChip( const char * i_fileName ,
                    TARGETING::TargetHandle_t i_pTargetHandle,
                    ScanFacility & i_scanFactory,
                    ResolutionFactory & i_reslFactory,
                    errlHndl_t & o_errl )
    : ExtensibleChip( i_pTargetHandle ),cv_dataBundle( NULL )
{
    iv_pRuleData = NULL;
    if( NULL != systemPtr )
    {
        TARGETING::TYPE  l_type  =
                        PlatServices::getTargetType( i_pTargetHandle );
        iv_pRuleData = systemPtr->getChipMetaData( l_type,i_fileName,
                                        i_scanFactory,i_reslFactory,o_errl );

    }

    init();

}

//------------------------------------------------------------------------------

void RuleChip::init( )
{
    PRDF_DEFINE_CHIP_SCOPE( this );
    // Call initialize plugin.
    ExtensibleChipFunction * l_init = getExtensibleFunction("Initialize", true);
    if (NULL != l_init)
    {
        (*l_init)( this,PluginDef::bindParm<void*>(NULL) );
    }

};

//------------------------------------------------------------------------------

RuleChip::~RuleChip()
{
    if (NULL != cv_dataBundle)
    {
        delete cv_dataBundle;
    }
};

//------------------------------------------------------------------------------

int32_t RuleChip::Analyze( STEP_CODE_DATA_STRUCT & i_serviceData,
                            ATTENTION_TYPE i_attnType )
{
    //this pointer is retained in stack just for the scope of this function
    PRDF_DEFINE_CHIP_SCOPE( this );
    int32_t l_rc = SUCCESS;
    ServiceDataCollector & i_sdc = *(i_serviceData.service_data);
    ErrorSignature & l_errSig = *(i_sdc.GetErrorSignature());

    // Set current ATTN type to input value.
    // If we don't do this, then the AttnRegisters don't work.
    i_sdc.SetCauseAttentionType(i_attnType);
    // Set Signature Chip Id.
    l_errSig.setChipId( GetId() );
    l_rc = iv_pRuleData->Analyze( i_serviceData, i_attnType );

    return l_rc;
};

//------------------------------------------------------------------------------

ExtensibleChipFunction *
    RuleChip::getExtensibleFunction( const char * i_func, bool i_expectNull )
{
    //this pointer is retained in stack just for the scope of this function
    PRDF_DEFINE_CHIP_SCOPE( this );
    ExtensibleChipFunction * l_ptr = NULL ;
    l_ptr = iv_pRuleData->getExtensibleFunction( i_func , i_expectNull );
    return l_ptr ;
}

//------------------------------------------------------------------------------

SCAN_COMM_REGISTER_CLASS * RuleChip::getRegister(const char * i_reg,
                                                     bool i_expectNull)
{
    //this pointer is retained in stack just for the scope of this function
    PRDF_DEFINE_CHIP_SCOPE( this );
    SCAN_COMM_REGISTER_CLASS * l_ptr = iv_pRuleData->getRegister( i_reg,
                                                            i_expectNull,this );
    return l_ptr ;
}


//------------------------------------------------------------------------------
int32_t RuleChip::CaptureErrorData( CaptureData & io_cap,int i_group )
{
    //this pointer is retained in stack just for the scope of this function
   PRDF_DEFINE_CHIP_SCOPE( this );
   return  iv_pRuleData->CaptureErrorData( io_cap ,i_group );
}

//------------------------------------------------------------------------------

uint32_t RuleChip::getSignatureOffset()
{
    //this pointer is retained in stack just for the scope of this function
    PRDF_DEFINE_CHIP_SCOPE( this );
    return iv_pRuleData->getSignatureOffset();
}

} // end namespace PRDF

OpenPOWER on IntegriCloud