blob: 2424c637198e446c0fe2188fd2fee27e177754ca [file] [log] [blame]
Matt Spinler835a8692019-08-27 13:56:05 -05001#pragma once
2
Matt Spinler455587e2020-01-15 14:31:52 -06003#include "pel_types.hpp"
4
Aatir186ce8c2019-10-20 15:13:39 -05005#include <map>
Matt Spinler835a8692019-08-27 13:56:05 -05006#include <string>
7#include <tuple>
8#include <vector>
9
10namespace openpower
11{
12namespace pels
13{
14namespace pel_values
15{
16
17// The actual value as it shows up in the PEL
18const int fieldValuePos = 0;
19
20// The name of the value as specified in the message registry
21const int registryNamePos = 1;
22
23// The description of the field, used by PEL parsers
24const int descriptionPos = 2;
25
26using PELFieldValue = std::tuple<uint32_t, const char*, const char*>;
27using PELValues = std::vector<PELFieldValue>;
28
29/**
Aatir7b291ec2019-11-19 10:37:37 -060030 * @brief Helper function to get values from lookup tables.
31 * @return std::string - the value
32 * @param[in] uint8_t - field to get value for
33 * @param[in] PELValues - lookup table
34 */
35std::string getValue(const uint8_t field, const pel_values::PELValues& values);
36
37/**
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +080038 * @brief Helper function to get value vector from lookup tables.
39 *
40 * @param[in] value - the value to lookup
41 * @param[in] table - lookup table
42 *
43 * @return std::vector<std::string> - the value vector
44 */
45std::vector<std::string> getValuesBitwise(uint16_t value,
46 const pel_values::PELValues& table);
47/**
Matt Spinler835a8692019-08-27 13:56:05 -050048 * @brief Find the desired entry in a PELValues table based on the
49 * field value.
50 *
51 * @param[in] value - the PEL value to find
52 * @param[in] fields - the PEL values table to use
53 *
54 * @return PELValues::const_iterator - an iterator to the table entry
55 */
56PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields);
57
58/**
59 * @brief Find the desired entry in a PELValues table based on the
60 * field message registry name.
61 *
62 * @param[in] name - the PEL message registry enum name
63 * @param[in] fields - the PEL values table to use
64 *
65 * @return PELValues::const_iterator - an iterator to the table entry
66 */
67PELValues::const_iterator findByName(const std::string& name,
68 const PELValues& fields);
69
70/**
71 * @brief The values for the 'subsystem' field in the User Header
72 */
73extern const PELValues subsystemValues;
74
75/**
76 * @brief The values for the 'severity' field in the User Header
77 */
78extern const PELValues severityValues;
79
80/**
81 * @brief The values for the 'Event Type' field in the User Header
82 */
83extern const PELValues eventTypeValues;
84
85/**
86 * @brief The values for the 'Event Scope' field in the User Header
87 */
88extern const PELValues eventScopeValues;
89
90/**
91 * @brief The values for the 'Action Flags' field in the User Header
92 */
93extern const PELValues actionFlagsValues;
94
95/**
96 * @brief The values for callout priorities in the SRC section
97 */
98extern const PELValues calloutPriorityValues;
99
Aatir186ce8c2019-10-20 15:13:39 -0500100/**
101 * @brief Map for section IDs
102 */
103extern const std::map<std::string, std::string> sectionTitles;
104
Aatirc92b4eb2019-11-18 13:44:51 -0600105/**
106 * @brief Map for creator IDs
107 */
108extern const std::map<std::string, std::string> creatorIDs;
109
Matt Spinler455587e2020-01-15 14:31:52 -0600110/**
111 * @brief Map for transmission states
112 */
113extern const std::map<TransmissionState, std::string> transmissionStates;
114
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800115/**
116 * @brief Map for Procedure Descriptions
117 */
118extern const std::map<std::string, std::string> procedureDesc;
119
120/**
121 * @brief Map for Callout Failing Component Types
122 */
123extern const std::map<uint8_t, std::string> failingComponentType;
124
125/**
126 * @brief Map for Boolean value
127 */
128extern const std::map<bool, std::string> boolString;
129
Matt Spinler835a8692019-08-27 13:56:05 -0500130} // namespace pel_values
131} // namespace pels
132} // namespace openpower