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 9*0a88826fSRohit PAI #include "Inventory.hpp" 104ecdfaaaSHarshit Aghera #include "MctpRequester.hpp" 114ecdfaaaSHarshit Aghera #include "NvidiaDeviceDiscovery.hpp" 12902c649bSHarshit Aghera #include "NvidiaGpuPowerSensor.hpp" 134ecdfaaaSHarshit Aghera #include "NvidiaGpuSensor.hpp" 144ecdfaaaSHarshit Aghera 15775199d2SHarshit Aghera #include <NvidiaGpuEnergySensor.hpp> 16bef4d418SHarshit Aghera #include <NvidiaGpuVoltageSensor.hpp> 174ecdfaaaSHarshit Aghera #include <boost/asio/io_context.hpp> 184ecdfaaaSHarshit Aghera #include <boost/asio/steady_timer.hpp> 194ecdfaaaSHarshit Aghera #include <sdbusplus/asio/connection.hpp> 204ecdfaaaSHarshit Aghera #include <sdbusplus/asio/object_server.hpp> 214ecdfaaaSHarshit Aghera 224ecdfaaaSHarshit Aghera #include <chrono> 234ecdfaaaSHarshit Aghera #include <cstdint> 244ecdfaaaSHarshit Aghera #include <memory> 254ecdfaaaSHarshit Aghera #include <string> 265e7deccdSHarshit Aghera #include <vector> 274ecdfaaaSHarshit Aghera 284ecdfaaaSHarshit Aghera class GpuDevice 294ecdfaaaSHarshit Aghera { 304ecdfaaaSHarshit Aghera public: 314ecdfaaaSHarshit Aghera GpuDevice(const SensorConfigs& configs, const std::string& name, 324ecdfaaaSHarshit Aghera const std::string& path, 334ecdfaaaSHarshit Aghera const std::shared_ptr<sdbusplus::asio::connection>& conn, 344ecdfaaaSHarshit Aghera uint8_t eid, boost::asio::io_context& io, 354ecdfaaaSHarshit Aghera mctp::MctpRequester& mctpRequester, 364ecdfaaaSHarshit Aghera sdbusplus::asio::object_server& objectServer); 374ecdfaaaSHarshit Aghera getPath() const384ecdfaaaSHarshit Aghera const std::string& getPath() const 394ecdfaaaSHarshit Aghera { 404ecdfaaaSHarshit Aghera return path; 414ecdfaaaSHarshit Aghera } 424ecdfaaaSHarshit Aghera 434ecdfaaaSHarshit Aghera private: 444ecdfaaaSHarshit Aghera void makeSensors(); 454ecdfaaaSHarshit Aghera 464ecdfaaaSHarshit Aghera void read(); 474ecdfaaaSHarshit Aghera 485e7deccdSHarshit Aghera void processTLimitThresholds(uint8_t rc, 495e7deccdSHarshit Aghera const std::vector<int32_t>& thresholds); 505e7deccdSHarshit Aghera 514ecdfaaaSHarshit Aghera uint8_t eid{}; 524ecdfaaaSHarshit Aghera 534ecdfaaaSHarshit Aghera std::chrono::milliseconds sensorPollMs; 544ecdfaaaSHarshit Aghera 554ecdfaaaSHarshit Aghera boost::asio::steady_timer waitTimer; 564ecdfaaaSHarshit Aghera 574ecdfaaaSHarshit Aghera mctp::MctpRequester& mctpRequester; 584ecdfaaaSHarshit Aghera 594ecdfaaaSHarshit Aghera std::shared_ptr<sdbusplus::asio::connection> conn; 604ecdfaaaSHarshit Aghera 614ecdfaaaSHarshit Aghera sdbusplus::asio::object_server& objectServer; 624ecdfaaaSHarshit Aghera 634ecdfaaaSHarshit Aghera std::shared_ptr<NvidiaGpuTempSensor> tempSensor; 64ba138daeSHarshit Aghera std::shared_ptr<NvidiaGpuTempSensor> tLimitSensor; 65b10a67b2SHarshit Aghera std::shared_ptr<NvidiaGpuTempSensor> dramTempSensor; 66902c649bSHarshit Aghera std::shared_ptr<NvidiaGpuPowerSensor> powerSensor; 67775199d2SHarshit Aghera std::shared_ptr<NvidiaGpuEnergySensor> energySensor; 68bef4d418SHarshit Aghera std::shared_ptr<NvidiaGpuVoltageSensor> voltageSensor; 694ecdfaaaSHarshit Aghera 704ecdfaaaSHarshit Aghera SensorConfigs configs; 714ecdfaaaSHarshit Aghera 724ecdfaaaSHarshit Aghera std::string name; 734ecdfaaaSHarshit Aghera 744ecdfaaaSHarshit Aghera std::string path; 75*0a88826fSRohit PAI 76*0a88826fSRohit PAI std::shared_ptr<Inventory> inventory; 774ecdfaaaSHarshit Aghera }; 78