summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/pel_values.hpp
blob: 2424c637198e446c0fe2188fd2fee27e177754ca (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
#pragma once

#include "pel_types.hpp"

#include <map>
#include <string>
#include <tuple>
#include <vector>

namespace openpower
{
namespace pels
{
namespace pel_values
{

// The actual value as it shows up in the PEL
const int fieldValuePos = 0;

// The name of the value as specified in the message registry
const int registryNamePos = 1;

// The description of the field, used by PEL parsers
const int descriptionPos = 2;

using PELFieldValue = std::tuple<uint32_t, const char*, const char*>;
using PELValues = std::vector<PELFieldValue>;

/**
 * @brief Helper function to get values from lookup tables.
 * @return std::string - the value
 * @param[in] uint8_t - field to get value for
 * @param[in] PELValues - lookup table
 */
std::string getValue(const uint8_t field, const pel_values::PELValues& values);

/**
 * @brief Helper function to get value vector from lookup tables.
 *
 * @param[in] value - the value to lookup
 * @param[in] table - lookup table
 *
 * @return std::vector<std::string> - the value vector
 */
std::vector<std::string> getValuesBitwise(uint16_t value,
                                          const pel_values::PELValues& table);
/**
 * @brief Find the desired entry in a PELValues table based on the
 *        field value.
 *
 * @param[in] value - the PEL value to find
 * @param[in] fields - the PEL values table to use
 *
 * @return PELValues::const_iterator - an iterator to the table entry
 */
PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields);

/**
 * @brief Find the desired entry in a PELValues table based on the
 *        field message registry name.
 *
 * @param[in] name - the PEL message registry enum name
 * @param[in] fields - the PEL values table to use
 *
 * @return PELValues::const_iterator - an iterator to the table entry
 */
PELValues::const_iterator findByName(const std::string& name,
                                     const PELValues& fields);

/**
 * @brief The values for the 'subsystem' field in the User Header
 */
extern const PELValues subsystemValues;

/**
 * @brief The values for the 'severity' field in the User Header
 */
extern const PELValues severityValues;

/**
 * @brief The values for the 'Event Type' field in the User Header
 */
extern const PELValues eventTypeValues;

/**
 * @brief The values for the 'Event Scope' field in the User Header
 */
extern const PELValues eventScopeValues;

/**
 * @brief The values for the 'Action Flags' field in the User Header
 */
extern const PELValues actionFlagsValues;

/**
 * @brief The values for callout priorities in the SRC section
 */
extern const PELValues calloutPriorityValues;

/**
 * @brief Map for section IDs
 */
extern const std::map<std::string, std::string> sectionTitles;

/**
 * @brief Map for creator IDs
 */
extern const std::map<std::string, std::string> creatorIDs;

/**
 * @brief Map for transmission states
 */
extern const std::map<TransmissionState, std::string> transmissionStates;

/**
 * @brief Map for Procedure Descriptions
 */
extern const std::map<std::string, std::string> procedureDesc;

/**
 * @brief Map for Callout Failing Component Types
 */
extern const std::map<uint8_t, std::string> failingComponentType;

/**
 * @brief Map for Boolean value
 */
extern const std::map<bool, std::string> boolString;

} // namespace pel_values
} // namespace pels
} // namespace openpower
OpenPOWER on IntegriCloud