summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wang <Chris_Wang@wiwynn.com>2024-04-10 11:35:42 +0300
committerPatrick Williams <patrick@stwcx.xyz>2024-05-01 00:17:14 +0300
commit062def2a24c108fe1c3b808973945336eadfefb7 (patch)
tree3d1ac44fd7ddf2a66ad2261250f36fae00430922
parentbcf74b1993333d0f03e958d2cf37d3f093cf9686 (diff)
downloadopenbmc-062def2a24c108fe1c3b808973945336eadfefb7.tar.xz
Setup NIC MCTP Endpoint after mctpd initialization
Since NIC's Entity Manager configuration cannot store information of static EID for Yosemite4 platform, setup the NIC's MCTP Endpoint after mctpd is successfully initilized if the corresponding slot is plugged in. Change-Id: Ida647d60d7ed72897f641dd9783f0105c2a5c0d5 Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
-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/
}