blob: cb001506d6682c27aa04d382700a5dfa82061f96 [file] [log] [blame]
Matt Spinler711d51d2019-11-06 09:36:51 -06001/**
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 Spinler835a8692019-08-27 13:56:05 -050016#include "pel_values.hpp"
17
18#include <algorithm>
19
20namespace openpower
21{
22namespace pels
23{
24namespace pel_values
25{
26
27// Note: The description fields will be filled in as part of the
28// PEL parser work.
29
30/**
31 * The possible values for the subsystem field in the User Header.
32 */
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080033const PELValues subsystemValues = {
34 {0x10, "processor", "Processor Subsystem"},
35 {0x11, "processor_fru", "Processor FRU"},
36 {0x12, "processor_chip", "Processor Chip Cache"},
37 {0x13, "processor_unit", "Processor Unit (CPU)"},
38 {0x14, "processor_bus", "Processor Bus Controller"},
Matt Spinler835a8692019-08-27 13:56:05 -050039
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080040 {0x20, "memory", "Memory Subsystem"},
41 {0x21, "memory_ctlr", "Memory Controller"},
42 {0x22, "memory_bus", "Memory Bus Interface"},
43 {0x23, "memory_dimm", "Memory DIMM"},
44 {0x24, "memory_fru", "Memory Card/FRU"},
45 {0x25, "external_cache", "External Cache"},
Matt Spinler835a8692019-08-27 13:56:05 -050046
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080047 {0x30, "io", "I/O Subsystem"},
48 {0x31, "io_hub", "I/O Hub"},
49 {0x32, "io_bridge", "I/O Bridge"},
50 {0x33, "io_bus", "I/O bus interface"},
51 {0x34, "io_processor", "I/O Processor"},
52 {0x35, "io_hub_other", "SMA Hub"},
53 {0x38, "phb", "PCI Bridge Chip"},
Matt Spinler835a8692019-08-27 13:56:05 -050054
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080055 {0x40, "io_adapter", "I/O Adapter Subsystem"},
56 {0x41, "io_adapter_comm", "I/O Adapter Communication"},
57 {0x46, "io_device", "I/O Device Subsystem"},
58 {0x47, "io_device_dasd", "I/O Device Disk"},
59 {0x4C, "io_external_general", "I/O External Peripheral"},
60 {0x4D, "io_external_workstation",
61 "I/O External Peripheral Local Work Station"},
62 {0x4E, "io_storage_mezz", "I/O Storage Mezza Expansion Subsystem"},
Matt Spinler835a8692019-08-27 13:56:05 -050063
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080064 {0x50, "cec_hardware", "CEC Hardware Subsystem"},
65 {0x51, "cec_sp_a", "CEC Hardware: Service Processor A"},
66 {0x52, "cec_sp_b", "CEC Hardware: Service Processor B"},
67 {0x53, "cec_node_controller", "CEC Hardware: Node Controller"},
68 {0x55, "cec_vpd", "CEC Hardware: VPD Interface"},
69 {0x56, "cec_i2c", "CEC Hardware: I2C Devices"},
70 {0x57, "cec_chip_iface", "CEC Hardware: CEC Chip Interface"},
71 {0x58, "cec_clocks", "CEC Hardware: Clock"},
72 {0x59, "cec_op_panel", "CEC Hardware: Operator Panel"},
73 {0x5A, "cec_tod", "CEC Hardware: Time-Of-Day Hardware"},
74 {0x5B, "cec_storage_device", "CEC Hardware: Memory Device"},
75 {0x5C, "cec_sp_hyp_iface",
76 "CEC Hardware: Hypervisor-Service Processor Interface"},
77 {0x5D, "cec_service_network", "CEC Hardware: Service Network"},
78 {0x5E, "cec_sp_hostboot_iface",
79 "CEC Hardware: Hostboot-Service Processor Interface"},
Matt Spinler835a8692019-08-27 13:56:05 -050080
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080081 {0x60, "power", "Power/Cooling Subsystem"},
82 {0x61, "power_supply", "Power Supply"},
83 {0x62, "power_control_hw", "Power Control Hardware"},
84 {0x63, "power_fans", "Fan (AMD)"},
85 {0x64, "power_sequencer", "Digital Power Supply Subsystem"},
Matt Spinler835a8692019-08-27 13:56:05 -050086
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080087 {0x70, "others", "Miscellaneous"},
88 {0x71, "other_hmc", "HMC Subsystem & Hardware"},
89 {0x72, "other_test_tool", "Test Tool"},
90 {0x73, "other_media", "Removable Media"},
91 {0x74, "other_multiple_subsystems", "Multiple Subsystems"},
92 {0x75, "other_na", "Not Applicable"},
93 {0x76, "other_info_src", "Miscellaneous"},
Matt Spinler835a8692019-08-27 13:56:05 -050094
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080095 {0x7A, "surv_hyp_lost_sp",
96 "Hypervisor lost communication with service processor"},
97 {0x7B, "surv_sp_lost_hyp",
98 "Service processor lost communication with Hypervisor"},
99 {0x7C, "surv_sp_lost_hmc", "Service processor lost communication with HMC"},
100 {0x7D, "surv_hmc_lost_lpar",
101 "HMC lost communication with logical partition"},
102 {0x7E, "surv_hmc_lost_bpa", "HMC lost communication with BPA"},
103 {0x7F, "surv_hmc_lost_hmc", "HMC lost communication with another HMC"},
Matt Spinler835a8692019-08-27 13:56:05 -0500104
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800105 {0x80, "platform_firmware", "Platform Firmware"},
106 {0x81, "sp_firmware", "Service Processor Firmware"},
107 {0x82, "hyp_firmware", "System Hypervisor Firmware"},
108 {0x83, "partition_firmware", "Partition Firmware"},
109 {0x84, "slic_firmware", "SLIC Firmware"},
110 {0x85, "spcn_firmware", "System Power Control Network Firmware"},
111 {0x86, "bulk_power_firmware_side_a", "Bulk Power Firmware Side A"},
112 {0x87, "hmc_code_firmware", "HMC Code"},
113 {0x88, "bulk_power_firmware_side_b", "Bulk Power Firmware Side B"},
114 {0x89, "virtual_sp", "Virtual Service Processor Firmware"},
115 {0x8A, "hostboot", "HostBoot"},
116 {0x8B, "occ", "OCC"},
117 {0x8D, "bmc_firmware", "BMC Firmware"},
Matt Spinler835a8692019-08-27 13:56:05 -0500118
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800119 {0x90, "software", "Software"},
120 {0x91, "os_software", "Operating System software"},
121 {0x92, "xpf_software", "XPF software"},
122 {0x93, "app_software", "Application software"},
Matt Spinler835a8692019-08-27 13:56:05 -0500123
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800124 {0xA0, "ext_env", "External Environment"},
125 {0xA1, "input_power_source", "Input Power Source (ac)"},
126 {0xA2, "ambient_temp", "Room Ambient Temperature"},
127 {0xA3, "user_error", "User Error"},
128 {0xA4, "corrosion", "Corrosion"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500129
130/**
131 * The possible values for the severity field in the User Header.
132 */
133const PELValues severityValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800134 {0x00, "non_error", "Informational Event"},
Matt Spinler835a8692019-08-27 13:56:05 -0500135
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800136 {0x10, "recovered", "Recovered Error"},
137 {0x20, "predictive", "Predictive Error"},
138 {0x21, "predictive_degraded_perf",
139 "Predictive Error, Degraded Performance"},
140 {0x22, "predictive_reboot", "Predictive Error, Correctable"},
141 {0x23, "predictive_reboot_degraded",
142 "Predictive Error, Correctable, Degraded"},
143 {0x24, "predictive_redundancy_loss", "Predictive Error, Redundancy Lost"},
Matt Spinler835a8692019-08-27 13:56:05 -0500144
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800145 {0x40, "unrecoverable", "Unrecoverable Error"},
146 {0x41, "unrecoverable_degraded_perf",
147 "Unrecoverable Error, Degraded Performance"},
148 {0x44, "unrecoverable_redundancy_loss",
149 "Unrecoverable Error, Loss of Redundancy"},
150 {0x45, "unrecoverable_redundancy_loss_perf",
151 "Unrecoverable, Loss of Redundancy + Performance"},
152 {0x48, "unrecoverable_loss_of_function",
153 "Unrecoverable Error, Loss of Function"},
Matt Spinler835a8692019-08-27 13:56:05 -0500154
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800155 {0x50, "critical", "Critical Error, Scope of Failure unknown"},
156 {0x51, "critical_system_term", "Critical Error, System Termination"},
157 {0x52, "critical_imminent_failure",
158 "Critical Error, System Failure likely or imminent"},
159 {0x53, "critical_partition_term",
160 "Critical Error, Partition(s) Termination"},
161 {0x54, "critical_partition_imminent_failure",
162 "Critical Error, Partition(s) Failure likely or imminent"},
Matt Spinler835a8692019-08-27 13:56:05 -0500163
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800164 {0x60, "diagnostic_error", "Error detected during diagnostic test"},
165 {0x61, "diagnostic_error_incorrect_results",
166 "Diagostic error, resource w/incorrect results"},
Matt Spinler835a8692019-08-27 13:56:05 -0500167
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800168 {0x71, "symptom_recovered", "Symptom Recovered"},
169 {0x72, "symptom_predictive", "Symptom Predictive"},
170 {0x74, "symptom_unrecoverable", "Symptom Unrecoverable"},
171 {0x75, "symptom_critical", "Symptom Critical"},
172 {0x76, "symptom_diag_err", "Symptom Diag Err"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500173
174/**
175 * The possible values for the Event Type field in the User Header.
176 */
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800177const PELValues eventTypeValues = {
178 {0x00, "na", "Not Applicable"},
179 {0x01, "misc_information_only", "Miscellaneous, Informational Only"},
180 {0x02, "tracing_event", "Tracing Event"},
181 {0x08, "dump_notification", "Dump Notification"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500182
183/**
184 * The possible values for the Event Scope field in the User Header.
185 */
186const PELValues eventScopeValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800187 {0x01, "single_partition", "Single Partition"},
188 {0x02, "multiple_partitions", "Multiple Partitions"},
189 {0x03, "entire_platform", "Entire Platform"},
190 {0x04, "possibly_multiple_platforms", "Multiple Platforms"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500191
192/**
193 * The possible values for the Action Flags field in the User Header.
194 */
195const PELValues actionFlagsValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800196 {0x8000, "service_action", "Service Action Required"},
197 {0x4000, "hidden", "Event not customer viewable"},
198 {0x2000, "report", "Report Externally"},
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800199 {0x1000, "dont_report", "Do Not Report To Hypervisor"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800200 {0x0800, "call_home", "HMC Call Home"},
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800201 {0x0400, "isolation_incomplete",
202 "Isolation Incomplete, further analysis required"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800203 {0x0100, "termination", "Service Processor Call Home Required"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500204
205/**
206 * The possible values for the Callout Priority field in the SRC.
207 */
208const PELValues calloutPriorityValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800209 {'H', "high", "Mandatory, replace all with this type as a unit"},
210 {'M', "medium", "Medium Priority"},
211 {'A', "medium_group_a", "Medium Priority A, replace these as a group"},
212 {'B', "medium_group_b", "Medium Priority B, replace these as a group"},
213 {'C', "medium_group_c", "Medium Priority C, replace these as a group"},
214 {'L', "low", "Lowest priority replacement"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500215
216PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields)
217{
218 return std::find_if(fields.begin(), fields.end(),
219 [value](const auto& entry) {
220 return value == std::get<fieldValuePos>(entry);
221 });
222}
223
224PELValues::const_iterator findByName(const std::string& name,
225 const PELValues& fields)
226
227{
228 return std::find_if(fields.begin(), fields.end(),
229 [&name](const auto& entry) {
230 return name == std::get<registryNamePos>(entry);
231 });
232}
233
Aatir186ce8c2019-10-20 15:13:39 -0500234/**
235 * @brief Map for section IDs
236 */
237const std::map<std::string, std::string> sectionTitles = {
Matt Spinler835a8692019-08-27 13:56:05 -0500238
Aatir186ce8c2019-10-20 15:13:39 -0500239 {"PH", "Private Header"},
240 {"UH", "User Header"},
241 {"PS", "Primary SRC"},
242 {"SS", "Secondary SRC"},
243 {"EH", "Extended User Header"},
244 {"MT", "Failing MTMS"},
245 {"DH", "Dump Location"},
246 {"SW", "Firmware Error"},
247 {"LP", "Impacted Part"},
248 {"LR", "Logical Resource"},
249 {"HM", "HMC ID"},
250 {"EP", "EPOW"},
251 {"IE", "IO Event"},
252 {"MI", "MFG Info"},
253 {"CH", "Call Home"},
254 {"UD", "User Data"},
255 {"EI", "Env Info"},
256 {"ED", "Extended User Data"},
257};
258
Aatirc92b4eb2019-11-18 13:44:51 -0600259/**
260 * @brief Map for creator IDs
261 */
262const std::map<std::string, std::string> creatorIDs = {
263
264 {"O", "BMC"}, {"C", "HMC"}, {"H", "PHYP"}, {"L", "Partition FW"},
265 {"S", "SLIC"}, {"B", "Hostboot"}, {"T", "OCC"}, {"M", "I/O Drawer"},
266 {"K", "Sapphire"}, {"P", "PowerNV"}};
267
Matt Spinler455587e2020-01-15 14:31:52 -0600268/**
269 * @brief Map for transmission states
270 */
271const std::map<TransmissionState, std::string> transmissionStates = {
272 {TransmissionState::newPEL, "Not Sent"},
273 {TransmissionState::badPEL, "Rejected"},
274 {TransmissionState::sent, "Sent"},
275 {TransmissionState::acked, "Acked"}};
276
Aatir7b291ec2019-11-19 10:37:37 -0600277std::string getValue(const uint8_t field, const pel_values::PELValues& values)
278{
279
280 auto tmp = pel_values::findByValue(field, values);
281 if (tmp != values.end())
282 {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800283 return std::get<pel_values::descriptionPos>(*tmp);
Aatir7b291ec2019-11-19 10:37:37 -0600284 }
285 else
286 {
287 return "invalid";
288 }
289}
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800290
291std::vector<std::string> getValuesBitwise(uint16_t value,
292 const pel_values::PELValues& table)
293{
294 std::vector<std::string> foundValues;
295 std::for_each(
296 table.begin(), table.end(), [&value, &foundValues](const auto& entry) {
297 if (value & std::get<fieldValuePos>(entry))
298 {
299 foundValues.push_back(std::get<descriptionPos>(entry));
300 }
301 });
302 return foundValues;
303}
Aatir186ce8c2019-10-20 15:13:39 -0500304} // namespace pel_values
Matt Spinler835a8692019-08-27 13:56:05 -0500305} // namespace pels
306} // namespace openpower