meta-ampere: mtmitchell: enable MCTP/PLDM
Enable MCTP in kernel support with Mt.Mitchell MCTP configuration.
Tested:
1. Check for mctpi2c3 in ifconfig command.
2. Check for mctpd.service service started and is in running state.
3. Check for pldmd.service service started and is in running state.
Signed-off-by: Thang Q. Nguyen <thang@os.amperecomputing.com>
Change-Id: I699e9bc93ae5815b8454a8cc42ec22d4cfd735e1
diff --git a/meta-ampere/meta-common/recipes-phosphor/mctp/files/mctp-local.service b/meta-ampere/meta-common/recipes-phosphor/mctp/files/mctp-local.service
new file mode 100644
index 0000000..6dfc00e
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/mctp/files/mctp-local.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=MCTP configuration for i2c bus 3
+After=mctpd.service
+BindTo=mctpd.service
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/mctp link set mctpi2c3 up
+ExecStart=/usr/bin/mctp addr add 8 dev mctpi2c3
+ExecStart=/usr/bin/mctp neigh add 8 dev mctpi2c3 lladdr 0x10
+RemainAfterExit=true
+
+[Install]
+WantedBy=mctpd.service
diff --git a/meta-ampere/meta-common/recipes-phosphor/mctp/mctp_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/mctp/mctp_%.bbappend
new file mode 100644
index 0000000..711913b
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/mctp/mctp_%.bbappend
@@ -0,0 +1,12 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append = " \
+ file://mctp-local.service \
+ "
+
+SYSTEMD_SERVICE:${PN} += "mctp-local.service"
+
+do_install:append() {
+ install -m 0644 ${WORKDIR}/mctp-local.service ${D}${systemd_system_unitdir}/
+}
+
diff --git a/meta-ampere/meta-common/recipes-phosphor/pldm/files/host_eid b/meta-ampere/meta-common/recipes-phosphor/pldm/files/host_eid
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/pldm/files/host_eid
@@ -0,0 +1 @@
+0
diff --git a/meta-ampere/meta-common/recipes-phosphor/pldm/pldm_%.bbappend b/meta-ampere/meta-common/recipes-phosphor/pldm/pldm_%.bbappend
new file mode 100644
index 0000000..6381917
--- /dev/null
+++ b/meta-ampere/meta-common/recipes-phosphor/pldm/pldm_%.bbappend
@@ -0,0 +1,23 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+SRC_URI:append = " file://host_eid"
+
+SYSTEMD_SERVICE:${PN}:remove = " \
+ pldmSoftPowerOff.service \
+ "
+SRC_URI:remove = "file://pldm-softpoweroff"
+
+EXTRA_OEMESON:append = " \
+ -Dtransport-implementation=af-mctp \
+ "
+
+do_install:append() {
+ install -d ${D}/${datadir}/pldm
+ install ${WORKDIR}/host_eid ${D}/${datadir}/pldm/
+ LINK="${D}${systemd_unitdir}/obmc-host-shutdown@0.target.wants/pldmSoftPowerOff.service"
+ rm -f $LINK
+ LINK="${D}${systemd_unitdir}/obmc-host-warm-reboot@0.target.wants/pldmSoftPowerOff.service"
+ rm -f $LINK
+ rm -f ${D}${systemd_unitdir}/system/pldmSoftPowerOff.service
+ rm -rf ${D}/${bindir}/pldm-softpoweroff
+}
diff --git a/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf b/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf
index 13598dc..0c3f218 100644
--- a/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf
+++ b/meta-ampere/meta-mitchell/conf/machine/mtmitchell.conf
@@ -9,6 +9,7 @@
require conf/machine/include/ast2600.inc
require conf/machine/include/obmc-bsp-common.inc
+require conf/distro/include/pldm.inc
FLASH_SIZE = "65536"
VOLATILE_LOG_DIR = "no"