| Matt Spinler | 711d51d | 2019-11-06 09:36:51 -0600 | [diff] [blame] | 1 | /** | 
 | 2 |  * Copyright © 2019 IBM Corporation | 
 | 3 |  * | 
 | 4 |  * Licensed under the Apache License, Version 2.0 (the "License"); | 
 | 5 |  * you may not use this file except in compliance with the License. | 
 | 6 |  * You may obtain a copy of the License at | 
 | 7 |  * | 
 | 8 |  *     http://www.apache.org/licenses/LICENSE-2.0 | 
 | 9 |  * | 
 | 10 |  * Unless required by applicable law or agreed to in writing, software | 
 | 11 |  * distributed under the License is distributed on an "AS IS" BASIS, | 
 | 12 |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
 | 13 |  * See the License for the specific language governing permissions and | 
 | 14 |  * limitations under the License. | 
 | 15 |  */ | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 16 | #include "pel_values.hpp" | 
 | 17 |  | 
 | 18 | #include <algorithm> | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 19 | #include <cassert> | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 20 |  | 
 | 21 | namespace openpower | 
 | 22 | { | 
 | 23 | namespace pels | 
 | 24 | { | 
 | 25 | namespace pel_values | 
 | 26 | { | 
 | 27 |  | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 28 | /** | 
 | 29 |  * The possible values for the subsystem field  in the User Header. | 
 | 30 |  */ | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 31 | const PELValues subsystemValues = { | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 32 |     {0x10, "processor", "Processor"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 33 |     {0x11, "processor_fru", "Processor FRU"}, | 
 | 34 |     {0x12, "processor_chip", "Processor Chip Cache"}, | 
 | 35 |     {0x13, "processor_unit", "Processor Unit (CPU)"}, | 
 | 36 |     {0x14, "processor_bus", "Processor Bus Controller"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 37 |  | 
| Matt Spinler | 70235fc | 2023-01-03 14:58:00 -0600 | [diff] [blame] | 38 |     {0x20, "memory", "Memory"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 39 |     {0x21, "memory_ctlr", "Memory Controller"}, | 
 | 40 |     {0x22, "memory_bus", "Memory Bus Interface"}, | 
 | 41 |     {0x23, "memory_dimm", "Memory DIMM"}, | 
 | 42 |     {0x24, "memory_fru", "Memory Card/FRU"}, | 
 | 43 |     {0x25, "external_cache", "External Cache"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 44 |  | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 45 |     {0x30, "io", "I/O"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 46 |     {0x31, "io_hub", "I/O Hub"}, | 
 | 47 |     {0x32, "io_bridge", "I/O Bridge"}, | 
 | 48 |     {0x33, "io_bus", "I/O bus interface"}, | 
 | 49 |     {0x34, "io_processor", "I/O Processor"}, | 
 | 50 |     {0x35, "io_hub_other", "SMA Hub"}, | 
 | 51 |     {0x38, "phb", "PCI Bridge Chip"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 52 |  | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 53 |     {0x40, "io_adapter", "I/O Adapter"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 54 |     {0x41, "io_adapter_comm", "I/O Adapter Communication"}, | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 55 |     {0x46, "io_device", "I/O Device"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 56 |     {0x47, "io_device_dasd", "I/O Device Disk"}, | 
 | 57 |     {0x4C, "io_external_general", "I/O External Peripheral"}, | 
 | 58 |     {0x4D, "io_external_workstation", | 
 | 59 |      "I/O External Peripheral Local Work Station"}, | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 60 |     {0x4E, "io_storage_mezz", "I/O Storage Mezza Expansion"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 61 |  | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 62 |     {0x50, "cec_hardware", "CEC Hardware"}, | 
 | 63 |     {0x51, "cec_sp_a", "CEC Hardware - Service Processor A"}, | 
 | 64 |     {0x52, "cec_sp_b", "CEC Hardware - Service Processor B"}, | 
 | 65 |     {0x53, "cec_node_controller", "CEC Hardware - Node Controller"}, | 
 | 66 |     {0x55, "cec_vpd", "CEC Hardware - VPD Interface"}, | 
 | 67 |     {0x56, "cec_i2c", "CEC Hardware - I2C Devices"}, | 
 | 68 |     {0x57, "cec_chip_iface", "CEC Hardware - CEC Chip Interface"}, | 
 | 69 |     {0x58, "cec_clocks", "CEC Hardware - Clock"}, | 
 | 70 |     {0x59, "cec_op_panel", "CEC Hardware - Operator Panel"}, | 
 | 71 |     {0x5A, "cec_tod", "CEC Hardware - Time-Of-Day Hardware"}, | 
 | 72 |     {0x5B, "cec_storage_device", "CEC Hardware - Memory Device"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 73 |     {0x5C, "cec_sp_hyp_iface", | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 74 |      "CEC Hardware - Hypervisor<->Service Processor Interface"}, | 
 | 75 |     {0x5D, "cec_service_network", "CEC Hardware - Service Network"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 76 |     {0x5E, "cec_sp_hostboot_iface", | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 77 |      "CEC Hardware - Hostboot-Service Processor Interface"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 78 |  | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 79 |     {0x60, "power", "Power/Cooling"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 80 |     {0x61, "power_supply", "Power Supply"}, | 
 | 81 |     {0x62, "power_control_hw", "Power Control Hardware"}, | 
 | 82 |     {0x63, "power_fans", "Fan (AMD)"}, | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 83 |     {0x64, "power_sequencer", "Digital Power Supply"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 84 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 85 |     {0x70, "others", "Miscellaneous"}, | 
| Vijay Lobo | 242be74 | 2021-09-16 22:40:46 -0500 | [diff] [blame] | 86 |     {0x71, "other_hmc", "HMC & Hardware"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 87 |     {0x72, "other_test_tool", "Test Tool"}, | 
 | 88 |     {0x73, "other_media", "Removable Media"}, | 
 | 89 |     {0x74, "other_multiple_subsystems", "Multiple Subsystems"}, | 
 | 90 |     {0x75, "other_na", "Not Applicable"}, | 
 | 91 |     {0x76, "other_info_src", "Miscellaneous"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 92 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 93 |     {0x7A, "surv_hyp_lost_sp", | 
 | 94 |      "Hypervisor lost communication with service processor"}, | 
 | 95 |     {0x7B, "surv_sp_lost_hyp", | 
 | 96 |      "Service processor lost communication with Hypervisor"}, | 
 | 97 |     {0x7C, "surv_sp_lost_hmc", "Service processor lost communication with HMC"}, | 
 | 98 |     {0x7D, "surv_hmc_lost_lpar", | 
 | 99 |      "HMC lost communication with logical partition"}, | 
 | 100 |     {0x7E, "surv_hmc_lost_bpa", "HMC lost communication with BPA"}, | 
 | 101 |     {0x7F, "surv_hmc_lost_hmc", "HMC lost communication with another HMC"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 102 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 103 |     {0x80, "platform_firmware", "Platform Firmware"}, | 
 | 104 |     {0x81, "sp_firmware", "Service Processor Firmware"}, | 
 | 105 |     {0x82, "hyp_firmware", "System Hypervisor Firmware"}, | 
 | 106 |     {0x83, "partition_firmware", "Partition Firmware"}, | 
 | 107 |     {0x84, "slic_firmware", "SLIC Firmware"}, | 
 | 108 |     {0x85, "spcn_firmware", "System Power Control Network Firmware"}, | 
 | 109 |     {0x86, "bulk_power_firmware_side_a", "Bulk Power Firmware Side A"}, | 
 | 110 |     {0x87, "hmc_code_firmware", "HMC Code"}, | 
 | 111 |     {0x88, "bulk_power_firmware_side_b", "Bulk Power Firmware Side B"}, | 
 | 112 |     {0x89, "virtual_sp", "Virtual Service Processor Firmware"}, | 
 | 113 |     {0x8A, "hostboot", "HostBoot"}, | 
 | 114 |     {0x8B, "occ", "OCC"}, | 
 | 115 |     {0x8D, "bmc_firmware", "BMC Firmware"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 116 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 117 |     {0x90, "software", "Software"}, | 
 | 118 |     {0x91, "os_software", "Operating System software"}, | 
 | 119 |     {0x92, "xpf_software", "XPF software"}, | 
 | 120 |     {0x93, "app_software", "Application software"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 121 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 122 |     {0xA0, "ext_env", "External Environment"}, | 
 | 123 |     {0xA1, "input_power_source", "Input Power Source (ac)"}, | 
 | 124 |     {0xA2, "ambient_temp", "Room Ambient Temperature"}, | 
 | 125 |     {0xA3, "user_error", "User Error"}, | 
 | 126 |     {0xA4, "corrosion", "Corrosion"}}; | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 127 |  | 
 | 128 | /** | 
 | 129 |  * The possible values for the severity field in the User Header. | 
 | 130 |  */ | 
 | 131 | const PELValues severityValues = { | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 132 |     {0x00, "non_error", "Informational Event"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 133 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 134 |     {0x10, "recovered", "Recovered Error"}, | 
 | 135 |     {0x20, "predictive", "Predictive Error"}, | 
 | 136 |     {0x21, "predictive_degraded_perf", | 
 | 137 |      "Predictive Error, Degraded Performance"}, | 
 | 138 |     {0x22, "predictive_reboot", "Predictive Error, Correctable"}, | 
 | 139 |     {0x23, "predictive_reboot_degraded", | 
 | 140 |      "Predictive Error, Correctable, Degraded"}, | 
 | 141 |     {0x24, "predictive_redundancy_loss", "Predictive Error, Redundancy Lost"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 142 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 143 |     {0x40, "unrecoverable", "Unrecoverable Error"}, | 
 | 144 |     {0x41, "unrecoverable_degraded_perf", | 
 | 145 |      "Unrecoverable Error, Degraded Performance"}, | 
 | 146 |     {0x44, "unrecoverable_redundancy_loss", | 
 | 147 |      "Unrecoverable Error, Loss of Redundancy"}, | 
 | 148 |     {0x45, "unrecoverable_redundancy_loss_perf", | 
 | 149 |      "Unrecoverable, Loss of Redundancy + Performance"}, | 
 | 150 |     {0x48, "unrecoverable_loss_of_function", | 
 | 151 |      "Unrecoverable Error, Loss of Function"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 152 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 153 |     {0x50, "critical", "Critical Error, Scope of Failure unknown"}, | 
 | 154 |     {0x51, "critical_system_term", "Critical Error, System Termination"}, | 
 | 155 |     {0x52, "critical_imminent_failure", | 
 | 156 |      "Critical Error, System Failure likely or imminent"}, | 
 | 157 |     {0x53, "critical_partition_term", | 
 | 158 |      "Critical Error, Partition(s) Termination"}, | 
 | 159 |     {0x54, "critical_partition_imminent_failure", | 
 | 160 |      "Critical Error, Partition(s) Failure likely or imminent"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 161 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 162 |     {0x60, "diagnostic_error", "Error detected during diagnostic test"}, | 
 | 163 |     {0x61, "diagnostic_error_incorrect_results", | 
 | 164 |      "Diagostic error, resource w/incorrect results"}, | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 165 |  | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 166 |     {0x71, "symptom_recovered", "Symptom Recovered"}, | 
 | 167 |     {0x72, "symptom_predictive", "Symptom Predictive"}, | 
 | 168 |     {0x74, "symptom_unrecoverable", "Symptom Unrecoverable"}, | 
 | 169 |     {0x75, "symptom_critical", "Symptom Critical"}, | 
 | 170 |     {0x76, "symptom_diag_err", "Symptom Diag Err"}}; | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 171 |  | 
 | 172 | /** | 
 | 173 |  * The possible values for the Event Type field in the User Header. | 
 | 174 |  */ | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 175 | const PELValues eventTypeValues = { | 
 | 176 |     {0x00, "na", "Not Applicable"}, | 
 | 177 |     {0x01, "misc_information_only", "Miscellaneous, Informational Only"}, | 
 | 178 |     {0x02, "tracing_event", "Tracing Event"}, | 
| Matt Spinler | 6b3490a | 2021-01-20 10:48:26 -0600 | [diff] [blame] | 179 |     {0x08, "dump_notification", "Dump Notification"}, | 
 | 180 |     {0x30, "env_normal", "Customer environmental problem back to normal"}}; | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 181 |  | 
 | 182 | /** | 
 | 183 |  * The possible values for the Event Scope field in the User Header. | 
 | 184 |  */ | 
 | 185 | const PELValues eventScopeValues = { | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 186 |     {0x01, "single_partition", "Single Partition"}, | 
 | 187 |     {0x02, "multiple_partitions", "Multiple Partitions"}, | 
 | 188 |     {0x03, "entire_platform", "Entire Platform"}, | 
 | 189 |     {0x04, "possibly_multiple_platforms", "Multiple Platforms"}}; | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 190 |  | 
 | 191 | /** | 
 | 192 |  * The possible values for the Action Flags field in the User Header. | 
 | 193 |  */ | 
 | 194 | const PELValues actionFlagsValues = { | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 195 |     {0x8000, "service_action", "Service Action Required"}, | 
 | 196 |     {0x4000, "hidden", "Event not customer viewable"}, | 
 | 197 |     {0x2000, "report", "Report Externally"}, | 
| Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 198 |     {0x1000, "dont_report", "Do Not Report To Hypervisor"}, | 
| Harisuddin Mohamed Isa | 57a24e3 | 2019-12-09 16:14:38 +0800 | [diff] [blame] | 199 |     {0x0800, "call_home", "HMC Call Home"}, | 
| Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 200 |     {0x0400, "isolation_incomplete", | 
 | 201 |      "Isolation Incomplete, further analysis required"}, | 
| harsh-agarwal1 | 9972716 | 2024-09-23 09:28:05 -0500 | [diff] [blame] | 202 |     {0x0100, "termination", "Service Processor Call Home Required"}, | 
 | 203 |     {0x0020, "heartbeat_call_home", "Heartbeat Call Home Event"}}; | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 204 |  | 
 | 205 | /** | 
 | 206 |  * The possible values for the Callout Priority field in the SRC. | 
 | 207 |  */ | 
 | 208 | const PELValues calloutPriorityValues = { | 
| Harisuddin Mohamed Isa | 0f717e1 | 2020-01-15 20:05:33 +0800 | [diff] [blame] | 209 |     {0x48, "high", "Mandatory, replace all with this type as a unit"}, | 
 | 210 |     {0x4D, "medium", "Medium Priority"}, | 
 | 211 |     {0x41, "medium_group_a", "Medium Priority A, replace these as a group"}, | 
 | 212 |     {0x42, "medium_group_b", "Medium Priority B, replace these as a group"}, | 
 | 213 |     {0x43, "medium_group_c", "Medium Priority C, replace these as a group"}, | 
 | 214 |     {0x4C, "low", "Lowest priority replacement"}}; | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 215 |  | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 216 | /** | 
| Matt Spinler | a27e2e5 | 2020-04-09 11:06:11 -0500 | [diff] [blame] | 217 |  * @brief Map of the registry names for the maintenance procedures | 
 | 218 |  *        to their actual names. | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 219 |  */ | 
| Matt Spinler | a27e2e5 | 2020-04-09 11:06:11 -0500 | [diff] [blame] | 220 | const std::map<std::string, std::string> maintenanceProcedures = { | 
| Jayanth Othayoth | f060bf0 | 2021-11-14 08:10:16 -0600 | [diff] [blame] | 221 |     {"bmc_code", "BMC0001"}, | 
 | 222 |     // Isolation not possible, please contact your next level of support | 
| Jayanth Othayoth | 52dbaba | 2021-11-14 08:44:37 -0600 | [diff] [blame] | 223 |     {"next_level_support", "BMC0002"}, | 
 | 224 |     // Problem is in SBE code, upgrade your firmware | 
| Jayanth Othayoth | 16f5495 | 2021-11-15 04:46:33 -0600 | [diff] [blame] | 225 |     {"sbe_code", "BMC0003"}, | 
 | 226 |     // Problem is somewhere in the FSI bus path | 
| Brandon Wyman | 1ba9ef1 | 2021-11-15 23:58:06 +0000 | [diff] [blame] | 227 |     {"fsi_path", "BMC0004"}, | 
 | 228 |     // Problem is over-current PSU fault | 
| Zane Shelley | ef8e79c | 2022-03-10 10:51:44 -0600 | [diff] [blame] | 229 |     {"power_overcurrent", "BMC0005"}, | 
 | 230 |     // An unrecoverable event occurred, look for previous errors for the cause | 
 | 231 |     {"find_sue_root_cause", "BMC0006"}, | 
| Priyanga Ramasamy | 134e1e1 | 2022-12-02 07:03:39 -0600 | [diff] [blame] | 232 |     // Correct system backplane VPD mismatch | 
 | 233 |     {"system_vpd_correction", "BMC0007"}, | 
| Marri Devender Rao | 385446b | 2023-04-14 00:16:35 -0500 | [diff] [blame] | 234 |     // service reminder about the failed parts present in the system | 
 | 235 |     {"detected_issue_need_service", "BMC0008"}, | 
| Zane Shelley | ef8e79c | 2022-03-10 10:51:44 -0600 | [diff] [blame] | 236 | }; | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 237 |  | 
| Matt Spinler | 2b6dfa0 | 2020-04-09 11:39:05 -0500 | [diff] [blame] | 238 | /** | 
 | 239 |  * @brief Map of the registry names for the symbolic FRUs to their | 
 | 240 |  *        actual names. | 
 | 241 |  */ | 
 | 242 | const std::map<std::string, std::string> symbolicFRUs = { | 
| Matt Spinler | 6b3490a | 2021-01-20 10:48:26 -0600 | [diff] [blame] | 243 |     {"service_docs", "SVCDOCS"},      {"pwrsply", "PWRSPLY"}, | 
 | 244 |     {"air_mover", "AIRMOVR"},         {"pgood_part", "PGDPART"}, | 
 | 245 |     {"usb_pgood", "USBPGD"},          {"ambient_temp", "AMBTEMP"}, | 
| Jay Meyer | 54ff54e | 2021-03-14 20:18:41 -0500 | [diff] [blame] | 246 |     {"ambient_temp_back", "AMBBACK"}, {"ambient_perf_loss", "AMBPERF"}, | 
| Matt Spinler | dde9920 | 2021-06-14 12:15:59 -0600 | [diff] [blame] | 247 |     {"ac_module", "ACMODUL"},         {"fan_cable", "FANCBL"}, | 
| Jim Wright | ace33db | 2022-04-19 14:33:37 -0500 | [diff] [blame] | 248 |     {"cable_continued", "CBLCONT"},   {"altitude", "ALTTUDE"}, | 
| Jim Wright | 9b779e4 | 2022-12-16 17:50:23 -0600 | [diff] [blame] | 249 |     {"pcie_hot_plug", "PCIEHP"},      {"overtemp", "OVERTMP"}, | 
 | 250 |     {"memory_dimm", "MEMDIMM"}}; | 
| Matt Spinler | 2b6dfa0 | 2020-04-09 11:39:05 -0500 | [diff] [blame] | 251 |  | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 252 | PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields) | 
 | 253 | { | 
 | 254 |     return std::find_if(fields.begin(), fields.end(), | 
 | 255 |                         [value](const auto& entry) { | 
| Patrick Williams | 075c792 | 2024-08-16 15:19:49 -0400 | [diff] [blame] | 256 |                             return value == std::get<fieldValuePos>(entry); | 
 | 257 |                         }); | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 258 | } | 
 | 259 |  | 
 | 260 | PELValues::const_iterator findByName(const std::string& name, | 
 | 261 |                                      const PELValues& fields) | 
 | 262 |  | 
 | 263 | { | 
 | 264 |     return std::find_if(fields.begin(), fields.end(), | 
 | 265 |                         [&name](const auto& entry) { | 
| Patrick Williams | 075c792 | 2024-08-16 15:19:49 -0400 | [diff] [blame] | 266 |                             return name == std::get<registryNamePos>(entry); | 
 | 267 |                         }); | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 268 | } | 
 | 269 |  | 
| Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 270 | /** | 
 | 271 |  * @brief Map for section IDs | 
 | 272 |  */ | 
 | 273 | const std::map<std::string, std::string> sectionTitles = { | 
| Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 274 |     {"PH", "Private Header"}, | 
 | 275 |     {"UH", "User Header"}, | 
 | 276 |     {"PS", "Primary SRC"}, | 
 | 277 |     {"SS", "Secondary SRC"}, | 
 | 278 |     {"EH", "Extended User Header"}, | 
 | 279 |     {"MT", "Failing MTMS"}, | 
 | 280 |     {"DH", "Dump Location"}, | 
 | 281 |     {"SW", "Firmware Error"}, | 
| Harisuddin Mohamed Isa | 0f717e1 | 2020-01-15 20:05:33 +0800 | [diff] [blame] | 282 |     {"LP", "Impacted Partition"}, | 
| Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 283 |     {"LR", "Logical Resource"}, | 
 | 284 |     {"HM", "HMC ID"}, | 
 | 285 |     {"EP", "EPOW"}, | 
 | 286 |     {"IE", "IO Event"}, | 
 | 287 |     {"MI", "MFG Info"}, | 
 | 288 |     {"CH", "Call Home"}, | 
 | 289 |     {"UD", "User Data"}, | 
 | 290 |     {"EI", "Env Info"}, | 
| Harisuddin Mohamed Isa | 0f717e1 | 2020-01-15 20:05:33 +0800 | [diff] [blame] | 291 |     {"ED", "Extended User Data"}}; | 
 | 292 |  | 
 | 293 | /** | 
 | 294 |  * @brief Map for Procedure Descriptions | 
 | 295 |  */ | 
 | 296 | const std::map<std::string, std::string> procedureDesc = {{"TODO", "TODO"}}; | 
 | 297 |  | 
 | 298 | /** | 
 | 299 |  * @brief Map for Callout Failing Component Types | 
 | 300 |  */ | 
 | 301 | const std::map<uint8_t, std::string> failingComponentType = { | 
 | 302 |     {0x10, "Normal Hardware FRU"}, | 
 | 303 |     {0x20, "Code FRU"}, | 
 | 304 |     {0x30, "Configuration error, configuration procedure required"}, | 
 | 305 |     {0x40, "Maintenance Procedure Required"}, | 
 | 306 |     {0x90, "External FRU"}, | 
 | 307 |     {0xA0, "External Code FRU"}, | 
 | 308 |     {0xB0, "Tool FRU"}, | 
 | 309 |     {0xC0, "Symbolic FRU"}, | 
 | 310 |     {0xE0, "Symbolic FRU with trusted location code"}}; | 
 | 311 |  | 
 | 312 | /** | 
 | 313 |  * @brief Map for Boolean value | 
 | 314 |  */ | 
 | 315 | const std::map<bool, std::string> boolString = {{true, "True"}, | 
 | 316 |                                                 {false, "False"}}; | 
| Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 317 |  | 
| Aatir | c92b4eb | 2019-11-18 13:44:51 -0600 | [diff] [blame] | 318 | /** | 
 | 319 |  * @brief Map for creator IDs | 
 | 320 |  */ | 
 | 321 | const std::map<std::string, std::string> creatorIDs = { | 
 | 322 |  | 
 | 323 |     {"O", "BMC"},      {"C", "HMC"},      {"H", "PHYP"}, {"L", "Partition FW"}, | 
 | 324 |     {"S", "SLIC"},     {"B", "Hostboot"}, {"T", "OCC"},  {"M", "I/O Drawer"}, | 
 | 325 |     {"K", "Sapphire"}, {"P", "PowerNV"}}; | 
 | 326 |  | 
| Matt Spinler | 455587e | 2020-01-15 14:31:52 -0600 | [diff] [blame] | 327 | /** | 
 | 328 |  * @brief Map for transmission states | 
 | 329 |  */ | 
 | 330 | const std::map<TransmissionState, std::string> transmissionStates = { | 
 | 331 |     {TransmissionState::newPEL, "Not Sent"}, | 
 | 332 |     {TransmissionState::badPEL, "Rejected"}, | 
 | 333 |     {TransmissionState::sent, "Sent"}, | 
 | 334 |     {TransmissionState::acked, "Acked"}}; | 
 | 335 |  | 
| Vijay Lobo | 593a4c6 | 2021-06-16 14:25:26 -0500 | [diff] [blame] | 336 | std::string getValue(const uint8_t field, const pel_values::PELValues& values, | 
 | 337 |                      const uint8_t position) | 
| Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 338 | { | 
| Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 339 |     auto tmp = pel_values::findByValue(field, values); | 
 | 340 |     if (tmp != values.end()) | 
 | 341 |     { | 
| Vijay Lobo | 593a4c6 | 2021-06-16 14:25:26 -0500 | [diff] [blame] | 342 |         if (position == pel_values::registryNamePos) | 
 | 343 |         { | 
 | 344 |             return std::get<pel_values::registryNamePos>(*tmp); | 
 | 345 |         } | 
 | 346 |         else | 
 | 347 |         { | 
 | 348 |             return std::get<pel_values::descriptionPos>(*tmp); | 
 | 349 |         } | 
| Aatir | 7b291ec | 2019-11-19 10:37:37 -0600 | [diff] [blame] | 350 |     } | 
 | 351 |     else | 
 | 352 |     { | 
 | 353 |         return "invalid"; | 
 | 354 |     } | 
 | 355 | } | 
| Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 356 |  | 
 | 357 | std::vector<std::string> getValuesBitwise(uint16_t value, | 
 | 358 |                                           const pel_values::PELValues& table) | 
 | 359 | { | 
 | 360 |     std::vector<std::string> foundValues; | 
| Patrick Williams | 075c792 | 2024-08-16 15:19:49 -0400 | [diff] [blame] | 361 |     std::for_each( | 
 | 362 |         table.begin(), table.end(), [&value, &foundValues](const auto& entry) { | 
 | 363 |             if (value & std::get<fieldValuePos>(entry)) | 
 | 364 |             { | 
 | 365 |                 foundValues.push_back(std::get<descriptionPos>(entry)); | 
 | 366 |             } | 
 | 367 |         }); | 
| Harisuddin Mohamed Isa | 600d15a | 2019-12-20 12:42:26 +0800 | [diff] [blame] | 368 |     return foundValues; | 
 | 369 | } | 
| Matt Spinler | 578e070 | 2020-03-13 09:40:43 -0500 | [diff] [blame] | 370 |  | 
| Aatir | 186ce8c | 2019-10-20 15:13:39 -0500 | [diff] [blame] | 371 | } // namespace pel_values | 
| Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 372 | } // namespace pels | 
 | 373 | } // namespace openpower |