Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Setup Endpoint for NICs, using devmem to read GPIO value since |
| 4 | # the gpio pin is occupied by gpio-monitor, read the value from |
| 5 | # gpioget is not possible. |
| 6 | |
Patrick Williams | 78c198b | 2024-08-26 14:51:26 -0400 | [diff] [blame] | 7 | # shellcheck source=meta-facebook/meta-yosemite4/recipes-networking/mctp/files/nic-gpio-addrs |
| 8 | . /usr/libexec/mctp/nic-gpio-addrs |
Delphine CC Chiu | 5c7dabe | 2023-12-15 17:58:13 +0800 | [diff] [blame] | 9 | |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 10 | # Setup slot1 NIC |
Delphine CC Chiu | 5c7dabe | 2023-12-15 17:58:13 +0800 | [diff] [blame] | 11 | gpio_val=$(devmem "$PRSNT_NIC0" "$WIDTH") |
| 12 | if [ $((gpio_val & "$BITMASK_NIC0")) -eq 0 ]; then |
| 13 | systemctl start setup-nic-endpoint-slot@0.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 14 | fi |
| 15 | |
Delphine CC Chiu | 5c7dabe | 2023-12-15 17:58:13 +0800 | [diff] [blame] | 16 | # Setup slot2 NIC |
| 17 | gpio_val=$(devmem "$PRSNT_NIC1" "$WIDTH") |
| 18 | if [ $((gpio_val & "$BITMASK_NIC1")) -eq 0 ]; then |
| 19 | systemctl start setup-nic-endpoint-slot@1.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 20 | fi |
Delphine CC Chiu | 5c7dabe | 2023-12-15 17:58:13 +0800 | [diff] [blame] | 21 | |
| 22 | # Setup slot3 NIC |
| 23 | gpio_val=$(devmem "$PRSNT_NIC2" "$WIDTH") |
| 24 | if [ $((gpio_val & "$BITMASK_NIC2")) -eq 0 ]; then |
| 25 | systemctl start setup-nic-endpoint-slot@2.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 26 | fi |
| 27 | |
| 28 | # Setup slot4 NIC |
Delphine CC Chiu | 5c7dabe | 2023-12-15 17:58:13 +0800 | [diff] [blame] | 29 | gpio_val=$(devmem "$PRSNT_NIC3" "$WIDTH") |
| 30 | if [ $((gpio_val & "$BITMASK_NIC3")) -eq 0 ]; then |
| 31 | systemctl start setup-nic-endpoint-slot@3.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 32 | fi |