Removed old guard design

RAS decision is to initiate guard through the callout section in the
PELs instead of issuing a dbus message after the PEL has been committed.
So removing the old design.

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: Id034fc7003661a8b0d55e97eae4a7fcb62bae79a
diff --git a/analyzer/analyzer_main.cpp b/analyzer/analyzer_main.cpp
index 5df6295..4041b6a 100644
--- a/analyzer/analyzer_main.cpp
+++ b/analyzer/analyzer_main.cpp
@@ -126,13 +126,6 @@
         // Create and commit a PEL.
         uint32_t logId = std::get<1>(createPel(isoData, servData));
 
-        // Write guard records to persistent storage.
-        // TODO: The PEL ID will be required, but interface is still unknown.
-        for (const auto& guard : servData.getGuardList())
-        {
-            guard.apply();
-        }
-
         // 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/guard.cpp b/analyzer/guard.cpp
deleted file mode 100644
index 2acd2c1..0000000
--- a/analyzer/guard.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <analyzer/guard.hpp>
-#include <util/trace.hpp>
-
-namespace analyzer
-{
-
-//------------------------------------------------------------------------------
-
-void Guard::apply() const
-{
-    // TODO
-    trace::err("Guard::apply() currently not supported");
-}
-
-//------------------------------------------------------------------------------
-
-} // namespace analyzer
diff --git a/analyzer/guard.hpp b/analyzer/guard.hpp
deleted file mode 100644
index d3cabdd..0000000
--- a/analyzer/guard.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#pragma once
-
-#include <map>
-#include <string>
-
-namespace analyzer
-{
-
-/**
- * @brief A service event requiring hardware to be guarded.
- */
-class Guard
-{
-  public:
-    /** Supported guard types. */
-    enum class Type
-    {
-        NONE,      ///< Do not guard
-        FATAL,     ///< Guard on fatal error (cannot recover resource)
-        NON_FATAL, ///< Guard on non-fatal error (can recover resource)
-    };
-
-  public:
-    /**
-     * @brief Constructor from components.
-     * @param i_path The hardware path to guard.
-     * @param i_type The guard type.
-     */
-    Guard(const std::string& i_path, Type i_type) :
-        iv_path(i_path), iv_type(i_type)
-    {}
-
-  private:
-    /** The hardware path to guard. */
-    const std::string iv_path;
-
-    /** The guard type. */
-    const Type iv_type;
-
-  public:
-    /** @brief Writes guard record to persistent storage. */
-    void apply() const;
-
-    /** @return A string representation of the guard type enum. */
-    std::string getString() const
-    {
-        // clang-format off
-        static const std::map<Type, std::string> m =
-        {
-            {Type::NONE,      "NONE"},
-            {Type::FATAL,     "FATAL"},
-            {Type::NON_FATAL, "NON_FATAL"},
-        };
-        // clang-format on
-
-        return m.at(iv_type);
-    }
-};
-
-} // namespace analyzer
diff --git a/analyzer/meson.build b/analyzer/meson.build
index 9324392..be37557 100644
--- a/analyzer/meson.build
+++ b/analyzer/meson.build
@@ -3,7 +3,6 @@
     'analyzer_main.cpp',
     'create_pel.cpp',
     'filter-root-cause.cpp',
-    'guard.cpp',
     'hei_user_interface.cpp',
     'initialize_isolator.cpp',
     'ras-data/ras-data-parser.cpp',
diff --git a/analyzer/resolution.cpp b/analyzer/resolution.cpp
index 1f105eb..ae4edd0 100644
--- a/analyzer/resolution.cpp
+++ b/analyzer/resolution.cpp
@@ -157,21 +157,15 @@
     // Get the target for the hardware callout.
     auto target = __getUnitTarget(__getRootCauseChipTarget(io_sd), iv_unitPath);
 
-    // Get the entity path for this target.
-    auto entityPath = util::pdbg::getPhysDevPath(target);
-
     // Add the actual callout to the service data.
     __calloutTarget(io_sd, target, iv_priority, iv_guard);
 
-    // Add the guard info to the service data.
-    Guard guard = io_sd.addGuard(entityPath, iv_guard);
-
     // Add the callout FFDC to the service data.
     nlohmann::json ffdc;
     ffdc["Callout Type"] = "Hardware Callout";
-    ffdc["Target"]       = entityPath;
+    ffdc["Target"]       = util::pdbg::getPhysDevPath(target);
     ffdc["Priority"]     = iv_priority.getRegistryString();
