meta-facebook: yosemite4: add mctp service conf
- Add script to setup mctp link and local address for each bus.
- Add service conf for running script before the service start,
and make it has dependency with entity-manager.
Tested: tested on yv4 system.
Change-Id: I20ac5b9935acf7d805dceec029fe5b30374a5532
Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/mctp-config.sh b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/mctp-config.sh
new file mode 100644
index 0000000..fcb8677
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/mctp-config.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# Set mctpi2c link up and assign local address.
+localEid=8
+
+# The Sentinel Dome BICs are on the i2c bus0 to bus7.
+busnum=0
+while [ $busnum -le 7 ]
+do
+ mctp link set mctpi2c${busnum} up
+ mctp addr add ${localEid} dev mctpi2c${busnum}
+ busnum=$((busnum+1))
+done
+
+# The NICs are on the i2c bus24 to bus27.
+busnum=24
+while [ $busnum -le 27 ]
+do
+ mctp link set mctpi2c${busnum} up
+ mctp addr add ${localEid} dev mctpi2c${busnum}
+ busnum=$((busnum+1))
+done
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-local-eid.conf b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-local-eid.conf
new file mode 100644
index 0000000..7a3d8ee
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-local-eid.conf
@@ -0,0 +1,8 @@
+[Unit]
+After=xyz.openbmc_project.EntityManager.service
+Requires=xyz.openbmc_project.EntityManager.service
+
+[Service]
+ExecStartPre=-/usr/share/mctp/mctp-config.sh
+Restart=always
+RestartSec=10
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend b/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
new file mode 100644
index 0000000..6f87713
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
@@ -0,0 +1,19 @@
+FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
+
+
+SRC_URI += " \
+ file://setup-local-eid.conf \
+ file://mctp-config.sh \
+"
+
+FILES:${PN} += "${systemd_system_unitdir}/*"
+
+do_install:append () {
+ override_dir=${D}${systemd_system_unitdir}/mctpd.service.d
+ install -d ${D}${systemd_system_unitdir}/mctpd.service.d
+ install -d ${D}${datadir}/mctp
+ install -m 0644 ${WORKDIR}/setup-local-eid.conf \
+ ${override_dir}/setup-local-eid.conf
+ install -m 0755 ${WORKDIR}/mctp-config.sh \
+ ${D}${datadir}/mctp/
+}