PHAL: clock daily data logger base infrastructure support
To support system clock issues debug added support to log clock
specific register information every 24 hours and report externally.
This commit provides support to base infrastructure to log informational
logs every 24 hours and at the beginning of application start.
Tested:
"User Header": {
"Section Version": "1",
"Sub-section type": "0",
"Log Committed by": "0x2000",
"Subsystem": "CEC Hardware - Clock",
"Event Scope": "Entire Platform",
"Event Severity": "Informational Event",
"Event Type": "Miscellaneous, Informational Only",
"Action Flags": [
"Service Action Required",
"Report Externally",
"HMC Call Home"
],
"Host Transmission": "Not Sent",
"HMC Transmission": "Not Sent"
},
"Primary SRC": {
"Section Version": "1",
"Sub-section type": "1",
"Created by": "0x3000",
"SRC Version": "0x02",
"SRC Format": "0x55",
"Virtual Progress SRC": "False",
"I5/OS Service Event Bit": "False",
"Hypervisor Dump Initiated":"False",
"Backplane CCIN": "2E33",
"Terminate FW Error": "False",
"Deconfigured": "False",
"Guarded": "False",
"Error Details": {
"Message": "Informational error to house clock debug info"
},
"Valid Word Count": "0x09",
"Reference Code": "BD58300A",
"Hex Word 2": "00080055",
"Hex Word 3": "2E330010",
"Hex Word 4": "00000000",
"Hex Word 5": "00000000",
"Hex Word 6": "00000000",
"Hex Word 7": "00000000",
"Hex Word 8": "00000000",
"Hex Word 9": "00000000"
}
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
Change-Id: I91cffe17ffe7d38b1127f89e61484c597b9b378b
diff --git a/extensions/phal/clock_logger.hpp b/extensions/phal/clock_logger.hpp
new file mode 100644
index 0000000..a9982d1
--- /dev/null
+++ b/extensions/phal/clock_logger.hpp
@@ -0,0 +1,77 @@
+/**
+ * Copyright © 2022 IBM Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "extensions/phal/create_pel.hpp"
+
+#include <fmt/format.h>
+
+#include <sdeventplus/utility/timer.hpp>
+
+#include <chrono>
+
+namespace openpower::phal::clock
+{
+
+/* Dbus event timer */
+using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>;
+
+/**
+ * @class Manager - Represents the clock daily management functions
+ *
+ */
+class Manager
+{
+ public:
+ Manager() = delete;
+ Manager(const Manager&) = delete;
+ Manager(Manager&&) = delete;
+ Manager& operator=(const Manager&) = delete;
+ Manager& operator=(Manager&&) = delete;
+ ~Manager() = default;
+
+ /**
+ * Constructor
+ * Starts the functions required to capture clock daily logger data.
+ *
+ * @param[in] event - sdeventplus event loop
+ */
+ Manager(const sdeventplus::Event& event);
+
+ /**
+ * @brief Add a dbus timer
+ */
+ void addTimer();
+
+ /**
+ * @brief Callback when a timer expires
+ */
+ void timerExpired();
+
+ /**
+ * @brief utility function to create clock data log
+ */
+ void createClockDataLog();
+
+ private:
+ /* The sdeventplus even loop to use */
+ sdeventplus::Event _event;
+
+ /** @brief Timer used for LEDs lamp test period */
+ sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer;
+};
+
+} // namespace openpower::phal::clock