MCTP: Define interface for MCTP endpoint enumeration
This interface will be implemented by an MCTP control message protocol
process[1] that discovers MCTP communication terminuses that are
discoverable by BMC. D-Bus discovery of this interface triggers higher
level protocols like PLDM to complete the PLDM discovery for the MCTP
devices.
[1] https://github.com/openbmc/docs/blob/master/designs/mctp/mctp-kernel.md
Signed-off-by: Tom Joseph <rushtotom@gmail.com>
Change-Id: I240bd3e7d300dfbc0a74ed71eb5a466e1d4a1db4
diff --git a/gen/xyz/openbmc_project/MCTP/Endpoint/meson.build b/gen/xyz/openbmc_project/MCTP/Endpoint/meson.build
new file mode 100644
index 0000000..88bfe98
--- /dev/null
+++ b/gen/xyz/openbmc_project/MCTP/Endpoint/meson.build
@@ -0,0 +1,14 @@
+# Generated file; do not modify.
+generated_sources += custom_target(
+ 'xyz/openbmc_project/MCTP/Endpoint__cpp'.underscorify(),
+ input: [ '../../../../../yaml/xyz/openbmc_project/MCTP/Endpoint.interface.yaml', ],
+ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'xyz/openbmc_project/MCTP/Endpoint',
+ ],
+)
+
diff --git a/gen/xyz/openbmc_project/MCTP/meson.build b/gen/xyz/openbmc_project/MCTP/meson.build
new file mode 100644
index 0000000..b9598ad
--- /dev/null
+++ b/gen/xyz/openbmc_project/MCTP/meson.build
@@ -0,0 +1,15 @@
+# Generated file; do not modify.
+subdir('Endpoint')
+generated_others += custom_target(
+ 'xyz/openbmc_project/MCTP/Endpoint__markdown'.underscorify(),
+ input: [ '../../../../yaml/xyz/openbmc_project/MCTP/Endpoint.interface.yaml', ],
+ output: [ 'Endpoint.md' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'markdown',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../yaml',
+ 'xyz/openbmc_project/MCTP/Endpoint',
+ ],
+)
+
diff --git a/gen/xyz/openbmc_project/meson.build b/gen/xyz/openbmc_project/meson.build
index 6737c83..19d6746 100644
--- a/gen/xyz/openbmc_project/meson.build
+++ b/gen/xyz/openbmc_project/meson.build
@@ -66,6 +66,7 @@
subdir('Ipmi')
subdir('Led')
subdir('Logging')
+subdir('MCTP')
subdir('Memory')
subdir('Network')
subdir('Nvme')
diff --git a/yaml/xyz/openbmc_project/MCTP/Endpoint.interface.yaml b/yaml/xyz/openbmc_project/MCTP/Endpoint.interface.yaml
new file mode 100644
index 0000000..119f1c6
--- /dev/null
+++ b/yaml/xyz/openbmc_project/MCTP/Endpoint.interface.yaml
@@ -0,0 +1,43 @@
+description: >
+ Describe an MCTP endpoint. It is an MCTP communication terminus. An MCTP
+ endpoint is a terminus or origin of MCTP packets or messages. The combined
+ functionality within a physical device that communicates using the MCTP
+ transport protocol and handles MCTP control commands. This includes
+ MCTP-capable management controllers and managed devices.
+
+properties:
+
+ - name: NetworkId
+ type: size
+ description: >
+ A locally defined identifier to distinguish each independent MCTP
+ network within a platform. The network IDs are used by the MCTP stack
+ to index separate MCTP Networks. This along with EID is used by upper
+ layer protocols to address the destination endpoint.
+
+ - name: EID
+ type: size
+ description: >
+ The logical address used to route MCTP messages to a specific MCTP
+ endpoint. A numeric handle (logical address) that uniquely identifies
+ a particular MCTP endpoint within a system for MCTP communication and
+ message routing purposes. Endpoint IDs are unique among MCTP
+ endpoints that comprise an MCTP communication network within a
+ system. MCTP EIDs are only unique within a particular MCTP network.
+ That is, they can be duplicated or overlap from one MCTP network to
+ the next. This is also referred to as "endpoint ID" and abbreviated
+ as "EID".
+
+ - name: SupportedMessageTypes
+ type: array[byte]
+ description: >
+ List of MCTP message types supported by the MCTP endpoint. MCTP
+ message type is an enumeration that identifies the type of the
+ communication payload in an MCTP message. The well defined message
+ types are MCTP Control(0x00), PLDM(0x01), NC-SI over MCTP(0x02),
+ Ethernet over MCTP(0x03), NVM Express Management Messages over
+ MCTP(0x04) and SPDM over MCTP(0x05). There are ranges for vendor
+ defined message types. All the message types are specified in the
+ DSP0239 specification. A device that supports a given message type
+ may not support that message type equally across all buses that
+ connect to the device.
diff --git a/yaml/xyz/openbmc_project/MCTP/README.md b/yaml/xyz/openbmc_project/MCTP/README.md
new file mode 100644
index 0000000..cac4a80
--- /dev/null
+++ b/yaml/xyz/openbmc_project/MCTP/README.md
@@ -0,0 +1,43 @@
+## Overview
+
+MCTP D-Bus interfaces are implemented by the MCTP control process daemon
+alias mcptd and aids in the discovery of MCTP enabled devices by application
+layer protocols (like PLDM, SPDM) which are implemented in the userspace.
+Application layer protocols will rely on the discovery of
+`xyz.openbmc_project.MCTP.Endpoint` D-Bus interface to discover MCTP endpoints.
+The supported MCTP message types in an endpoint are exposed by the
+`SupportedMessageTypes` property in the `xyz.openbmc_project.MCTP.Endpoint`
+interface. For example, if the endpoint supports PLDM then pldm daemon will
+complete the PLDM discovery flow with the MCTP endpoint. Also mctpd discovers
+the removal of the MCTP endpoints and removes the D-Bus objects corresponding to
+those endpoints. MCTP bridges are not modelled in the D-Bus.
+
+### D-Bus object modelling
+
+The root D-Bus object path for the mctpd is `/xyz/openbmc_project/mctp`. There
+will be a D-Bus object for every endpoint that is discovered by the mctpd.
+The lifetime of the D-Bus object is the lifetime of the connected MCTP device.
+
+The D-Bus object path for MCTP endpoints are named
+`xyz/openbmc_project/mctp/<NetworkId>/<EID>` where NetworkId is the locally
+defined [network identfier][1] the endpoint is part of and EID is the endpoint
+ID. This aids in the enumeration of the endpoints belonging to an MCTP network.
+The D-Bus object implements the `xyz.openbmc_project.MCTP.Endpoint` interface.
+The object may also optionally implement `xyz.openbmc_project.Common.UUID`
+interface to address the requirement for devices with multiple endpoints and for
+hot-plug devices.
+
+An MCTP Network may provide an optional MCTP Network ID that can be used to
+differentiate different MCTP Networks when more than one MCTP Network can be
+accessed by an entity . The Network ID is also used when an entity has more than
+one point of access to the MCTP Network. The MCTP Network ID enables the entity
+to tell whether the access points provide access to the same MCTP Network or to
+different MCTP Networks. If the implementation supports the optional MCTP
+network ID then it is exposed on the D-Bus. The D-Bus object path is
+`xyz/openbmc_project/mctp/<NetworkId>` where NetworkId is the locally
+defined [network identfier][1] and implements the
+ `xyz.openbmc_project.Common.UUID` interface and the UUID property is the MCTP
+ network ID.
+
+[1]: https://github.com/openbmc/docs/blob/master/designs/mctp/mctp-kernel.md#addressing
+