blob: 5f8b8525949f94b29a2b59142b08714684a459f8 [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
Harisuddin Mohamed Isabebeb942020-03-12 17:12:24 +080029const std::string sectionVer = "Section Version";
30const std::string subSection = "Sub-section type";
31const std::string createdBy = "Created by";
32
Matt Spinler835a8692019-08-27 13:56:05 -050033/**
Aatir7b291ec2019-11-19 10:37:37 -060034 * @brief Helper function to get values from lookup tables.
35 * @return std::string - the value
36 * @param[in] uint8_t - field to get value for
37 * @param[in] PELValues - lookup table
38 */
39std::string getValue(const uint8_t field, const pel_values::PELValues& values);
40
41/**
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +080042 * @brief Helper function to get value vector from lookup tables.
43 *
44 * @param[in] value - the value to lookup
45 * @param[in] table - lookup table
46 *
47 * @return std::vector<std::string> - the value vector
48 */
49std::vector<std::string> getValuesBitwise(uint16_t value,
50 const pel_values::PELValues& table);
51/**
Matt Spinler835a8692019-08-27 13:56:05 -050052 * @brief Find the desired entry in a PELValues table based on the
53 * field value.
54 *
55 * @param[in] value - the PEL value to find
56 * @param[in] fields - the PEL values table to use
57 *
58 * @return PELValues::const_iterator - an iterator to the table entry
59 */
60PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields);
61
62/**
63 * @brief Find the desired entry in a PELValues table based on the
64 * field message registry name.
65 *
66 * @param[in] name - the PEL message registry enum name
67 * @param[in] fields - the PEL values table to use
68 *
69 * @return PELValues::const_iterator - an iterator to the table entry
70 */
71PELValues::const_iterator findByName(const std::string& name,
72 const PELValues& fields);
73
74/**
75 * @brief The values for the 'subsystem' field in the User Header
76 */
77extern const PELValues subsystemValues;
78
79/**
80 * @brief The values for the 'severity' field in the User Header
81 */
82extern const PELValues severityValues;
83
84/**
85 * @brief The values for the 'Event Type' field in the User Header
86 */
87extern const PELValues eventTypeValues;
88
89/**
90 * @brief The values for the 'Event Scope' field in the User Header
91 */
92extern const PELValues eventScopeValues;
93
94/**
95 * @brief The values for the 'Action Flags' field in the User Header
96 */
97extern const PELValues actionFlagsValues;
98
99/**
100 * @brief The values for callout priorities in the SRC section
101 */
102extern const PELValues calloutPriorityValues;
103
Aatir186ce8c2019-10-20 15:13:39 -0500104/**
105 * @brief Map for section IDs
106 */
107extern const std::map<std::string, std::string> sectionTitles;
108
Aatirc92b4eb2019-11-18 13:44:51 -0600109/**
110 * @brief Map for creator IDs
111 */
112extern const std::map<std::string, std::string> creatorIDs;
113
Matt Spinler455587e2020-01-15 14:31:52 -0600114/**
115 * @brief Map for transmission states
116 */
117extern const std::map<TransmissionState, std::string> transmissionStates;
118
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800119/**
120 * @brief Map for Procedure Descriptions
121 */
122extern const std::map<std::string, std::string> procedureDesc;
123
124/**
125 * @brief Map for Callout Failing Component Types
126 */
127extern const std::map<uint8_t, std::string> failingComponentType;
128
129/**
130 * @brief Map for Boolean value
131 */
132extern const std::map<bool, std::string> boolString;
133
Matt Spinler578e0702020-03-13 09:40:43 -0500134/**
Matt Spinlera27e2e52020-04-09 11:06:11 -0500135 * @brief Map for maintenance procedures
Matt Spinler578e0702020-03-13 09:40:43 -0500136 */
Matt Spinlera27e2e52020-04-09 11:06:11 -0500137extern const std::map<std::string, std::string> maintenanceProcedures;
Matt Spinler578e0702020-03-13 09:40:43 -0500138
Matt Spinler2b6dfa02020-04-09 11:39:05 -0500139/**
140 * @brief Map for symbolic FRUs.
141 */
142extern const std::map<std::string, std::string> symbolicFRUs;
143
Matt Spinler835a8692019-08-27 13:56:05 -0500144} // namespace pel_values
145} // namespace pels
146} // namespace openpower