MCTPEndpoint.cpp (275f7c39190bab69efa11218b68587e8955cc588) MCTPEndpoint.cpp (19d1fda609a4c39caca73858c90ebee823028362)
1#include "MCTPEndpoint.hpp"
2
3#include "Utils.hpp"
4#include "VariantVisitors.hpp"
5
6#include <bits/fs_dir.h>
7
8#include <boost/system/detail/errc.hpp>

--- 20 unchanged lines hidden (view full) ---

29#include <string>
30#include <system_error>
31#include <utility>
32#include <variant>
33#include <vector>
34
35PHOSPHOR_LOG2_USING;
36
1#include "MCTPEndpoint.hpp"
2
3#include "Utils.hpp"
4#include "VariantVisitors.hpp"
5
6#include <bits/fs_dir.h>
7
8#include <boost/system/detail/errc.hpp>

--- 20 unchanged lines hidden (view full) ---

29#include <string>
30#include <system_error>
31#include <utility>
32#include <variant>
33#include <vector>
34
35PHOSPHOR_LOG2_USING;
36
37static constexpr const char* mctpdBusName = "xyz.openbmc_project.MCTP";
38static constexpr const char* mctpdControlPath = "/xyz/openbmc_project/mctp";
37static constexpr const char* mctpdBusName = "au.com.codeconstruct.MCTP1";
38static constexpr const char* mctpdControlPath = "/au/com/codeconstruct/mctp1";
39static constexpr const char* mctpdControlInterface =
39static constexpr const char* mctpdControlInterface =
40 "au.com.CodeConstruct.MCTP";
40 "au.com.codeconstruct.MCTP.BusOwner1";
41static constexpr const char* mctpdEndpointControlInterface =
41static constexpr const char* mctpdEndpointControlInterface =
42 "au.com.CodeConstruct.MCTP.Endpoint";
42 "au.com.codeconstruct.MCTP.Endpoint1";
43
44MCTPDDevice::MCTPDDevice(
45 const std::shared_ptr<sdbusplus::asio::connection>& connection,
46 const std::string& interface, const std::vector<uint8_t>& physaddr) :
47 connection(connection), interface(interface), physaddr(physaddr)
48{}
49
50void MCTPDDevice::onEndpointInterfacesRemoved(

--- 60 unchanged lines hidden (view full) ---

111 }
112 else
113 {
114 info(
115 "Device object for inventory at '{INVENTORY_PATH}' was destroyed concurrent to completion of its endpoint setup",
116 "INVENTORY_PATH", objpath);
117 }
118 };
43
44MCTPDDevice::MCTPDDevice(
45 const std::shared_ptr<sdbusplus::asio::connection>& connection,
46 const std::string& interface, const std::vector<uint8_t>& physaddr) :
47 connection(connection), interface(interface), physaddr(physaddr)
48{}
49
50void MCTPDDevice::onEndpointInterfacesRemoved(

--- 60 unchanged lines hidden (view full) ---

111 }
112 else
113 {
114 info(
115 "Device object for inventory at '{INVENTORY_PATH}' was destroyed concurrent to completion of its endpoint setup",
116 "INVENTORY_PATH", objpath);
117 }
118 };
119 connection->async_method_call(onSetup, mctpdBusName, mctpdControlPath,
120 mctpdControlInterface, "AssignEndpoint",
121 interface, physaddr);
119 connection->async_method_call(
120 onSetup, mctpdBusName,
121 mctpdControlPath + std::string("/interfaces/") + interface,
122 mctpdControlInterface, "AssignEndpoint", physaddr);
122}
123
124void MCTPDDevice::endpointRemoved()
125{
126 if (endpoint)
127 {
128 debug("Endpoint removed @ [ {MCTP_ENDPOINT} ]", "MCTP_ENDPOINT",
129 endpoint->describe());

--- 26 unchanged lines hidden (view full) ---

156 }
157 description.append(std::format("{:02x} ]", *it));
158 }
159 return description;
160}
161
162std::string MCTPDEndpoint::path(const std::shared_ptr<MCTPEndpoint>& ep)
163{
123}
124
125void MCTPDDevice::endpointRemoved()
126{
127 if (endpoint)
128 {
129 debug("Endpoint removed @ [ {MCTP_ENDPOINT} ]", "MCTP_ENDPOINT",
130 endpoint->describe());

--- 26 unchanged lines hidden (view full) ---

157 }
158 description.append(std::format("{:02x} ]", *it));
159 }
160 return description;
161}
162
163std::string MCTPDEndpoint::path(const std::shared_ptr<MCTPEndpoint>& ep)
164{
164 return std::format("/xyz/openbmc_project/mctp/{}/{}", ep->network(),
165 ep->eid());
165 return std::format("{}/networks/{}/endpoints/{}", mctpdControlPath,
166 ep->network(), ep->eid());
166}
167
168void MCTPDEndpoint::onMctpEndpointChange(sdbusplus::message_t& msg)
169{
170 auto [iface, changed, _] =
171 msg.unpack<std::string, std::map<std::string, BasicVariantType>,
172 std::vector<std::string>>();
173 if (iface != mctpdEndpointControlInterface)

--- 234 unchanged lines hidden ---
167}
168
169void MCTPDEndpoint::onMctpEndpointChange(sdbusplus::message_t& msg)
170{
171 auto [iface, changed, _] =
172 msg.unpack<std::string, std::map<std::string, BasicVariantType>,
173 std::vector<std::string>>();
174 if (iface != mctpdEndpointControlInterface)

--- 234 unchanged lines hidden ---