blob: 8b73453484e282875392284971b02ef88ec697d7 [file] [log] [blame]
Harshit Aghera4ecdfaa2025-05-22 11:35:39 +05301/*
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
21constexpr const char* sensorPathPrefix = "/xyz/openbmc_project/sensors/";
22constexpr const char* deviceType = "NvidiaMctpVdm";
23
24struct SensorConfigs
25{
26 std::string name;
27 uint64_t pollRate{};
28};
29
30class GpuDevice;
Harshit Aghera8951c872025-06-25 15:25:33 +053031class SmaDevice;
Harshit Aghera4ecdfaa2025-05-22 11:35:39 +053032
33void 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,
Harshit Aghera8951c872025-06-25 15:25:33 +053037 boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>>&
38 smaDevices,
Harshit Aghera4ecdfaa2025-05-22 11:35:39 +053039 const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection,
40 mctp::MctpRequester& mctpRequester);
41
42void interfaceRemoved(
43 sdbusplus::message_t& message,
44 boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>&
Harshit Aghera8951c872025-06-25 15:25:33 +053045 gpuDevices,
46 boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>>&
47 smaDevices);