| 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 |  | 
| Harisuddin Mohamed Isa | bebeb94 | 2020-03-12 17:12:24 +0800 | [diff] [blame] | 29 | const std::string sectionVer = "Section Version"; | 
 | 30 | const std::string subSection = "Sub-section type"; | 
 | 31 | const std::string createdBy = "Created by"; | 
 | 32 |  | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 33 | /** | 
| Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 34 |  * @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 | 
| Vijay Lobo | 593a4c6 | 2021-06-16 14:25:26 -0500 | [diff] [blame] | 38 |  * @param[in] uint8_t - position in the pel_values table to read | 
| Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 39 |  */ | 
| Vijay Lobo | 593a4c6 | 2021-06-16 14:25:26 -0500 | [diff] [blame] | 40 | std::string getValue(const uint8_t field, const pel_values::PELValues& values, | 
 | 41 |                      const uint8_t position = pel_values::descriptionPos); | 
| Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 42 |  | 
 | 43 | /** | 
| Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 44 |  * @brief Helper function to get value vector from lookup tables. | 
 | 45 |  * | 
 | 46 |  * @param[in] value - the value to lookup | 
 | 47 |  * @param[in] table - lookup table | 
 | 48 |  * | 
 | 49 |  * @return std::vector<std::string> - the value vector | 
 | 50 |  */ | 
 | 51 | std::vector<std::string> getValuesBitwise(uint16_t value, | 
 | 52 |                                           const pel_values::PELValues& table); | 
 | 53 | /** | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 54 |  * @brief Find the desired entry in a PELValues table based on the | 
 | 55 |  *        field value. | 
 | 56 |  * | 
 | 57 |  * @param[in] value - the PEL value to find | 
 | 58 |  * @param[in] fields - the PEL values table to use | 
 | 59 |  * | 
 | 60 |  * @return PELValues::const_iterator - an iterator to the table entry | 
 | 61 |  */ | 
 | 62 | PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields); | 
 | 63 |  | 
 | 64 | /** | 
 | 65 |  * @brief Find the desired entry in a PELValues table based on the | 
 | 66 |  *        field message registry name. | 
 | 67 |  * | 
 | 68 |  * @param[in] name - the PEL message registry enum name | 
 | 69 |  * @param[in] fields - the PEL values table to use | 
 | 70 |  * | 
 | 71 |  * @return PELValues::const_iterator - an iterator to the table entry | 
 | 72 |  */ | 
 | 73 | PELValues::const_iterator findByName(const std::string& name, | 
 | 74 |                                      const PELValues& fields); | 
 | 75 |  | 
 | 76 | /** | 
 | 77 |  * @brief The values for the 'subsystem' field in the User Header | 
 | 78 |  */ | 
 | 79 | extern const PELValues subsystemValues; | 
 | 80 |  | 
 | 81 | /** | 
 | 82 |  * @brief The values for the 'severity' field in the User Header | 
 | 83 |  */ | 
 | 84 | extern const PELValues severityValues; | 
 | 85 |  | 
 | 86 | /** | 
 | 87 |  * @brief The values for the 'Event Type' field in the User Header | 
 | 88 |  */ | 
 | 89 | extern const PELValues eventTypeValues; | 
 | 90 |  | 
 | 91 | /** | 
 | 92 |  * @brief The values for the 'Event Scope' field in the User Header | 
 | 93 |  */ | 
 | 94 | extern const PELValues eventScopeValues; | 
 | 95 |  | 
 | 96 | /** | 
 | 97 |  * @brief The values for the 'Action Flags' field in the User Header | 
 | 98 |  */ | 
 | 99 | extern const PELValues actionFlagsValues; | 
 | 100 |  | 
 | 101 | /** | 
 | 102 |  * @brief The values for callout priorities in the SRC section | 
 | 103 |  */ | 
 | 104 | extern const PELValues calloutPriorityValues; | 
 | 105 |  | 
| Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 106 | /** | 
 | 107 |  * @brief Map for section IDs | 
 | 108 |  */ | 
 | 109 | extern const std::map<std::string, std::string> sectionTitles; | 
 | 110 |  | 
| Aatir | c92b4eb | 2019-11-18 13:44:51 -0600 | [diff] [blame] | 111 | /** | 
 | 112 |  * @brief Map for creator IDs | 
 | 113 |  */ | 
 | 114 | extern const std::map<std::string, std::string> creatorIDs; | 
 | 115 |  | 
| Matt Spinler | 455587e | 2020-01-15 14:31:52 -0600 | [diff] [blame] | 116 | /** | 
 | 117 |  * @brief Map for transmission states | 
 | 118 |  */ | 
 | 119 | extern const std::map<TransmissionState, std::string> transmissionStates; | 
 | 120 |  | 
| Harisuddin Mohamed Isa | 0f717e1 | 2020-01-15 20:05:33 +0800 | [diff] [blame] | 121 | /** | 
 | 122 |  * @brief Map for Procedure Descriptions | 
 | 123 |  */ | 
 | 124 | extern const std::map<std::string, std::string> procedureDesc; | 
 | 125 |  | 
 | 126 | /** | 
 | 127 |  * @brief Map for Callout Failing Component Types | 
 | 128 |  */ | 
 | 129 | extern const std::map<uint8_t, std::string> failingComponentType; | 
 | 130 |  | 
 | 131 | /** | 
 | 132 |  * @brief Map for Boolean value | 
 | 133 |  */ | 
 | 134 | extern const std::map<bool, std::string> boolString; | 
 | 135 |  | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 136 | /** | 
| Matt Spinler | a27e2e5 | 2020-04-09 11:06:11 -0500 | [diff] [blame] | 137 |  * @brief Map for maintenance procedures | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 138 |  */ | 
| Matt Spinler | a27e2e5 | 2020-04-09 11:06:11 -0500 | [diff] [blame] | 139 | extern const std::map<std::string, std::string> maintenanceProcedures; | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 140 |  | 
| Matt Spinler | 2b6dfa0 | 2020-04-09 11:39:05 -0500 | [diff] [blame] | 141 | /** | 
 | 142 |  * @brief Map for symbolic FRUs. | 
 | 143 |  */ | 
 | 144 | extern const std::map<std::string, std::string> symbolicFRUs; | 
 | 145 |  | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 146 | } // namespace pel_values | 
 | 147 | } // namespace pels | 
 | 148 | } // namespace openpower |