blob: adb2fd41b248a4c9e3445d85d6c00424436b2fd6 [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,
82 PROCESSOR_UNIT = 0x13,
83 PROCESSOR_BUS = 0x14,
84
85 MEMORY = 0x20,
86 MEMORY_BUS = 0x22,
87 MEMORY_DIMM = 0x23,
88
89 PHB = 0x38,
90
91 CEC_HARDWARE = 0x50,
92 CEC_CLOCKS = 0x58,
93 CEC_TOD = 0x5A,
94
95 OTHERS = 0x70,
96};
97
Zane Shelleyc85716c2021-08-17 10:54:06 -050098/** @brief Container class for procedure callout service actions. */
99class Procedure
100{
101 public:
102 /** Contact next level support. */
103 static const Procedure NEXTLVL;
104
105 private:
106 /**
107 * @brief Constructor from components.
108 * @param i_string The string representation of the procedure used for
109 * callouts.
110 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600111 Procedure(const std::string& i_string, const SrcSubsystem i_subsystem) :
112 iv_string(i_string), iv_subsystem(i_subsystem)
113 {}
Zane Shelleyc85716c2021-08-17 10:54:06 -0500114
115 private:
116 /** The string representation of the procedure used for callouts. */
117 const std::string iv_string;
118
Zane Shelley55e7fec2022-01-28 15:29:44 -0600119 /** The associated SRC subsystem of the procedure. */
120 const SrcSubsystem iv_subsystem;
121
Zane Shelleyc85716c2021-08-17 10:54:06 -0500122 public:
123 /** iv_string accessor */
124 std::string getString() const
125 {
126 return iv_string;
127 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600128
129 /** iv_subsystem accessor */
130 SrcSubsystem getSrcSubsystem() const
131 {
132 return iv_subsystem;
133 }
Zane Shelleyc85716c2021-08-17 10:54:06 -0500134};
135
Zane Shelley55e7fec2022-01-28 15:29:44 -0600136inline const Procedure Procedure::NEXTLVL{"next_level_support",
137 SrcSubsystem::OTHERS};
Zane Shelleyc85716c2021-08-17 10:54:06 -0500138
Zane Shelley5d63cef2021-09-17 18:10:17 -0500139/** @brief Container class for bus callout service actions. */
140class BusType
141{
142 public:
143 /** SMP bus (fabric A or X bus). */
144 static const BusType SMP_BUS;
145
146 /** OMI bus (memory bus). */
147 static const BusType OMI_BUS;
148
149 private:
150 /**
151 * @brief Constructor from components.
152 * @param i_string The string representation of the procedure used for
153 * callouts.
154 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600155 BusType(const std::string& i_string, const SrcSubsystem i_subsystem) :
156 iv_string(i_string), iv_subsystem(i_subsystem)
157 {}
Zane Shelley5d63cef2021-09-17 18:10:17 -0500158
159 private:
160 /** The string representation of the procedure used for callouts. */
161 const std::string iv_string;
162
Zane Shelley55e7fec2022-01-28 15:29:44 -0600163 /** The associated SRC subsystem of the bus. */
164 const SrcSubsystem iv_subsystem;
165
Zane Shelley5d63cef2021-09-17 18:10:17 -0500166 public:
167 bool operator==(const BusType& r) const
168 {
Zane Shelley55e7fec2022-01-28 15:29:44 -0600169 return ((this->iv_string == r.iv_string) &&
170 (this->iv_subsystem == r.iv_subsystem));
Zane Shelley5d63cef2021-09-17 18:10:17 -0500171 }
172
173 /** iv_string accessor */
174 std::string getString() const
175 {
176 return iv_string;
177 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600178
179 /** iv_subsystem accessor */
180 SrcSubsystem getSrcSubsystem() const
181 {
182 return iv_subsystem;
183 }
Zane Shelley5d63cef2021-09-17 18:10:17 -0500184};
185
Zane Shelley55e7fec2022-01-28 15:29:44 -0600186inline const BusType BusType::SMP_BUS{"SMP_BUS", SrcSubsystem::PROCESSOR_BUS};
187inline const BusType BusType::OMI_BUS{"OMI_BUS", SrcSubsystem::MEMORY_BUS};
Zane Shelley5d63cef2021-09-17 18:10:17 -0500188
Zane Shelley84721d92021-09-08 13:30:27 -0500189/** @brief Container class for clock callout service actions. */
190class ClockType
191{
192 public:
193 /** Oscillator reference clock 0. */
194 static const ClockType OSC_REF_CLOCK_0;
195
196 /** Oscillator reference clock 1. */
197 static const ClockType OSC_REF_CLOCK_1;
198
Zane Shelleyd195b712022-01-26 13:26:34 -0600199 /** Time of Day (TOD) clock. */
200 static const ClockType TOD_CLOCK;
201
Zane Shelley84721d92021-09-08 13:30:27 -0500202 private:
203 /**
204 * @brief Constructor from components.
205 * @param i_string The string representation of the procedure used for
206 * callouts.
207 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600208 ClockType(const std::string& i_string, const SrcSubsystem i_subsystem) :
209 iv_string(i_string), iv_subsystem(i_subsystem)
210 {}
Zane Shelley84721d92021-09-08 13:30:27 -0500211
212 private:
213 /** The string representation of the procedure used for callouts. */
214 const std::string iv_string;
215
Zane Shelley55e7fec2022-01-28 15:29:44 -0600216 /** The associated SRC subsystem of the clock. */
217 const SrcSubsystem iv_subsystem;
218
Zane Shelley84721d92021-09-08 13:30:27 -0500219 public:
220 /** iv_string accessor */
221 std::string getString() const
222 {
223 return iv_string;
224 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600225
226 /** iv_subsystem accessor */
227 SrcSubsystem getSrcSubsystem() const
228 {
229 return iv_subsystem;
230 }
Zane Shelley84721d92021-09-08 13:30:27 -0500231};
232
Zane Shelley55e7fec2022-01-28 15:29:44 -0600233inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0",
234 SrcSubsystem::CEC_CLOCKS};
235inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1",
236 SrcSubsystem::CEC_CLOCKS};
237inline const ClockType ClockType::TOD_CLOCK{"TOD_CLOCK", SrcSubsystem::CEC_TOD};
Zane Shelley84721d92021-09-08 13:30:27 -0500238
Zane Shelleya4134772022-01-10 17:22:44 -0600239/** @brief Container class for part callout service actions. */
240class PartType
241{
242 public:
243 /** The part containing the PNOR. */
244 static const PartType PNOR;
245
246 private:
247 /**
248 * @brief Constructor from components.
249 * @param i_string The string representation of the part callout.
250 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600251 PartType(const std::string& i_string, const SrcSubsystem i_subsystem) :
252 iv_string(i_string), iv_subsystem(i_subsystem)
253 {}
Zane Shelleya4134772022-01-10 17:22:44 -0600254
255 private:
256 /** The string representation of the part callout. */
257 const std::string iv_string;
258
Zane Shelley55e7fec2022-01-28 15:29:44 -0600259 /** The associated SRC subsystem of the part. */
260 const SrcSubsystem iv_subsystem;
261
Zane Shelleya4134772022-01-10 17:22:44 -0600262 public:
263 bool operator==(const PartType& r) const
264 {
Zane Shelley55e7fec2022-01-28 15:29:44 -0600265 return ((this->iv_string == r.iv_string) &&
266 (this->iv_subsystem == r.iv_subsystem));
Zane Shelleya4134772022-01-10 17:22:44 -0600267 }
268
269 /** iv_string accessor */
270 std::string getString() const
271 {
272 return iv_string;
273 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600274
275 /** iv_subsystem accessor */
276 SrcSubsystem getSrcSubsystem() const
277 {
278 return iv_subsystem;
279 }
Zane Shelleya4134772022-01-10 17:22:44 -0600280};
281
Zane Shelley55e7fec2022-01-28 15:29:44 -0600282inline const PartType PartType::PNOR{"PNOR", SrcSubsystem::CEC_HARDWARE};
Zane Shelleya4134772022-01-10 17:22:44 -0600283
Zane Shelleybf3326f2021-11-12 13:41:39 -0600284/** @brief Container class for guard service actions. */
285class GuardType
286{
287 public:
288 /** Do not guard. */
289 static const GuardType NONE;
290
291 /** Guard on fatal error (cannot recover resource). */
292 static const GuardType UNRECOVERABLE;
293
294 /** Guard on non-fatal error (can recover resource). */
295 static const GuardType PREDICTIVE;
296
297 private:
298 /**
299 * @brief Constructor from components.
300 * @param i_string The string representation of the procedure used for
301 * callouts.
302 */
303 explicit GuardType(const std::string& i_string) : iv_string(i_string) {}
304
305 private:
306 /** The string representation of the procedure used for callouts. */
307 const std::string iv_string;
308
309 public:
310 bool operator==(const GuardType& r) const
311 {
312 return this->iv_string == r.iv_string;
313 }
314
315 /** iv_string accessor */
316 std::string getString() const
317 {
318 return iv_string;
319 }
320};
321
322inline const GuardType GuardType::NONE{"GARD_NULL"};
323inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"};
324inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"};
325
Zane Shelleyc85716c2021-08-17 10:54:06 -0500326} // namespace callout
327
328} // namespace analyzer