Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 3 | #include <map> |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 4 | #include <string> |
| 5 | #include <tuple> |
| 6 | #include <vector> |
| 7 | |
| 8 | namespace openpower |
| 9 | { |
| 10 | namespace pels |
| 11 | { |
| 12 | namespace pel_values |
| 13 | { |
| 14 | |
| 15 | // The actual value as it shows up in the PEL |
| 16 | const int fieldValuePos = 0; |
| 17 | |
| 18 | // The name of the value as specified in the message registry |
| 19 | const int registryNamePos = 1; |
| 20 | |
| 21 | // The description of the field, used by PEL parsers |
| 22 | const int descriptionPos = 2; |
| 23 | |
| 24 | using PELFieldValue = std::tuple<uint32_t, const char*, const char*>; |
| 25 | using PELValues = std::vector<PELFieldValue>; |
| 26 | |
| 27 | /** |
Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 28 | * @brief Helper function to get values from lookup tables. |
| 29 | * @return std::string - the value |
| 30 | * @param[in] uint8_t - field to get value for |
| 31 | * @param[in] PELValues - lookup table |
| 32 | */ |
| 33 | std::string getValue(const uint8_t field, const pel_values::PELValues& values); |
| 34 | |
| 35 | /** |
Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 36 | * @brief Helper function to get value vector from lookup tables. |
| 37 | * |
| 38 | * @param[in] value - the value to lookup |
| 39 | * @param[in] table - lookup table |
| 40 | * |
| 41 | * @return std::vector<std::string> - the value vector |
| 42 | */ |
| 43 | std::vector<std::string> getValuesBitwise(uint16_t value, |
| 44 | const pel_values::PELValues& table); |
| 45 | /** |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 46 | * @brief Find the desired entry in a PELValues table based on the |
| 47 | * field value. |
| 48 | * |
| 49 | * @param[in] value - the PEL value to find |
| 50 | * @param[in] fields - the PEL values table to use |
| 51 | * |
| 52 | * @return PELValues::const_iterator - an iterator to the table entry |
| 53 | */ |
| 54 | PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields); |
| 55 | |
| 56 | /** |
| 57 | * @brief Find the desired entry in a PELValues table based on the |
| 58 | * field message registry name. |
| 59 | * |
| 60 | * @param[in] name - the PEL message registry enum name |
| 61 | * @param[in] fields - the PEL values table to use |
| 62 | * |
| 63 | * @return PELValues::const_iterator - an iterator to the table entry |
| 64 | */ |
| 65 | PELValues::const_iterator findByName(const std::string& name, |
| 66 | const PELValues& fields); |
| 67 | |
| 68 | /** |
| 69 | * @brief The values for the 'subsystem' field in the User Header |
| 70 | */ |
| 71 | extern const PELValues subsystemValues; |
| 72 | |
| 73 | /** |
| 74 | * @brief The values for the 'severity' field in the User Header |
| 75 | */ |
| 76 | extern const PELValues severityValues; |
| 77 | |
| 78 | /** |
| 79 | * @brief The values for the 'Event Type' field in the User Header |
| 80 | */ |
| 81 | extern const PELValues eventTypeValues; |
| 82 | |
| 83 | /** |
| 84 | * @brief The values for the 'Event Scope' field in the User Header |
| 85 | */ |
| 86 | extern const PELValues eventScopeValues; |
| 87 | |
| 88 | /** |
| 89 | * @brief The values for the 'Action Flags' field in the User Header |
| 90 | */ |
| 91 | extern const PELValues actionFlagsValues; |
| 92 | |
| 93 | /** |
| 94 | * @brief The values for callout priorities in the SRC section |
| 95 | */ |
| 96 | extern const PELValues calloutPriorityValues; |
| 97 | |
Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 98 | /** |
| 99 | * @brief Map for section IDs |
| 100 | */ |
| 101 | extern const std::map<std::string, std::string> sectionTitles; |
| 102 | |
Aatir | c92b4eb | 2019-11-18 13:44:51 -0600 | [diff] [blame] | 103 | /** |
| 104 | * @brief Map for creator IDs |
| 105 | */ |
| 106 | extern const std::map<std::string, std::string> creatorIDs; |
| 107 | |
Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 108 | } // namespace pel_values |
| 109 | } // namespace pels |
| 110 | } // namespace openpower |