xref: /openbmc/dbus-sensors/src/nvidia-gpu/NvidiaDeviceDiscovery.hpp (revision 8951c87e8fca6ba57f78344119ab42866c190c80)
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION &
3  * AFFILIATES. All rights reserved.
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include "MctpRequester.hpp"
10 
11 #include <boost/asio/io_context.hpp>
12 #include <boost/container/flat_map.hpp>
13 #include <sdbusplus/asio/connection.hpp>
14 #include <sdbusplus/asio/object_server.hpp>
15 #include <sdbusplus/message.hpp>
16 
17 #include <cstdint>
18 #include <memory>
19 #include <string>
20 
21 constexpr const char* sensorPathPrefix = "/xyz/openbmc_project/sensors/";
22 constexpr const char* deviceType = "NvidiaMctpVdm";
23 
24 struct SensorConfigs
25 {
26     std::string name;
27     uint64_t pollRate{};
28 };
29 
30 class GpuDevice;
31 class SmaDevice;
32 
33 void createSensors(
34     boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer,
35     boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>&
36         gpuDevices,
37     boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>>&
38         smaDevices,
39     const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
40     mctp::MctpRequester& mctpRequester);
41 
42 void interfaceRemoved(
43     sdbusplus::message_t& message,
44     boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>&
45         gpuDevices,
46     boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>>&
47         smaDevices);
48