blob: 8d86acf6e97ce0bec24139fc905321dc0eec3c9c [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/**
Matt Spinler835a8692019-08-27 13:56:05 -050036 * @brief Find the desired entry in a PELValues table based on the
37 * field value.
38 *
39 * @param[in] value - the PEL value to find
40 * @param[in] fields - the PEL values table to use
41 *
42 * @return PELValues::const_iterator - an iterator to the table entry
43 */
44PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields);
45
46/**
47 * @brief Find the desired entry in a PELValues table based on the
48 * field message registry name.
49 *
50 * @param[in] name - the PEL message registry enum name
51 * @param[in] fields - the PEL values table to use
52 *
53 * @return PELValues::const_iterator - an iterator to the table entry
54 */
55PELValues::const_iterator findByName(const std::string& name,
56 const PELValues& fields);
57
58/**
59 * @brief The values for the 'subsystem' field in the User Header
60 */
61extern const PELValues subsystemValues;
62
63/**
64 * @brief The values for the 'severity' field in the User Header
65 */
66extern const PELValues severityValues;
67
68/**
69 * @brief The values for the 'Event Type' field in the User Header
70 */
71extern const PELValues eventTypeValues;
72
73/**
74 * @brief The values for the 'Event Scope' field in the User Header
75 */
76extern const PELValues eventScopeValues;
77
78/**
79 * @brief The values for the 'Action Flags' field in the User Header
80 */
81extern const PELValues actionFlagsValues;
82
83/**
84 * @brief The values for callout priorities in the SRC section
85 */
86extern const PELValues calloutPriorityValues;
87
Aatir186ce8c2019-10-20 15:13:39 -050088/**
89 * @brief Map for section IDs
90 */
91extern const std::map<std::string, std::string> sectionTitles;
92
Aatirc92b4eb2019-11-18 13:44:51 -060093/**
94 * @brief Map for creator IDs
95 */
96extern const std::map<std::string, std::string> creatorIDs;
97
Matt Spinler835a8692019-08-27 13:56:05 -050098} // namespace pel_values
99} // namespace pels
100} // namespace openpower