summaryrefslogtreecommitdiffstats
path: root/src/import/hwpf/fapi2/include/collect_reg_ffdc.H
blob: 98f1f3b805576218e97aaecf843e1b7c860cd16b (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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/hwpf/fapi2/include/collect_reg_ffdc.H $            */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2015,2018                        */
/* [+] International Business Machines Corp.                              */
/*                                                                        */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
#ifndef FAPI2_COLLECT_REG_FFDC_H_
#define FAPI2_COLLECT_REG_FFDC_H_
#include <stdint.h>
#include <vector>
#include <hw_access.H>
#include <ffdc.H>
#include <hwp_error_info.H>
#include <error_info_defs.H>
#include <buffer.H>
#include <target.H>
#include <return_code.H>
#include <fapi2_attribute_service.H>
#include <plat_trace.H>
#include <endian.h>


namespace fapi2
{

// in generated file collect_reg_ffdc_regs.C
void getAddressData(const fapi2::HwpFfdcId i_ffdcId,
                    std::vector<uint64_t>& o_scomAddresses ,
                    std::vector<uint32_t>& o_cfamAddresses ,
                    uint32_t& o_ffdcSize );


///
/// @brief converts value to a type to enable overloading based on values
///
/// @tparam  v - value to create to a unique type
///
/// @return  v - value.
///
template <int v>
struct toType
{
    enum { value = v };
};

///
/// @class TargetPosition
///
///  helper class to get the position for the passed in chip
///  or chiplet.
///
///
template < TargetType T, bool isChiplet = T& TARGET_TYPE_CHIPLETS >
class TargetPosition
{

    public:
        ///
        /// @brief constructor
        ///
        TargetPosition(const Target<T>& t)
            : iv_targ(t)
        {};

        ///
        /// @brief Return position of either a chip or chiplet target
        ///
        /// @param[out]  o_pos - position of chip/chiplet target
        ///
        /// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
        ///
        fapi2::ReturnCode getPosition( uint32_t& o_pos)
        {
            return getPosition(o_pos, toType<isChiplet>());
        }

    private:
        ///
        /// @brief  return target position for chiplet
        ///
        /// @param[out] o_pos - chiplet position
        /// @param[in]  is_chiplet = true
        ///
        /// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
        ///
        fapi2::ReturnCode getPosition(uint32_t& o_pos, toType<true>)
        {
            fapi2::ReturnCode l_rc;

            uint8_t l_chipletPos = 0;

            l_rc = FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, iv_targ, l_chipletPos);

            if (l_rc)
            {
                FAPI_ERR("collect_reg_ffdc.C: Error getting chiplet position");
                l_chipletPos = 0xFF;
            }

            o_pos = static_cast<uint32_t>(l_chipletPos);

            return l_rc;
        }

        ///
        /// @brief  return target position for chip
        ///
        /// @param[out] o_pos - chiplet position
        /// @param[in]  is_chiplet = false
        ///
        /// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
        ///
        fapi2::ReturnCode getPosition(uint32_t& o_pos, toType<false>)
        {
            fapi2::ReturnCode l_rc;

            uint32_t l_Pos = 0;

            l_rc = FAPI_ATTR_GET(fapi2::ATTR_POS, iv_targ, l_Pos);

            if (l_rc)
            {
                FAPI_ERR("collect_reg_ffdc.C: Error getting position");
                l_Pos = 0xFF;
            }

            o_pos = l_Pos;

            return l_rc;
        }

        const fapi2::Target<T>& iv_targ;
};




const fapi2::TargetType TARGET_TYPE_PROC_CHIPLETS = fapi2::TARGET_TYPE_EX |
        fapi2::TARGET_TYPE_MCS |
        fapi2::TARGET_TYPE_XBUS |
        fapi2::TARGET_TYPE_CORE |
        fapi2::TARGET_TYPE_EQ |
        fapi2::TARGET_TYPE_MCA |
        fapi2::TARGET_TYPE_MCBIST |
        fapi2::TARGET_TYPE_MI |
        fapi2::TARGET_TYPE_CAPP |
        fapi2::TARGET_TYPE_DMI |
        fapi2::TARGET_TYPE_OBUS |
        fapi2::TARGET_TYPE_OBUS_BRICK |
        fapi2::TARGET_TYPE_SBE |
        fapi2::TARGET_TYPE_PPE |
        fapi2::TARGET_TYPE_PERV |
        fapi2::TARGET_TYPE_PEC |
        fapi2::TARGET_TYPE_PHB |
        fapi2::TARGET_TYPE_MC |
        fapi2::TARGET_TYPE_OMI |
        fapi2::TARGET_TYPE_MEM_PORT;

const fapi2::TargetType TARGET_TYPE_SCOM_TARGET = fapi2::TARGET_TYPE_PROC_CHIP |
        fapi2::TARGET_TYPE_MEMBUF_CHIP |
        fapi2::TARGET_TYPE_EX |
        fapi2::TARGET_TYPE_MBA |
        fapi2::TARGET_TYPE_MCS |
        fapi2::TARGET_TYPE_XBUS |
        fapi2::TARGET_TYPE_ABUS |
        fapi2::TARGET_TYPE_L4 |
        fapi2::TARGET_TYPE_CORE |
        fapi2::TARGET_TYPE_EQ |
        fapi2::TARGET_TYPE_MCA |
        fapi2::TARGET_TYPE_MCBIST |
        fapi2::TARGET_TYPE_MI |
        fapi2::TARGET_TYPE_DMI |
        fapi2::TARGET_TYPE_OBUS |
        fapi2::TARGET_TYPE_OBUS_BRICK |
        fapi2::TARGET_TYPE_SBE |
        fapi2::TARGET_TYPE_PPE |
        fapi2::TARGET_TYPE_PERV |
        fapi2::TARGET_TYPE_PEC |
        fapi2::TARGET_TYPE_PHB |
        fapi2::TARGET_TYPE_MC |
        fapi2::TARGET_TYPE_OMI |
        fapi2::TARGET_TYPE_MEM_PORT;



template< TargetType T>
inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
getChipTarget(const fapi2::Target<T>& i_target)
{
    return getChipTarget(i_target);
}

// handle membuf/proc targets
inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
getChipTarget(const fapi2::Target<fapi2::TARGET_TYPE_CHIPS>& i_target)
{
    return i_target;
}

// handle dimms
inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
getChipTarget(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
    return i_target.getParent<fapi2::TARGET_TYPE_MBA>().getParent<fapi2::TARGET_TYPE_MEMBUF_CHIP>();
}

// everything else is w/proc chip?
inline fapi2::Target<fapi2::TARGET_TYPE_CHIPS>
getChipTarget(const
              fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIPLETS>& i_target)
{
    return i_target.getParent<fapi2::TARGET_TYPE_CHIPS>();
}

template < TargetType T>
fapi2::Target<fapi2::TARGET_TYPE_SCOM_TARGET>
getScomTarget(const fapi2::Target<T>& i_target)
{
    return i_target;
}

inline fapi2::Target<fapi2::TARGET_TYPE_SCOM_TARGET>
getScomTarget(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target)
{
    return i_target.getParent<fapi2::TARGET_TYPE_MBA>();
}


template<TargetType T>
class CfamReader
{
    public:
        CfamReader(const fapi2::Target<T>& i_target)
            : iv_target(i_target) {};

        ReturnCode
        read_register(const uint32_t address, fapi2::buffer<uint32_t>& i_buf)
        {
            FAPI_DBG("CfamReader.read_register - no-op");

            return FAPI2_RC_SUCCESS;
        }

    private:
        const fapi2::Target<T>& iv_target;
};

template<>
class CfamReader<TARGET_TYPE_MEMBUF_CHIP>
{
    public:
        CfamReader(const fapi2::Target<TARGET_TYPE_MEMBUF_CHIP>& i_target)
            : iv_target(i_target) {};

        ReturnCode read_register
        (const uint32_t address, fapi2::buffer<uint32_t>& i_buf)
        {
            FAPI_DBG("CfamReader.read_register - MEMBUF VERSION");
            return fapi2::getCfamRegister(iv_target, address, i_buf);
        }

    private:
        const fapi2::Target<TARGET_TYPE_MEMBUF_CHIP>& iv_target;
};

template<>
class CfamReader<TARGET_TYPE_PROC_CHIP>
{
    public:
        CfamReader(const fapi2::Target<TARGET_TYPE_PROC_CHIP>& i_target)
            : iv_target(i_target) {};

        ReturnCode
        read_register(const uint32_t address, fapi2::buffer<uint32_t>& i_buf)
        {
            FAPI_DBG("CfamReader.read_register - PROC VERSION");
            return fapi2::getCfamRegister(iv_target, address, i_buf);
        }

    private:
        const fapi2::Target<TARGET_TYPE_PROC_CHIP>& iv_target;
};

///
/// @class ScomReader
///
///  Class to abstract away details of reading of a scom register
///
template< TargetType T >
class ScomReader
{
    public:
        ScomReader(const fapi2::Target<T>& i_target)
            : iv_target(i_target)
        {};

        ReturnCode read_register(const uint64_t i_address,
                                 fapi2::buffer<uint64_t>& o_buf)
        {
            FAPI_DBG("ScomReader.read_register - BASE version");
            return getScom(iv_target, i_address, o_buf);
        }
    private:
        const fapi2::Target<T>& iv_target;
};

///
/// @brief class to handle reading from scom registers from generic function
///
template<>
class ScomReader<TARGET_TYPE_DIMM>
{
    public:
        ScomReader(const fapi2::Target<TARGET_TYPE_DIMM>& i_target)
            : iv_target(getScomTarget(i_target))
        {};

        ReturnCode
        read_register(const uint64_t i_address, fapi2::buffer<uint64_t>& o_buf)
        {
            FAPI_DBG("ScomReader.read_register - DIMM version");
            ReturnCode l_rc = getScom(iv_target, i_address, o_buf);
            return l_rc;
        }

    private:
        const fapi2::Target<TARGET_TYPE_SCOM_TARGET>& iv_target;

};

///
/// @brief collectRegisterData
///
///  collect all the data from a list of registers and return it to the caller
///
/// @tparam      T register data size - uint32_t or uint64_t
/// @tparam      U - reader object for specific data type
/// @param[in]   i_addresses - vector containing either cfam or scom addresses
/// @param[in]   i_reader    - input reader object
/// @param[in]   i_offset    - optional offset to add to the address values
///                            passed in the vector of addresses
/// @param[out]  o_pData - pointer to the data destination
///
/// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
///
template< typename T, class U>
ReturnCode collectRegisterData(std::vector<T>& i_addresses, U& i_reader,
                               uint32_t i_offset, uint8_t*& o_pData)
{
    FAPI_DBG("collectRegisterData -> address count: 0x%lx", i_addresses.size());

    T l_data = 0;

    ReturnCode l_rc = FAPI2_RC_SUCCESS;

    for( auto address : i_addresses )
    {
        fapi2::buffer<T> l_buf;

        const T l_address = address + i_offset;

        l_rc = i_reader.read_register(l_address, l_buf);

        if(l_rc)
        {
            l_data = 0xbaddbadd;

#ifdef __DELETE_PLATFORMDATA_SUPPORTED
            // delete the platform log if it exits
            deletePlatformDataPointer(l_rc);
#endif

        }
        else
        {
            l_data = l_buf();
        }

        memcpy(o_pData, &l_data, sizeof(T));

        o_pData += sizeof(T);

    }

    return l_rc;
}
template< typename T, class U>
ReturnCode collectRegisterAndAddressData(std::vector<T>& i_addresses, U& i_reader,
        uint32_t i_offset, uint8_t*& o_pData)
{
    FAPI_DBG("collectRegisterAndAddressData -> address count: 0x%lx", i_addresses.size());

    T l_data = 0;
    uint32_t l_addr = 0;

    ReturnCode l_rc = FAPI2_RC_SUCCESS;

    for( auto address : i_addresses )
    {
        fapi2::buffer<T> l_buf;

        T l_address = address + i_offset;

        l_rc = i_reader.read_register(l_address, l_buf);

        if(l_rc)
        {
            l_data = 0xbaddbadd;
#ifdef __DELETE_PLATFORMDATA_SUPPORTED
            // delete the platform data pointer if it exists
            deletePlatformDataPointer(l_rc);
#endif
        }
        else
        {
            l_data = l_buf();
        }

        l_address = htobe64(l_address);
        l_data = htobe64(l_data);
        l_addr = l_address >> 32;

        memcpy(o_pData, &l_addr, sizeof(uint32_t));
        o_pData += sizeof(uint32_t);

        memcpy(o_pData, &l_data, sizeof(T));
        o_pData += sizeof(T);

    }

    return l_rc;
}

///
/// @brief readRegisters
///
///  Template function to allow reading either scom and cfam data from registers
///  for a given target
///
/// @tparam      T - fapi2::TargetType
/// @param[in]   i_target - fapi2::Target
/// @param[out]  o_pData - pointer to a location to store register data
/// @param[in]   i_cfamAddresses - vector of cfam addresses to read
/// @param[in]   i_scomAddresses - vector of scom addresses to read
/// @param[in]   i_childOffset - optional offset to address of child
///
/// @return fapi2::ReturnCode. FAPI_RC_SUCCESS, or failure value.
///
template<fapi2::TargetType T>
void readRegisters(const fapi2::Target<T>& i_target,
                   uint8_t* o_pData,
                   std::vector<uint32_t> i_cfamAddresses,
                   std::vector<uint64_t> i_scomAddresses,
                   uint32_t i_childOffset = 0)
{
    FAPI_DBG("readRegisters()");

    // create an object to read Cfam registers
    CfamReader<T> l_cfamReader(i_target);

    // Create an object to read scom registers
    ScomReader<T> l_scomReader(i_target);

    // read data from the cfam registers if required
    ReturnCode rc = collectRegisterData<uint32_t,
               CfamReader<T> >(i_cfamAddresses, l_cfamReader,
                               i_childOffset, o_pData);

    if(rc)
    {
        FAPI_ERR("An error occured when reading from the cfam registers skipping..");
    }

    // read data from Scom registers if present
    rc = collectRegisterData<uint64_t,
    ScomReader<T> >(i_scomAddresses, l_scomReader,
                    i_childOffset, o_pData);

    if(rc)
    {
        FAPI_ERR("An error occured when reading the scom registers..");
    }

    FAPI_DBG("readRegisters() exit");
}

///
/// @brief Collect register data for child targets
///
/// @tparam      C - child target type
/// @tparam      T - parent target type
/// @param[in]   i_parent - fapi2::Target
/// @param[in]   i_childState - fapi2::TargetState for child targets
/// @param[in]   i_ffdcId - type of ffdc to be collected
/// @param[out]  o_errorInfoFfdc - vector of shared pointers to fapi2::ErrorInfoFfdc type
///                            for returned register data
/// @param[in]   i_childOffsetMult - child offset for register calculations
///
///
template<fapi2::TargetType C, fapi2::TargetType T>
void collectRegFfdc(const fapi2::ffdc_t i_parent,
                    const fapi2::TargetState i_childState,
                    const HwpFfdcId i_ffdcId,
                    std::vector<std::shared_ptr<fapi2::ErrorInfoFfdc>>& o_errorInfoFfdc,
                    uint32_t i_childOffsetMult = 0)
{

    FAPI_INF("collectRegFfdc child targets version");

    std::vector<fapi2::Target<C> > l_targets;

    if( i_parent.ptr() == nullptr )
    {
        FAPI_ERR("Target ptr in FFDC object was null, skipping register data collection.");
    }
    else
    {

        Target<T> l_parent =
            *(static_cast<const Target<T>*>(i_parent.ptr()));

        // Collect FFDC for functional or present chiplets of
        // type C associated with i_target - yeah, odd syntax.
        l_targets = l_parent.template getChildren<C>(i_childState);

        if (l_targets.empty())
        {
            FAPI_INF("collect_reg_ffdc.C: Error: No chiplets found. ");
            return;
        }

        std::vector<uint32_t> l_cfamAddresses;
        std::vector<uint64_t> l_scomAddresses;

        uint32_t l_ffdcSize = 0;        // total size needed for all entries
        uint32_t l_ffdcRegReadSize = 0; // readRegisters size addition

        // call generated code to fetch the address vectors
        getAddressData(i_ffdcId, l_scomAddresses, l_cfamAddresses, l_ffdcRegReadSize);

        uint32_t l_position = 0;

        // initialize to single readRegister entry
        l_ffdcSize = l_ffdcRegReadSize;

        // add the position size to the total
        l_ffdcSize += sizeof(l_position);

        // update size for each target
        l_ffdcSize = (l_ffdcSize * l_targets.size());

        uint8_t  l_pBuf[l_ffdcSize];

        uint8_t* l_pData = &l_pBuf[0];

        // grab the data for each child target
        for( auto target : l_targets)
        {
            ReturnCode l_rc =
                TargetPosition<C>(target).getPosition(l_position);

            // add chip/chiplets position to the data
            memcpy(l_pData, &l_position, sizeof(l_position));

            // advance the pointer into our buffer
            l_pData += sizeof(l_position);

            if(i_childState == TARGET_STATE_FUNCTIONAL)
            {
                FAPI_INF(" calling version for TARGET_STATE_FUNCTIONAL ");

                // since its functional just read from the child target
                readRegisters(target, l_pData, l_cfamAddresses,
                              l_scomAddresses, i_childOffsetMult);
            }
            else
            {
                // use the parent and read address + offset since the
                // child targets may not be functional
                uint32_t l_offset = i_childOffsetMult * l_position;

                FAPI_INF(" calling version for TARGET_STATE_PRESENT ");

                readRegisters(l_parent, l_pData, l_cfamAddresses,
                              l_scomAddresses, l_offset);
            }

            // advance the pointer past readRegisters data entry
            l_pData += l_ffdcRegReadSize;
        }

        FAPI_INF("collectRegFfdc. SCOM address count: %#lx", l_scomAddresses.size());
        FAPI_INF("collectRegFfdc. CFAM address count: %#lx", l_cfamAddresses.size());

        FAPI_DBG("size info i_ffdcId = %d, l_pBuf = %p, l_ffdcSize=%d", i_ffdcId, l_pBuf, l_ffdcSize);

        // Create a ErrorInfoFfdc object and pass it back
        o_errorInfoFfdc.push_back(std::shared_ptr<fapi2::ErrorInfoFfdc>(new ErrorInfoFfdc(i_ffdcId, l_pBuf, l_ffdcSize)));
    }
}
///
/// @brief Collect register data for a single target
///
/// @tparam      T - target type
/// @param[in]   i_target - fapi2::Target
/// @param[in]   i_ffdcId - type of ffdc to be collected
/// @param[out]  o_errorInfoFfdc - shared pointer to fapi2::ErrorInfoFfdc type
///                            for returned register data
/// @param[in]   i_childOffset - child offset for register calculations
///
template<fapi2::TargetType T>
void collectRegFfdc(const fapi2::ffdc_t i_target,
                    const HwpFfdcId i_ffdcId,
                    std::vector<std::shared_ptr<fapi2::ErrorInfoFfdc> >& o_errorInfoFfdc,
                    uint32_t i_childOffset = 0)
{

    FAPI_INF("single target no children - ");

    if( i_target.ptr() == nullptr )
    {
        FAPI_ERR("Target ptr in FFDC object was null, skipping register data collection.");
    }
    else
    {

        Target<T> l_target =
            *(static_cast<const Target<T>*>(i_target.ptr()));

        std::vector<uint32_t> l_cfamAddresses;
        std::vector<uint64_t> l_scomAddresses;

        uint32_t l_ffdcSize = 0;

        // call generated code to fetch the address vectors
        getAddressData(i_ffdcId, l_scomAddresses, l_cfamAddresses, l_ffdcSize);

        uint32_t l_position = 0;

        ReturnCode l_rc = TargetPosition<T>(l_target).getPosition(l_position);

        l_ffdcSize += sizeof(l_position);

        uint8_t l_pBuf[l_ffdcSize];

        uint8_t* l_pData = &l_pBuf[0];

        // add chip/chiplets position to the data
        memcpy(l_pData, &l_position, sizeof(l_position));

        l_pData += sizeof(l_position);

        // do the work
        readRegisters(l_target, l_pData, l_cfamAddresses, l_scomAddresses,
                      i_childOffset);

        FAPI_DBG("size info i_ffdcId = %d, l_pBuf = %p, l_ffdcSize=%d", i_ffdcId, l_pBuf, l_ffdcSize);
        // Create a ErrorInfoFfdc object and add it to the Error Information
        // object of the FFDC class
        o_errorInfoFfdc.push_back(std::shared_ptr<fapi2::ErrorInfoFfdc>(new ErrorInfoFfdc(i_ffdcId, l_pBuf, l_ffdcSize)));

        FAPI_INF("collectRegFfdc. SCOM address count:  %d", (uint32_t)(l_scomAddresses.size()));
        FAPI_INF("collectRegFfdc. CFAM address count:  %d", (uint32_t)(l_cfamAddresses.size()));
    }

    FAPI_INF("collectRegFfdc() - exit");
}

}// end namespace
#endif
OpenPOWER on IntegriCloud