Add support for TOD clock callouts

Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I42726f6d1b036120fcfe217e6dd47be8dd6d927b
diff --git a/analyzer/callout.hpp b/analyzer/callout.hpp
index b4f7912..0ec3241 100644
--- a/analyzer/callout.hpp
+++ b/analyzer/callout.hpp
@@ -158,6 +158,9 @@
     /** Oscillator reference clock 1. */
     static const ClockType OSC_REF_CLOCK_1;
 
+    /** Time of Day (TOD) clock. */
+    static const ClockType TOD_CLOCK;
+
   private:
     /**
      * @brief Constructor from components.
@@ -180,6 +183,7 @@
 
 inline const ClockType ClockType::OSC_REF_CLOCK_0{"OSC_REF_CLOCK_0"};
 inline const ClockType ClockType::OSC_REF_CLOCK_1{"OSC_REF_CLOCK_1"};
+inline const ClockType ClockType::TOD_CLOCK{"TOD_CLOCK"};
 
 /** @brief Container class for part callout service actions. */
 class PartType
diff --git a/analyzer/meson.build b/analyzer/meson.build
index 3cf063e..c849130 100644
--- a/analyzer/meson.build
+++ b/analyzer/meson.build
@@ -12,6 +12,7 @@
 
 plugins_src = files(
     'plugins/p10-plugins.cpp',
+    'plugins/p10-tod-plugins.cpp',
 )
 
 # Library dependencies.
diff --git a/analyzer/plugins/p10-plugins.cpp b/analyzer/plugins/p10-plugins.cpp
index 3e61135..a3ac1ca 100644
--- a/analyzer/plugins/p10-plugins.cpp
+++ b/analyzer/plugins/p10-plugins.cpp
@@ -108,14 +108,6 @@
     }
 }
 
-/**
- * @brief Handles TOD step check fault attentions.
- */
-void tod_step_check_fault(unsigned int, const libhei::Chip&, ServiceData&)
-{
-    // TODO
-}
-
 } // namespace P10
 
 PLUGIN_DEFINE_NS(P10_10, P10, pll_unlock);
@@ -124,7 +116,4 @@
 PLUGIN_DEFINE_NS(P10_10, P10, lpc_timeout);
 PLUGIN_DEFINE_NS(P10_20, P10, lpc_timeout);
 
-PLUGIN_DEFINE_NS(P10_10, P10, tod_step_check_fault);
-PLUGIN_DEFINE_NS(P10_20, P10, tod_step_check_fault);
-
 } // namespace analyzer
diff --git a/analyzer/plugins/p10-tod-plugins.cpp b/analyzer/plugins/p10-tod-plugins.cpp
new file mode 100644
index 0000000..84a8cfe
--- /dev/null
+++ b/analyzer/plugins/p10-tod-plugins.cpp
@@ -0,0 +1,34 @@
+
+#include <analyzer/plugins/plugin.hpp>
+#include <util/pdbg.hpp>
+#include <util/trace.hpp>
+
+namespace analyzer
+{
+
+namespace P10
+{
+
+/**
+ * @brief Handles TOD step check fault attentions.
+ */
+void tod_step_check_fault(unsigned int, const libhei::Chip& i_chip,
+                          ServiceData& io_servData)
+{
+    // TODO: The TOD step check fault analysis is complicated. It requires
+    //       analysis of multiple status registers on all processors in the
+    //       system. Until that support is available, call out the TOD clock and
+    //       the processor reporting the attention.
+    trace::err("Warning: TOD step check fault handling not fully supported");
+    io_servData.calloutClock(callout::ClockType::TOD_CLOCK,
+                             callout::Priority::MED, true);
+    io_servData.calloutTarget(util::pdbg::getTrgt(i_chip),
+                              callout::Priority::MED, false);
+}
+
+} // namespace P10
+
+PLUGIN_DEFINE_NS(P10_10, P10, tod_step_check_fault);
+PLUGIN_DEFINE_NS(P10_20, P10, tod_step_check_fault);
+
+} // namespace analyzer
diff --git a/analyzer/ras-data/ras-data-definition.md b/analyzer/ras-data/ras-data-definition.md
index 9c4b10f..007d01f 100644
--- a/analyzer/ras-data/ras-data-definition.md
+++ b/analyzer/ras-data/ras-data-definition.md
@@ -180,6 +180,7 @@
 |-----------------|------------------------------------------------------------|
 | OSC_REF_CLOCK_0 | Oscillator reference clock 0                               |
 | OSC_REF_CLOCK_1 | Oscillator reference clock 1                               |
+| TOD_CLOCK       | Time of Day (TOD) clock                                    |
 
 #### 5.1.7) action type `callout_procedure`
 
diff --git a/analyzer/ras-data/ras-data-parser.cpp b/analyzer/ras-data/ras-data-parser.cpp
index e3b86f6..861283b 100644
--- a/analyzer/ras-data/ras-data-parser.cpp
+++ b/analyzer/ras-data/ras-data-parser.cpp
@@ -225,6 +225,7 @@
             {
                 {"OSC_REF_CLOCK_0", callout::ClockType::OSC_REF_CLOCK_0},
                 {"OSC_REF_CLOCK_1", callout::ClockType::OSC_REF_CLOCK_1},
+                {"TOD_CLOCK",       callout::ClockType::TOD_CLOCK},
             };
             // clang-format on
 
diff --git a/analyzer/ras-data/schema/ras-data-schema-v01.json b/analyzer/ras-data/schema/ras-data-schema-v01.json
index e1bced1..77773e5 100644
--- a/analyzer/ras-data/schema/ras-data-schema-v01.json
+++ b/analyzer/ras-data/schema/ras-data-schema-v01.json
@@ -158,7 +158,8 @@
                                         "name": {
                                             "enum": [
                                                 "OSC_REF_CLOCK_0",
-                                                "OSC_REF_CLOCK_1"
+                                                "OSC_REF_CLOCK_1",
+                                                "TOD_CLOCK"
                                             ]
                                         }
                                     }