Chris Wang | 0598b57 | 2024-03-12 17:29:15 +0800 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | # This script is a backup solution for setting up/removing MCTP endpoint for NICs |
| 4 | action=$1 |
| 5 | slot=$2 |
| 6 | # NIC bus are 24~27. |
| 7 | bus=$((23 + slot)) |
| 8 | # Static EID for NIC are 90~93. |
| 9 | eid=$((89 + slot)) |
| 10 | |
| 11 | sleep 2 |
| 12 | |
| 13 | if [ "$action" = "add" ]; then |
| 14 | echo "Adding MCTP endpoint for slot $slot" |
| 15 | busctl call xyz.openbmc_project.MCTP /xyz/openbmc_project/mctp au.com.CodeConstruct.MCTP AssignEndpointStatic sayy "mctpi2c${bus}" 1 0x32 "$eid" |
| 16 | elif [ "$action" = "remove" ]; then |
| 17 | echo "Removing MCTP endpoint for slot $slot" |
| 18 | busctl call xyz.openbmc_project.MCTP /xyz/openbmc_project/mctp/1/${eid} au.com.CodeConstruct.MCTP.Endpoint Remove |
| 19 | fi |
| 20 | |