Enable guard support
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I7bc6c0cdd3aa6d513f1a87d351b99069fc005339
diff --git a/analyzer/analyzer_main.cpp b/analyzer/analyzer_main.cpp
index 4041b6a..751bb55 100644
--- a/analyzer/analyzer_main.cpp
+++ b/analyzer/analyzer_main.cpp
@@ -126,6 +126,8 @@
// Create and commit a PEL.
uint32_t logId = std::get<1>(createPel(isoData, servData));
+ trace::inf("PEL created: PLID=0x%0" PRIx32, logId);
+
// Gather/return information needed for dump.
// TODO: Need ID from root cause. At the moment, HUID does not exist in
// devtree. Will need a better ID definition.
diff --git a/analyzer/callout.hpp b/analyzer/callout.hpp
index b49f97b..8c54793 100644
--- a/analyzer/callout.hpp
+++ b/analyzer/callout.hpp
@@ -181,6 +181,48 @@
inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0"};
inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1"};
+/** @brief Container class for guard service actions. */
+class GuardType
+{
+ public:
+ /** Do not guard. */
+ static const GuardType NONE;
+
+ /** Guard on fatal error (cannot recover resource). */
+ static const GuardType UNRECOVERABLE;
+
+ /** Guard on non-fatal error (can recover resource). */
+ static const GuardType PREDICTIVE;
+
+ private:
+ /**
+ * @brief Constructor from components.
+ * @param i_string The string representation of the procedure used for
+ * callouts.
+ */
+ explicit GuardType(const std::string& i_string) : iv_string(i_string) {}
+
+ private:
+ /** The string representation of the procedure used for callouts. */
+ const std::string iv_string;
+
+ public:
+ bool operator==(const GuardType& r) const
+ {
+ return this->iv_string == r.iv_string;
+ }
+
+ /** iv_string accessor */
+ std::string getString() const
+ {
+ return iv_string;
+ }
+};
+
+inline const GuardType GuardType::NONE{"GARD_NULL"};
+inline const GuardType GuardType::UNRECOVERABLE{"GARD_Unrecoverable"};
+inline const GuardType GuardType::PREDICTIVE{"GARD_Predictive"};
+
} // namespace callout
} // namespace analyzer
diff --git a/analyzer/resolution.cpp b/analyzer/resolution.cpp
index ae4edd0..8bf8b95 100644
--- a/analyzer/resolution.cpp
+++ b/analyzer/resolution.cpp
@@ -130,7 +130,21 @@
callout["LocationCode"] = util::pdbg::getLocationCode(i_target);
callout["Priority"] = i_priority.getUserDataString();
callout["Deconfigured"] = false;
- callout["Guarded"] = i_guard;
+ callout["Guarded"] = false; // default
+
+ // Check if guard info should be added.
+ if (i_guard)
+ {
+ auto guardType = io_sd.queryGuardPolicy();
+
+ if (!(callout::GuardType::NONE == guardType))
+ {
+ callout["Guarded"] = true;
+ callout["EntityPath"] = util::pdbg::getPhysBinPath(i_target);
+ callout["GuardType"] = guardType.getString();
+ }
+ }
+
io_sd.addCallout(callout);
}
diff --git a/analyzer/service_data.hpp b/analyzer/service_data.hpp
index 953a96d..1ce991e 100644
--- a/analyzer/service_data.hpp
+++ b/analyzer/service_data.hpp
@@ -62,6 +62,18 @@
return iv_isCheckstop;
}
+ /** @return Returns the guard type based on current analysis policies. */
+ callout::GuardType queryGuardPolicy() const
+ {
+ // TODO: Manual execution of the analyzer (i.e. from the command line),
+ // will eventually require the ability to not guard. This is
+ // useful when we simply want to check for attentions in the
+ // hardware with no service action.
+
+ return queryCheckstop() ? callout::GuardType::UNRECOVERABLE
+ : callout::GuardType::PREDICTIVE;
+ }
+
/**
* @brief Add callout information to the callout list.
* @param The JSON object for this callout.