blob: 1c344b8807351fd210457adab35a29eed3a82a76 [file] [log] [blame]
Jayanth Othayothed7fb7a2022-09-09 00:07:41 -05001/**
2 * Copyright © 2022 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include "extensions/phal/create_pel.hpp"
19
Jayanth Othayothed7fb7a2022-09-09 00:07:41 -050020#include <sdeventplus/utility/timer.hpp>
21
22#include <chrono>
23
24namespace openpower::phal::clock
25{
26
27/* Dbus event timer */
28using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>;
29
30/**
31 * @class Manager - Represents the clock daily management functions
32 *
33 */
34class Manager
35{
36 public:
37 Manager() = delete;
38 Manager(const Manager&) = delete;
39 Manager(Manager&&) = delete;
40 Manager& operator=(const Manager&) = delete;
41 Manager& operator=(Manager&&) = delete;
42 ~Manager() = default;
43
44 /**
45 * Constructor
46 * Starts the functions required to capture clock daily logger data.
47 *
48 * @param[in] event - sdeventplus event loop
49 */
50 Manager(const sdeventplus::Event& event);
51
52 /**
53 * @brief Add a dbus timer
54 */
55 void addTimer();
56
57 /**
58 * @brief Callback when a timer expires
59 */
60 void timerExpired();
61
62 /**
63 * @brief utility function to create clock data log
64 */
65 void createClockDataLog();
66
Jayanth Othayoth91bf93e2022-09-09 04:30:17 -050067 /**
68 * @brief Add processor specific CFAM data to daily logger.
69 *
70 * @param[in] proc - pdbg processor target
71 * @param[out] ffdcData - reference to clock data log
72 */
73 void addCFAMData(struct pdbg_target* proc,
74 openpower::pel::FFDCData& clockDataLog);
75
Jayanth Othayoth5ffe7fb2022-09-09 06:39:58 -050076 /**
77 * @brief Add clock specific register data to daily logger.
78 *
79 * @param[out] ffdcData - reference to clock data log
80 */
81 void addClockRegData(openpower::pel::FFDCData& clockDataLog);
82
Jayanth Othayothed7fb7a2022-09-09 00:07:41 -050083 private:
84 /* The sdeventplus even loop to use */
85 sdeventplus::Event _event;
86
87 /** @brief Timer used for LEDs lamp test period */
88 sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> timer;
89};
90
91} // namespace openpower::phal::clock