1 /** 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 20 #include <sdeventplus/utility/timer.hpp> 21 22 #include <chrono> 23 24 namespace openpower::phal::clock 25 { 26 27 /* Dbus event timer */ 28 using Timer = sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic>; 29 30 /** 31 * @class Manager - Represents the clock daily management functions 32 * 33 */ 34 class 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 67 /** 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 76 /** 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 83 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 92