Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 3 | #include <analyzer/analyzer_main.hpp> |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 4 | #include <analyzer/callout.hpp> |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 5 | #include <hei_main.hpp> |
Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 6 | #include <nlohmann/json.hpp> |
Zane Shelley | 37acb28 | 2022-01-10 16:05:22 -0600 | [diff] [blame] | 7 | #include <util/pdbg.hpp> |
Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 8 | |
| 9 | namespace analyzer |
| 10 | { |
| 11 | |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 12 | /** |
| 13 | * @brief Data regarding required service actions based on the hardware error |
| 14 | * analysis. |
| 15 | */ |
| 16 | class ServiceData |
| 17 | { |
| 18 | public: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 19 | /** |
| 20 | * @brief Constructor from components. |
| 21 | * @param The signature of the root cause attention. |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 22 | * @param The type of analysis to perform. |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 23 | */ |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 24 | ServiceData(const libhei::Signature& i_rootCause, |
| 25 | AnalysisType i_analysisType) : |
| 26 | iv_rootCause(i_rootCause), |
| 27 | iv_analysisType(i_analysisType) |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 28 | {} |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 29 | |
| 30 | /** @brief Destructor. */ |
| 31 | ~ServiceData() = default; |
| 32 | |
| 33 | /** @brief Copy constructor. */ |
| 34 | ServiceData(const ServiceData&) = default; |
| 35 | |
| 36 | /** @brief Assignment operator. */ |
| 37 | ServiceData& operator=(const ServiceData&) = default; |
| 38 | |
| 39 | private: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 40 | /** The signature of the root cause attention. */ |
| 41 | const libhei::Signature iv_rootCause; |
| 42 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 43 | /** The type of analysis to perform. */ |
| 44 | const AnalysisType iv_analysisType; |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 45 | |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 46 | /** The list of callouts that will be added to a PEL. */ |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 47 | nlohmann::json iv_calloutList = nlohmann::json::array(); |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 48 | |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 49 | /** FFDC for callouts that would otherwise not be available in the |
| 50 | * callout list (unit paths, bus types, etc.). */ |
| 51 | nlohmann::json iv_calloutFFDC = nlohmann::json::array(); |
| 52 | |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 53 | public: |
Zane Shelley | 8af9e46 | 2021-03-11 10:44:28 -0600 | [diff] [blame] | 54 | /** @return The signature of the root cause attention. */ |
| 55 | const libhei::Signature& getRootCause() const |
| 56 | { |
| 57 | return iv_rootCause; |
| 58 | } |
| 59 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 60 | /** @return The type of analysis to perform. */ |
| 61 | AnalysisType getAnalysisType() const |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 62 | { |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 63 | return iv_analysisType; |
Zane Shelley | ca49619 | 2021-08-09 12:05:52 -0500 | [diff] [blame] | 64 | } |
| 65 | |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 66 | /** @return Returns the guard type based on current analysis policies. */ |
| 67 | callout::GuardType queryGuardPolicy() const |
| 68 | { |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 69 | if (AnalysisType::SYSTEM_CHECKSTOP == iv_analysisType) |
| 70 | { |
| 71 | return callout::GuardType::UNRECOVERABLE; |
| 72 | } |
| 73 | else if (AnalysisType::TERMINATE_IMMEDIATE == iv_analysisType) |
| 74 | { |
| 75 | return callout::GuardType::PREDICTIVE; |
| 76 | } |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 77 | |
Zane Shelley | 82be3ab | 2021-12-07 10:36:08 -0600 | [diff] [blame] | 78 | return callout::GuardType::NONE; |
Zane Shelley | bf3326f | 2021-11-12 13:41:39 -0600 | [diff] [blame] | 79 | } |
| 80 | |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 81 | /** |
Zane Shelley | 37acb28 | 2022-01-10 16:05:22 -0600 | [diff] [blame] | 82 | * @brief Add callout for a pdbg_target. |
| 83 | * @param i_target The chip or unit target to add to the callout list. |
| 84 | * @param i_priority The callout priority. |
| 85 | * @param i_guard True if guard is required. False, otherwise. |
| 86 | */ |
| 87 | void calloutTarget(pdbg_target* i_target, |
| 88 | const callout::Priority& i_priority, bool i_guard); |
| 89 | |
| 90 | /** |
| 91 | * @brief Add callout for a connected target on the other side of a bus. |
| 92 | * @param i_rxTarget The target on the receiving side (RX) of the bus. |
| 93 | * @param i_busType The bus type. |
| 94 | * @param i_priority The callout priority. |
| 95 | * @param i_guard True if guard is required. False, otherwise. |
| 96 | */ |
| 97 | void calloutConnected(pdbg_target* i_rxTarget, |
| 98 | const callout::BusType& i_busType, |
| 99 | const callout::Priority& i_priority, bool i_guard); |
| 100 | |
| 101 | /** |
| 102 | * @brief Add callout for an entire bus. |
| 103 | * @param i_rxTarget The target on the receiving side (RX) of the bus. |
| 104 | * @param i_busType The bus type. |
| 105 | * @param i_priority The callout priority. |
| 106 | * @param i_guard True if guard is required. False, otherwise. |
| 107 | */ |
| 108 | void calloutBus(pdbg_target* i_rxTarget, const callout::BusType& i_busType, |
| 109 | const callout::Priority& i_priority, bool i_guard); |
| 110 | |
| 111 | /** |
| 112 | * @brief Add callout for a clock. |
| 113 | * @param i_clockType The clock type. |
| 114 | * @param i_priority The callout priority. |
| 115 | * @param i_guard True if guard is required. False, otherwise. |
| 116 | */ |
| 117 | void calloutClock(const callout::ClockType& i_clockType, |
| 118 | const callout::Priority& i_priority, bool i_guard); |
| 119 | |
| 120 | /** |
| 121 | * @brief Add callout for a service procedure. |
| 122 | * @param i_procedure The procedure type. |
| 123 | * @param i_priority The callout priority. |
| 124 | */ |
| 125 | void calloutProcedure(const callout::Procedure& i_procedure, |
| 126 | const callout::Priority& i_priority); |
| 127 | |
Zane Shelley | a413477 | 2022-01-10 17:22:44 -0600 | [diff] [blame] | 128 | /** |
| 129 | * @brief Add callout for part type. |
| 130 | * @param i_part The part type. |
| 131 | * @param i_priority The callout priority. |
| 132 | */ |
| 133 | void calloutPart(const callout::PartType& i_part, |
| 134 | const callout::Priority& i_priority); |
| 135 | |
Zane Shelley | 37acb28 | 2022-01-10 16:05:22 -0600 | [diff] [blame] | 136 | /** @brief Accessor to iv_calloutList. */ |
| 137 | const nlohmann::json& getCalloutList() const |
| 138 | { |
| 139 | return iv_calloutList; |
| 140 | } |
| 141 | |
| 142 | /** @brief Accessor to iv_calloutFFDC. */ |
| 143 | const nlohmann::json& getCalloutFFDC() const |
| 144 | { |
| 145 | return iv_calloutFFDC; |
| 146 | } |
| 147 | |
| 148 | private: |
| 149 | /** |
Zane Shelley | c85716c | 2021-08-17 10:54:06 -0500 | [diff] [blame] | 150 | * @brief Add callout information to the callout list. |
| 151 | * @param The JSON object for this callout. |
| 152 | */ |
Zane Shelley | 979e287 | 2021-09-20 22:46:06 -0500 | [diff] [blame] | 153 | void addCallout(const nlohmann::json& i_callout); |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 154 | |
Zane Shelley | 9513582 | 2021-08-23 09:00:05 -0500 | [diff] [blame] | 155 | /** |
Zane Shelley | 2d11432 | 2021-08-25 17:06:12 -0500 | [diff] [blame] | 156 | * @brief Add FFDC for a callout that would otherwise not be available in |
| 157 | * the callout list (unit paths, bus types, etc.). |
| 158 | * @param The JSON object for this callout. |
| 159 | */ |
| 160 | void addCalloutFFDC(const nlohmann::json& i_ffdc) |
| 161 | { |
| 162 | iv_calloutFFDC.push_back(i_ffdc); |
| 163 | } |
| 164 | |
Zane Shelley | 37acb28 | 2022-01-10 16:05:22 -0600 | [diff] [blame] | 165 | /** |
| 166 | * @brief A simple helper function for all the callout functions that need |
| 167 | * to callout a target (callout only, no FFDC). |
| 168 | * @param i_target The chip or unit target to add to the callout list. |
| 169 | * @param i_priority The callout priority. |
| 170 | * @param i_guard True if guard is required. False, otherwise. |
| 171 | */ |
| 172 | void addTargetCallout(pdbg_target* i_target, |
| 173 | const callout::Priority& i_priority, bool i_guard); |
Zane Shelley | 5f6e3de | 2021-02-23 13:57:37 -0600 | [diff] [blame] | 174 | |
Zane Shelley | 37acb28 | 2022-01-10 16:05:22 -0600 | [diff] [blame] | 175 | /** |
| 176 | * @brief A simple helper function for all the callout functions that need |
| 177 | * to callout a the backplane (callout only, no FFDC). |
| 178 | * @param i_priority The callout priority. |
| 179 | */ |
| 180 | void addBackplaneCallout(const callout::Priority& i_priority); |
Zane Shelley | 64791cf | 2021-02-15 17:02:37 -0600 | [diff] [blame] | 181 | }; |
| 182 | |
Zane Shelley | f685afd | 2021-02-15 15:39:44 -0600 | [diff] [blame] | 183 | } // namespace analyzer |