Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Matt Spinler | 455587e | 2020-01-15 14:31:52 -0600 | [diff] [blame] | 3 | #include "pel_types.hpp" |
| 4 | |
Matt Spinler | 81bc561 | 2023-06-01 16:48:19 -0500 | [diff] [blame] | 5 | #include <cstdint> |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 6 | #include <map> |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 7 | #include <string> |
| 8 | #include <tuple> |
| 9 | #include <vector> |
| 10 | |
| 11 | namespace openpower |
| 12 | { |
| 13 | namespace pels |
| 14 | { |
| 15 | namespace pel_values |
| 16 | { |
| 17 | |
| 18 | // The actual value as it shows up in the PEL |
| 19 | const int fieldValuePos = 0; |
| 20 | |
| 21 | // The name of the value as specified in the message registry |
| 22 | const int registryNamePos = 1; |
| 23 | |
| 24 | // The description of the field, used by PEL parsers |
| 25 | const int descriptionPos = 2; |
| 26 | |
| 27 | using PELFieldValue = std::tuple<uint32_t, const char*, const char*>; |
| 28 | using PELValues = std::vector<PELFieldValue>; |
| 29 | |
Harisuddin Mohamed Isa | bebeb94 | 2020-03-12 17:12:24 +0800 | [diff] [blame] | 30 | const std::string sectionVer = "Section Version"; |
| 31 | const std::string subSection = "Sub-section type"; |
| 32 | const std::string createdBy = "Created by"; |
| 33 | |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 34 | /** |
Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 35 | * @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 Lobo | 593a4c6 | 2021-06-16 14:25:26 -0500 | [diff] [blame] | 39 | * @param[in] uint8_t - position in the pel_values table to read |
Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 40 | */ |
Vijay Lobo | 593a4c6 | 2021-06-16 14:25:26 -0500 | [diff] [blame] | 41 | std::string getValue(const uint8_t field, const pel_values::PELValues& values, |
| 42 | const uint8_t position = pel_values::descriptionPos); |
Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 43 | |
| 44 | /** |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 45 | * @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 | */ |
| 52 | std::vector<std::string> getValuesBitwise(uint16_t value, |
| 53 | const pel_values::PELValues& table); |
| 54 | /** |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 55 | * @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 | */ |
| 63 | PELValues::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 | */ |
| 74 | PELValues::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 | */ |
| 80 | extern const PELValues subsystemValues; |
| 81 | |
| 82 | /** |
| 83 | * @brief The values for the 'severity' field in the User Header |
| 84 | */ |
| 85 | extern const PELValues severityValues; |
| 86 | |
| 87 | /** |
| 88 | * @brief The values for the 'Event Type' field in the User Header |
| 89 | */ |
| 90 | extern const PELValues eventTypeValues; |
| 91 | |
| 92 | /** |
| 93 | * @brief The values for the 'Event Scope' field in the User Header |
| 94 | */ |
| 95 | extern const PELValues eventScopeValues; |
| 96 | |
| 97 | /** |
| 98 | * @brief The values for the 'Action Flags' field in the User Header |
| 99 | */ |
| 100 | extern const PELValues actionFlagsValues; |
| 101 | |
| 102 | /** |
| 103 | * @brief The values for callout priorities in the SRC section |
| 104 | */ |
| 105 | extern const PELValues calloutPriorityValues; |
| 106 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 107 | /** |
| 108 | * @brief Map for section IDs |
| 109 | */ |
| 110 | extern const std::map<std::string, std::string> sectionTitles; |
| 111 | |
Aatir | c92b4eb | 2019-11-18 13:44:51 -0600 | [diff] [blame] | 112 | /** |
| 113 | * @brief Map for creator IDs |
| 114 | */ |
| 115 | extern const std::map<std::string, std::string> creatorIDs; |
| 116 | |
Matt Spinler | 455587e | 2020-01-15 14:31:52 -0600 | [diff] [blame] | 117 | /** |
| 118 | * @brief Map for transmission states |
| 119 | */ |
| 120 | extern const std::map<TransmissionState, std::string> transmissionStates; |
| 121 | |
Harisuddin Mohamed Isa | 0f717e1 | 2020-01-15 20:05:33 +0800 | [diff] [blame] | 122 | /** |
| 123 | * @brief Map for Procedure Descriptions |
| 124 | */ |
| 125 | extern const std::map<std::string, std::string> procedureDesc; |
| 126 | |
| 127 | /** |
| 128 | * @brief Map for Callout Failing Component Types |
| 129 | */ |
| 130 | extern const std::map<uint8_t, std::string> failingComponentType; |
| 131 | |
| 132 | /** |
| 133 | * @brief Map for Boolean value |
| 134 | */ |
| 135 | extern const std::map<bool, std::string> boolString; |
| 136 | |
Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 137 | /** |
Matt Spinler | a27e2e5 | 2020-04-09 11:06:11 -0500 | [diff] [blame] | 138 | * @brief Map for maintenance procedures |
Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 139 | */ |
Matt Spinler | a27e2e5 | 2020-04-09 11:06:11 -0500 | [diff] [blame] | 140 | extern const std::map<std::string, std::string> maintenanceProcedures; |
Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 141 | |
Matt Spinler | 2b6dfa0 | 2020-04-09 11:39:05 -0500 | [diff] [blame] | 142 | /** |
| 143 | * @brief Map for symbolic FRUs. |
| 144 | */ |
| 145 | extern const std::map<std::string, std::string> symbolicFRUs; |
| 146 | |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 147 | } // namespace pel_values |
| 148 | } // namespace pels |
| 149 | } // namespace openpower |