1*4ecdfaaaSHarshit Aghera /* 2*4ecdfaaaSHarshit Aghera * SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & 3*4ecdfaaaSHarshit Aghera * AFFILIATES. All rights reserved. 4*4ecdfaaaSHarshit Aghera * SPDX-License-Identifier: Apache-2.0 5*4ecdfaaaSHarshit Aghera */ 6*4ecdfaaaSHarshit Aghera 7*4ecdfaaaSHarshit Aghera #pragma once 8*4ecdfaaaSHarshit Aghera 9*4ecdfaaaSHarshit Aghera #include "MctpRequester.hpp" 10*4ecdfaaaSHarshit Aghera #include "NvidiaDeviceDiscovery.hpp" 11*4ecdfaaaSHarshit Aghera #include "NvidiaGpuSensor.hpp" 12*4ecdfaaaSHarshit Aghera 13*4ecdfaaaSHarshit Aghera #include <boost/asio/io_context.hpp> 14*4ecdfaaaSHarshit Aghera #include <boost/asio/steady_timer.hpp> 15*4ecdfaaaSHarshit Aghera #include <sdbusplus/asio/connection.hpp> 16*4ecdfaaaSHarshit Aghera #include <sdbusplus/asio/object_server.hpp> 17*4ecdfaaaSHarshit Aghera 18*4ecdfaaaSHarshit Aghera #include <chrono> 19*4ecdfaaaSHarshit Aghera #include <cstdint> 20*4ecdfaaaSHarshit Aghera #include <memory> 21*4ecdfaaaSHarshit Aghera #include <string> 22*4ecdfaaaSHarshit Aghera 23*4ecdfaaaSHarshit Aghera class GpuDevice 24*4ecdfaaaSHarshit Aghera { 25*4ecdfaaaSHarshit Aghera public: 26*4ecdfaaaSHarshit Aghera GpuDevice(const SensorConfigs& configs, const std::string& name, 27*4ecdfaaaSHarshit Aghera const std::string& path, 28*4ecdfaaaSHarshit Aghera const std::shared_ptr<sdbusplus::asio::connection>& conn, 29*4ecdfaaaSHarshit Aghera uint8_t eid, boost::asio::io_context& io, 30*4ecdfaaaSHarshit Aghera mctp::MctpRequester& mctpRequester, 31*4ecdfaaaSHarshit Aghera sdbusplus::asio::object_server& objectServer); 32*4ecdfaaaSHarshit Aghera 33*4ecdfaaaSHarshit Aghera const std::string& getPath() const 34*4ecdfaaaSHarshit Aghera { 35*4ecdfaaaSHarshit Aghera return path; 36*4ecdfaaaSHarshit Aghera } 37*4ecdfaaaSHarshit Aghera 38*4ecdfaaaSHarshit Aghera private: 39*4ecdfaaaSHarshit Aghera void makeSensors(); 40*4ecdfaaaSHarshit Aghera 41*4ecdfaaaSHarshit Aghera void read(); 42*4ecdfaaaSHarshit Aghera 43*4ecdfaaaSHarshit Aghera uint8_t eid{}; 44*4ecdfaaaSHarshit Aghera 45*4ecdfaaaSHarshit Aghera std::chrono::milliseconds sensorPollMs; 46*4ecdfaaaSHarshit Aghera 47*4ecdfaaaSHarshit Aghera boost::asio::steady_timer waitTimer; 48*4ecdfaaaSHarshit Aghera 49*4ecdfaaaSHarshit Aghera mctp::MctpRequester& mctpRequester; 50*4ecdfaaaSHarshit Aghera 51*4ecdfaaaSHarshit Aghera std::shared_ptr<sdbusplus::asio::connection> conn; 52*4ecdfaaaSHarshit Aghera 53*4ecdfaaaSHarshit Aghera sdbusplus::asio::object_server& objectServer; 54*4ecdfaaaSHarshit Aghera 55*4ecdfaaaSHarshit Aghera std::shared_ptr<NvidiaGpuTempSensor> tempSensor; 56*4ecdfaaaSHarshit Aghera 57*4ecdfaaaSHarshit Aghera SensorConfigs configs; 58*4ecdfaaaSHarshit Aghera 59*4ecdfaaaSHarshit Aghera std::string name; 60*4ecdfaaaSHarshit Aghera 61*4ecdfaaaSHarshit Aghera std::string path; 62*4ecdfaaaSHarshit Aghera }; 63