-    ffdc["Guard Type"]   = guard.getString();
+    ffdc["Guard"]        = iv_guard;
     io_sd.addCalloutFFDC(ffdc);
 }
 
@@ -191,17 +185,13 @@
     // Callout the TX endpoint.
     __calloutTarget(io_sd, txTarget, iv_priority, iv_guard);
 
-    // Guard the TX endpoint.
-    Guard txGuard =
-        io_sd.addGuard(util::pdbg::getPhysDevPath(txTarget), iv_guard);
-
     // Add the callout FFDC to the service data.
     nlohmann::json ffdc;
     ffdc["Callout Type"] = "Connected Callout";
     ffdc["Bus Type"]     = iv_busType.getString();
     ffdc["Target"]       = util::pdbg::getPhysDevPath(txTarget);
     ffdc["Priority"]     = iv_priority.getRegistryString();
-    ffdc["Guard Type"]   = txGuard.getString();
+    ffdc["Guard"]        = iv_guard;
     io_sd.addCalloutFFDC(ffdc);
 }
 
@@ -228,16 +218,6 @@
     // TODO: For P10 (OMI bus and XBUS), the callout is simply the backplane.
     __calloutBackplane(io_sd, iv_priority);
 
-    // Guard the RX endpoint.
-    Guard guard =
-        io_sd.addGuard(util::pdbg::getPhysDevPath(rxTarget), iv_guard);
-
-    // Guard the TX endpoint.
-    // No need to check return because it is the same as RX target.
-    io_sd.addGuard(util::pdbg::getPhysDevPath(txTarget), iv_guard);
-
-    // TODO: Currently no guard for "everything else in between".
-
     // Add the callout FFDC to the service data.
     nlohmann::json ffdc;
     ffdc["Callout Type"] = "Bus Callout";
@@ -245,7 +225,7 @@
     ffdc["RX Target"]    = util::pdbg::getPhysDevPath(rxTarget);
     ffdc["TX Target"]    = util::pdbg::getPhysDevPath(txTarget);
     ffdc["Priority"]     = iv_priority.getRegistryString();
-    ffdc["Guard Type"]   = guard.getString();
+    ffdc["Guard"]        = iv_guard;
     io_sd.addCalloutFFDC(ffdc);
 }
 
diff --git a/analyzer/service_data.hpp b/analyzer/service_data.hpp
index ac90707..953a96d 100644
--- a/analyzer/service_data.hpp
+++ b/analyzer/service_data.hpp
@@ -1,7 +1,6 @@
 #pragma once
 
 #include <analyzer/callout.hpp>
-#include <analyzer/guard.hpp>
 #include <hei_main.hpp>
 #include <nlohmann/json.hpp>
 
@@ -49,11 +48,6 @@
      *  callout list (unit paths, bus types, etc.). */
     nlohmann::json iv_calloutFFDC = nlohmann::json::array();
 
-    /** The list of hardware guard requests. Some information will be added to
-     *  the PEL, but the actual guard record will be created after submitting
-     *  the PEL. */
-    std::vector<Guard> iv_guardList;
-
   public:
     /** @return The signature of the root cause attention. */
     const libhei::Signature& getRootCause() const
@@ -84,26 +78,6 @@
         iv_calloutFFDC.push_back(i_ffdc);
     }
 
-    /**
-     * @brief  Add a guard request to the guard list.
-     * @param  i_path  Entity path for the target part.
-     * @param  i_guard True, if the part should be guarded. False, otherwise.
-     * @return A reference to the object just added to the guard list.
-     */
-    const Guard& addGuard(const std::string& i_path, bool i_guard)
-    {
-        Guard::Type guardType = Guard::Type::NONE;
-        if (i_guard)
-        {
-            // The guard type is dependent on the presence of a system checkstop
-            // attention.
-            guardType =
-                queryCheckstop() ? Guard::Type::FATAL : Guard::Type::NON_FATAL;
-        }
-
-        return iv_guardList.emplace_back(i_path, guardType);
-    }
-
     /** @brief Accessor to iv_calloutList. */
     const nlohmann::json& getCalloutList() const
     {
@@ -115,12 +89,6 @@
     {
         return iv_calloutFFDC;
     }
-
-    /** @brief Accessor to iv_guardList. */
-    const std::vector<Guard>& getGuardList() const
-    {
-        return iv_guardList;
-    }
 };
 
 } // namespace analyzer
