blob: 16556f3025a020eb4645ec0e812a7489d3cd2b77 [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
Matt Spinler81bc5612023-06-01 16:48:19 -05005#include <cstdint>
Aatir186ce8c2019-10-20 15:13:39 -05006#include <map>
Matt Spinler835a8692019-08-27 13:56:05 -05007#include <string>
8#include <tuple>
9#include <vector>
10
11namespace openpower
12{
13namespace pels
14{
15namespace pel_values
16{
17
18// The actual value as it shows up in the PEL
19const int fieldValuePos = 0;
20
21// The name of the value as specified in the message registry
22const int registryNamePos = 1;
23
24// The description of the field, used by PEL parsers
25const int descriptionPos = 2;
26
27using PELFieldValue = std::tuple<uint32_t, const char*, const char*>;
28using PELValues = std::vector<PELFieldValue>;
29
Harisuddin Mohamed Isabebeb942020-03-12 17:12:24 +080030const std::string sectionVer = "Section Version";
31const std::string subSection = "Sub-section type";
32const std::string createdBy = "Created by";
33
Matt Spinler835a8692019-08-27 13:56:05 -050034/**
Aatir7b291ec2019-11-19 10:37:37 -060035 * @brief Helper function to get values from lookup tables.
36 * @return std::string - the value
37 * @param[in] uint8_t - field to get value for
38 * @param[in] PELValues - lookup table
Vijay Lobo593a4c62021-06-16 14:25:26 -050039 * @param[in] uint8_t - position in the pel_values table to read
Aatir7b291ec2019-11-19 10:37:37 -060040 */
Vijay Lobo593a4c62021-06-16 14:25:26 -050041std::string getValue(const uint8_t field, const pel_values::PELValues& values,
42 const uint8_t position = pel_values::descriptionPos);
Aatir7b291ec2019-11-19 10:37:37 -060043
44/**
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +080045 * @brief Helper function to get value vector from lookup tables.
46 *
47 * @param[in] value - the value to lookup
48 * @param[in] table - lookup table
49 *
50 * @return std::vector<std::string> - the value vector
51 */
52std::vector<std::string> getValuesBitwise(uint16_t value,
53 const pel_values::PELValues& table);
54/**
Matt Spinler835a8692019-08-27 13:56:05 -050055 * @brief Find the desired entry in a PELValues table based on the
56 * field value.
57 *
58 * @param[in] value - the PEL value to find
59 * @param[in] fields - the PEL values table to use
60 *
61 * @return PELValues::const_iterator - an iterator to the table entry
62 */
63PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields);
64
65/**
66 * @brief Find the desired entry in a PELValues table based on the
67 * field message registry name.
68 *
69 * @param[in] name - the PEL message registry enum name
70 * @param[in] fields - the PEL values table to use
71 *
72 * @return PELValues::const_iterator - an iterator to the table entry
73 */
74PELValues::const_iterator findByName(const std::string& name,
75 const PELValues& fields);
76
77/**
78 * @brief The values for the 'subsystem' field in the User Header
79 */
80extern const PELValues subsystemValues;
81
82/**
83 * @brief The values for the 'severity' field in the User Header
84 */
85extern const PELValues severityValues;
86
87/**
88 * @brief The values for the 'Event Type' field in the User Header
89 */
90extern const PELValues eventTypeValues;
91
92/**
93 * @brief The values for the 'Event Scope' field in the User Header
94 */
95extern const PELValues eventScopeValues;
96
97/**
98 * @brief The values for the 'Action Flags' field in the User Header
99 */
100extern const PELValues actionFlagsValues;
101
102/**
103 * @brief The values for callout priorities in the SRC section
104 */
105extern const PELValues calloutPriorityValues;
106
Aatir186ce8c2019-10-20 15:13:39 -0500107/**
108 * @brief Map for section IDs
109 */
110extern const std::map<std::string, std::string> sectionTitles;
111
Aatirc92b4eb2019-11-18 13:44:51 -0600112/**
113 * @brief Map for creator IDs
114 */
115extern const std::map<std::string, std::string> creatorIDs;
116
Matt Spinler455587e2020-01-15 14:31:52 -0600117/**
118 * @brief Map for transmission states
119 */
120extern const std::map<TransmissionState, std::string> transmissionStates;
121
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800122/**
123 * @brief Map for Procedure Descriptions
124 */
125extern const std::map<std::string, std::string> procedureDesc;
126
127/**
128 * @brief Map for Callout Failing Component Types
129 */
130extern const std::map<uint8_t, std::string> failingComponentType;
131
132/**
133 * @brief Map for Boolean value
134 */
135extern const std::map<bool, std::string> boolString;
136
Matt Spinler578e0702020-03-13 09:40:43 -0500137/**
Matt Spinlera27e2e52020-04-09 11:06:11 -0500138 * @brief Map for maintenance procedures
Matt Spinler578e0702020-03-13 09:40:43 -0500139 */
Matt Spinlera27e2e52020-04-09 11:06:11 -0500140extern const std::map<std::string, std::string> maintenanceProcedures;
Matt Spinler578e0702020-03-13 09:40:43 -0500141
Matt Spinler2b6dfa02020-04-09 11:39:05 -0500142/**
143 * @brief Map for symbolic FRUs.
144 */
145extern const std::map<std::string, std::string> symbolicFRUs;
146
Matt Spinler835a8692019-08-27 13:56:05 -0500147} // namespace pel_values
148} // namespace pels
149} // namespace openpower