blob: 44f31b9e9dbe519f071a3019df97855f677f848a [file] [log] [blame]
Zane Shelleyf685afd2021-02-15 15:39:44 -06001#pragma once
2
Zane Shelley82be3ab2021-12-07 10:36:08 -06003#include <analyzer/analyzer_main.hpp>
Zane Shelleyc85716c2021-08-17 10:54:06 -05004#include <analyzer/callout.hpp>
Zane Shelley8af9e462021-03-11 10:44:28 -06005#include <hei_main.hpp>
Zane Shelleyf685afd2021-02-15 15:39:44 -06006#include <nlohmann/json.hpp>
Zane Shelley37acb282022-01-10 16:05:22 -06007#include <util/pdbg.hpp>
Zane Shelleyf685afd2021-02-15 15:39:44 -06008
9namespace analyzer
10{
11
Zane Shelley64791cf2021-02-15 17:02:37 -060012/**
13 * @brief Data regarding required service actions based on the hardware error
14 * analysis.
15 */
16class ServiceData
17{
18 public:
Zane Shelley8af9e462021-03-11 10:44:28 -060019 /**
20 * @brief Constructor from components.
Zane Shelley62adf5c2022-01-18 21:06:50 -060021 * @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 Shelley8af9e462021-03-11 10:44:28 -060024 */
Zane Shelley82be3ab2021-12-07 10:36:08 -060025 ServiceData(const libhei::Signature& i_rootCause,
Zane Shelley62adf5c2022-01-18 21:06:50 -060026 AnalysisType i_analysisType,
27 const libhei::IsolationData& i_isoData) :
Zane Shelley82be3ab2021-12-07 10:36:08 -060028 iv_rootCause(i_rootCause),
Zane Shelley62adf5c2022-01-18 21:06:50 -060029 iv_analysisType(i_analysisType), iv_isoData(i_isoData)
Zane Shelley8af9e462021-03-11 10:44:28 -060030 {}
Zane Shelley64791cf2021-02-15 17:02:37 -060031
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 Shelley8af9e462021-03-11 10:44:28 -060042 /** The signature of the root cause attention. */
43 const libhei::Signature iv_rootCause;
44
Zane Shelley82be3ab2021-12-07 10:36:08 -060045 /** The type of analysis to perform. */
46 const AnalysisType iv_analysisType;
Zane Shelleyca496192021-08-09 12:05:52 -050047
Zane Shelley62adf5c2022-01-18 21:06:50 -060048 /** The data found during isolation. */
49 const libhei::IsolationData iv_isoData;
50
Zane Shelley64791cf2021-02-15 17:02:37 -060051 /** The list of callouts that will be added to a PEL. */
Zane Shelleyc85716c2021-08-17 10:54:06 -050052 nlohmann::json iv_calloutList = nlohmann::json::array();
Zane Shelley64791cf2021-02-15 17:02:37 -060053
Zane Shelley2d114322021-08-25 17:06:12 -050054 /** 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 Shelley64791cf2021-02-15 17:02:37 -060058 public:
Zane Shelley8af9e462021-03-11 10:44:28 -060059 /** @return The signature of the root cause attention. */
60 const libhei::Signature& getRootCause() const
61 {
62 return iv_rootCause;
63 }
64
Zane Shelley82be3ab2021-12-07 10:36:08 -060065 /** @return The type of analysis to perform. */
66 AnalysisType getAnalysisType() const
Zane Shelleyca496192021-08-09 12:05:52 -050067 {
Zane Shelley82be3ab2021-12-07 10:36:08 -060068 return iv_analysisType;
Zane Shelleyca496192021-08-09 12:05:52 -050069 }
70
Zane Shelley62adf5c2022-01-18 21:06:50 -060071 /** @return The data found during isolation. */
72 const libhei::IsolationData& getIsolationData() const
73 {
74 return iv_isoData;
75 }
76
Zane Shelleybf3326f2021-11-12 13:41:39 -060077 /** @return Returns the guard type based on current analysis policies. */
78 callout::GuardType queryGuardPolicy() const
79 {
Zane Shelley82be3ab2021-12-07 10:36:08 -060080 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 Shelleybf3326f2021-11-12 13:41:39 -060088
Zane Shelley82be3ab2021-12-07 10:36:08 -060089 return callout::GuardType::NONE;
Zane Shelleybf3326f2021-11-12 13:41:39 -060090 }
91
Zane Shelleyc85716c2021-08-17 10:54:06 -050092 /**
Zane Shelley37acb282022-01-10 16:05:22 -060093 * @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 Shelleya4134772022-01-10 17:22:44 -0600139 /**
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 Shelley37acb282022-01-10 16:05:22 -0600147 /** @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 Shelleyc85716c2021-08-17 10:54:06 -0500161 * @brief Add callout information to the callout list.
162 * @param The JSON object for this callout.
163 */
Zane Shelley979e2872021-09-20 22:46:06 -0500164 void addCallout(const nlohmann::json& i_callout);
Zane Shelley64791cf2021-02-15 17:02:37 -0600165
Zane Shelley95135822021-08-23 09:00:05 -0500166 /**
Zane Shelley2d114322021-08-25 17:06:12 -0500167 * @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 Shelley37acb282022-01-10 16:05:22 -0600176 /**
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 Shelley5f6e3de2021-02-23 13:57:37 -0600185
Zane Shelley37acb282022-01-10 16:05:22 -0600186 /**
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 Shelley64791cf2021-02-15 17:02:37 -0600192};
193
Zane Shelleyf685afd2021-02-15 15:39:44 -0600194} // namespace analyzer