Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 3 | #include <analyzer/callout.hpp> |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 4 | #include <hei_main.hpp> |
Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 5 | #include <nlohmann/json.hpp> |
| 6 | |
| 7 | namespace analyzer |
| 8 | { |
| 9 | |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 10 | /** |
| 11 | * @brief Data regarding required service actions based on the hardware error |
| 12 | * analysis. |
| 13 | */ |
| 14 | class ServiceData |
| 15 | { |
| 16 | public: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 17 | /** |
| 18 | * @brief Constructor from components. |
| 19 | * @param The signature of the root cause attention. |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 20 | * @param True if the signature list contained a system checkstop attention. |
| 21 | * False, otherwise. |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 22 | */ |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 23 | ServiceData(const libhei::Signature& i_rootCause, bool i_isCheckstop) : |
| 24 | iv_rootCause(i_rootCause), iv_isCheckstop(i_isCheckstop) |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 25 | {} |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 26 | |
| 27 | /** @brief Destructor. */ |
| 28 | ~ServiceData() = default; |
| 29 | |
| 30 | /** @brief Copy constructor. */ |
| 31 | ServiceData(const ServiceData&) = default; |
| 32 | |
| 33 | /** @brief Assignment operator. */ |
| 34 | ServiceData& operator=(const ServiceData&) = default; |
| 35 | |
| 36 | private: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 37 | /** The signature of the root cause attention. */ |
| 38 | const libhei::Signature iv_rootCause; |
| 39 | |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 40 | /** True if the signature list contained a system checkstop attention. |
| 41 | * False, otherwise. */ |
| 42 | const bool iv_isCheckstop; |
| 43 | |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 44 | /** The list of callouts that will be added to a PEL. */ |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 45 | nlohmann::json iv_calloutList = nlohmann::json::array(); |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 46 | |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 47 | /** FFDC for callouts that would otherwise not be available in the |
| 48 | * callout list (unit paths, bus types, etc.). */ |
| 49 | nlohmann::json iv_calloutFFDC = nlohmann::json::array(); |
| 50 | |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 51 | public: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 52 | /** @return The signature of the root cause attention. */ |
| 53 | const libhei::Signature& getRootCause() const |
| 54 | { |
| 55 | return iv_rootCause; |
| 56 | } |
| 57 | |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 58 | /** @return True if the signature list contained a system checkstop |
| 59 | * attention. False, otherwise. */ |
| 60 | bool queryCheckstop() const |
| 61 | { |
| 62 | return iv_isCheckstop; |
| 63 | } |
| 64 | |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 65 | /** @return Returns the guard type based on current analysis policies. */ |
| 66 | callout::GuardType queryGuardPolicy() const |
| 67 | { |
| 68 | // TODO: Manual execution of the analyzer (i.e. from the command line), |
| 69 | // will eventually require the ability to not guard. This is |
| 70 | // useful when we simply want to check for attentions in the |
| 71 | // hardware with no service action. |
| 72 | |
| 73 | return queryCheckstop() ? callout::GuardType::UNRECOVERABLE |
| 74 | : callout::GuardType::PREDICTIVE; |
| 75 | } |
| 76 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 77 | /** |
| 78 | * @brief Add callout information to the callout list. |
| 79 | * @param The JSON object for this callout. |
| 80 | */ |
Zane Shelley | 979e287 | 2021-09-20 22:46:06 -0500 | [diff] [blame] | 81 | void addCallout(const nlohmann::json& i_callout); |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 82 | |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 83 | /** |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 84 | * @brief Add FFDC for a callout that would otherwise not be available in |
| 85 | * the callout list (unit paths, bus types, etc.). |
| 86 | * @param The JSON object for this callout. |
| 87 | */ |
| 88 | void addCalloutFFDC(const nlohmann::json& i_ffdc) |
| 89 | { |
| 90 | iv_calloutFFDC.push_back(i_ffdc); |
| 91 | } |
| 92 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 93 | /** @brief Accessor to iv_calloutList. */ |
| 94 | const nlohmann::json& getCalloutList() const |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 95 | { |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 96 | return iv_calloutList; |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 97 | } |
Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 98 | |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 99 | /** @brief Accessor to iv_calloutFFDC. */ |
| 100 | const nlohmann::json& getCalloutFFDC() const |
| 101 | { |
| 102 | return iv_calloutFFDC; |
| 103 | } |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 104 | }; |
| 105 | |
Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 106 | } // namespace analyzer |