14ecdfaaaSHarshit Aghera /* 24ecdfaaaSHarshit Aghera * SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & 34ecdfaaaSHarshit Aghera * AFFILIATES. All rights reserved. 44ecdfaaaSHarshit Aghera * SPDX-License-Identifier: Apache-2.0 54ecdfaaaSHarshit Aghera */ 64ecdfaaaSHarshit Aghera 74ecdfaaaSHarshit Aghera #pragma once 84ecdfaaaSHarshit Aghera 94ecdfaaaSHarshit Aghera #include "MctpRequester.hpp" 104ecdfaaaSHarshit Aghera #include "NvidiaDeviceDiscovery.hpp" 11*902c649bSHarshit Aghera #include "NvidiaGpuPowerSensor.hpp" 124ecdfaaaSHarshit Aghera #include "NvidiaGpuSensor.hpp" 134ecdfaaaSHarshit Aghera 144ecdfaaaSHarshit Aghera #include <boost/asio/io_context.hpp> 154ecdfaaaSHarshit Aghera #include <boost/asio/steady_timer.hpp> 164ecdfaaaSHarshit Aghera #include <sdbusplus/asio/connection.hpp> 174ecdfaaaSHarshit Aghera #include <sdbusplus/asio/object_server.hpp> 184ecdfaaaSHarshit Aghera 194ecdfaaaSHarshit Aghera #include <chrono> 204ecdfaaaSHarshit Aghera #include <cstdint> 214ecdfaaaSHarshit Aghera #include <memory> 224ecdfaaaSHarshit Aghera #include <string> 235e7deccdSHarshit Aghera #include <vector> 244ecdfaaaSHarshit Aghera 254ecdfaaaSHarshit Aghera class GpuDevice 264ecdfaaaSHarshit Aghera { 274ecdfaaaSHarshit Aghera public: 284ecdfaaaSHarshit Aghera GpuDevice(const SensorConfigs& configs, const std::string& name, 294ecdfaaaSHarshit Aghera const std::string& path, 304ecdfaaaSHarshit Aghera const std::shared_ptr<sdbusplus::asio::connection>& conn, 314ecdfaaaSHarshit Aghera uint8_t eid, boost::asio::io_context& io, 324ecdfaaaSHarshit Aghera mctp::MctpRequester& mctpRequester, 334ecdfaaaSHarshit Aghera sdbusplus::asio::object_server& objectServer); 344ecdfaaaSHarshit Aghera 354ecdfaaaSHarshit Aghera const std::string& getPath() const 364ecdfaaaSHarshit Aghera { 374ecdfaaaSHarshit Aghera return path; 384ecdfaaaSHarshit Aghera } 394ecdfaaaSHarshit Aghera 404ecdfaaaSHarshit Aghera private: 414ecdfaaaSHarshit Aghera void makeSensors(); 424ecdfaaaSHarshit Aghera 434ecdfaaaSHarshit Aghera void read(); 444ecdfaaaSHarshit Aghera 455e7deccdSHarshit Aghera void processTLimitThresholds(uint8_t rc, 465e7deccdSHarshit Aghera const std::vector<int32_t>& thresholds); 475e7deccdSHarshit Aghera 484ecdfaaaSHarshit Aghera uint8_t eid{}; 494ecdfaaaSHarshit Aghera 504ecdfaaaSHarshit Aghera std::chrono::milliseconds sensorPollMs; 514ecdfaaaSHarshit Aghera 524ecdfaaaSHarshit Aghera boost::asio::steady_timer waitTimer; 534ecdfaaaSHarshit Aghera 544ecdfaaaSHarshit Aghera mctp::MctpRequester& mctpRequester; 554ecdfaaaSHarshit Aghera 564ecdfaaaSHarshit Aghera std::shared_ptr<sdbusplus::asio::connection> conn; 574ecdfaaaSHarshit Aghera 584ecdfaaaSHarshit Aghera sdbusplus::asio::object_server& objectServer; 594ecdfaaaSHarshit Aghera 604ecdfaaaSHarshit Aghera std::shared_ptr<NvidiaGpuTempSensor> tempSensor; 61ba138daeSHarshit Aghera std::shared_ptr<NvidiaGpuTempSensor> tLimitSensor; 62*902c649bSHarshit Aghera std::shared_ptr<NvidiaGpuPowerSensor> powerSensor; 634ecdfaaaSHarshit Aghera 644ecdfaaaSHarshit Aghera SensorConfigs configs; 654ecdfaaaSHarshit Aghera 664ecdfaaaSHarshit Aghera std::string name; 674ecdfaaaSHarshit Aghera 684ecdfaaaSHarshit Aghera std::string path; 694ecdfaaaSHarshit Aghera }; 70