Matt Spinler | 835a869 | 2019-08-27 13:56:05 -0500 | [diff] [blame] | 1 | #include "pel_values.hpp" |
| 2 | |
| 3 | #include <algorithm> |
| 4 | |
| 5 | namespace openpower |
| 6 | { |
| 7 | namespace pels |
| 8 | { |
| 9 | namespace pel_values |
| 10 | { |
| 11 | |
| 12 | // Note: The description fields will be filled in as part of the |
| 13 | // PEL parser work. |
| 14 | |
| 15 | /** |
| 16 | * The possible values for the subsystem field in the User Header. |
| 17 | */ |
| 18 | const PELValues subsystemValues = {{0x10, "processor", "TODO"}, |
| 19 | {0x11, "processor_fru", "TODO"}, |
| 20 | {0x12, "processor_chip", "TODO"}, |
| 21 | {0x13, "processor_unit", "TODO"}, |
| 22 | {0x14, "processor_bus", "TODO"}, |
| 23 | |
| 24 | {0x20, "memory", "TODO"}, |
| 25 | {0x21, "memory_ctlr", "TODO"}, |
| 26 | {0x22, "memory_bus", "TODO"}, |
| 27 | {0x23, "memory_dimm", "TODO"}, |
| 28 | {0x24, "memory_fru", "TODO"}, |
| 29 | {0x25, "external_cache", "TODO"}, |
| 30 | |
| 31 | {0x30, "io", "TODO"}, |
| 32 | {0x31, "io_hub", "TODO"}, |
| 33 | {0x32, "io_bridge", "TODO"}, |
| 34 | {0x33, "io_bus", "TODO"}, |
| 35 | {0x34, "io_processor", "TODO"}, |
| 36 | {0x35, "io_hub_other", "TODO"}, |
| 37 | {0x38, "phb", "TODO"}, |
| 38 | |
| 39 | {0x40, "io_adapter", "TODO"}, |
| 40 | {0x41, "io_adapter_comm", "TODO"}, |
| 41 | {0x46, "io_device", "TODO"}, |
| 42 | {0x47, "io_device_dasd", "TODO"}, |
| 43 | {0x4C, "io_external_general", "TODO"}, |
| 44 | {0x4D, "io_external_workstation", "TODO"}, |
| 45 | {0x4E, "io_storage_mezz", "TODO"}, |
| 46 | |
| 47 | {0x50, "cec_hardware", "TODO"}, |
| 48 | {0x51, "cec_sp_a", "TODO"}, |
| 49 | {0x52, "cec_sp_b", "TODO"}, |
| 50 | {0x53, "cec_node_controller", "TODO"}, |
| 51 | {0x55, "cec_vpd", "TODO"}, |
| 52 | {0x56, "cec_i2c", "TODO"}, |
| 53 | {0x57, "cec_chip_iface", "TODO"}, |
| 54 | {0x58, "cec_clocks", "TODO"}, |
| 55 | {0x59, "cec_op_panel", "TODO"}, |
| 56 | {0x5A, "cec_tod", "TODO"}, |
| 57 | {0x5B, "cec_storage_device", "TODO"}, |
| 58 | {0x5C, "cec_sp_hyp_iface", "TODO"}, |
| 59 | {0x5D, "cec_service_network", "TODO"}, |
| 60 | {0x5E, "cec_sp_hostboot_iface", "TODO"}, |
| 61 | |
| 62 | {0x60, "power", "TODO"}, |
| 63 | {0x61, "power_supply", "TODO"}, |
| 64 | {0x62, "power_control_hw", "TODO"}, |
| 65 | {63, "power_fans", "TODO"}, |
| 66 | {0x64, "power_sequencer", "TODO"}, |
| 67 | |
| 68 | {0x70, "others", "TODO"}, |
| 69 | {0x71, "other_hmc", "TODO"}, |
| 70 | {0x72, "other_test_tool", "TODO"}, |
| 71 | {0x73, "other_media", "TODO"}, |
| 72 | {0x74, "other_multiple_subsystems", "TODO"}, |
| 73 | {0x75, "other_na", "TODO"}, |
| 74 | {0x76, "other_info_src", "TODO"}, |
| 75 | |
| 76 | {0x7A, "surv_hyp_lost_sp", "TODO"}, |
| 77 | {0x7B, "surv_sp_lost_hyp", "TODO"}, |
| 78 | {0x7C, "surv_sp_lost_hmc", "TODO"}, |
| 79 | {0x7D, "surv_hmc_lost_lpar", "TODO"}, |
| 80 | {0x7E, "surv_hmc_lost_bpa", "TODO"}, |
| 81 | {0x7F, "surv_hmc_lost_hmc", "TODO"}, |
| 82 | |
| 83 | {0x80, "platform_firmware", "TODO"}, |
| 84 | {0x81, "sp_firmware", "TODO"}, |
| 85 | {0x82, "hyp_firmware", "TODO"}, |
| 86 | {0x83, "partition_firmware", "TODO"}, |
| 87 | {0x84, "slic_firmware", "TODO"}, |
| 88 | {0x85, "spcn_firmware", "TODO"}, |
| 89 | {0x86, "bulk_power_firmware_side_a", "TODO"}, |
| 90 | {0x87, "hmc_code_firmware", "TODO"}, |
| 91 | {0x88, "bulk_power_firmware_side_b", "TODO"}, |
| 92 | {0x89, "virtual_sp", "TODO"}, |
| 93 | {0x8A, "hostboot", "TODO"}, |
| 94 | {0x8B, "occ", "TODO"}, |
| 95 | {0x8D, "bmc_firmware", "TODO"}, |
| 96 | |
| 97 | {0x90, "software", "TODO"}, |
| 98 | {0x91, "os_software", "TODO"}, |
| 99 | {0x92, "xpf_software", "TODO"}, |
| 100 | {0x93, "app_software", "TODO"}, |
| 101 | |
| 102 | {0xA0, "ext_env", "TODO"}, |
| 103 | {0xA1, "input_power_source", "TODO"}, |
| 104 | {0xA2, "ambient_temp", "TODO"}, |
| 105 | {0xA3, "user_error", "TODO"}, |
| 106 | {0xA4, "corrosion", "TODO"}}; |
| 107 | |
| 108 | /** |
| 109 | * The possible values for the severity field in the User Header. |
| 110 | */ |
| 111 | const PELValues severityValues = { |
| 112 | {0x00, "non_error", "TODO"}, |
| 113 | |
| 114 | {0x10, "recovered", "TODO"}, |
| 115 | {0x20, "predictive", "TODO"}, |
| 116 | {0x21, "predictive_degraded_perf", "TODO"}, |
| 117 | {0x22, "predictive_reboot", "TODO"}, |
| 118 | {0x23, "predictive_reboot_degraded", "TODO"}, |
| 119 | {0x24, "predictive_redundancy_loss", "TODO"}, |
| 120 | |
| 121 | {0x40, "unrecoverable", "TODO"}, |
| 122 | {0x41, "unrecoverable_degraded_perf", "TODO"}, |
| 123 | {0x44, "unrecoverable_redundancy_loss", "TODO"}, |
| 124 | {0x45, "unrecoverable_redundancy_loss_perf", "TODO"}, |
| 125 | {0x48, "unrecoverable_loss_of_function", "TODO"}, |
| 126 | |
| 127 | {0x50, "critical", "TODO"}, |
| 128 | {0x51, "critical_system_term", "TODO"}, |
| 129 | {0x52, "critical_imminent_failure", "TODO"}, |
| 130 | {0x53, "critical_partition_term", "TODO"}, |
| 131 | {0x54, "critical_partition_imminent_failure", "TODO"}, |
| 132 | |
| 133 | {0x60, "diagnostic_error", "TODO"}, |
| 134 | {0x61, "diagnostic_error_incorrect_results", "TODO"}, |
| 135 | |
| 136 | {0x71, "symptom_recovered", "TODO"}, |
| 137 | {0x72, "symptom_predictive", "TODO"}, |
| 138 | {0x74, "symptom_unrecoverable", "TODO"}, |
| 139 | {0x75, "symptom_critical", "TODO"}, |
| 140 | {0x76, "symptom_diag_err", "TODO"}}; |
| 141 | |
| 142 | /** |
| 143 | * The possible values for the Event Type field in the User Header. |
| 144 | */ |
| 145 | const PELValues eventTypeValues = {{0x00, "na", "TODO"}, |
| 146 | {0x01, "misc_information_only", "TODO"}, |
| 147 | {0x02, "tracing_event", "TODO"}, |
| 148 | {0x08, "dump_notification", "TODO"}}; |
| 149 | |
| 150 | /** |
| 151 | * The possible values for the Event Scope field in the User Header. |
| 152 | */ |
| 153 | const PELValues eventScopeValues = { |
| 154 | {0x01, "single_partition", "TODO"}, |
| 155 | {0x02, "multiple_partitions", "TODO"}, |
| 156 | {0x03, "entire_platform", "TODO"}, |
| 157 | {0x04, "possibly_multiple_platforms", "TODO"}}; |
| 158 | |
| 159 | /** |
| 160 | * The possible values for the Action Flags field in the User Header. |
| 161 | */ |
| 162 | const PELValues actionFlagsValues = { |
| 163 | {0x8000, "service_action", "TODO"}, {0x4000, "hidden", "TODO"}, |
| 164 | {0x2000, "report", "TODO"}, {0x1000, "dont_report", "TODO"}, |
| 165 | {0x0800, "call_home", "TODO"}, {0x0100, "termination", "TODO"}}; |
| 166 | |
| 167 | /** |
| 168 | * The possible values for the Callout Priority field in the SRC. |
| 169 | */ |
| 170 | const PELValues calloutPriorityValues = { |
| 171 | {'H', "high", "TODO"}, {'M', "medium", "TODO"}, |
| 172 | {'A', "medium_group_a", "TODO"}, {'B', "medium_group_b", "TODO"}, |
| 173 | {'C', "medium_group_c", "TODO"}, {'L', "low", "TODO"}}; |
| 174 | |
| 175 | PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields) |
| 176 | { |
| 177 | return std::find_if(fields.begin(), fields.end(), |
| 178 | [value](const auto& entry) { |
| 179 | return value == std::get<fieldValuePos>(entry); |
| 180 | }); |
| 181 | } |
| 182 | |
| 183 | PELValues::const_iterator findByName(const std::string& name, |
| 184 | const PELValues& fields) |
| 185 | |
| 186 | { |
| 187 | return std::find_if(fields.begin(), fields.end(), |
| 188 | [&name](const auto& entry) { |
| 189 | return name == std::get<registryNamePos>(entry); |
| 190 | }); |
| 191 | } |
| 192 | |
| 193 | } // namespace pel_values |
| 194 | |
| 195 | } // namespace pels |
| 196 | } // namespace openpower |