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 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 5 | #include <map> |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 6 | #include <string> |
| 7 | #include <tuple> |
| 8 | #include <vector> |
| 9 | |
| 10 | namespace openpower |
| 11 | { |
| 12 | namespace pels |
| 13 | { |
| 14 | namespace pel_values |
| 15 | { |
| 16 | |
| 17 | // The actual value as it shows up in the PEL |
| 18 | const int fieldValuePos = 0; |
| 19 | |
| 20 | // The name of the value as specified in the message registry |
| 21 | const int registryNamePos = 1; |
| 22 | |
| 23 | // The description of the field, used by PEL parsers |
| 24 | const int descriptionPos = 2; |
| 25 | |
| 26 | using PELFieldValue = std::tuple<uint32_t, const char*, const char*>; |
| 27 | using PELValues = std::vector<PELFieldValue>; |
| 28 | |
| 29 | /** |
Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 30 | * @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 | */ |
| 35 | std::string getValue(const uint8_t field, const pel_values::PELValues& values); |
| 36 | |
| 37 | /** |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 38 | * @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 | */ |
| 45 | std::vector<std::string> getValuesBitwise(uint16_t value, |
| 46 | const pel_values::PELValues& table); |
| 47 | /** |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 48 | * @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 | */ |
| 56 | PELValues::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 | */ |
| 67 | PELValues::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 | */ |
| 73 | extern const PELValues subsystemValues; |
| 74 | |
| 75 | /** |
| 76 | * @brief The values for the 'severity' field in the User Header |
| 77 | */ |
| 78 | extern const PELValues severityValues; |
| 79 | |
| 80 | /** |
| 81 | * @brief The values for the 'Event Type' field in the User Header |
| 82 | */ |
| 83 | extern const PELValues eventTypeValues; |
| 84 | |
| 85 | /** |
| 86 | * @brief The values for the 'Event Scope' field in the User Header |
| 87 | */ |
| 88 | extern const PELValues eventScopeValues; |
| 89 | |
| 90 | /** |
| 91 | * @brief The values for the 'Action Flags' field in the User Header |
| 92 | */ |
| 93 | extern const PELValues actionFlagsValues; |
| 94 | |
| 95 | /** |
| 96 | * @brief The values for callout priorities in the SRC section |
| 97 | */ |
| 98 | extern const PELValues calloutPriorityValues; |
| 99 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 100 | /** |
| 101 | * @brief Map for section IDs |
| 102 | */ |
| 103 | extern const std::map<std::string, std::string> sectionTitles; |
| 104 | |
Aatir | c92b4eb | 2019-11-18 13:44:51 -0600 | [diff] [blame] | 105 | /** |
| 106 | * @brief Map for creator IDs |
| 107 | */ |
| 108 | extern const std::map<std::string, std::string> creatorIDs; |
| 109 | |
Matt Spinler | 455587e | 2020-01-15 14:31:52 -0600 | [diff] [blame] | 110 | /** |
| 111 | * @brief Map for transmission states |
| 112 | */ |
| 113 | extern const std::map<TransmissionState, std::string> transmissionStates; |
| 114 | |
Harisuddin Mohamed Isa | 0f717e1 | 2020-01-15 20:05:33 +0800 | [diff] [blame] | 115 | /** |
| 116 | * @brief Map for Procedure Descriptions |
| 117 | */ |
| 118 | extern const std::map<std::string, std::string> procedureDesc; |
| 119 | |
| 120 | /** |
| 121 | * @brief Map for Callout Failing Component Types |
| 122 | */ |
| 123 | extern const std::map<uint8_t, std::string> failingComponentType; |
| 124 | |
| 125 | /** |
| 126 | * @brief Map for Boolean value |
| 127 | */ |
| 128 | extern const std::map<bool, std::string> boolString; |
| 129 | |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 130 | } // namespace pel_values |
| 131 | } // namespace pels |
| 132 | } // namespace openpower |