Harshit Aghera | 4ecdfaa | 2025-05-22 11:35:39 +0530 | [diff] [blame] | 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 | |
| 32 | void createSensors( |
| 33 | boost::asio::io_context& io, sdbusplus::asio::object_server& objectServer, |
| 34 | boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>& |
| 35 | gpuDevices, |
| 36 | const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection, |
| 37 | mctp::MctpRequester& mctpRequester); |
| 38 | |
| 39 | void interfaceRemoved( |
| 40 | sdbusplus::message_t& message, |
| 41 | boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>& |
| 42 | gpuDevices); |