blob: cbe128a746c5e11f86bcb497ec9897c891c690e9 [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>
Matt Spinler578e0702020-03-13 09:40:43 -050019#include <cassert>
Matt Spinler835a8692019-08-27 13:56:05 -050020
21namespace openpower
22{
23namespace pels
24{
25namespace pel_values
26{
27
Matt Spinler835a8692019-08-27 13:56:05 -050028/**
29 * The possible values for the subsystem field in the User Header.
30 */
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080031const PELValues subsystemValues = {
32 {0x10, "processor", "Processor Subsystem"},
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 Spinler835a8692019-08-27 13:56:05 -050037
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080038 {0x20, "memory", "Memory Subsystem"},
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 Spinler835a8692019-08-27 13:56:05 -050044
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080045 {0x30, "io", "I/O Subsystem"},
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 Spinler835a8692019-08-27 13:56:05 -050052
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080053 {0x40, "io_adapter", "I/O Adapter Subsystem"},
54 {0x41, "io_adapter_comm", "I/O Adapter Communication"},
55 {0x46, "io_device", "I/O Device Subsystem"},
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"},
60 {0x4E, "io_storage_mezz", "I/O Storage Mezza Expansion Subsystem"},
Matt Spinler835a8692019-08-27 13:56:05 -050061
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080062 {0x50, "cec_hardware", "CEC Hardware Subsystem"},
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"},
73 {0x5C, "cec_sp_hyp_iface",
74 "CEC Hardware: Hypervisor-Service Processor Interface"},
75 {0x5D, "cec_service_network", "CEC Hardware: Service Network"},
76 {0x5E, "cec_sp_hostboot_iface",
77 "CEC Hardware: Hostboot-Service Processor Interface"},
Matt Spinler835a8692019-08-27 13:56:05 -050078
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080079 {0x60, "power", "Power/Cooling Subsystem"},
80 {0x61, "power_supply", "Power Supply"},
81 {0x62, "power_control_hw", "Power Control Hardware"},
82 {0x63, "power_fans", "Fan (AMD)"},
83 {0x64, "power_sequencer", "Digital Power Supply Subsystem"},
Matt Spinler835a8692019-08-27 13:56:05 -050084
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080085 {0x70, "others", "Miscellaneous"},
86 {0x71, "other_hmc", "HMC Subsystem & Hardware"},
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 Spinler835a8692019-08-27 13:56:05 -050092
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +080093 {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 Spinler835a8692019-08-27 13:56:05 -0500102
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800103 {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 Spinler835a8692019-08-27 13:56:05 -0500116
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800117 {0x90, "software", "Software"},
118 {0x91, "os_software", "Operating System software"},
119 {0x92, "xpf_software", "XPF software"},
120 {0x93, "app_software", "Application software"},
Matt Spinler835a8692019-08-27 13:56:05 -0500121
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800122 {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 Spinler835a8692019-08-27 13:56:05 -0500127
128/**
129 * The possible values for the severity field in the User Header.
130 */
131const PELValues severityValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800132 {0x00, "non_error", "Informational Event"},
Matt Spinler835a8692019-08-27 13:56:05 -0500133
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800134 {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 Spinler835a8692019-08-27 13:56:05 -0500142
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800143 {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 Spinler835a8692019-08-27 13:56:05 -0500152
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800153 {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 Spinler835a8692019-08-27 13:56:05 -0500161
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800162 {0x60, "diagnostic_error", "Error detected during diagnostic test"},
163 {0x61, "diagnostic_error_incorrect_results",
164 "Diagostic error, resource w/incorrect results"},
Matt Spinler835a8692019-08-27 13:56:05 -0500165
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800166 {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 Spinler835a8692019-08-27 13:56:05 -0500171
172/**
173 * The possible values for the Event Type field in the User Header.
174 */
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800175const PELValues eventTypeValues = {
176 {0x00, "na", "Not Applicable"},
177 {0x01, "misc_information_only", "Miscellaneous, Informational Only"},
178 {0x02, "tracing_event", "Tracing Event"},
179 {0x08, "dump_notification", "Dump Notification"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500180
181/**
182 * The possible values for the Event Scope field in the User Header.
183 */
184const PELValues eventScopeValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800185 {0x01, "single_partition", "Single Partition"},
186 {0x02, "multiple_partitions", "Multiple Partitions"},
187 {0x03, "entire_platform", "Entire Platform"},
188 {0x04, "possibly_multiple_platforms", "Multiple Platforms"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500189
190/**
191 * The possible values for the Action Flags field in the User Header.
192 */
193const PELValues actionFlagsValues = {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800194 {0x8000, "service_action", "Service Action Required"},
195 {0x4000, "hidden", "Event not customer viewable"},
196 {0x2000, "report", "Report Externally"},
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800197 {0x1000, "dont_report", "Do Not Report To Hypervisor"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800198 {0x0800, "call_home", "HMC Call Home"},
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800199 {0x0400, "isolation_incomplete",
200 "Isolation Incomplete, further analysis required"},
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800201 {0x0100, "termination", "Service Processor Call Home Required"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500202
203/**
204 * The possible values for the Callout Priority field in the SRC.
205 */
206const PELValues calloutPriorityValues = {
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800207 {0x48, "high", "Mandatory, replace all with this type as a unit"},
208 {0x4D, "medium", "Medium Priority"},
209 {0x41, "medium_group_a", "Medium Priority A, replace these as a group"},
210 {0x42, "medium_group_b", "Medium Priority B, replace these as a group"},
211 {0x43, "medium_group_c", "Medium Priority C, replace these as a group"},
212 {0x4C, "low", "Lowest priority replacement"}};
Matt Spinler835a8692019-08-27 13:56:05 -0500213
Matt Spinler578e0702020-03-13 09:40:43 -0500214/**
Matt Spinlera27e2e52020-04-09 11:06:11 -0500215 * @brief Map of the registry names for the maintenance procedures
216 * to their actual names.
Matt Spinler578e0702020-03-13 09:40:43 -0500217 */
Matt Spinlera27e2e52020-04-09 11:06:11 -0500218const std::map<std::string, std::string> maintenanceProcedures = {
Matt Spinler92b4fd42020-06-25 10:49:44 -0500219 {"no_vpd_for_fru", "BMCSP01"}, {"bmc_code", "BMCSP02"}};
Matt Spinler578e0702020-03-13 09:40:43 -0500220
Matt Spinler2b6dfa02020-04-09 11:39:05 -0500221/**
222 * @brief Map of the registry names for the symbolic FRUs to their
223 * actual names.
224 */
225const std::map<std::string, std::string> symbolicFRUs = {
226 {"service_docs", "SVCDOCS"}};
227
Matt Spinler835a8692019-08-27 13:56:05 -0500228PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields)
229{
230 return std::find_if(fields.begin(), fields.end(),
231 [value](const auto& entry) {
232 return value == std::get<fieldValuePos>(entry);
233 });
234}
235
236PELValues::const_iterator findByName(const std::string& name,
237 const PELValues& fields)
238
239{
240 return std::find_if(fields.begin(), fields.end(),
241 [&name](const auto& entry) {
242 return name == std::get<registryNamePos>(entry);
243 });
244}
245
Aatir186ce8c2019-10-20 15:13:39 -0500246/**
247 * @brief Map for section IDs
248 */
249const std::map<std::string, std::string> sectionTitles = {
Aatir186ce8c2019-10-20 15:13:39 -0500250 {"PH", "Private Header"},
251 {"UH", "User Header"},
252 {"PS", "Primary SRC"},
253 {"SS", "Secondary SRC"},
254 {"EH", "Extended User Header"},
255 {"MT", "Failing MTMS"},
256 {"DH", "Dump Location"},
257 {"SW", "Firmware Error"},
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800258 {"LP", "Impacted Partition"},
Aatir186ce8c2019-10-20 15:13:39 -0500259 {"LR", "Logical Resource"},
260 {"HM", "HMC ID"},
261 {"EP", "EPOW"},
262 {"IE", "IO Event"},
263 {"MI", "MFG Info"},
264 {"CH", "Call Home"},
265 {"UD", "User Data"},
266 {"EI", "Env Info"},
Harisuddin Mohamed Isa0f717e12020-01-15 20:05:33 +0800267 {"ED", "Extended User Data"}};
268
269/**
270 * @brief Map for Procedure Descriptions
271 */
272const std::map<std::string, std::string> procedureDesc = {{"TODO", "TODO"}};
273
274/**
275 * @brief Map for Callout Failing Component Types
276 */
277const std::map<uint8_t, std::string> failingComponentType = {
278 {0x10, "Normal Hardware FRU"},
279 {0x20, "Code FRU"},
280 {0x30, "Configuration error, configuration procedure required"},
281 {0x40, "Maintenance Procedure Required"},
282 {0x90, "External FRU"},
283 {0xA0, "External Code FRU"},
284 {0xB0, "Tool FRU"},
285 {0xC0, "Symbolic FRU"},
286 {0xE0, "Symbolic FRU with trusted location code"}};
287
288/**
289 * @brief Map for Boolean value
290 */
291const std::map<bool, std::string> boolString = {{true, "True"},
292 {false, "False"}};
Aatir186ce8c2019-10-20 15:13:39 -0500293
Aatirc92b4eb2019-11-18 13:44:51 -0600294/**
295 * @brief Map for creator IDs
296 */
297const std::map<std::string, std::string> creatorIDs = {
298
299 {"O", "BMC"}, {"C", "HMC"}, {"H", "PHYP"}, {"L", "Partition FW"},
300 {"S", "SLIC"}, {"B", "Hostboot"}, {"T", "OCC"}, {"M", "I/O Drawer"},
301 {"K", "Sapphire"}, {"P", "PowerNV"}};
302
Matt Spinler455587e2020-01-15 14:31:52 -0600303/**
304 * @brief Map for transmission states
305 */
306const std::map<TransmissionState, std::string> transmissionStates = {
307 {TransmissionState::newPEL, "Not Sent"},
308 {TransmissionState::badPEL, "Rejected"},
309 {TransmissionState::sent, "Sent"},
310 {TransmissionState::acked, "Acked"}};
311
Aatir7b291ec2019-11-19 10:37:37 -0600312std::string getValue(const uint8_t field, const pel_values::PELValues& values)
313{
314
315 auto tmp = pel_values::findByValue(field, values);
316 if (tmp != values.end())
317 {
Harisuddin Mohamed Isa57a24e32019-12-09 16:14:38 +0800318 return std::get<pel_values::descriptionPos>(*tmp);
Aatir7b291ec2019-11-19 10:37:37 -0600319 }
320 else
321 {
322 return "invalid";
323 }
324}
Harisuddin Mohamed Isa600d15a2019-12-20 12:42:26 +0800325
326std::vector<std::string> getValuesBitwise(uint16_t value,
327 const pel_values::PELValues& table)
328{
329 std::vector<std::string> foundValues;
330 std::for_each(
331 table.begin(), table.end(), [&value, &foundValues](const auto& entry) {
332 if (value & std::get<fieldValuePos>(entry))
333 {
334 foundValues.push_back(std::get<descriptionPos>(entry));
335 }
336 });
337 return foundValues;
338}
Matt Spinler578e0702020-03-13 09:40:43 -0500339
Aatir186ce8c2019-10-20 15:13:39 -0500340} // namespace pel_values
Matt Spinler835a8692019-08-27 13:56:05 -0500341} // namespace pels
342} // namespace openpower