summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.conf8
-rw-r--r--meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh30
-rw-r--r--meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend6
3 files changed, 44 insertions, 0 deletions
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.conf b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.conf
new file mode 100644
index 0000000000..ad532c9a7d
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.conf
@@ -0,0 +1,8 @@
+[Unit]
+After=mctpd.service
+Requires=mctpd.service
+
+[Service]
+ExecStartPost=-/usr/share/mctp/setup-static-endpoints.sh
+Restart=always
+RestartSec=10
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh
new file mode 100644
index 0000000000..dba9f8c060
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# Setup Endpoint for NICs, using devmem to read GPIO value since
+# the gpio pin is occupied by gpio-monitor, read the value from
+# gpioget is not possible.
+
+# Setup slot1 NIC
+gpio_val=$(devmem 0x1e780088 8)
+# PRSNT_NIC0 is at the 6th bit (GPIOU5), 0 means NIC is present
+if [ $((gpio_val & 0x20)) -eq 0 ]; then
+ /usr/bin/configure-nic-mctp-endpoint.sh add 1
+fi
+
+# Setup slot2 & 3 NIC
+gpio_val=$(devmem 0x1e780020 8)
+# PRSNT_NIC1 is at the 1th bit (GPIOE0), 0 means NIC is present
+if [ $((gpio_val & 0x01)) -eq 0 ]; then
+ /usr/bin/configure-nic-mctp-endpoint.sh add 2
+fi
+# PRSNT_NIC2 is at the 2th bit (GPIOE1), 0 means NIC is present
+if [ $((gpio_val & 0x02)) -eq 0 ]; then
+ /usr/bin/configure-nic-mctp-endpoint.sh add 3
+fi
+
+# Setup slot4 NIC
+gpio_val=$(devmem 0x1e780078 8)
+# PRSNT_NIC3 is at the 4th bit (GPIOM3), 0 means NIC is present
+if [ $((gpio_val & 0x08)) -eq 0 ]; then
+ /usr/bin/configure-nic-mctp-endpoint.sh add 4
+fi
diff --git a/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend b/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
index 6f8771345d..04dcac30d9 100644
--- a/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
+++ b/meta-facebook/meta-yosemite4/recipes-networking/mctp/mctp_%.bbappend
@@ -3,7 +3,9 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += " \
file://setup-local-eid.conf \
+ file://setup-static-endpoints.conf \
file://mctp-config.sh \
+ file://setup-static-endpoints.sh \
"
FILES:${PN} += "${systemd_system_unitdir}/*"
@@ -14,6 +16,10 @@ do_install:append () {
install -d ${D}${datadir}/mctp
install -m 0644 ${WORKDIR}/setup-local-eid.conf \
${override_dir}/setup-local-eid.conf
+ install -m 0644 ${WORKDIR}/setup-static-endpoints.conf \
+ ${override_dir}/setup-static-endpoints.conf
install -m 0755 ${WORKDIR}/mctp-config.sh \
${D}${datadir}/mctp/
+ install -m 0755 ${WORKDIR}/setup-static-endpoints.sh \
+ ${D}${datadir}/mctp/
}