Add Error definition for host watchdog timeout
When the host watchdog times out, we need an errorlog to report it.
This commit adds that support.
Change-Id: I0ebb792b768b2ce10e2019fcc24a4d171d3f38fb
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/Makefile.am b/Makefile.am
index 90651d6..9b54f9e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,5 +1,6 @@
AM_DEFAULT_SOURCE_EXT = .cpp
-sbin_PROGRAMS = checkstop_app
+sbin_PROGRAMS = checkstop_app \
+ watchdog_timeout
nobase_nodist_include_HEADERS = \
org/open_power/Host/error.hpp
@@ -13,13 +14,22 @@
checkstop_app_SOURCES = checkstop_app.cpp \
org/open_power/Host/error.cpp
-checkstop_app_LDFLAGS = \
- $(PHOSPHOR_LOGGING_LIBS) \
- $(SDBUSPLUS_LIBS)
+watchdog_timeout_SOURCES = watchdog_timeout.cpp \
+ org/open_power/Host/error.cpp
-checkstop_app_CXXFLAGS = \
- $(PHOSPHOR_LOGGING_CFLAGS) \
- $(SDBUSPLUS_CFLAGS)
+generic_ldflags = \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ $(SDBUSPLUS_LIBS)
+
+generic_cxxflags = \
+ $(PHOSPHOR_LOGGING_CFLAGS) \
+ $(SDBUSPLUS_CFLAGS)
+
+checkstop_app_LDFLAGS = ${generic_ldflags}
+watchdog_timeout_LDFLAGS = ${generic_ldflags}
+
+checkstop_app_CXXFLAGS = ${generic_cxxflags}
+watchdog_timeout_CXXFLAGS = ${generic_cxxflags}
org/open_power/Host/error.hpp: ${top_srcdir}/org/open_power/Host.errors.yaml
@mkdir -p `dirname $@`
diff --git a/elog-errors.hpp b/elog-errors.hpp
index 31a2fc5..a1d9316 100644
--- a/elog-errors.hpp
+++ b/elog-errors.hpp
@@ -1,89 +1,125 @@
-// This file was autogenerated. Do not edit!
-// See elog-gen.py for more details
-#pragma once
-
-#include <string>
-#include <tuple>
-#include <type_traits>
-#include <sdbusplus/exception.hpp>
-#include <phosphor-logging/log.hpp>
-
-namespace sdbusplus
-{
-namespace org
-{
-namespace open_power
-{
-namespace Host
-{
-namespace Error
-{
- struct Checkstop;
-} // namespace Error
-} // namespace Host
-} // namespace open_power
-} // namespace org
-} // namespace sdbusplus
-
-
-namespace phosphor
-{
-
-namespace logging
-{
-
-namespace org
-{
-namespace open_power
-{
-namespace Host
-{
-namespace _Checkstop
-{
-
-
-} // namespace _Checkstop
-
-struct Checkstop : public sdbusplus::exception_t
-{
- static constexpr auto errName = "org.open_power.Host.Checkstop";
- static constexpr auto errDesc = "Checkstop condition detected";
- static constexpr auto L = level::ERR;
- using metadata_types = std::tuple<>;
-
- const char* name() const noexcept
- {
- return errName;
- }
-
- const char* description() const noexcept
- {
- return errDesc;
- }
-
- const char* what() const noexcept
- {
- return errName;
- }
-};
-
-} // namespace Host
-} // namespace open_power
-} // namespace org
-
-
-namespace details
-{
-
-template <>
-struct map_exception_type<sdbusplus::org::open_power::Host::Error::Checkstop>
-{
- using type = org::open_power::Host::Checkstop;
-};
-
-}
-
-
-} // namespace logging
-
-} // namespace phosphor
+// This file was autogenerated. Do not edit!
+// See elog-gen.py for more details
+#pragma once
+
+#include <string>
+#include <tuple>
+#include <type_traits>
+#include <sdbusplus/exception.hpp>
+#include <phosphor-logging/log.hpp>
+#include <phosphor-logging/elog.hpp>
+
+namespace sdbusplus
+{
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace Error
+{
+ struct Checkstop;
+} // namespace Error
+} // namespace Host
+} // namespace open_power
+} // namespace org
+} // namespace sdbusplus
+
+namespace sdbusplus
+{
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace Error
+{
+ struct WatchdogTimedOut;
+} // namespace Error
+} // namespace Host
+} // namespace open_power
+} // namespace org
+} // namespace sdbusplus
+
+
+namespace phosphor
+{
+
+namespace logging
+{
+
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace _Checkstop
+{
+
+
+} // namespace _Checkstop
+
+struct Checkstop
+{
+ static constexpr auto L = level::ERR;
+ using metadata_types = std::tuple<>;
+
+};
+
+} // namespace Host
+} // namespace open_power
+} // namespace org
+
+
+namespace details
+{
+
+template <>
+struct map_exception_type<sdbusplus::org::open_power::Host::Error::Checkstop>
+{
+ using type = org::open_power::Host::Checkstop;
+};
+
+}
+
+namespace org
+{
+namespace open_power
+{
+namespace Host
+{
+namespace _WatchdogTimedOut
+{
+
+
+} // namespace _WatchdogTimedOut
+
+struct WatchdogTimedOut
+{
+ static constexpr auto L = level::ERR;
+ using metadata_types = std::tuple<>;
+
+};
+
+} // namespace Host
+} // namespace open_power
+} // namespace org
+
+
+namespace details
+{
+
+template <>
+struct map_exception_type<sdbusplus::org::open_power::Host::Error::WatchdogTimedOut>
+{
+ using type = org::open_power::Host::WatchdogTimedOut;
+};
+
+}
+
+} // namespace logging
+
+} // namespace phosphor
diff --git a/org/open_power/Host.errors.yaml b/org/open_power/Host.errors.yaml
index b356f57..ffd3aa3 100644
--- a/org/open_power/Host.errors.yaml
+++ b/org/open_power/Host.errors.yaml
@@ -1,2 +1,5 @@
- name: Checkstop
description: Host checkstop condition detected
+
+- name: WatchdogTimedOut
+ description: Host watchdog timed out
diff --git a/watchdog_timeout.cpp b/watchdog_timeout.cpp
new file mode 100644
index 0000000..130b79a
--- /dev/null
+++ b/watchdog_timeout.cpp
@@ -0,0 +1,13 @@
+#include <phosphor-logging/elog.hpp>
+#include "elog-errors.hpp"
+#include "org/open_power/Host/error.hpp"
+
+int main(int argc, char* argv[])
+{
+ using namespace phosphor::logging;
+ using error = sdbusplus::org::open_power::Host::Error::WatchdogTimedOut;
+ report<error>();
+
+ return 0;
+}
+