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