Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 3 | #include <map> |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 4 | #include <string> |
| 5 | |
| 6 | namespace analyzer |
| 7 | { |
| 8 | |
| 9 | namespace callout |
| 10 | { |
| 11 | |
| 12 | /** @brief All callouts will have a priority indicating when to issue the |
| 13 | * required service action. */ |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 14 | enum class Priority |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 15 | { |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 16 | /** Serivce is mandatory. */ |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 17 | HIGH, |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 18 | |
| 19 | /** Serivce medium priority callouts one at a time, in order, until the |
| 20 | * issue is resolved. */ |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 21 | MED, |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 22 | |
| 23 | /** Same as MED, except replace all A's as a group. */ |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 24 | MED_A, |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 25 | |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 26 | /** Same as MED, except replace all B's as a group. */ |
| 27 | MED_B, |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 28 | |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 29 | /** Same as MED, except replace all C's as a group. */ |
| 30 | MED_C, |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 31 | |
| 32 | /** If servicing all high and medium priority callouts did not resolve |
| 33 | * the issue, service low priority callouts one at a time, in order, |
| 34 | * until the issue is resolved. */ |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 35 | LOW, |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 36 | }; |
| 37 | |
Zane Shelley | 9980d48 | 2022-01-28 15:21:47 -0600 | [diff] [blame] | 38 | /** @return The string representation of the priority used in callouts. */ |
| 39 | inline std::string getString(Priority i_priority) |
| 40 | { |
| 41 | // clang-format off |
| 42 | static const std::map<Priority, std::string> m = |
| 43 | { |
| 44 | {Priority::HIGH, "H"}, |
| 45 | {Priority::MED, "M"}, |
| 46 | {Priority::MED_A, "A"}, |
| 47 | {Priority::MED_B, "B"}, |
| 48 | {Priority::MED_C, "C"}, |
| 49 | {Priority::LOW, "L"}, |
| 50 | }; |
| 51 | // clang-format on |
| 52 | |
| 53 | return m.at(i_priority); |
| 54 | } |
| 55 | |
| 56 | /** @return The string representation of the priority used in The callout FFDC. |
| 57 | */ |
| 58 | inline std::string getStringFFDC(Priority i_priority) |
| 59 | { |
| 60 | // clang-format off |
| 61 | static const std::map<Priority, std::string> m = |
| 62 | { |
| 63 | {Priority::HIGH, "high"}, |
| 64 | {Priority::MED, "medium"}, |
| 65 | {Priority::MED_A, "medium_group_A"}, |
| 66 | {Priority::MED_B, "medium_group_B"}, |
| 67 | {Priority::MED_C, "medium_group_C"}, |
| 68 | {Priority::LOW, "low"}, |
| 69 | }; |
| 70 | // clang-format on |
| 71 | |
| 72 | return m.at(i_priority); |
| 73 | } |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 74 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 75 | /** These SRC subsystem values are defined by the PEL spec. */ |
| 76 | enum class SrcSubsystem |
| 77 | { |
| 78 | // Can also reference `extensions/openpower-pels/pel_values.cpp` from |
| 79 | // `openbmc/phosphor-logging` for the full list of these values. |
| 80 | |
| 81 | PROCESSOR = 0x10, |
Caleb Palmer | bc94bde | 2022-02-18 09:03:37 -0600 | [diff] [blame] | 82 | PROCESSOR_FRU = 0x11, |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 83 | PROCESSOR_UNIT = 0x13, |
| 84 | PROCESSOR_BUS = 0x14, |
| 85 | |
Caleb Palmer | bc94bde | 2022-02-18 09:03:37 -0600 | [diff] [blame] | 86 | MEMORY_CTLR = 0x21, |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 87 | MEMORY_BUS = 0x22, |
| 88 | MEMORY_DIMM = 0x23, |
Caleb Palmer | bc94bde | 2022-02-18 09:03:37 -0600 | [diff] [blame] | 89 | MEMORY_FRU = 0x24, |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 90 | |
| 91 | PHB = 0x38, |
| 92 | |
| 93 | CEC_HARDWARE = 0x50, |
| 94 | CEC_CLOCKS = 0x58, |
| 95 | CEC_TOD = 0x5A, |
| 96 | |
| 97 | OTHERS = 0x70, |
| 98 | }; |
| 99 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 100 | /** @brief Container class for procedure callout service actions. */ |
| 101 | class Procedure |
| 102 | { |
| 103 | public: |
| 104 | /** Contact next level support. */ |
| 105 | static const Procedure NEXTLVL; |
| 106 | |
Zane Shelley | d8b7018 | 2022-03-10 10:50:22 -0600 | [diff] [blame] | 107 | /** An unrecoverable event occurred, look for previous errors for the |
| 108 | * cause. */ |
| 109 | static const Procedure SUE_SEEN; |
| 110 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 111 | private: |
| 112 | /** |
| 113 | * @brief Constructor from components. |
| 114 | * @param i_string The string representation of the procedure used for |
| 115 | * callouts. |
| 116 | */ |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 117 | Procedure(const std::string& i_string, const SrcSubsystem i_subsystem) : |
| 118 | iv_string(i_string), iv_subsystem(i_subsystem) |
| 119 | {} |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 120 | |
| 121 | private: |
| 122 | /** The string representation of the procedure used for callouts. */ |
| 123 | const std::string iv_string; |
| 124 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 125 | /** The associated SRC subsystem of the procedure. */ |
| 126 | const SrcSubsystem iv_subsystem; |
| 127 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 128 | public: |
| 129 | /** iv_string accessor */ |
| 130 | std::string getString() const |
| 131 | { |
| 132 | return iv_string; |
| 133 | } |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 134 | |
| 135 | /** iv_subsystem accessor */ |
| 136 | SrcSubsystem getSrcSubsystem() const |
| 137 | { |
| 138 | return iv_subsystem; |
| 139 | } |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 140 | }; |
| 141 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 142 | inline const Procedure Procedure::NEXTLVL{"next_level_support", |
| 143 | SrcSubsystem::OTHERS}; |
Zane Shelley | d8b7018 | 2022-03-10 10:50:22 -0600 | [diff] [blame] | 144 | inline const Procedure Procedure::SUE_SEEN{"find_sue_root_cause", |
| 145 | SrcSubsystem::OTHERS}; |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 146 | |
Zane Shelley | 5d63cef | 2021-09-17 18:10:17 -0500 | [diff] [blame] | 147 | /** @brief Container class for bus callout service actions. */ |
| 148 | class BusType |
| 149 | { |
| 150 | public: |
| 151 | /** SMP bus (fabric A or X bus). */ |
| 152 | static const BusType SMP_BUS; |
| 153 | |
| 154 | /** OMI bus (memory bus). */ |
| 155 | static const BusType OMI_BUS; |
| 156 | |
| 157 | private: |
| 158 | /** |
| 159 | * @brief Constructor from components. |
| 160 | * @param i_string The string representation of the procedure used for |
| 161 | * callouts. |
| 162 | */ |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 163 | BusType(const std::string& i_string, const SrcSubsystem i_subsystem) : |
| 164 | iv_string(i_string), iv_subsystem(i_subsystem) |
| 165 | {} |
Zane Shelley | 5d63cef | 2021-09-17 18:10:17 -0500 | [diff] [blame] | 166 | |
| 167 | private: |
| 168 | /** The string representation of the procedure used for callouts. */ |
| 169 | const std::string iv_string; |
| 170 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 171 | /** The associated SRC subsystem of the bus. */ |
| 172 | const SrcSubsystem iv_subsystem; |
| 173 | |
Zane Shelley | 5d63cef | 2021-09-17 18:10:17 -0500 | [diff] [blame] | 174 | public: |
| 175 | bool operator==(const BusType& r) const |
| 176 | { |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 177 | return ((this->iv_string == r.iv_string) && |
| 178 | (this->iv_subsystem == r.iv_subsystem)); |
Zane Shelley | 5d63cef | 2021-09-17 18:10:17 -0500 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | /** iv_string accessor */ |
| 182 | std::string getString() const |
| 183 | { |
| 184 | return iv_string; |
| 185 | } |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 186 | |
| 187 | /** iv_subsystem accessor */ |
| 188 | SrcSubsystem getSrcSubsystem() const |
| 189 | { |
| 190 | return iv_subsystem; |
| 191 | } |
Zane Shelley | 5d63cef | 2021-09-17 18:10:17 -0500 | [diff] [blame] | 192 | }; |
| 193 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 194 | inline const BusType BusType::SMP_BUS{"SMP_BUS", SrcSubsystem::PROCESSOR_BUS}; |
| 195 | inline const BusType BusType::OMI_BUS{"OMI_BUS", SrcSubsystem::MEMORY_BUS}; |
Zane Shelley | 5d63cef | 2021-09-17 18:10:17 -0500 | [diff] [blame] | 196 | |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 197 | /** @brief Container class for clock callout service actions. */ |
| 198 | class ClockType |
| 199 | { |
| 200 | public: |
| 201 | /** Oscillator reference clock 0. */ |
| 202 | static const ClockType OSC_REF_CLOCK_0; |
| 203 | |
| 204 | /** Oscillator reference clock 1. */ |
| 205 | static const ClockType OSC_REF_CLOCK_1; |
| 206 | |
Zane Shelley | d195b71 | 2022-01-26 13:26:34 -0600 | [diff] [blame] | 207 | /** Time of Day (TOD) clock. */ |
| 208 | static const ClockType TOD_CLOCK; |
| 209 | |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 210 | private: |
| 211 | /** |
| 212 | * @brief Constructor from components. |
| 213 | * @param i_string The string representation of the procedure used for |
| 214 | * callouts. |
| 215 | */ |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 216 | ClockType(const std::string& i_string, const SrcSubsystem i_subsystem) : |
| 217 | iv_string(i_string), iv_subsystem(i_subsystem) |
| 218 | {} |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 219 | |
| 220 | private: |
| 221 | /** The string representation of the procedure used for callouts. */ |
| 222 | const std::string iv_string; |
| 223 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 224 | /** The associated SRC subsystem of the clock. */ |
| 225 | const SrcSubsystem iv_subsystem; |
| 226 | |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 227 | public: |
| 228 | /** iv_string accessor */ |
| 229 | std::string getString() const |
| 230 | { |
| 231 | return iv_string; |
| 232 | } |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 233 | |
| 234 | /** iv_subsystem accessor */ |
| 235 | SrcSubsystem getSrcSubsystem() const |
| 236 | { |
| 237 | return iv_subsystem; |
| 238 | } |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 239 | }; |
| 240 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 241 | inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0", |
| 242 | SrcSubsystem::CEC_CLOCKS}; |
| 243 | inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1", |
| 244 | SrcSubsystem::CEC_CLOCKS}; |
| 245 | inline const ClockType ClockType::TOD_CLOCK{"TOD_CLOCK", SrcSubsystem::CEC_TOD}; |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 246 | |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 247 | /** @brief Container class for part callout service actions. */ |
| 248 | class PartType |
| 249 | { |
| 250 | public: |
| 251 | /** The part containing the PNOR. */ |
| 252 | static const PartType PNOR; |
| 253 | |
| 254 | private: |
| 255 | /** |
| 256 | * @brief Constructor from components. |
| 257 | * @param i_string The string representation of the part callout. |
| 258 | */ |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 259 | PartType(const std::string& i_string, const SrcSubsystem i_subsystem) : |
| 260 | iv_string(i_string), iv_subsystem(i_subsystem) |
| 261 | {} |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 262 | |
| 263 | private: |
| 264 | /** The string representation of the part callout. */ |
| 265 | const std::string iv_string; |
| 266 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 267 | /** The associated SRC subsystem of the part. */ |
| 268 | const SrcSubsystem iv_subsystem; |
| 269 | |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 270 | public: |
| 271 | bool operator==(const PartType& r) const |
| 272 | { |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 273 | return ((this->iv_string == r.iv_string) && |
| 274 | (this->iv_subsystem == r.iv_subsystem)); |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 275 | } |
| 276 | |
| 277 | /** iv_string accessor */ |
| 278 | std::string getString() const |
| 279 | { |
| 280 | return iv_string; |
| 281 | } |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 282 | |
| 283 | /** iv_subsystem accessor */ |
| 284 | SrcSubsystem getSrcSubsystem() const |
| 285 | { |
| 286 | return iv_subsystem; |
| 287 | } |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 288 | }; |
| 289 | |
Zane Shelley | 55e7fec | 2022-01-28 15:29:44 -0600 | [diff] [blame] | 290 | inline const PartType PartType::PNOR{"PNOR", SrcSubsystem::CEC_HARDWARE}; |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 291 | |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 292 | /** @brief Container class for guard service actions. */ |
| 293 | class GuardType |
| 294 | { |
| 295 | public: |
| 296 | /** Do not guard. */ |
| 297 | static const GuardType NONE; |
| 298 | |
| 299 | /** Guard on fatal error (cannot recover resource). */ |
| 300 | static const GuardType UNRECOVERABLE; |
| 301 | |
| 302 | /** Guard on non-fatal error (can recover resource). */ |
| 303 | static const GuardType PREDICTIVE; |
| 304 | |
| 305 | private: |
| 306 | /** |
| 307 | * @brief Constructor from components. |
| 308 | * @param i_string The string representation of the procedure used for |
| 309 | * callouts. |
| 310 | */ |
| 311 | explicit GuardType(const std::string& i_string) : iv_string(i_string) {} |
| 312 | |
| 313 | private: |
| 314 | /** The string representation of the procedure used for callouts. */ |
| 315 | const std::string iv_string; |
| 316 | |
| 317 | public: |
| 318 | bool operator==(const GuardType& r) const |
| 319 | { |
| 320 | return this->iv_string == r.iv_string; |
| 321 | } |
| 322 | |
| 323 | /** iv_string accessor */ |
| 324 | std::string getString() const |
| 325 | { |
| 326 | return iv_string; |
| 327 | } |
| 328 | }; |
| 329 | |
| 330 | inline const GuardType GuardType::NONE{"GARD_NULL"}; |
| 331 | inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"}; |
| 332 | inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"}; |
| 333 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 334 | } // namespace callout |
| 335 | |
| 336 | } // namespace analyzer |