mctp: add I3CMCTPDDevice Assignment
This commit adds the assignment of I3CMCTPDDevice to MCTPEndpoint.
Tested on yosemite4, which is a multihost platform with 8 server blades,
mctpreactor may associate these endpoint with EM configs properly.
Change-Id: I4f8038f539245b43ba3c9ac923ccad9670aed87f
Signed-off-by: Unive Tien <unive.tien.wiwynn@gmail.com>
diff --git a/src/mctp/MCTPEndpoint.hpp b/src/mctp/MCTPEndpoint.hpp
index ffba380..2abfc95 100644
--- a/src/mctp/MCTPEndpoint.hpp
+++ b/src/mctp/MCTPEndpoint.hpp
@@ -326,3 +326,26 @@
static std::string interfaceFromBus(int bus);
};
+
+class I3CMCTPDDevice : public MCTPDDevice
+{
+ public:
+ static std::optional<SensorBaseConfigMap> match(const SensorData& config);
+ static bool match(const std::set<std::string>& interfaces);
+ static std::shared_ptr<I3CMCTPDDevice> from(
+ const std::shared_ptr<sdbusplus::asio::connection>& connection,
+ const SensorBaseConfigMap& iface);
+
+ I3CMCTPDDevice() = delete;
+ I3CMCTPDDevice(
+ const std::shared_ptr<sdbusplus::asio::connection>& connection, int bus,
+ const std::vector<uint8_t>& physaddr) :
+ MCTPDDevice(connection, interfaceFromBus(bus), physaddr)
+ {}
+ ~I3CMCTPDDevice() override = default;
+
+ private:
+ static constexpr const char* configType = "MCTPI3CTarget";
+
+ static std::string interfaceFromBus(int bus);
+};