summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/occ/occ_procedures/p8_pm_utils.C
blob: 25e2291dfa8d283e15467f3d42f2d403afc970d6 (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/occ/occ_procedures/p8_pm_utils.C $           */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 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                                                     */
// $Id: p8_pm_utils.C,v 1.3 2014/02/17 02:53:07 stillgs Exp $
// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/p8/working/procedures/ipl/fapi/p8_pm_utils.C,v $
//------------------------------------------------------------------------------
// *! (C) Copyright International Business Machines Corp. 2011
// *! All Rights Reserved -- Property of IBM
// *! *** IBM Confidential ***
//------------------------------------------------------------------------------
// *! OWNER NAME: Greg Still         Email: stillgs@us.ibm.com
// *! BACKUP:     Mike Olsen         Email: cmolsen@us.ibm.com
// *!
// *!
/// \file p8_pm_utils.C
/// \brief Utility functions for PM FAPIs
///
//------------------------------------------------------------------------------

#ifndef _P8_PM_UTILS_C_
#define _P8_PM_UTILS_C_

// ----------------------------------------------------------------------
// Includes
// ----------------------------------------------------------------------
#include "p8_pm.H"

extern "C" {

using namespace fapi;

#include "p8_pm_utils.H"


//------------------------------------------------------------------------------
/**
 * Trace a set of FIRs (Globals and select Locals)
 *
 * @param[in] i_target Chip target
 * @param[in] i_msg    String to put out in the trace
 *
 * @retval ECMD_SUCCESS
 */
fapi::ReturnCode
p8_pm_glob_fir_trace(const fapi::Target& i_target,
                    const char * i_msg)
{
    fapi::ReturnCode    rc;
    ecmdDataBufferBase  data(64);
    uint64_t            address;
    uint8_t             trace_en_flag = false;

    CONST_UINT64_T( GLOB_XSTOP_FIR_0x01040000                                 , ULL(0x01040000) );
    CONST_UINT64_T( GLOB_RECOV_FIR_0x01040001                                 , ULL(0x01040001) );
    CONST_UINT64_T( TP_LFIR_0x0104000A                                        , ULL(0x0104000A) );

    do
    {

        //  Note: i_msg is put on on each record to allow for trace "greps"
        //  so as to see the "big picture" across when

        rc = FAPI_ATTR_GET(ATTR_PM_GLOBAL_FIR_TRACE_EN, NULL, trace_en_flag);
        if (rc)
        {
            FAPI_ERR("fapiGetAttribute of ATTR_PM_GLOBAL_FIR_TRACE_EN with rc = 0x%x", (uint32_t)rc);
            break;
        }

        // If trace is not enabled, leave.
        if (!trace_en_flag)
        {
            break;
        }

        //  ******************************************************************
        //  Check for xstops and recoverables and put in the trace
        //  ******************************************************************
        address =  READ_GLOBAL_XSTOP_FIR_0x570F001B;
        GETSCOM(rc, i_target, address, data);

        if (data.getNumBitsSet(0,64))
        {
            FAPI_INF("Xstop is **ACTIVE** %s", i_msg);
        }

        address =  READ_GLOBAL_RECOV_FIR_0x570F001C;
        GETSCOM(rc, i_target, address, data);
        if (data.getNumBitsSet(0,64))
        {
            FAPI_INF("Recoverable attention is **ACTIVE** %s", i_msg);
        }

        address =  READ_GLOBAL_RECOV_FIR_0x570F001C;
        GETSCOM(rc, i_target, address, data);
        if (data.getNumBitsSet(0,64))
        {
            FAPI_INF("Recoverable attention is **ACTIVE** %s", i_msg);
        }

        address =  GLOB_XSTOP_FIR_0x01040000;
        GETSCOM(rc, i_target, address, data);
        if (data.getNumBitsSet(0,64))
        {
            FAPI_INF("Glob Xstop FIR is **ACTIVE** %s", i_msg);
        }

        address =  GLOB_RECOV_FIR_0x01040001;
        GETSCOM(rc, i_target, address, data);
        if (data.getNumBitsSet(0,64))
        {
            FAPI_INF("Glob Recov FIR is **ACTIVE** %s", i_msg);
        }

        address =  TP_LFIR_0x0104000A;
        GETSCOM(rc, i_target, address, data);
        if (data.getNumBitsSet(0,64))
        {
            FAPI_INF("TP LFIR is **ACTIVE** %s", i_msg);
        }

    } while(0);
    return rc;
}

//------------------------------------------------------------------------------
/**
 * Trace PCBS FSMs
 *
 * @param[in] i_target Chip target
 * @param[in] i_msg    String to put out in the trace
 *
 * @retval ECMD_SUCCESS
 * @retval ERROR defined in xml
 */
fapi::ReturnCode
p8_pm_pcbs_fsm_trace_chip(const fapi::Target& i_target,
                            const char *      i_msg)
{
    fapi::ReturnCode                rc;
    ecmdDataBufferBase              data(64);
    uint8_t                         trace_en_flag = false;

    std::vector<fapi::Target>       l_exChiplets;
    uint8_t                         l_ex_number = 0;

    do
    {
        rc = FAPI_ATTR_GET(ATTR_PM_PCBS_FSM_TRACE_EN, NULL, trace_en_flag);
        if (rc)
        {
            FAPI_ERR("fapiGetAttribute of ATTR_PM_PCBS_FSM_TRACE_EN with rc = 0x%x", (uint32_t)rc);
            break;
        }

        // If trace is not enabled, leave.
        if (!trace_en_flag)
        {
            break;
        }

        rc = fapiGetChildChiplets(i_target,
                                  fapi::TARGET_TYPE_EX_CHIPLET,
                                  l_exChiplets,
                                  TARGET_STATE_FUNCTIONAL);
        if (rc)
        {
            FAPI_ERR("fapiGetChildChiplets with rc = 0x%x", (uint32_t)rc);
            break;
        }

        // For each chiplet
        for (uint8_t c=0; c< l_exChiplets.size(); c++)
        {

            rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &l_exChiplets[c], l_ex_number);
            if (rc)
            {
                FAPI_ERR("fapiGetAttribute of ATTR_CHIP_UNIT_POS with rc = 0x%x", (uint32_t)rc);
                break;
            }

            FAPI_DBG("\tCore number = %d", l_ex_number);

            rc = p8_pm_pcbs_fsm_trace (i_target, l_ex_number, i_msg);
            if (!rc.ok())
            {
                break;
            }
        }

    } while(0);
    return rc;
}

//------------------------------------------------------------------------------
/**
 * Trace PCBS FSMs for a given EX
 *
 * @param[in] i_target Chip target
 * @param[in] i_msg    String to put out in the trace
 *
 * @retval ECMD_SUCCESS
 */
fapi::ReturnCode
p8_pm_pcbs_fsm_trace  ( const fapi::Target& i_target,
                        uint32_t            i_ex_number,
                        const char *        i_msg)
{
    fapi::ReturnCode                rc;
    ecmdDataBufferBase              data(64);
    uint64_t                        address;
    uint8_t                         trace_en_flag = false;
    uint64_t                        ex_offset;

    do
    {
        rc = FAPI_ATTR_GET(ATTR_PM_PCBS_FSM_TRACE_EN, NULL, trace_en_flag);
        if (rc)
        {
            FAPI_ERR("fapiGetAttribute of ATTR_PM_PCBS_FSM_TRACE_EN with rc = 0x%x", (uint32_t)rc);
            break;
        }

        // If trace is not enabled, leave.
        if (!trace_en_flag)
        {
            break;
        }
    
        ex_offset = i_ex_number * 0x01000000;

        //  Note: i_msg is put on on each record to allow for trace "greps"
        //  so as to see the "big picture" across when

        //  ******************************************************************
        //  Read PCBS FSM Monitor0
        //  ******************************************************************
        address =  EX_PCBS_FSM_MONITOR1_REG_0x100F0170 + ex_offset;
        GETSCOM(rc, i_target, address, data);
        FAPI_INF("PCBS Monitor0 = 0x%016llX;  %s target:%s" ,
                                    data.getDoubleWord(0),
                                    i_msg,
                                    i_target.toEcmdString());

        //  ******************************************************************
        //  Read PCBS FSM Monitor1
        //  ******************************************************************
        address =  EX_PCBS_FSM_MONITOR2_REG_0x100F0171 + ex_offset;
        GETSCOM(rc, i_target, address, data);
        FAPI_INF("PCBS Monitor1 = 0x%016llX;  %s target:%s" ,
                                    data.getDoubleWord(0),
                                    i_msg,
                                    i_target.toEcmdString());

        //  ******************************************************************
        //  Read PCBS DPLL CPM PARM REG
        //  ******************************************************************
        address =  EX_DPLL_CPM_PARM_REG_0x100F0152 + ex_offset;
        GETSCOM(rc, i_target, address, data);
        FAPI_INF("DPLLC Monitor = 0x%016llX;  %s target:%s" ,
                                    data.getDoubleWord(0),
                                    i_msg,
                                    i_target.toEcmdString());

        //  ******************************************************************
        //  Read PCBS PMGP0
        //  ******************************************************************
        address =  EX_PMGP0_0x100F0100 + ex_offset;
        GETSCOM(rc, i_target, address, data);
        FAPI_INF("PMGP0 Monitor = 0x%016llX;  %s target:%s" ,
                                    data.getDoubleWord(0),
                                    i_msg,
                                    i_target.toEcmdString());

    } while(0);
    return rc;
}

} //end extern

#endif // _P8_PM_UTILS_H_

OpenPOWER on IntegriCloud