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