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 | |
| 75 | /** @brief Container class for procedure callout service actions. */ |
| 76 | class Procedure |
| 77 | { |
| 78 | public: |
| 79 | /** Contact next level support. */ |
| 80 | static const Procedure NEXTLVL; |
| 81 | |
| 82 | private: |
| 83 | /** |
| 84 | * @brief Constructor from components. |
| 85 | * @param i_string The string representation of the procedure used for |
| 86 | * callouts. |
| 87 | */ |
| 88 | explicit Procedure(const std::string& i_string) : iv_string(i_string) {} |
| 89 | |
| 90 | private: |
| 91 | /** The string representation of the procedure used for callouts. */ |
| 92 | const std::string iv_string; |
| 93 | |
| 94 | public: |
| 95 | /** iv_string accessor */ |
| 96 | std::string getString() const |
| 97 | { |
| 98 | return iv_string; |
| 99 | } |
| 100 | }; |
| 101 | |
Zane Shelley | 86ccc45 | 2021-11-16 13:10:52 -0600 | [diff] [blame] | 102 | inline const Procedure Procedure::NEXTLVL{"next_level_support"}; |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 103 | |
Zane Shelley | 5d63cef | 2021-09-17 18:10:17 -0500 | [diff] [blame] | 104 | /** @brief Container class for bus callout service actions. */ |
| 105 | class BusType |
| 106 | { |
| 107 | public: |
| 108 | /** SMP bus (fabric A or X bus). */ |
| 109 | static const BusType SMP_BUS; |
| 110 | |
| 111 | /** OMI bus (memory bus). */ |
| 112 | static const BusType OMI_BUS; |
| 113 | |
| 114 | private: |
| 115 | /** |
| 116 | * @brief Constructor from components. |
| 117 | * @param i_string The string representation of the procedure used for |
| 118 | * callouts. |
| 119 | */ |
| 120 | explicit BusType(const std::string& i_string) : iv_string(i_string) {} |
| 121 | |
| 122 | private: |
| 123 | /** The string representation of the procedure used for callouts. */ |
| 124 | const std::string iv_string; |
| 125 | |
| 126 | public: |
| 127 | bool operator==(const BusType& r) const |
| 128 | { |
| 129 | return this->iv_string == r.iv_string; |
| 130 | } |
| 131 | |
| 132 | /** iv_string accessor */ |
| 133 | std::string getString() const |
| 134 | { |
| 135 | return iv_string; |
| 136 | } |
| 137 | }; |
| 138 | |
| 139 | inline const BusType BusType::SMP_BUS{"SMP_BUS"}; |
| 140 | inline const BusType BusType::OMI_BUS{"OMI_BUS"}; |
| 141 | |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 142 | /** @brief Container class for clock callout service actions. */ |
| 143 | class ClockType |
| 144 | { |
| 145 | public: |
| 146 | /** Oscillator reference clock 0. */ |
| 147 | static const ClockType OSC_REF_CLOCK_0; |
| 148 | |
| 149 | /** Oscillator reference clock 1. */ |
| 150 | static const ClockType OSC_REF_CLOCK_1; |
| 151 | |
Zane Shelley | d195b71 | 2022-01-26 13:26:34 -0600 | [diff] [blame] | 152 | /** Time of Day (TOD) clock. */ |
| 153 | static const ClockType TOD_CLOCK; |
| 154 | |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 155 | private: |
| 156 | /** |
| 157 | * @brief Constructor from components. |
| 158 | * @param i_string The string representation of the procedure used for |
| 159 | * callouts. |
| 160 | */ |
| 161 | explicit ClockType(const std::string& i_string) : iv_string(i_string) {} |
| 162 | |
| 163 | private: |
| 164 | /** The string representation of the procedure used for callouts. */ |
| 165 | const std::string iv_string; |
| 166 | |
| 167 | public: |
| 168 | /** iv_string accessor */ |
| 169 | std::string getString() const |
| 170 | { |
| 171 | return iv_string; |
| 172 | } |
| 173 | }; |
| 174 | |
| 175 | inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0"}; |
| 176 | inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1"}; |
Zane Shelley | d195b71 | 2022-01-26 13:26:34 -0600 | [diff] [blame] | 177 | inline const ClockType ClockType::TOD_CLOCK{"TOD_CLOCK"}; |
Zane Shelley | 84721d9 | 2021-09-08 13:30:27 -0500 | [diff] [blame] | 178 | |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 179 | /** @brief Container class for part callout service actions. */ |
| 180 | class PartType |
| 181 | { |
| 182 | public: |
| 183 | /** The part containing the PNOR. */ |
| 184 | static const PartType PNOR; |
| 185 | |
| 186 | private: |
| 187 | /** |
| 188 | * @brief Constructor from components. |
| 189 | * @param i_string The string representation of the part callout. |
| 190 | */ |
| 191 | explicit PartType(const std::string& i_string) : iv_string(i_string) {} |
| 192 | |
| 193 | private: |
| 194 | /** The string representation of the part callout. */ |
| 195 | const std::string iv_string; |
| 196 | |
| 197 | public: |
| 198 | bool operator==(const PartType& r) const |
| 199 | { |
| 200 | return this->iv_string == r.iv_string; |
| 201 | } |
| 202 | |
| 203 | /** iv_string accessor */ |
| 204 | std::string getString() const |
| 205 | { |
| 206 | return iv_string; |
| 207 | } |
| 208 | }; |
| 209 | |
| 210 | inline const PartType PartType::PNOR{"PNOR"}; |
| 211 | |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 212 | /** @brief Container class for guard service actions. */ |
| 213 | class GuardType |
| 214 | { |
| 215 | public: |
| 216 | /** Do not guard. */ |
| 217 | static const GuardType NONE; |
| 218 | |
| 219 | /** Guard on fatal error (cannot recover resource). */ |
| 220 | static const GuardType UNRECOVERABLE; |
| 221 | |
| 222 | /** Guard on non-fatal error (can recover resource). */ |
| 223 | static const GuardType PREDICTIVE; |
| 224 | |
| 225 | private: |
| 226 | /** |
| 227 | * @brief Constructor from components. |
| 228 | * @param i_string The string representation of the procedure used for |
| 229 | * callouts. |
| 230 | */ |
| 231 | explicit GuardType(const std::string& i_string) : iv_string(i_string) {} |
| 232 | |
| 233 | private: |
| 234 | /** The string representation of the procedure used for callouts. */ |
| 235 | const std::string iv_string; |
| 236 | |
| 237 | public: |
| 238 | bool operator==(const GuardType& r) const |
| 239 | { |
| 240 | return this->iv_string == r.iv_string; |
| 241 | } |
| 242 | |
| 243 | /** iv_string accessor */ |
| 244 | std::string getString() const |
| 245 | { |
| 246 | return iv_string; |
| 247 | } |
| 248 | }; |
| 249 | |
| 250 | inline const GuardType GuardType::NONE{"GARD_NULL"}; |
| 251 | inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"}; |
| 252 | inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"}; |
| 253 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 254 | } // namespace callout |
| 255 | |
| 256 | } // namespace analyzer |