blob: 76c1dcfb01c1d28902ffa886aa03e7cf639bc502 [file] [log] [blame]
Zane Shelleyc85716c2021-08-17 10:54:06 -05001#pragma once
2
Zane Shelley9980d482022-01-28 15:21:47 -06003#include <map>
Zane Shelleyc85716c2021-08-17 10:54:06 -05004#include <string>
5
6namespace analyzer
7{
8
9namespace callout
10{
11
12/** @brief All callouts will have a priority indicating when to issue the
13 * required service action. */
Zane Shelley9980d482022-01-28 15:21:47 -060014enum class Priority
Zane Shelleyc85716c2021-08-17 10:54:06 -050015{
Zane Shelleyc85716c2021-08-17 10:54:06 -050016 /** Serivce is mandatory. */
Zane Shelley9980d482022-01-28 15:21:47 -060017 HIGH,
Zane Shelleyc85716c2021-08-17 10:54:06 -050018
19 /** Serivce medium priority callouts one at a time, in order, until the
20 * issue is resolved. */
Zane Shelley9980d482022-01-28 15:21:47 -060021 MED,
Zane Shelleyc85716c2021-08-17 10:54:06 -050022
23 /** Same as MED, except replace all A's as a group. */
Zane Shelley9980d482022-01-28 15:21:47 -060024 MED_A,
Zane Shelleyc85716c2021-08-17 10:54:06 -050025
Zane Shelley9980d482022-01-28 15:21:47 -060026 /** Same as MED, except replace all B's as a group. */
27 MED_B,
Zane Shelleyc85716c2021-08-17 10:54:06 -050028
Zane Shelley9980d482022-01-28 15:21:47 -060029 /** Same as MED, except replace all C's as a group. */
30 MED_C,
Zane Shelleyc85716c2021-08-17 10:54:06 -050031
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 Shelley9980d482022-01-28 15:21:47 -060035 LOW,
Zane Shelleyc85716c2021-08-17 10:54:06 -050036};
37
Zane Shelley9980d482022-01-28 15:21:47 -060038/** @return The string representation of the priority used in callouts. */
39inline 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 */
58inline 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 Shelleyc85716c2021-08-17 10:54:06 -050074
Zane Shelley55e7fec2022-01-28 15:29:44 -060075/** These SRC subsystem values are defined by the PEL spec. */
76enum 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 Palmerbc94bde2022-02-18 09:03:37 -060082 PROCESSOR_FRU = 0x11,
Zane Shelley55e7fec2022-01-28 15:29:44 -060083 PROCESSOR_UNIT = 0x13,
84 PROCESSOR_BUS = 0x14,
85
Caleb Palmerbc94bde2022-02-18 09:03:37 -060086 MEMORY_CTLR = 0x21,
Zane Shelley55e7fec2022-01-28 15:29:44 -060087 MEMORY_BUS = 0x22,
88 MEMORY_DIMM = 0x23,
Caleb Palmerbc94bde2022-02-18 09:03:37 -060089 MEMORY_FRU = 0x24,
Zane Shelley55e7fec2022-01-28 15:29:44 -060090
91 PHB = 0x38,
92
93 CEC_HARDWARE = 0x50,
94 CEC_CLOCKS = 0x58,
95 CEC_TOD = 0x5A,
96
97 OTHERS = 0x70,
98};
99
Zane Shelleyc85716c2021-08-17 10:54:06 -0500100/** @brief Container class for procedure callout service actions. */
101class Procedure
102{
103 public:
104 /** Contact next level support. */
105 static const Procedure NEXTLVL;
106
Zane Shelleyd8b70182022-03-10 10:50:22 -0600107 /** An unrecoverable event occurred, look for previous errors for the
108 * cause. */
109 static const Procedure SUE_SEEN;
110
Zane Shelleyc85716c2021-08-17 10:54:06 -0500111 private:
112 /**
113 * @brief Constructor from components.
114 * @param i_string The string representation of the procedure used for
115 * callouts.
116 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600117 Procedure(const std::string& i_string, const SrcSubsystem i_subsystem) :
118 iv_string(i_string), iv_subsystem(i_subsystem)
119 {}
Zane Shelleyc85716c2021-08-17 10:54:06 -0500120
121 private:
122 /** The string representation of the procedure used for callouts. */
123 const std::string iv_string;
124
Zane Shelley55e7fec2022-01-28 15:29:44 -0600125 /** The associated SRC subsystem of the procedure. */
126 const SrcSubsystem iv_subsystem;
127
Zane Shelleyc85716c2021-08-17 10:54:06 -0500128 public:
129 /** iv_string accessor */
130 std::string getString() const
131 {
132 return iv_string;
133 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600134
135 /** iv_subsystem accessor */
136 SrcSubsystem getSrcSubsystem() const
137 {
138 return iv_subsystem;
139 }
Zane Shelleyc85716c2021-08-17 10:54:06 -0500140};
141
Zane Shelley55e7fec2022-01-28 15:29:44 -0600142inline const Procedure Procedure::NEXTLVL{"next_level_support",
143 SrcSubsystem::OTHERS};
Zane Shelleyd8b70182022-03-10 10:50:22 -0600144inline const Procedure Procedure::SUE_SEEN{"find_sue_root_cause",
145 SrcSubsystem::OTHERS};
Zane Shelleyc85716c2021-08-17 10:54:06 -0500146
Zane Shelley5d63cef2021-09-17 18:10:17 -0500147/** @brief Container class for bus callout service actions. */
148class 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 Shelley55e7fec2022-01-28 15:29:44 -0600163 BusType(const std::string& i_string, const SrcSubsystem i_subsystem) :
164 iv_string(i_string), iv_subsystem(i_subsystem)
165 {}
Zane Shelley5d63cef2021-09-17 18:10:17 -0500166
167 private:
168 /** The string representation of the procedure used for callouts. */
169 const std::string iv_string;
170
Zane Shelley55e7fec2022-01-28 15:29:44 -0600171 /** The associated SRC subsystem of the bus. */
172 const SrcSubsystem iv_subsystem;
173
Zane Shelley5d63cef2021-09-17 18:10:17 -0500174 public:
175 bool operator==(const BusType& r) const
176 {
Zane Shelley55e7fec2022-01-28 15:29:44 -0600177 return ((this->iv_string == r.iv_string) &&
178 (this->iv_subsystem == r.iv_subsystem));
Zane Shelley5d63cef2021-09-17 18:10:17 -0500179 }
180
181 /** iv_string accessor */
182 std::string getString() const
183 {
184 return iv_string;
185 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600186
187 /** iv_subsystem accessor */
188 SrcSubsystem getSrcSubsystem() const
189 {
190 return iv_subsystem;
191 }
Zane Shelley5d63cef2021-09-17 18:10:17 -0500192};
193
Zane Shelley55e7fec2022-01-28 15:29:44 -0600194inline const BusType BusType::SMP_BUS{"SMP_BUS", SrcSubsystem::PROCESSOR_BUS};
195inline const BusType BusType::OMI_BUS{"OMI_BUS", SrcSubsystem::MEMORY_BUS};
Zane Shelley5d63cef2021-09-17 18:10:17 -0500196
Zane Shelley84721d92021-09-08 13:30:27 -0500197/** @brief Container class for clock callout service actions. */
198class 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 Shelleyd195b712022-01-26 13:26:34 -0600207 /** Time of Day (TOD) clock. */
208 static const ClockType TOD_CLOCK;
209
Zane Shelley84721d92021-09-08 13:30:27 -0500210 private:
211 /**
212 * @brief Constructor from components.
213 * @param i_string The string representation of the procedure used for
214 * callouts.
215 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600216 ClockType(const std::string& i_string, const SrcSubsystem i_subsystem) :
217 iv_string(i_string), iv_subsystem(i_subsystem)
218 {}
Zane Shelley84721d92021-09-08 13:30:27 -0500219
220 private:
221 /** The string representation of the procedure used for callouts. */
222 const std::string iv_string;
223
Zane Shelley55e7fec2022-01-28 15:29:44 -0600224 /** The associated SRC subsystem of the clock. */
225 const SrcSubsystem iv_subsystem;
226
Zane Shelley84721d92021-09-08 13:30:27 -0500227 public:
228 /** iv_string accessor */
229 std::string getString() const
230 {
231 return iv_string;
232 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600233
234 /** iv_subsystem accessor */
235 SrcSubsystem getSrcSubsystem() const
236 {
237 return iv_subsystem;
238 }
Zane Shelley84721d92021-09-08 13:30:27 -0500239};
240
Zane Shelley55e7fec2022-01-28 15:29:44 -0600241inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0",
242 SrcSubsystem::CEC_CLOCKS};
243inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1",
244 SrcSubsystem::CEC_CLOCKS};
245inline const ClockType ClockType::TOD_CLOCK{"TOD_CLOCK", SrcSubsystem::CEC_TOD};
Zane Shelley84721d92021-09-08 13:30:27 -0500246
Zane Shelleya4134772022-01-10 17:22:44 -0600247/** @brief Container class for part callout service actions. */
248class 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 Shelley55e7fec2022-01-28 15:29:44 -0600259 PartType(const std::string& i_string, const SrcSubsystem i_subsystem) :
260 iv_string(i_string), iv_subsystem(i_subsystem)
261 {}
Zane Shelleya4134772022-01-10 17:22:44 -0600262
263 private:
264 /** The string representation of the part callout. */
265 const std::string iv_string;
266
Zane Shelley55e7fec2022-01-28 15:29:44 -0600267 /** The associated SRC subsystem of the part. */
268 const SrcSubsystem iv_subsystem;
269
Zane Shelleya4134772022-01-10 17:22:44 -0600270 public:
271 bool operator==(const PartType& r) const
272 {
Zane Shelley55e7fec2022-01-28 15:29:44 -0600273 return ((this->iv_string == r.iv_string) &&
274 (this->iv_subsystem == r.iv_subsystem));
Zane Shelleya4134772022-01-10 17:22:44 -0600275 }
276
277 /** iv_string accessor */
278 std::string getString() const
279 {
280 return iv_string;
281 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600282
283 /** iv_subsystem accessor */
284 SrcSubsystem getSrcSubsystem() const
285 {
286 return iv_subsystem;
287 }
Zane Shelleya4134772022-01-10 17:22:44 -0600288};
289
Zane Shelley55e7fec2022-01-28 15:29:44 -0600290inline const PartType PartType::PNOR{"PNOR", SrcSubsystem::CEC_HARDWARE};
Zane Shelleya4134772022-01-10 17:22:44 -0600291
Zane Shelleybf3326f2021-11-12 13:41:39 -0600292/** @brief Container class for guard service actions. */
293class 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
330inline const GuardType GuardType::NONE{"GARD_NULL"};
331inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"};
332inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"};
333
Zane Shelleyc85716c2021-08-17 10:54:06 -0500334} // namespace callout
335
336} // namespace analyzer