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
|
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/diag/prdf/common/plat/mem/prdfMemUeTable.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,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 __prdfMemUeTable_H
#define __prdfMemUeTable_H
/** @file prdfMemUeTable.H */
// Framework includes
#include <iipCaptureData.h>
#include <prdfExtensibleChip.H>
// Platform includes
#include <prdfMemAddress.H>
#include <prdfParserEnums.H>
// Other includes
#include <list>
namespace PRDF
{
/**
* @brief A table of memory UEs.
* @note Only one of these tables will exists per MBA/MCA.
* @note So far, this table is used only for FFDC.
*/
class MemUeTable
{
private: // constants, enums
/** @brief Table size limits. */
enum TableTHs
{
MAX_ENTRY_COUNT = 255, ///< Entry count threshold
};
public: // functions
/**
* @brief Constructor.
* @param i_chip MCA or MBA associated with this data.
*/
explicit MemUeTable( ExtensibleChip * i_chip ) :
iv_chip( i_chip )
{}
/**
* @brief Will attempt to add a new entry to the table.
* @note If an entry already exists, the entry's count is incremented and
* moved to the end of the queue.
* @param i_type See enum UE_TABLE::Type.
* @param i_addr The address in which the UE occurred.
*/
void addEntry( UE_TABLE::Type i_type, const MemAddr & i_addr );
/**
* @brief Gathers all table data to be stored in capture data.
* @param io_cd Capture data struct.
*/
void addCapData( CaptureData & io_cd );
private: // structs, typedefs
/** @brief Individual entries of iv_table. */
struct UeTableData
{
UE_TABLE::Type type; ///< See enum UE_TABLE::Type
MemAddr addr; ///< The address in which the UE occurred
uint8_t count; ///< Number of times the entry is detected
/** @brief Default constructor. */
UeTableData() {}
/**
* @brief Constructor from components.
* @param i_type See enum UE_TABLE::Type.
* @param i_addr The address in which the UE occurred.
*/
UeTableData( UE_TABLE::Type i_type, const MemAddr & i_addr ) :
type(i_type), addr(i_addr), count(1)
{}
/** An entry is equivalent if the type and address match. */
bool operator==( const UeTableData & i_data ) const
{
return ( this->type == i_data.type && this->addr == i_data.addr );
}
};
typedef std::list<UeTableData> UeTable;
private: // instance variables
ExtensibleChip * iv_chip; ///< MCA or MBA associated with this data.
/** A FIFO that stores the latest memory UE addresses and their types. This
* is not a pure FIFO, because if a new entry matches an existing entry,
* the existing entries count is incremented and it is moved to the end of
* the queue. However, if a new entry does not match an existing entry and
* the table is full, the oldest entry will be removed to make room for
* the new entry. */
UeTable iv_table;
};
} // end namespace PRDF
#endif // __prdfMemUeTable_H
|