blob: 9a1ed88e66ad6765cd70ebea4d71fab815697e63 [file] [log] [blame]
Matt Spinler835a8692019-08-27 13:56:05 -05001#pragma once
2
Aatir186ce8c2019-10-20 15:13:39 -05003#include <map>
Matt Spinler835a8692019-08-27 13:56:05 -05004#include <string>
5#include <tuple>
6#include <vector>
7
8namespace openpower
9{
10namespace pels
11{
12namespace pel_values
13{
14
15// The actual value as it shows up in the PEL
16const int fieldValuePos = 0;
17
18// The name of the value as specified in the message registry
19const int registryNamePos = 1;
20
21// The description of the field, used by PEL parsers
22const int descriptionPos = 2;
23
24using PELFieldValue = std::tuple<uint32_t, const char*, const char*>;
25using PELValues = std::vector<PELFieldValue>;
26
27/**
Aatir7b291ec2019-11-19 10:37:37 -060028 * @brief Helper function to get values from lookup tables.
29 * @return std::string - the value
30 * @param[in] uint8_t - field to get value for
31 * @param[in] PELValues - lookup table
32 */
33std::string getValue(const uint8_t field, const pel_values::PELValues& values);
34
35/**
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +080036 * @brief Helper function to get value vector from lookup tables.
37 *
38 * @param[in] value - the value to lookup
39 * @param[in] table - lookup table
40 *
41 * @return std::vector<std::string> - the value vector
42 */
43std::vector<std::string> getValuesBitwise(uint16_t value,
44 const pel_values::PELValues& table);
45/**
Matt Spinler835a8692019-08-27 13:56:05 -050046 * @brief Find the desired entry in a PELValues table based on the
47 * field value.
48 *
49 * @param[in] value - the PEL value to find
50 * @param[in] fields - the PEL values table to use
51 *
52 * @return PELValues::const_iterator - an iterator to the table entry
53 */
54PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields);
55
56/**
57 * @brief Find the desired entry in a PELValues table based on the
58 * field message registry name.
59 *
60 * @param[in] name - the PEL message registry enum name
61 * @param[in] fields - the PEL values table to use
62 *
63 * @return PELValues::const_iterator - an iterator to the table entry
64 */
65PELValues::const_iterator findByName(const std::string& name,
66 const PELValues& fields);
67
68/**
69 * @brief The values for the 'subsystem' field in the User Header
70 */
71extern const PELValues subsystemValues;
72
73/**
74 * @brief The values for the 'severity' field in the User Header
75 */
76extern const PELValues severityValues;
77
78/**
79 * @brief The values for the 'Event Type' field in the User Header
80 */
81extern const PELValues eventTypeValues;
82
83/**
84 * @brief The values for the 'Event Scope' field in the User Header
85 */
86extern const PELValues eventScopeValues;
87
88/**
89 * @brief The values for the 'Action Flags' field in the User Header
90 */
91extern const PELValues actionFlagsValues;
92
93/**
94 * @brief The values for callout priorities in the SRC section
95 */
96extern const PELValues calloutPriorityValues;
97
Aatir186ce8c2019-10-20 15:13:39 -050098/**
99 * @brief Map for section IDs
100 */
101extern const std::map<std::string, std::string> sectionTitles;
102
Aatirc92b4eb2019-11-18 13:44:51 -0600103/**
104 * @brief Map for creator IDs
105 */
106extern const std::map<std::string, std::string> creatorIDs;
107
Matt Spinler835a8692019-08-27 13:56:05 -0500108} // namespace pel_values
109} // namespace pels
110} // namespace openpower