summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/plat/mem/prdfCenMbaDataBundle.H
blob: f883653cf9713cb79c00861923c66ed73545a075 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/plat/mem/prdfCenMbaDataBundle.H $    */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2017,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 __prdfCenMbaDataBundle_H
#define __prdfCenMbaDataBundle_H

// Framework includes
#include <prdfExtensibleChip.H>

// Platform includes
#include <prdfMemUeTable.H>
#include <prdfPlatServices.H>

#ifdef __HOSTBOOT_MODULE

  #include <prdfMemTdCtlr.H>

  #ifndef __HOSTBOOT_RUNTIME
    #include <prdfMemIplCeStats.H>
  #endif
#endif

namespace PRDF
{

/** @brief Centaur MBA data bundle. */
class MbaDataBundle : public DataBundle
{
  public: // functions

    /**
     * @brief Constructor.
     * @param i_chip The MBA chip.
     */
    explicit MbaDataBundle( ExtensibleChip * i_chip ) :
        iv_chip(i_chip), iv_ueTable(i_chip)
    {}

    /** @brief Destructor. */
    ~MbaDataBundle()
    {
        #ifdef __HOSTBOOT_MODULE
        delete iv_tdCtlr; iv_tdCtlr = nullptr;
        #endif

        #if defined(__HOSTBOOT_MODULE) && !defined(__HOSTBOOT_RUNTIME)
        delete iv_sfCmd; iv_sfCmd = nullptr;
        delete iv_iplCeStats; iv_iplCeStats = nullptr;
        #endif
    }

    // Don't allow copy or assignment.
    MbaDataBundle( const MbaDataBundle & ) = delete;
    const MbaDataBundle & operator=( const MbaDataBundle & ) = delete;

    #ifdef __HOSTBOOT_MODULE

    /** @return The Targeted Diagnostics controller. */
    MemTdCtlr<TARGETING::TYPE_MBA> * getTdCtlr()
    {
        if ( nullptr == iv_tdCtlr )
        {
            iv_tdCtlr = new MemTdCtlr<TARGETING::TYPE_MBA>{iv_chip};
        }

        return iv_tdCtlr;
    }

    #ifndef __HOSTBOOT_RUNTIME
    /** @return The IPL CE statistics object. */
    MemIplCeStats<TARGETING::TYPE_MBA> * getIplCeStats()
    {
        if ( nullptr == iv_iplCeStats )
        {
            iv_iplCeStats = new MemIplCeStats<TARGETING::TYPE_MBA>( iv_chip );
        }

        return iv_iplCeStats;
    }
    #endif

    #endif

  private: // instance variables

    /** The MBA chip associated with this data bundle. */
    ExtensibleChip * const iv_chip;

    #ifdef __HOSTBOOT_MODULE

    /** The Targeted Diagnostics controller. */
    MemTdCtlr<TARGETING::TYPE_MBA> * iv_tdCtlr = nullptr;

    #ifndef __HOSTBOOT_RUNTIME
    /** MNFG IPL CE statistics. */
    MemIplCeStats<TARGETING::TYPE_MBA> * iv_iplCeStats = nullptr;
    #endif

    #endif

  public: // instance variables

    MemUeTable iv_ueTable;                      ///< UE table for FFDC

    #if defined(__HOSTBOOT_MODULE) && !defined(__HOSTBOOT_RUNTIME)

    /** Super fast commands during Memory Diagnostics require a cleanup after
     *  the command has finished. After starting the command, we have to store
     *  the command object until we get the command complete attention. */
    mss_SuperFastRead * iv_sfCmd = nullptr;

    #endif
};

/**
 * @brief  Wrapper function for the MbaDataBundle.
 * @param  i_mbaChip The MBA chip.
 * @return This MBA's data bundle.
 */
inline MbaDataBundle * getMbaDataBundle( ExtensibleChip * i_mbaChip )
{
    return static_cast<MbaDataBundle *>(i_mbaChip->getDataBundle());
}

} // end namespace PRDF

#endif // __prdfCenMbaDataBundle_H

OpenPOWER on IntegriCloud