1 /* 2 * SPDX-FileCopyrightText: Copyright OpenBMC Authors 3 * SPDX-License-Identifier: Apache-2.0 4 */ 5 6 #pragma once 7 8 #include "MctpRequester.hpp" 9 10 #include <boost/asio/io_context.hpp> 11 #include <boost/container/flat_map.hpp> 12 #include <sdbusplus/asio/connection.hpp> 13 #include <sdbusplus/asio/object_server.hpp> 14 #include <sdbusplus/message.hpp> 15 16 #include <cstdint> 17 #include <memory> 18 #include <string> 19 20 constexpr const char* sensorPathPrefix = "/xyz/openbmc_project/sensors/"; 21 constexpr const char* deviceType = "NvidiaMctpVdm"; 22 23 struct SensorConfigs 24 { 25 std::string name; 26 uint64_t pollRate{}; 27 }; 28 29 class GpuDevice; 30 class SmaDevice; 31 class PcieDevice; 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 boost::container::flat_map<std::string, std::shared_ptr<PcieDevice>>& 40 pcieDevices, 41 const std::shared_ptr<sdbusplus::asio::connection>& dbusConnection, 42 mctp::MctpRequester& mctpRequester); 43 44 void interfaceRemoved( 45 sdbusplus::message_t& message, 46 boost::container::flat_map<std::string, std::shared_ptr<GpuDevice>>& 47 gpuDevices, 48 boost::container::flat_map<std::string, std::shared_ptr<SmaDevice>>& 49 smaDevices, 50 boost::container::flat_map<std::string, std::shared_ptr<PcieDevice>>& 51 pcieDevices); 52