1c85716caSZane Shelley #pragma once
2c85716caSZane Shelley
39980d489SZane Shelley #include <map>
4c85716caSZane Shelley #include <string>
5c85716caSZane Shelley
6c85716caSZane Shelley namespace analyzer
7c85716caSZane Shelley {
8c85716caSZane Shelley
9c85716caSZane Shelley namespace callout
10c85716caSZane Shelley {
11c85716caSZane Shelley
12c85716caSZane Shelley /** @brief All callouts will have a priority indicating when to issue the
13c85716caSZane Shelley * required service action. */
149980d489SZane Shelley enum class Priority
15c85716caSZane Shelley {
16c85716caSZane Shelley /** Serivce is mandatory. */
179980d489SZane Shelley HIGH,
18c85716caSZane Shelley
19c85716caSZane Shelley /** Serivce medium priority callouts one at a time, in order, until the
20c85716caSZane Shelley * issue is resolved. */
219980d489SZane Shelley MED,
22c85716caSZane Shelley
23c85716caSZane Shelley /** Same as MED, except replace all A's as a group. */
249980d489SZane Shelley MED_A,
25c85716caSZane Shelley
269980d489SZane Shelley /** Same as MED, except replace all B's as a group. */
279980d489SZane Shelley MED_B,
28c85716caSZane Shelley
299980d489SZane Shelley /** Same as MED, except replace all C's as a group. */
309980d489SZane Shelley MED_C,
31c85716caSZane Shelley
32c85716caSZane Shelley /** If servicing all high and medium priority callouts did not resolve
33c85716caSZane Shelley * the issue, service low priority callouts one at a time, in order,
34c85716caSZane Shelley * until the issue is resolved. */
359980d489SZane Shelley LOW,
36c85716caSZane Shelley };
37c85716caSZane Shelley
389980d489SZane Shelley /** @return The string representation of the priority used in callouts. */
getString(Priority i_priority)399980d489SZane Shelley inline std::string getString(Priority i_priority)
409980d489SZane Shelley {
41c85716caSZane Shelley // clang-format off
429980d489SZane Shelley static const std::map<Priority, std::string> m =
439980d489SZane Shelley {
449980d489SZane Shelley {Priority::HIGH, "H"},
459980d489SZane Shelley {Priority::MED, "M"},
469980d489SZane Shelley {Priority::MED_A, "A"},
479980d489SZane Shelley {Priority::MED_B, "B"},
489980d489SZane Shelley {Priority::MED_C, "C"},
499980d489SZane Shelley {Priority::LOW, "L"},
509980d489SZane Shelley };
51c85716caSZane Shelley // clang-format on
52c85716caSZane Shelley
539980d489SZane Shelley return m.at(i_priority);
549980d489SZane Shelley }
559980d489SZane Shelley
569980d489SZane Shelley /** @return The string representation of the priority used in The callout FFDC.
579980d489SZane Shelley */
getStringFFDC(Priority i_priority)589980d489SZane Shelley inline std::string getStringFFDC(Priority i_priority)
599980d489SZane Shelley {
609980d489SZane Shelley // clang-format off
619980d489SZane Shelley static const std::map<Priority, std::string> m =
629980d489SZane Shelley {
639980d489SZane Shelley {Priority::HIGH, "high"},
649980d489SZane Shelley {Priority::MED, "medium"},
659980d489SZane Shelley {Priority::MED_A, "medium_group_A"},
669980d489SZane Shelley {Priority::MED_B, "medium_group_B"},
679980d489SZane Shelley {Priority::MED_C, "medium_group_C"},
689980d489SZane Shelley {Priority::LOW, "low"},
699980d489SZane Shelley };
709980d489SZane Shelley // clang-format on
719980d489SZane Shelley
729980d489SZane Shelley return m.at(i_priority);
739980d489SZane Shelley }
749980d489SZane Shelley
7555e7fec3SZane Shelley /** These SRC subsystem values are defined by the PEL spec. */
7655e7fec3SZane Shelley enum class SrcSubsystem
7755e7fec3SZane Shelley {
7855e7fec3SZane Shelley // Can also reference `extensions/openpower-pels/pel_values.cpp` from
7955e7fec3SZane Shelley // `openbmc/phosphor-logging` for the full list of these values.
8055e7fec3SZane Shelley
8155e7fec3SZane Shelley PROCESSOR = 0x10,
82bc94bdeaSCaleb Palmer PROCESSOR_FRU = 0x11,
8355e7fec3SZane Shelley PROCESSOR_UNIT = 0x13,
8455e7fec3SZane Shelley PROCESSOR_BUS = 0x14,
8555e7fec3SZane Shelley
86bc94bdeaSCaleb Palmer MEMORY_CTLR = 0x21,
8755e7fec3SZane Shelley MEMORY_BUS = 0x22,
8855e7fec3SZane Shelley MEMORY_DIMM = 0x23,
89bc94bdeaSCaleb Palmer MEMORY_FRU = 0x24,
9055e7fec3SZane Shelley
9155e7fec3SZane Shelley PHB = 0x38,
9255e7fec3SZane Shelley
9355e7fec3SZane Shelley CEC_HARDWARE = 0x50,
9455e7fec3SZane Shelley CEC_CLOCKS = 0x58,
9555e7fec3SZane Shelley CEC_TOD = 0x5A,
9655e7fec3SZane Shelley
9755e7fec3SZane Shelley OTHERS = 0x70,
9855e7fec3SZane Shelley };
9955e7fec3SZane Shelley
100c85716caSZane Shelley /** @brief Container class for procedure callout service actions. */
101c85716caSZane Shelley class Procedure
102c85716caSZane Shelley {
103c85716caSZane Shelley public:
104c85716caSZane Shelley /** Contact next level support. */
105c85716caSZane Shelley static const Procedure NEXTLVL;
106c85716caSZane Shelley
107*d8b70184SZane Shelley /** An unrecoverable event occurred, look for previous errors for the
108*d8b70184SZane Shelley * cause. */
109*d8b70184SZane Shelley static const Procedure SUE_SEEN;
110*d8b70184SZane Shelley
111c85716caSZane Shelley private:
112c85716caSZane Shelley /**
113c85716caSZane Shelley * @brief Constructor from components.
114c85716caSZane Shelley * @param i_string The string representation of the procedure used for
115c85716caSZane Shelley * callouts.
116c85716caSZane Shelley */
Procedure(const std::string & i_string,const SrcSubsystem i_subsystem)11755e7fec3SZane Shelley Procedure(const std::string& i_string, const SrcSubsystem i_subsystem) :
11855e7fec3SZane Shelley iv_string(i_string), iv_subsystem(i_subsystem)
11955e7fec3SZane Shelley {}
120c85716caSZane Shelley
121c85716caSZane Shelley private:
122c85716caSZane Shelley /** The string representation of the procedure used for callouts. */
123c85716caSZane Shelley const std::string iv_string;
124c85716caSZane Shelley
12555e7fec3SZane Shelley /** The associated SRC subsystem of the procedure. */
12655e7fec3SZane Shelley const SrcSubsystem iv_subsystem;
12755e7fec3SZane Shelley
128c85716caSZane Shelley public:
129c85716caSZane Shelley /** iv_string accessor */
getString() const130c85716caSZane Shelley std::string getString() const
131c85716caSZane Shelley {
132c85716caSZane Shelley return iv_string;
133c85716caSZane Shelley }
13455e7fec3SZane Shelley
13555e7fec3SZane Shelley /** iv_subsystem accessor */
getSrcSubsystem() const13655e7fec3SZane Shelley SrcSubsystem getSrcSubsystem() const
13755e7fec3SZane Shelley {
13855e7fec3SZane Shelley return iv_subsystem;
13955e7fec3SZane Shelley }
140c85716caSZane Shelley };
141c85716caSZane Shelley
14255e7fec3SZane Shelley inline const Procedure Procedure::NEXTLVL{"next_level_support",
14355e7fec3SZane Shelley SrcSubsystem::OTHERS};
144*d8b70184SZane Shelley inline const Procedure Procedure::SUE_SEEN{"find_sue_root_cause",
145*d8b70184SZane Shelley SrcSubsystem::OTHERS};
146c85716caSZane Shelley
1475d63cefcSZane Shelley /** @brief Container class for bus callout service actions. */
1485d63cefcSZane Shelley class BusType
1495d63cefcSZane Shelley {
1505d63cefcSZane Shelley public:
1515d63cefcSZane Shelley /** SMP bus (fabric A or X bus). */
1525d63cefcSZane Shelley static const BusType SMP_BUS;
1535d63cefcSZane Shelley
1545d63cefcSZane Shelley /** OMI bus (memory bus). */
1555d63cefcSZane Shelley static const BusType OMI_BUS;
1565d63cefcSZane Shelley
1575d63cefcSZane Shelley private:
1585d63cefcSZane Shelley /**
1595d63cefcSZane Shelley * @brief Constructor from components.
1605d63cefcSZane Shelley * @param i_string The string representation of the procedure used for
1615d63cefcSZane Shelley * callouts.
1625d63cefcSZane Shelley */
BusType(const std::string & i_string,const SrcSubsystem i_subsystem)16355e7fec3SZane Shelley BusType(const std::string& i_string, const SrcSubsystem i_subsystem) :
16455e7fec3SZane Shelley iv_string(i_string), iv_subsystem(i_subsystem)
16555e7fec3SZane Shelley {}
1665d63cefcSZane Shelley
1675d63cefcSZane Shelley private:
1685d63cefcSZane Shelley /** The string representation of the procedure used for callouts. */
1695d63cefcSZane Shelley const std::string iv_string;
1705d63cefcSZane Shelley
17155e7fec3SZane Shelley /** The associated SRC subsystem of the bus. */
17255e7fec3SZane Shelley const SrcSubsystem iv_subsystem;
17355e7fec3SZane Shelley
1745d63cefcSZane Shelley public:
operator ==(const BusType & r) const1755d63cefcSZane Shelley bool operator==(const BusType& r) const
1765d63cefcSZane Shelley {
17755e7fec3SZane Shelley return ((this->iv_string == r.iv_string) &&
17855e7fec3SZane Shelley (this->iv_subsystem == r.iv_subsystem));
1795d63cefcSZane Shelley }
1805d63cefcSZane Shelley
1815d63cefcSZane Shelley /** iv_string accessor */
getString() const1825d63cefcSZane Shelley std::string getString() const
1835d63cefcSZane Shelley {
1845d63cefcSZane Shelley return iv_string;
1855d63cefcSZane Shelley }
18655e7fec3SZane Shelley
18755e7fec3SZane Shelley /** iv_subsystem accessor */
getSrcSubsystem() const18855e7fec3SZane Shelley SrcSubsystem getSrcSubsystem() const
18955e7fec3SZane Shelley {
19055e7fec3SZane Shelley return iv_subsystem;
19155e7fec3SZane Shelley }
1925d63cefcSZane Shelley };
1935d63cefcSZane Shelley
19455e7fec3SZane Shelley inline const BusType BusType::SMP_BUS{"SMP_BUS", SrcSubsystem::PROCESSOR_BUS};
19555e7fec3SZane Shelley inline const BusType BusType::OMI_BUS{"OMI_BUS", SrcSubsystem::MEMORY_BUS};
1965d63cefcSZane Shelley
19784721d90SZane Shelley /** @brief Container class for clock callout service actions. */
19884721d90SZane Shelley class ClockType
19984721d90SZane Shelley {
20084721d90SZane Shelley public:
20184721d90SZane Shelley /** Oscillator reference clock 0. */
20284721d90SZane Shelley static const ClockType OSC_REF_CLOCK_0;
20384721d90SZane Shelley
20484721d90SZane Shelley /** Oscillator reference clock 1. */
20584721d90SZane Shelley static const ClockType OSC_REF_CLOCK_1;
20684721d90SZane Shelley
207d195b716SZane Shelley /** Time of Day (TOD) clock. */
208d195b716SZane Shelley static const ClockType TOD_CLOCK;
209d195b716SZane Shelley
21084721d90SZane Shelley private:
21184721d90SZane Shelley /**
21284721d90SZane Shelley * @brief Constructor from components.
21384721d90SZane Shelley * @param i_string The string representation of the procedure used for
21484721d90SZane Shelley * callouts.
21584721d90SZane Shelley */
ClockType(const std::string & i_string,const SrcSubsystem i_subsystem)21655e7fec3SZane Shelley ClockType(const std::string& i_string, const SrcSubsystem i_subsystem) :
21755e7fec3SZane Shelley iv_string(i_string), iv_subsystem(i_subsystem)
21855e7fec3SZane Shelley {}
21984721d90SZane Shelley
22084721d90SZane Shelley private:
22184721d90SZane Shelley /** The string representation of the procedure used for callouts. */
22284721d90SZane Shelley const std::string iv_string;
22384721d90SZane Shelley
22455e7fec3SZane Shelley /** The associated SRC subsystem of the clock. */
22555e7fec3SZane Shelley const SrcSubsystem iv_subsystem;
22655e7fec3SZane Shelley
22784721d90SZane Shelley public:
22884721d90SZane Shelley /** iv_string accessor */
getString() const22984721d90SZane Shelley std::string getString() const
23084721d90SZane Shelley {
23184721d90SZane Shelley return iv_string;
23284721d90SZane Shelley }
23355e7fec3SZane Shelley
23455e7fec3SZane Shelley /** iv_subsystem accessor */
getSrcSubsystem() const23555e7fec3SZane Shelley SrcSubsystem getSrcSubsystem() const
23655e7fec3SZane Shelley {
23755e7fec3SZane Shelley return iv_subsystem;
23855e7fec3SZane Shelley }
23984721d90SZane Shelley };
24084721d90SZane Shelley
24155e7fec3SZane Shelley inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0",
24255e7fec3SZane Shelley SrcSubsystem::CEC_CLOCKS};
24355e7fec3SZane Shelley inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1",
24455e7fec3SZane Shelley SrcSubsystem::CEC_CLOCKS};
24555e7fec3SZane Shelley inline const ClockType ClockType::TOD_CLOCK{"TOD_CLOCK", SrcSubsystem::CEC_TOD};
24684721d90SZane Shelley
247a4134770SZane Shelley /** @brief Container class for part callout service actions. */
248a4134770SZane Shelley class PartType
249a4134770SZane Shelley {
250a4134770SZane Shelley public:
251a4134770SZane Shelley /** The part containing the PNOR. */
252a4134770SZane Shelley static const PartType PNOR;
253a4134770SZane Shelley
254a4134770SZane Shelley private:
255a4134770SZane Shelley /**
256a4134770SZane Shelley * @brief Constructor from components.
257a4134770SZane Shelley * @param i_string The string representation of the part callout.
258a4134770SZane Shelley */
PartType(const std::string & i_string,const SrcSubsystem i_subsystem)25955e7fec3SZane Shelley PartType(const std::string& i_string, const SrcSubsystem i_subsystem) :
26055e7fec3SZane Shelley iv_string(i_string), iv_subsystem(i_subsystem)
26155e7fec3SZane Shelley {}
262a4134770SZane Shelley
263a4134770SZane Shelley private:
264a4134770SZane Shelley /** The string representation of the part callout. */
265a4134770SZane Shelley const std::string iv_string;
266a4134770SZane Shelley
26755e7fec3SZane Shelley /** The associated SRC subsystem of the part. */
26855e7fec3SZane Shelley const SrcSubsystem iv_subsystem;
26955e7fec3SZane Shelley
270a4134770SZane Shelley public:
operator ==(const PartType & r) const271a4134770SZane Shelley bool operator==(const PartType& r) const
272a4134770SZane Shelley {
27355e7fec3SZane Shelley return ((this->iv_string == r.iv_string) &&
27455e7fec3SZane Shelley (this->iv_subsystem == r.iv_subsystem));
275a4134770SZane Shelley }
276a4134770SZane Shelley
277a4134770SZane Shelley /** iv_string accessor */
getString() const278a4134770SZane Shelley std::string getString() const
279a4134770SZane Shelley {
280a4134770SZane Shelley return iv_string;
281a4134770SZane Shelley }
28255e7fec3SZane Shelley
28355e7fec3SZane Shelley /** iv_subsystem accessor */
getSrcSubsystem() const28455e7fec3SZane Shelley SrcSubsystem getSrcSubsystem() const
28555e7fec3SZane Shelley {
28655e7fec3SZane Shelley return iv_subsystem;
28755e7fec3SZane Shelley }
288a4134770SZane Shelley };
289a4134770SZane Shelley
29055e7fec3SZane Shelley inline const PartType PartType::PNOR{"PNOR", SrcSubsystem::CEC_HARDWARE};
291a4134770SZane Shelley
292bf3326fbSZane Shelley /** @brief Container class for guard service actions. */
293bf3326fbSZane Shelley class GuardType
294bf3326fbSZane Shelley {
295bf3326fbSZane Shelley public:
296bf3326fbSZane Shelley /** Do not guard. */
297bf3326fbSZane Shelley static const GuardType NONE;
298bf3326fbSZane Shelley
299bf3326fbSZane Shelley /** Guard on fatal error (cannot recover resource). */
300bf3326fbSZane Shelley static const GuardType UNRECOVERABLE;
301bf3326fbSZane Shelley
302bf3326fbSZane Shelley /** Guard on non-fatal error (can recover resource). */
303bf3326fbSZane Shelley static const GuardType PREDICTIVE;
304bf3326fbSZane Shelley
305bf3326fbSZane Shelley private:
306bf3326fbSZane Shelley /**
307bf3326fbSZane Shelley * @brief Constructor from components.
308bf3326fbSZane Shelley * @param i_string The string representation of the procedure used for
309bf3326fbSZane Shelley * callouts.
310bf3326fbSZane Shelley */
GuardType(const std::string & i_string)311bf3326fbSZane Shelley explicit GuardType(const std::string& i_string) : iv_string(i_string) {}
312bf3326fbSZane Shelley
313bf3326fbSZane Shelley private:
314bf3326fbSZane Shelley /** The string representation of the procedure used for callouts. */
315bf3326fbSZane Shelley const std::string iv_string;
316bf3326fbSZane Shelley
317bf3326fbSZane Shelley public:
operator ==(const GuardType & r) const318bf3326fbSZane Shelley bool operator==(const GuardType& r) const
319bf3326fbSZane Shelley {
320bf3326fbSZane Shelley return this->iv_string == r.iv_string;
321bf3326fbSZane Shelley }
322bf3326fbSZane Shelley
323bf3326fbSZane Shelley /** iv_string accessor */
getString() const324bf3326fbSZane Shelley std::string getString() const
325bf3326fbSZane Shelley {
326bf3326fbSZane Shelley return iv_string;
327bf3326fbSZane Shelley }
328bf3326fbSZane Shelley };
329bf3326fbSZane Shelley
330bf3326fbSZane Shelley inline const GuardType GuardType::NONE{"GARD_NULL"};
331bf3326fbSZane Shelley inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"};
332bf3326fbSZane Shelley inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"};
333bf3326fbSZane Shelley
334c85716caSZane Shelley } // namespace callout
335c85716caSZane Shelley
336c85716caSZane Shelley } // namespace analyzer
337