summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh')
-rw-r--r--meta-facebook/meta-yosemite4/recipes-networking/mctp/files/setup-static-endpoints.sh30
1 files changed, 30 insertions, 0 deletions
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