blob: c5c67c59b8470497cb1cd2db06fd562418ff8757 [file] [log] [blame]
Alexander Hansen40fb5492025-10-28 17:56:12 +01001// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright 2019 IBM Corporation
3
Matt Spinler835a8692019-08-27 13:56:05 -05004#include "pel_values.hpp"
5
6#include <algorithm>
Matt Spinler578e0702020-03-13 09:40:43 -05007#include <cassert>
Matt Spinler835a8692019-08-27 13:56:05 -05008
9namespace openpower
10{
11namespace pels
12{
13namespace pel_values
14{
15
Matt Spinler835a8692019-08-27 13:56:05 -050016/**
17 * The possible values for the subsystem field in the User Header.
18 */
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080019const PELValues subsystemValues = {
Vijay Lobo242be742021-09-16 22:40:46 -050020 {0x10, "processor", "Processor"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080021 {0x11, "processor_fru", "Processor FRU"},
22 {0x12, "processor_chip", "Processor Chip Cache"},
23 {0x13, "processor_unit", "Processor Unit (CPU)"},
24 {0x14, "processor_bus", "Processor Bus Controller"},
Matt Spinler835a8692019-08-27 13:56:05 -050025
Matt Spinler70235fc2023-01-03 14:58:00 -060026 {0x20, "memory", "Memory"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080027 {0x21, "memory_ctlr", "Memory Controller"},
28 {0x22, "memory_bus", "Memory Bus Interface"},
29 {0x23, "memory_dimm", "Memory DIMM"},
30 {0x24, "memory_fru", "Memory Card/FRU"},
31 {0x25, "external_cache", "External Cache"},
Matt Spinler835a8692019-08-27 13:56:05 -050032
Vijay Lobo242be742021-09-16 22:40:46 -050033 {0x30, "io", "I/O"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080034 {0x31, "io_hub", "I/O Hub"},
35 {0x32, "io_bridge", "I/O Bridge"},
36 {0x33, "io_bus", "I/O bus interface"},
37 {0x34, "io_processor", "I/O Processor"},
38 {0x35, "io_hub_other", "SMA Hub"},
39 {0x38, "phb", "PCI Bridge Chip"},
Matt Spinler835a8692019-08-27 13:56:05 -050040
Vijay Lobo242be742021-09-16 22:40:46 -050041 {0x40, "io_adapter", "I/O Adapter"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080042 {0x41, "io_adapter_comm", "I/O Adapter Communication"},
Vijay Lobo242be742021-09-16 22:40:46 -050043 {0x46, "io_device", "I/O Device"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080044 {0x47, "io_device_dasd", "I/O Device Disk"},
45 {0x4C, "io_external_general", "I/O External Peripheral"},
46 {0x4D, "io_external_workstation",
47 "I/O External Peripheral Local Work Station"},
Vijay Lobo242be742021-09-16 22:40:46 -050048 {0x4E, "io_storage_mezz", "I/O Storage Mezza Expansion"},
Matt Spinler835a8692019-08-27 13:56:05 -050049
Vijay Lobo242be742021-09-16 22:40:46 -050050 {0x50, "cec_hardware", "CEC Hardware"},
51 {0x51, "cec_sp_a", "CEC Hardware - Service Processor A"},
52 {0x52, "cec_sp_b", "CEC Hardware - Service Processor B"},
53 {0x53, "cec_node_controller", "CEC Hardware - Node Controller"},
54 {0x55, "cec_vpd", "CEC Hardware - VPD Interface"},
55 {0x56, "cec_i2c", "CEC Hardware - I2C Devices"},
56 {0x57, "cec_chip_iface", "CEC Hardware - CEC Chip Interface"},
57 {0x58, "cec_clocks", "CEC Hardware - Clock"},
58 {0x59, "cec_op_panel", "CEC Hardware - Operator Panel"},
59 {0x5A, "cec_tod", "CEC Hardware - Time-Of-Day Hardware"},
60 {0x5B, "cec_storage_device", "CEC Hardware - Memory Device"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080061 {0x5C, "cec_sp_hyp_iface",
Vijay Lobo242be742021-09-16 22:40:46 -050062 "CEC Hardware - Hypervisor<->Service Processor Interface"},
63 {0x5D, "cec_service_network", "CEC Hardware - Service Network"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080064 {0x5E, "cec_sp_hostboot_iface",
Vijay Lobo242be742021-09-16 22:40:46 -050065 "CEC Hardware - Hostboot-Service Processor Interface"},
Matt Spinler835a8692019-08-27 13:56:05 -050066
Vijay Lobo242be742021-09-16 22:40:46 -050067 {0x60, "power", "Power/Cooling"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080068 {0x61, "power_supply", "Power Supply"},
69 {0x62, "power_control_hw", "Power Control Hardware"},
70 {0x63, "power_fans", "Fan (AMD)"},
Vijay Lobo242be742021-09-16 22:40:46 -050071 {0x64, "power_sequencer", "Digital Power Supply"},
Matt Spinler835a8692019-08-27 13:56:05 -050072
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080073 {0x70, "others", "Miscellaneous"},
Vijay Lobo242be742021-09-16 22:40:46 -050074 {0x71, "other_hmc", "HMC & Hardware"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080075 {0x72, "other_test_tool", "Test Tool"},
76 {0x73, "other_media", "Removable Media"},
77 {0x74, "other_multiple_subsystems", "Multiple Subsystems"},
78 {0x75, "other_na", "Not Applicable"},
79 {0x76, "other_info_src", "Miscellaneous"},
Matt Spinler835a8692019-08-27 13:56:05 -050080
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080081 {0x7A, "surv_hyp_lost_sp",
82 "Hypervisor lost communication with service processor"},
83 {0x7B, "surv_sp_lost_hyp",
84 "Service processor lost communication with Hypervisor"},
85 {0x7C, "surv_sp_lost_hmc", "Service processor lost communication with HMC"},
86 {0x7D, "surv_hmc_lost_lpar",
87 "HMC lost communication with logical partition"},
88 {0x7E, "surv_hmc_lost_bpa", "HMC lost communication with BPA"},
89 {0x7F, "surv_hmc_lost_hmc", "HMC lost communication with another HMC"},
Matt Spinler835a8692019-08-27 13:56:05 -050090
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080091 {0x80, "platform_firmware", "Platform Firmware"},
92 {0x81, "sp_firmware", "Service Processor Firmware"},
93 {0x82, "hyp_firmware", "System Hypervisor Firmware"},
94 {0x83, "partition_firmware", "Partition Firmware"},
95 {0x84, "slic_firmware", "SLIC Firmware"},
96 {0x85, "spcn_firmware", "System Power Control Network Firmware"},
97 {0x86, "bulk_power_firmware_side_a", "Bulk Power Firmware Side A"},
98 {0x87, "hmc_code_firmware", "HMC Code"},
99 {0x88, "bulk_power_firmware_side_b", "Bulk Power Firmware Side B"},
100 {0x89, "virtual_sp", "Virtual Service Processor Firmware"},
101 {0x8A, "hostboot", "HostBoot"},
102 {0x8B, "occ", "OCC"},
103 {0x8D, "bmc_firmware", "BMC Firmware"},
Matt Spinler835a8692019-08-27 13:56:05 -0500104
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800105 {0x90, "software", "Software"},
106 {0x91, "os_software", "Operating System software"},
107 {0x92, "xpf_software", "XPF software"},
108 {0x93, "app_software", "Application software"},
Matt Spinler835a8692019-08-27 13:56:05 -0500109
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800110 {0xA0, "ext_env", "External Environment"},
111 {0xA1, "input_power_source", "Input Power Source (ac)"},
112 {0xA2, "ambient_temp", "Room Ambient Temperature"},
113 {0xA3, "user_error", "User Error"},
114 {0xA4, "corrosion", "Corrosion"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500115
116/**
117 * The possible values for the severity field in the User Header.
118 */
119const PELValues severityValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800120 {0x00, "non_error", "Informational Event"},
Matt Spinler835a8692019-08-27 13:56:05 -0500121
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800122 {0x10, "recovered", "Recovered Error"},
123 {0x20, "predictive", "Predictive Error"},
124 {0x21, "predictive_degraded_perf",
125 "Predictive Error, Degraded Performance"},
126 {0x22, "predictive_reboot", "Predictive Error, Correctable"},
127 {0x23, "predictive_reboot_degraded",
128 "Predictive Error, Correctable, Degraded"},
129 {0x24, "predictive_redundancy_loss", "Predictive Error, Redundancy Lost"},
Matt Spinler835a8692019-08-27 13:56:05 -0500130
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800131 {0x40, "unrecoverable", "Unrecoverable Error"},
132 {0x41, "unrecoverable_degraded_perf",
133 "Unrecoverable Error, Degraded Performance"},
134 {0x44, "unrecoverable_redundancy_loss",
135 "Unrecoverable Error, Loss of Redundancy"},
136 {0x45, "unrecoverable_redundancy_loss_perf",
137 "Unrecoverable, Loss of Redundancy + Performance"},
138 {0x48, "unrecoverable_loss_of_function",
139 "Unrecoverable Error, Loss of Function"},
Matt Spinler835a8692019-08-27 13:56:05 -0500140
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800141 {0x50, "critical", "Critical Error, Scope of Failure unknown"},
142 {0x51, "critical_system_term", "Critical Error, System Termination"},
143 {0x52, "critical_imminent_failure",
144 "Critical Error, System Failure likely or imminent"},
145 {0x53, "critical_partition_term",
146 "Critical Error, Partition(s) Termination"},
147 {0x54, "critical_partition_imminent_failure",
148 "Critical Error, Partition(s) Failure likely or imminent"},
Matt Spinler835a8692019-08-27 13:56:05 -0500149
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800150 {0x60, "diagnostic_error", "Error detected during diagnostic test"},
151 {0x61, "diagnostic_error_incorrect_results",
152 "Diagostic error, resource w/incorrect results"},
Matt Spinler835a8692019-08-27 13:56:05 -0500153
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800154 {0x71, "symptom_recovered", "Symptom Recovered"},
155 {0x72, "symptom_predictive", "Symptom Predictive"},
156 {0x74, "symptom_unrecoverable", "Symptom Unrecoverable"},
157 {0x75, "symptom_critical", "Symptom Critical"},
158 {0x76, "symptom_diag_err", "Symptom Diag Err"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500159
160/**
161 * The possible values for the Event Type field in the User Header.
162 */
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800163const PELValues eventTypeValues = {
164 {0x00, "na", "Not Applicable"},
165 {0x01, "misc_information_only", "Miscellaneous, Informational Only"},
166 {0x02, "tracing_event", "Tracing Event"},
Matt Spinler6b3490a2021-01-20 10:48:26 -0600167 {0x08, "dump_notification", "Dump Notification"},
168 {0x30, "env_normal", "Customer environmental problem back to normal"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500169
170/**
171 * The possible values for the Event Scope field in the User Header.
172 */
173const PELValues eventScopeValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800174 {0x01, "single_partition", "Single Partition"},
175 {0x02, "multiple_partitions", "Multiple Partitions"},
176 {0x03, "entire_platform", "Entire Platform"},
177 {0x04, "possibly_multiple_platforms", "Multiple Platforms"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500178
179/**
180 * The possible values for the Action Flags field in the User Header.
181 */
182const PELValues actionFlagsValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800183 {0x8000, "service_action", "Service Action Required"},
184 {0x4000, "hidden", "Event not customer viewable"},
185 {0x2000, "report", "Report Externally"},
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800186 {0x1000, "dont_report", "Do Not Report To Hypervisor"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800187 {0x0800, "call_home", "HMC Call Home"},
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800188 {0x0400, "isolation_incomplete",
189 "Isolation Incomplete, further analysis required"},
harsh-agarwal199727162024-09-23 09:28:05 -0500190 {0x0100, "termination", "Service Processor Call Home Required"},
191 {0x0020, "heartbeat_call_home", "Heartbeat Call Home Event"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500192
193/**
194 * The possible values for the Callout Priority field in the SRC.
195 */
196const PELValues calloutPriorityValues = {
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800197 {0x48, "high", "Mandatory, replace all with this type as a unit"},
198 {0x4D, "medium", "Medium Priority"},
199 {0x41, "medium_group_a", "Medium Priority A, replace these as a group"},
200 {0x42, "medium_group_b", "Medium Priority B, replace these as a group"},
201 {0x43, "medium_group_c", "Medium Priority C, replace these as a group"},
202 {0x4C, "low", "Lowest priority replacement"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500203
Matt Spinler578e0702020-03-13 09:40:43 -0500204/**
Matt Spinlera27e2e52020-04-09 11:06:11 -0500205 * @brief Map of the registry names for the maintenance procedures
206 * to their actual names.
Matt Spinler578e0702020-03-13 09:40:43 -0500207 */
Matt Spinlera27e2e52020-04-09 11:06:11 -0500208const std::map<std::string, std::string> maintenanceProcedures = {
Jayanth Othayothf060bf02021-11-14 08:10:16 -0600209 {"bmc_code", "BMC0001"},
210 // Isolation not possible, please contact your next level of support
Jayanth Othayoth52dbaba2021-11-14 08:44:37 -0600211 {"next_level_support", "BMC0002"},
212 // Problem is in SBE code, upgrade your firmware
Jayanth Othayoth16f54952021-11-15 04:46:33 -0600213 {"sbe_code", "BMC0003"},
214 // Problem is somewhere in the FSI bus path
Brandon Wyman1ba9ef12021-11-15 23:58:06 +0000215 {"fsi_path", "BMC0004"},
216 // Problem is over-current PSU fault
Zane Shelleyef8e79c2022-03-10 10:51:44 -0600217 {"power_overcurrent", "BMC0005"},
218 // An unrecoverable event occurred, look for previous errors for the cause
219 {"find_sue_root_cause", "BMC0006"},
Priyanga Ramasamy134e1e12022-12-02 07:03:39 -0600220 // Correct system backplane VPD mismatch
221 {"system_vpd_correction", "BMC0007"},
Marri Devender Rao385446b2023-04-14 00:16:35 -0500222 // service reminder about the failed parts present in the system
223 {"detected_issue_need_service", "BMC0008"},
Zane Shelleyef8e79c2022-03-10 10:51:44 -0600224};
Matt Spinler578e0702020-03-13 09:40:43 -0500225
Matt Spinler2b6dfa02020-04-09 11:39:05 -0500226/**
227 * @brief Map of the registry names for the symbolic FRUs to their
228 * actual names.
229 */
230const std::map<std::string, std::string> symbolicFRUs = {
Matt Spinler6b3490a2021-01-20 10:48:26 -0600231 {"service_docs", "SVCDOCS"}, {"pwrsply", "PWRSPLY"},
232 {"air_mover", "AIRMOVR"}, {"pgood_part", "PGDPART"},
233 {"usb_pgood", "USBPGD"}, {"ambient_temp", "AMBTEMP"},
Jay Meyer54ff54e2021-03-14 20:18:41 -0500234 {"ambient_temp_back", "AMBBACK"}, {"ambient_perf_loss", "AMBPERF"},
Matt Spinlerdde99202021-06-14 12:15:59 -0600235 {"ac_module", "ACMODUL"}, {"fan_cable", "FANCBL"},
Jim Wrightace33db2022-04-19 14:33:37 -0500236 {"cable_continued", "CBLCONT"}, {"altitude", "ALTTUDE"},
Jim Wright9b779e42022-12-16 17:50:23 -0600237 {"pcie_hot_plug", "PCIEHP"}, {"overtemp", "OVERTMP"},
238 {"memory_dimm", "MEMDIMM"}};
Matt Spinler2b6dfa02020-04-09 11:39:05 -0500239
Matt Spinler835a8692019-08-27 13:56:05 -0500240PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields)
241{
242 return std::find_if(fields.begin(), fields.end(),
243 [value](const auto& entry) {
Patrick Williams075c7922024-08-16 15:19:49 -0400244 return value == std::get<fieldValuePos>(entry);
245 });
Matt Spinler835a8692019-08-27 13:56:05 -0500246}
247
248PELValues::const_iterator findByName(const std::string& name,
249 const PELValues& fields)
250
251{
252 return std::find_if(fields.begin(), fields.end(),
253 [&name](const auto& entry) {
Patrick Williams075c7922024-08-16 15:19:49 -0400254 return name == std::get<registryNamePos>(entry);
255 });
Matt Spinler835a8692019-08-27 13:56:05 -0500256}
257
Aatir186ce8c2019-10-20 15:13:39 -0500258/**
259 * @brief Map for section IDs
260 */
261const std::map<std::string, std::string> sectionTitles = {
Aatir186ce8c2019-10-20 15:13:39 -0500262 {"PH", "Private Header"},
263 {"UH", "User Header"},
264 {"PS", "Primary SRC"},
265 {"SS", "Secondary SRC"},
266 {"EH", "Extended User Header"},
267 {"MT", "Failing MTMS"},
268 {"DH", "Dump Location"},
269 {"SW", "Firmware Error"},
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800270 {"LP", "Impacted Partition"},
Aatir186ce8c2019-10-20 15:13:39 -0500271 {"LR", "Logical Resource"},
272 {"HM", "HMC ID"},
273 {"EP", "EPOW"},
274 {"IE", "IO Event"},
275 {"MI", "MFG Info"},
276 {"CH", "Call Home"},
277 {"UD", "User Data"},
278 {"EI", "Env Info"},
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800279 {"ED", "Extended User Data"}};
280
281/**
282 * @brief Map for Procedure Descriptions
283 */
284const std::map<std::string, std::string> procedureDesc = {{"TODO", "TODO"}};
285
286/**
287 * @brief Map for Callout Failing Component Types
288 */
289const std::map<uint8_t, std::string> failingComponentType = {
290 {0x10, "Normal Hardware FRU"},
291 {0x20, "Code FRU"},
292 {0x30, "Configuration error, configuration procedure required"},
293 {0x40, "Maintenance Procedure Required"},
294 {0x90, "External FRU"},
295 {0xA0, "External Code FRU"},
296 {0xB0, "Tool FRU"},
297 {0xC0, "Symbolic FRU"},
298 {0xE0, "Symbolic FRU with trusted location code"}};
299
300/**
301 * @brief Map for Boolean value
302 */
303const std::map<bool, std::string> boolString = {{true, "True"},
304 {false, "False"}};
Aatir186ce8c2019-10-20 15:13:39 -0500305
Aatirc92b4eb2019-11-18 13:44:51 -0600306/**
307 * @brief Map for creator IDs
308 */
309const std::map<std::string, std::string> creatorIDs = {
310
311 {"O", "BMC"}, {"C", "HMC"}, {"H", "PHYP"}, {"L", "Partition FW"},
312 {"S", "SLIC"}, {"B", "Hostboot"}, {"T", "OCC"}, {"M", "I/O Drawer"},
313 {"K", "Sapphire"}, {"P", "PowerNV"}};
314
Matt Spinler455587e2020-01-15 14:31:52 -0600315/**
316 * @brief Map for transmission states
317 */
318const std::map<TransmissionState, std::string> transmissionStates = {
319 {TransmissionState::newPEL, "Not Sent"},
320 {TransmissionState::badPEL, "Rejected"},
321 {TransmissionState::sent, "Sent"},
322 {TransmissionState::acked, "Acked"}};
323
Vijay Lobo593a4c62021-06-16 14:25:26 -0500324std::string getValue(const uint8_t field, const pel_values::PELValues& values,
325 const uint8_t position)
Aatir7b291ec2019-11-19 10:37:37 -0600326{
Aatir7b291ec2019-11-19 10:37:37 -0600327 auto tmp = pel_values::findByValue(field, values);
328 if (tmp != values.end())
329 {
Vijay Lobo593a4c62021-06-16 14:25:26 -0500330 if (position == pel_values::registryNamePos)
331 {
332 return std::get<pel_values::registryNamePos>(*tmp);
333 }
334 else
335 {
336 return std::get<pel_values::descriptionPos>(*tmp);
337 }
Aatir7b291ec2019-11-19 10:37:37 -0600338 }
339 else
340 {
341 return "invalid";
342 }
343}
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800344
345std::vector<std::string> getValuesBitwise(uint16_t value,
346 const pel_values::PELValues& table)
347{
348 std::vector<std::string> foundValues;
Patrick Williams075c7922024-08-16 15:19:49 -0400349 std::for_each(
350 table.begin(), table.end(), [&value, &foundValues](const auto& entry) {
351 if (value & std::get<fieldValuePos>(entry))
352 {
353 foundValues.push_back(std::get<descriptionPos>(entry));
354 }
355 });
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800356 return foundValues;
357}
Matt Spinler578e0702020-03-13 09:40:43 -0500358
Aatir186ce8c2019-10-20 15:13:39 -0500359} // namespace pel_values
Matt Spinler835a8692019-08-27 13:56:05 -0500360} // namespace pels
361} // namespace openpower