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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/htmgt/htmgt_utility.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2015 */
/* [+] 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 HTMGT_UTILITY_H
#define HTMGT_UTILITY_H
#include <stdint.h>
#include <trace/interface.H>
#include <errl/errlmanager.H>
#include "htmgt_occcmd.H"
#define TMGT_DBG( _fmt_, _args_...) \
TRACDCOMP( g_trac_htmgt, "D>" _fmt_, ##_args_ )
#define TMGT_INF( _fmt_, _args_...) \
TRACFCOMP( g_trac_htmgt, _fmt_, ##_args_ )
#define TMGT_WRN( _fmt_, _args_...) \
TRACFCOMP( g_trac_htmgt, "W>" _fmt_, ##_args_ )
#define TMGT_ERR( _fmt_, _args_...) \
TRACFCOMP( g_trac_htmgt, "E>" _fmt_, ##_args_ )
#define TMGT_DBG_BIN( _fmt_, _args_...) \
TRACDBIN( g_trac_htmgt, "D>" _fmt_, ##_args_ )
#define TMGT_BIN( _fmt_, _args_...) \
TRACFBIN( g_trac_htmgt, _fmt_, ##_args_ )
#ifndef __HOSTBOOT_RUNTIME
#define TMGT_CONSOLE( _fmt_, _args_...) \
CONSOLE::displayf( HTMGT_COMP_NAME, _fmt_, ##_args_ )
#else
#define TMGT_CONSOLE(_fmt_, _args_...)
#endif
inline uint16_t UINT16_GET(const uint8_t * i_ptr)
{
return (*i_ptr) << 8 | *(i_ptr+1);
}
inline uint32_t UINT32_GET(const uint8_t * i_ptr)
{
return (UINT16_GET(i_ptr) << 16) | UINT16_GET(i_ptr + 2);
}
inline void UINT16_PUT(uint8_t * i_ptr, uint16_t i_value)
{
*i_ptr = (uint8_t) (i_value >> 8);
*(i_ptr + 1) = (uint8_t) (i_value);
}
inline void UINT32_PUT(uint8_t * i_ptr, uint32_t i_value)
{
*i_ptr = (uint8_t)(i_value >> 24);
*(i_ptr + 1) = (uint8_t)(i_value >> 16);
*(i_ptr + 2) = (uint8_t)(i_value >> 8);
*(i_ptr + 3) = (uint8_t)(i_value);
}
namespace HTMGT
{
// Trace definition
extern trace_desc_t* g_trac_htmgt;
// Debug flags
extern uint32_t G_debug_data;
enum debugTraceTypes
{
// Types are bit flags so can enable multiple at once
DEBUG_TRACE_OFF = 0x00,
DEBUG_TRACE_OCCCMD = 0x01, // OCC command tracing
DEBUG_TRACE_OCCCMD_FULL = 0x02, // full OCC command tracing
DEBUG_TRACE_FULL_NONVERBOSE = 0x7FFFFFFF,
DEBUG_TRACE_VERBOSE = 0x80000000, // verbose tracing
DEBUG_TRACE_FULL = 0xFFFFFFFF
};
extern uint32_t G_debug_trace;
enum tmgtElogSubsecTypes
{
// Values selected to be common with FSP from tmgt_elog_parser.H
//SUBSEC_MSG_DATA_TYPE = 0x01,
//SUBSEC_ERROR_DATA_TYPE = 0x06,
//SUBSEC_ENERGYSCALE_DATA_TYPE = 0x08,
//SUBSEC_OCC_ELOG_DATA_TYPE = 0x0A,
//SUBSEC_OCC_FFDC_DATA_TYPE = 0x0B,
SUBSEC_ADDITIONAL_SRC = 0x0C,
SUBSEC_OCC_CMD_DATA = 0x0D,
SUBSEC_OCC_RSP_DATA = 0x0E,
//SUBSEC_ELOG_TYPE_TOIF_RESET = 0x10,
//SUBSEC_ELOG_TYPE_OCC_RESET = 0x11,
//SUBSEC_ELOG_TYPE_PCAP_DATA = 0x12,
//SUBSEC_ELOG_TYPE_THERMAL_DATA = 0x13,
//SUBSEC_PROC_SCOM_REGISTERS = 0x14,
// 0xE0-0xEF are reserved for OCC Exceptions
};
/**
* @brief Create/Build an Error log and add HTMGT component trace
*
* @param[in,out] io_err Error handle to use or NULL to create new handle
* @param[in] i_modid Module ID
* @param[in] i_rc Return Code
* @param[in] i_data1 User data word 1
* @param[in] i_data2 User data word 2
* @param[in] i_data3 User data word 3
* @param[in] i_data4 User data word 4
* @param[in] i_sev Error severity
* @param[in] i_addFwCallout true if a FW Callout should be added
*/
void bldErrLog(errlHndl_t & io_err,
const uint8_t i_modid,
const uint16_t i_rc,
const uint32_t i_data1 = 0,
const uint32_t i_data2 = 0,
const uint32_t i_data3 = 0,
const uint32_t i_data4 = 0,
const ERRORLOG::errlSeverity_t i_sev =
ERRORLOG::ERRL_SEV_INFORMATIONAL,
const bool i_addFwCallout = false);
/**
* @brief Internal utility to convert OCC command type to a string
*
* @param[in] i_cmd OCC command type
*
* @return text string description of command
*/
const char *command_string(const uint8_t i_cmd);
/**
* Helper function to return the DIMM number as the OCC sees it.
* There can be 8 DIMMs per Centaur.
*
* @param i_mba - the MBA the DIMM is on
* @param i_dimm - the DIMM
* @return - a number 0-7
*/
uint8_t getOCCDIMMPos(const TARGETING::TargetHandle_t i_mba,
const TARGETING::TargetHandle_t i_dimm);
/**
* @brief Internal utility function to convert the OCC state to a string
*
* @param[in] i_state - OCC state
*
* @return text string description of state
*/
const char *state_string(const uint8_t i_state);
} // end namespace
#endif
|