summaryrefslogtreecommitdiffstats
path: root/src/usr/isteps/tod/TodUtils.H
blob: 3ddd6998ca60d786f40f32c81e8938526521c331 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/isteps/tod/TodUtils.H $                               */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2010,2017                        */
/* [+] 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 __TOD_HOSTBOOT_H
#define __TOD_HOSTBOOT_H


#include <attributeenums.H>
#include <errl/errlentry.H>
#include <fapi2.H>
#include "TodTrace.H"
#include <util/utilmem.H>

//FIX_ME_BEFORE_PRODUCTION_Q12 Update these

//moved from mboxclientlib.H
/** @enum mboxTodTopologyAction
 *        Values used to determine whether to enable, disable or switch TOD
 *        topologies.
 */
enum mboxTodTopologyAction
{
    MBOX_DISABLE_TOPOLOGY        = 0,
    MBOX_ENABLE_TOPOLOGY         = 1,
    MBOX_SWITCH_TOPOLOGY         = 99
};  // end mboxTodTopologyAction

/** @enum mboxTopologyValue
 *        Values used to determine whether to enable, disable or switch TOD
 *        topologies.
 */
enum mboxTopologyValue
{
    MBOX_PRIMARY_TOPOLOGY        = 0,
    MBOX_SECONDARY_TOPOLOGY      = 1
};  // end mboxTopologyValue

/**
 * Retrieve the CLASS of the target, or return NA if the target is NULL
 */
#define GETCLASS(pTarget) (((pTarget) == NULL) ? (TARGETING::CLASS_NA) : \
        ((pTarget)->getAttr<TARGETING::ATTR_CLASS>()))

/**
 *  * Retrieve the TYPE of the target, or return NA if the target is NULL
 *   */
#define GETTYPE(pTarget) (((pTarget) == NULL) ? (TARGETING::TYPE_NA) : \
        ((pTarget)->getAttr<TARGETING::ATTR_TYPE>()))


namespace TOD
{

struct maxConfigParams
{
    uint8_t max_procchips_per_node; // This will contain the maximum proc
                                    // chips per Node available on the system
    uint8_t max_exs_per_procchip;   // This will contain the maximum cores per
                                    // proc chip on the system
    uint8_t max_dimms_per_mbaport;  // This will contain the maximum dimms per
                                    // MBA Port available on the system
    uint8_t max_mbaports_per_mba;   // This will contain the maximum MBA Ports
                                    // per MBA available on the system
    uint8_t max_mbas_per_membuf;    // This will contain the maximum MBA per
                                    // Memory Buffer available on the system
    uint8_t max_psilinks_per_fsp;   // This will contain the maximum psi links
                                    // per fsp which is same on all Systems
    uint8_t min_psilinks_per_fsp;   // This will contain minimum number of psi
                                    // links per fsp present in the system
    uint8_t max_chiplets_per_proc;  // This will contain the maximum chiplets
                                    // per proc available on the System
    uint8_t max_mcs_per_sys;        // This will contain max mcs
                                    // present in the system
    uint8_t max_compute_nodes_per_sys; // This will contain max compute
                                       // nodes present in the system
    uint8_t max_exs_per_procchip_archlimit; // This will contain max
                                            // Architecture limit of max exs
                                            // per proc chip

    /**
    * @brief Copies the data from maxConfigParams structure into the buffer
    * @par  Detailed Description
    * Copies the data from maxConfigParams structure into the buffer
    *
    * @param[out] o_utilBuf
    * Output buffer in which the data from the structure will be copied
    * This buffer will be cleared and data will be written from beginning of
    * the stream. After the data is updated ,the buffer pointer will be
    * pointing to the end of the inserted data
    *
    * @return Error log handle indicating the status of the request
    *
    * @retval NULL  Successfully copied the data from maxConfigParams structure
    *                into the buffer
    * @retval !NULL Failed to copy the data from maxConfigParams structure
    *               into the buffer
    *
    * Error log handle points to a valid error log object whose
    * primary SRC reason code (pError->getSRC()->reasonCode()) indicates
    * the type of error.
    *
    *  @note It is up to the caller to change the severity of the
    *      returned error based on what it decides to do with it. By
    *      default any returned error created by this function will be a
    *      non-reported tracing event error log.
    *
    */

    errlHndl_t flatten(UtilMem& o_utilBuf )const ;


    /**
    * @brief Copies the data from the input buffer to the maxConfigParams
    * structure
    * @par  Detailed Description
    * Copies the data from the input buffer to the maxConfigParams
    * structure
    *
    * @param[in] i_utilBuf
    * Input buffer from  which the data will be copied to the structure
    * @note Input buffer must contain only the maxConfigParams info and
    * the buffer pointer must be pointing to index 0 of the buffer.
    * The call will not alter any error in the existing input stream
    *
    * @return Error log handle indicating the status of the request
    *
    * @retval NULL  Successfully copied the data from buffer into the
    *               maxConfigParams structure
    * @retval !NULL Failed to copy the data from buffer into the
    *               maxConfigParams structure
    *
    * Error log handle points to a valid error log object whose
    * primary SRC reason code (pError->getSRC()->reasonCode()) indicates
    * the type of error.
    *
    *  @note It is up to the caller to change the severity of the
    *      returned error based on what it decides to do with it. By
    *      default any returned error created by this function will be a
    *      non-reported tracing event error log.
    *
    *
    */

    errlHndl_t unflatten(const  UtilMem& i_utilBuf);


    /**
    * @brief Returns the Size of data which is held in the maxConfigParams
    * structure
    * @par  Detailed Description
    * Returns the size of data which is held in the maxConfigParams structure
    *
    *
    * @return
    * Returns the size of data which is held in the maxConfigParams structure
    */

    uint32_t flattenSize(void) const;
};

typedef maxConfigParams maxConfigParamsContainer;


errlHndl_t getMaxConfigParams(maxConfigParamsContainer& o_maxConfigParams);

#define GETHUID(pTarget) (((pTarget) == NULL) ? (0) : \
        ((pTarget)->getAttr<TARGETING::ATTR_HUID>()))

//moved from fapi_sbe_common.H
#define CONST_UINT64_T(name, expr) const uint64_t name = (expr);
#define ULL(x) x##ull
//moved from p8_scom_addresses.H
CONST_UINT64_T( TOD_PSS_MSS_STATUS_REG_00040008       , ULL(0x00040008) );

//******************************************************************************
// isFunctional
//******************************************************************************

bool isFunctional(const TARGETING::Target* i_pTarget);


//moved from TodSvcUtil.C from open powervm p8
//******************************************************************************
// todGetScom
//******************************************************************************
errlHndl_t todGetScom(const TARGETING::Target * i_target,
                      const uint64_t i_address,
                      fapi2::variable_buffer & o_data);
}// end of namespace

#endif //end of .H file
OpenPOWER on IntegriCloud