summaryrefslogtreecommitdiff
path: root/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor
diff options
context:
space:
mode:
authorChris Wang <Chris_Wang@wiwynn.com>2024-03-12 12:29:15 +0300
committerPatrick Williams <patrick@stwcx.xyz>2024-03-13 05:13:44 +0300
commit0598b574e8a02209ba089c9bfadd6c5a9cc0b3b0 (patch)
tree65880a5b76e995aa0e5e97712d6e982a79075127 /meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor
parent9c40b39ecccb09f54c5d31ece58bfbc017bbc5d8 (diff)
downloadopenbmc-0598b574e8a02209ba089c9bfadd6c5a9cc0b3b0.tar.xz
meta-facebook: yosemite4: Support NIC endpoint setup
Setup the MCTP Endpoint for the NIC when inserted. Remove the MCTP Endpoint for the NIC when unplugged. Change-Id: I0c36cecda6509a64e4f26c70bf61590467571a7b Signed-off-by: Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>
Diffstat (limited to 'meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor')
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/configure-nic-mctp-endpoint.sh20
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/remove-nic-endpoint-slot@.service8
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/setup-nic-endpoint-slot@.service8
-rw-r--r--meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json24
4 files changed, 52 insertions, 8 deletions
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/configure-nic-mctp-endpoint.sh b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/configure-nic-mctp-endpoint.sh
new file mode 100644
index 0000000000..b2036bc5f0
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/configure-nic-mctp-endpoint.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+# This script is a backup solution for setting up/removing MCTP endpoint for NICs
+action=$1
+slot=$2
+# NIC bus are 24~27.
+bus=$((23 + slot))
+# Static EID for NIC are 90~93.
+eid=$((89 + slot))
+
+sleep 2
+
+if [ "$action" = "add" ]; then
+ echo "Adding MCTP endpoint for slot $slot"
+ busctl call xyz.openbmc_project.MCTP /xyz/openbmc_project/mctp au.com.CodeConstruct.MCTP AssignEndpointStatic sayy "mctpi2c${bus}" 1 0x32 "$eid"
+elif [ "$action" = "remove" ]; then
+ echo "Removing MCTP endpoint for slot $slot"
+ busctl call xyz.openbmc_project.MCTP /xyz/openbmc_project/mctp/1/${eid} au.com.CodeConstruct.MCTP.Endpoint Remove
+fi
+
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/remove-nic-endpoint-slot@.service b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/remove-nic-endpoint-slot@.service
new file mode 100644
index 0000000000..d16ba2f44f
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/remove-nic-endpoint-slot@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Remove MCTP endpoint for Slot%i NIC
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/configure-nic-mctp-endpoint.sh remove %i
+SyslogIdentifier=remove-nic-endpoint-slot%i
+
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/setup-nic-endpoint-slot@.service b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/setup-nic-endpoint-slot@.service
new file mode 100644
index 0000000000..db06940930
--- /dev/null
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/setup-nic-endpoint-slot@.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Setup MCTP endpoint for Slot%i NIC
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/configure-nic-mctp-endpoint.sh add %i
+SyslogIdentifier=setup-nic-endpoint-slot%i
+
diff --git a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json
index 87073889fa..925719c0d5 100644
--- a/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json
+++ b/meta-facebook/meta-yosemite4/recipes-phosphor/gpio/phosphor-gpio-monitor/yosemite4-phosphor-multi-gpio-monitor.json
@@ -101,11 +101,13 @@
"Name": "PRSNT_NIC0_N",
"ChipId": "0",
"GpioNum": 165,
- "EventMon": "FALLING",
+ "EventMon": "BOTH",
"Targets": {
+ "RISING": ["remove-nic-endpoint-slot@1.service"],
"FALLING": [
"obmc-chassis-powercycle@1.target",
- "obmc-chassis-powercycle@2.target"
+ "obmc-chassis-powercycle@2.target",
+ "setup-nic-endpoint-slot@1.service"
]
},
"Continue": true
@@ -114,11 +116,13 @@
"Name": "PRSNT_NIC1_N",
"ChipId": "0",
"GpioNum": 32,
- "EventMon": "FALLING",
+ "EventMon": "BOTH",
"Targets": {
+ "RISING": ["remove-nic-endpoint-slot@2.service"],
"FALLING": [
"obmc-chassis-powercycle@3.target",
- "obmc-chassis-powercycle@4.target"
+ "obmc-chassis-powercycle@4.target",
+ "setup-nic-endpoint-slot@2.service"
]
},
"Continue": true
@@ -127,11 +131,13 @@
"Name": "PRSNT_NIC2_N",
"ChipId": "0",
"GpioNum": 33,
- "EventMon": "FALLING",
+ "EventMon": "BOTH",
"Targets": {
+ "RISING": ["remove-nic-endpoint-slot@3.service"],
"FALLING": [
"obmc-chassis-powercycle@5.target",
- "obmc-chassis-powercycle@6.target"
+ "obmc-chassis-powercycle@6.target",
+ "setup-nic-endpoint-slot@3.service"
]
},
"Continue": true
@@ -140,11 +146,13 @@
"Name": "PRSNT_NIC3_N",
"ChipId": "0",
"GpioNum": 99,
- "EventMon": "FALLING",
+ "EventMon": "BOTH",
"Targets": {
+ "RISING": ["remove-nic-endpoint-slot@3.service"],
"FALLING": [
"obmc-chassis-powercycle@7.target",
- "obmc-chassis-powercycle@8.target"
+ "obmc-chassis-powercycle@8.target",
+ "setup-nic-endpoint-slot@4.service"
]
},
"Continue": true