blob: 00d968ebf6538d29decd093f480cae1ca37a66a7 [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
107 private:
108 /**
109 * @brief Constructor from components.
110 * @param i_string The string representation of the procedure used for
111 * callouts.
112 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600113 Procedure(const std::string& i_string, const SrcSubsystem i_subsystem) :
114 iv_string(i_string), iv_subsystem(i_subsystem)
115 {}
Zane Shelleyc85716c2021-08-17 10:54:06 -0500116
117 private:
118 /** The string representation of the procedure used for callouts. */
119 const std::string iv_string;
120
Zane Shelley55e7fec2022-01-28 15:29:44 -0600121 /** The associated SRC subsystem of the procedure. */
122 const SrcSubsystem iv_subsystem;
123
Zane Shelleyc85716c2021-08-17 10:54:06 -0500124 public:
125 /** iv_string accessor */
126 std::string getString() const
127 {
128 return iv_string;
129 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600130
131 /** iv_subsystem accessor */
132 SrcSubsystem getSrcSubsystem() const
133 {
134 return iv_subsystem;
135 }
Zane Shelleyc85716c2021-08-17 10:54:06 -0500136};
137
Zane Shelley55e7fec2022-01-28 15:29:44 -0600138inline const Procedure Procedure::NEXTLVL{"next_level_support",
139 SrcSubsystem::OTHERS};
Zane Shelleyc85716c2021-08-17 10:54:06 -0500140
Zane Shelley5d63cef2021-09-17 18:10:17 -0500141/** @brief Container class for bus callout service actions. */
142class BusType
143{
144 public:
145 /** SMP bus (fabric A or X bus). */
146 static const BusType SMP_BUS;
147
148 /** OMI bus (memory bus). */
149 static const BusType OMI_BUS;
150
151 private:
152 /**
153 * @brief Constructor from components.
154 * @param i_string The string representation of the procedure used for
155 * callouts.
156 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600157 BusType(const std::string& i_string, const SrcSubsystem i_subsystem) :
158 iv_string(i_string), iv_subsystem(i_subsystem)
159 {}
Zane Shelley5d63cef2021-09-17 18:10:17 -0500160
161 private:
162 /** The string representation of the procedure used for callouts. */
163 const std::string iv_string;
164
Zane Shelley55e7fec2022-01-28 15:29:44 -0600165 /** The associated SRC subsystem of the bus. */
166 const SrcSubsystem iv_subsystem;
167
Zane Shelley5d63cef2021-09-17 18:10:17 -0500168 public:
169 bool operator==(const BusType& r) const
170 {
Zane Shelley55e7fec2022-01-28 15:29:44 -0600171 return ((this->iv_string == r.iv_string) &&
172 (this->iv_subsystem == r.iv_subsystem));
Zane Shelley5d63cef2021-09-17 18:10:17 -0500173 }
174
175 /** iv_string accessor */
176 std::string getString() const
177 {
178 return iv_string;
179 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600180
181 /** iv_subsystem accessor */
182 SrcSubsystem getSrcSubsystem() const
183 {
184 return iv_subsystem;
185 }
Zane Shelley5d63cef2021-09-17 18:10:17 -0500186};
187
Zane Shelley55e7fec2022-01-28 15:29:44 -0600188inline const BusType BusType::SMP_BUS{"SMP_BUS", SrcSubsystem::PROCESSOR_BUS};
189inline const BusType BusType::OMI_BUS{"OMI_BUS", SrcSubsystem::MEMORY_BUS};
Zane Shelley5d63cef2021-09-17 18:10:17 -0500190
Zane Shelley84721d92021-09-08 13:30:27 -0500191/** @brief Container class for clock callout service actions. */
192class ClockType
193{
194 public:
195 /** Oscillator reference clock 0. */
196 static const ClockType OSC_REF_CLOCK_0;
197
198 /** Oscillator reference clock 1. */
199 static const ClockType OSC_REF_CLOCK_1;
200
Zane Shelleyd195b712022-01-26 13:26:34 -0600201 /** Time of Day (TOD) clock. */
202 static const ClockType TOD_CLOCK;
203
Zane Shelley84721d92021-09-08 13:30:27 -0500204 private:
205 /**
206 * @brief Constructor from components.
207 * @param i_string The string representation of the procedure used for
208 * callouts.
209 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600210 ClockType(const std::string& i_string, const SrcSubsystem i_subsystem) :
211 iv_string(i_string), iv_subsystem(i_subsystem)
212 {}
Zane Shelley84721d92021-09-08 13:30:27 -0500213
214 private:
215 /** The string representation of the procedure used for callouts. */
216 const std::string iv_string;
217
Zane Shelley55e7fec2022-01-28 15:29:44 -0600218 /** The associated SRC subsystem of the clock. */
219 const SrcSubsystem iv_subsystem;
220
Zane Shelley84721d92021-09-08 13:30:27 -0500221 public:
222 /** iv_string accessor */
223 std::string getString() const
224 {
225 return iv_string;
226 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600227
228 /** iv_subsystem accessor */
229 SrcSubsystem getSrcSubsystem() const
230 {
231 return iv_subsystem;
232 }
Zane Shelley84721d92021-09-08 13:30:27 -0500233};
234
Zane Shelley55e7fec2022-01-28 15:29:44 -0600235inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0",
236 SrcSubsystem::CEC_CLOCKS};
237inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1",
238 SrcSubsystem::CEC_CLOCKS};
239inline const ClockType ClockType::TOD_CLOCK{"TOD_CLOCK", SrcSubsystem::CEC_TOD};
Zane Shelley84721d92021-09-08 13:30:27 -0500240
Zane Shelleya4134772022-01-10 17:22:44 -0600241/** @brief Container class for part callout service actions. */
242class PartType
243{
244 public:
245 /** The part containing the PNOR. */
246 static const PartType PNOR;
247
248 private:
249 /**
250 * @brief Constructor from components.
251 * @param i_string The string representation of the part callout.
252 */
Zane Shelley55e7fec2022-01-28 15:29:44 -0600253 PartType(const std::string& i_string, const SrcSubsystem i_subsystem) :
254 iv_string(i_string), iv_subsystem(i_subsystem)
255 {}
Zane Shelleya4134772022-01-10 17:22:44 -0600256
257 private:
258 /** The string representation of the part callout. */
259 const std::string iv_string;
260
Zane Shelley55e7fec2022-01-28 15:29:44 -0600261 /** The associated SRC subsystem of the part. */
262 const SrcSubsystem iv_subsystem;
263
Zane Shelleya4134772022-01-10 17:22:44 -0600264 public:
265 bool operator==(const PartType& r) const
266 {
Zane Shelley55e7fec2022-01-28 15:29:44 -0600267 return ((this->iv_string == r.iv_string) &&
268 (this->iv_subsystem == r.iv_subsystem));
Zane Shelleya4134772022-01-10 17:22:44 -0600269 }
270
271 /** iv_string accessor */
272 std::string getString() const
273 {
274 return iv_string;
275 }
Zane Shelley55e7fec2022-01-28 15:29:44 -0600276
277 /** iv_subsystem accessor */
278 SrcSubsystem getSrcSubsystem() const
279 {
280 return iv_subsystem;
281 }
Zane Shelleya4134772022-01-10 17:22:44 -0600282};
283
Zane Shelley55e7fec2022-01-28 15:29:44 -0600284inline const PartType PartType::PNOR{"PNOR", SrcSubsystem::CEC_HARDWARE};
Zane Shelleya4134772022-01-10 17:22:44 -0600285
Zane Shelleybf3326f2021-11-12 13:41:39 -0600286/** @brief Container class for guard service actions. */
287class GuardType
288{
289 public:
290 /** Do not guard. */
291 static const GuardType NONE;
292
293 /** Guard on fatal error (cannot recover resource). */
294 static const GuardType UNRECOVERABLE;
295
296 /** Guard on non-fatal error (can recover resource). */
297 static const GuardType PREDICTIVE;
298
299 private:
300 /**
301 * @brief Constructor from components.
302 * @param i_string The string representation of the procedure used for
303 * callouts.
304 */
305 explicit GuardType(const std::string& i_string) : iv_string(i_string) {}
306
307 private:
308 /** The string representation of the procedure used for callouts. */
309 const std::string iv_string;
310
311 public:
312 bool operator==(const GuardType& r) const
313 {
314 return this->iv_string == r.iv_string;
315 }
316
317 /** iv_string accessor */
318 std::string getString() const
319 {
320 return iv_string;
321 }
322};
323
324inline const GuardType GuardType::NONE{"GARD_NULL"};
325inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"};
326inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"};
327
Zane Shelleyc85716c2021-08-17 10:54:06 -0500328} // namespace callout
329
330} // namespace analyzer