diff --git a/test/resolution_test.cpp b/test/resolution_test.cpp
index 55be828..df82b4a 100644
--- a/test/resolution_test.cpp
+++ b/test/resolution_test.cpp
@@ -135,15 +135,12 @@
     // Add the actual callout to the service data.
     __calloutTarget(io_sd, locCode, iv_priority, iv_guard);
 
-    // Add the guard info to the service data.
-    Guard guard = io_sd.addGuard(entityPath, iv_guard);
-
     // Add the callout FFDC to the service data.
     nlohmann::json ffdc;
     ffdc["Callout Type"] = "Hardware Callout";
     ffdc["Target"]       = entityPath;
     ffdc["Priority"]     = iv_priority.getRegistryString();
-    ffdc["Guard Type"]   = guard.getString();
+    ffdc["Guard"]        = iv_guard;
     io_sd.addCalloutFFDC(ffdc);
 }
 
@@ -163,16 +160,13 @@
     // Callout the TX endpoint.
     __calloutTarget(io_sd, std::get<1>(txPath), iv_priority, iv_guard);
 
-    // Guard the TX endpoint.
-    Guard txGuard = io_sd.addGuard(std::get<0>(txPath), iv_guard);
-
     // Add the callout FFDC to the service data.
     nlohmann::json ffdc;
     ffdc["Callout Type"] = "Connected Callout";
     ffdc["Bus Type"]     = iv_busType.getString();
     ffdc["Target"]       = std::get<0>(txPath);
     ffdc["Priority"]     = iv_priority.getRegistryString();
-    ffdc["Guard Type"]   = txGuard.getString();
+    ffdc["Guard"]        = iv_guard;
     io_sd.addCalloutFFDC(ffdc);
 }
 
@@ -199,15 +193,6 @@
     // TODO: For P10 (OMI bus and XBUS), the callout is simply the backplane.
     __calloutBackplane(io_sd, iv_priority);
 
-    // Guard the RX endpoint.
-    Guard guard = io_sd.addGuard(rxPath, iv_guard);
-
-    // Guard the TX endpoint.
-    // No need to check return because it is the same as RX target.
-    io_sd.addGuard(std::get<0>(txPath), iv_guard);
-
-    // TODO: Currently no guard for "everything else in between".
-
     // Add the callout FFDC to the service data.
     nlohmann::json ffdc;
     ffdc["Callout Type"] = "Bus Callout";
@@ -215,7 +200,7 @@
     ffdc["RX Target"]    = rxPath;
     ffdc["TX Target"]    = std::get<0>(txPath);
     ffdc["Priority"]     = iv_priority.getRegistryString();
-    ffdc["Guard Type"]   = guard.getString();
+    ffdc["Guard"]        = iv_guard;
     io_sd.addCalloutFFDC(ffdc);
 }
 
@@ -376,7 +361,7 @@
     s = R"([
     {
         "Callout Type": "Hardware Callout",
-        "Guard Type": "FATAL",
+        "Guard": true,
         "Priority": "medium_group_A",
         "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
     }
@@ -436,21 +421,21 @@
     {
         "Bus Type": "SMP_BUS",
         "Callout Type": "Connected Callout",
-        "Guard Type": "FATAL",
+        "Guard": true,
         "Priority": "medium_group_A",
         "Target": "/proc1/pib/perv24/pauc0/iohs0/smpgroup0"
     },
     {
         "Bus Type": "OMI_BUS",
         "Callout Type": "Connected Callout",
-        "Guard Type": "FATAL",
+        "Guard": true,
         "Priority": "medium_group_B",
         "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
     },
     {
         "Bus Type": "OMI_BUS",
         "Callout Type": "Connected Callout",
-        "Guard Type": "FATAL",
+        "Guard": true,
         "Priority": "medium_group_C",
         "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
     }
@@ -509,21 +494,21 @@
     s = R"([
     {
         "Callout Type": "Hardware Callout",
-        "Guard Type": "FATAL",
+        "Guard": true,
         "Priority": "medium_group_A",
         "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0"
     },
     {
         "Bus Type": "OMI_BUS",
         "Callout Type": "Connected Callout",
-        "Guard Type": "FATAL",
+        "Guard": true,
         "Priority": "medium_group_A",
         "Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"
     },
     {
         "Bus Type": "OMI_BUS",
         "Callout Type": "Bus Callout",
-        "Guard Type": "NONE",
+        "Guard": false,
         "Priority": "low",
         "RX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0",
         "TX Target": "/proc0/pib/perv12/mc0/mi0/mcc0/omi0/ocmb0"