xref: /openbmc/dbus-sensors/src/nvidia-gpu/NvidiaDeviceDiscovery.hpp (revision 8951c87e8fca6ba57f78344119ab42866c190c80)
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 
114ecdfaaaSHarshit Aghera #include <boost/asio/io_context.hpp>
124ecdfaaaSHarshit Aghera #include <boost/container/flat_map.hpp>
134ecdfaaaSHarshit Aghera #include <sdbusplus/asio/connection.hpp>
144ecdfaaaSHarshit Aghera #include <sdbusplus/asio/object_server.hpp>
154ecdfaaaSHarshit Aghera #include <sdbusplus/message.hpp>
164ecdfaaaSHarshit Aghera 
174ecdfaaaSHarshit Aghera #include <cstdint>
184ecdfaaaSHarshit Aghera #include <memory>
194ecdfaaaSHarshit Aghera #include <string>
204ecdfaaaSHarshit Aghera 
214ecdfaaaSHarshit Aghera constexpr const char* sensorPathPrefix = "/xyz/openbmc_project/sensors/";
224ecdfaaaSHarshit Aghera constexpr const char* deviceType = "NvidiaMctpVdm";
234ecdfaaaSHarshit Aghera 
244ecdfaaaSHarshit Aghera struct SensorConfigs
254ecdfaaaSHarshit Aghera {
264ecdfaaaSHarshit Aghera     std::string name;
274ecdfaaaSHarshit Aghera     uint64_t pollRate{};
284ecdfaaaSHarshit Aghera };
294ecdfaaaSHarshit Aghera 
304ecdfaaaSHarshit Aghera class GpuDevice;
31*8951c87eSHarshit Aghera class SmaDevice;
324ecdfaaaSHarshit Aghera 
334ecdfaaaSHarshit Aghera void createSensors(
344ecdfaaaSHarshit Aghera     boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
354ecdfaaaSHarshit Aghera     boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>&
364ecdfaaaSHarshit Aghera         gpuDevices,
37*8951c87eSHarshit Aghera     boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>>&
38*8951c87eSHarshit Aghera         smaDevices,
394ecdfaaaSHarshit Aghera     const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
404ecdfaaaSHarshit Aghera     mctp::MctpRequester& mctpRequester);
414ecdfaaaSHarshit Aghera 
424ecdfaaaSHarshit Aghera void interfaceRemoved(
434ecdfaaaSHarshit Aghera     sdbusplus::message_t& message,
444ecdfaaaSHarshit Aghera     boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>&
45*8951c87eSHarshit Aghera         gpuDevices,
46*8951c87eSHarshit Aghera     boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>>&
47*8951c87eSHarshit Aghera         smaDevices);
48