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 | |
| 7 | # Setup slot1 NIC |
| 8 | gpio_val=$(devmem 0x1e780088 8) |
| 9 | # PRSNT_NIC0 is at the 6th bit (GPIOU5), 0 means NIC is present |
| 10 | if [ $((gpio_val & 0x20)) -eq 0 ]; then |
Delphine CC Chiu | db8c93a | 2024-05-08 14:18:23 +0800 | [diff] [blame] | 11 | systemctl start setup-nic-endpoint-slot@0.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 12 | fi |
| 13 | |
| 14 | # Setup slot2 & 3 NIC |
| 15 | gpio_val=$(devmem 0x1e780020 8) |
| 16 | # PRSNT_NIC1 is at the 1th bit (GPIOE0), 0 means NIC is present |
| 17 | if [ $((gpio_val & 0x01)) -eq 0 ]; then |
Delphine CC Chiu | db8c93a | 2024-05-08 14:18:23 +0800 | [diff] [blame] | 18 | systemctl start setup-nic-endpoint-slot@1.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 19 | fi |
| 20 | # PRSNT_NIC2 is at the 2th bit (GPIOE1), 0 means NIC is present |
| 21 | if [ $((gpio_val & 0x02)) -eq 0 ]; then |
Delphine CC Chiu | db8c93a | 2024-05-08 14:18:23 +0800 | [diff] [blame] | 22 | systemctl start setup-nic-endpoint-slot@2.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 23 | fi |
| 24 | |
| 25 | # Setup slot4 NIC |
| 26 | gpio_val=$(devmem 0x1e780078 8) |
| 27 | # PRSNT_NIC3 is at the 4th bit (GPIOM3), 0 means NIC is present |
| 28 | if [ $((gpio_val & 0x08)) -eq 0 ]; then |
Delphine CC Chiu | db8c93a | 2024-05-08 14:18:23 +0800 | [diff] [blame] | 29 | systemctl start setup-nic-endpoint-slot@3.service |
Chris Wang | 062def2 | 2024-04-10 16:35:42 +0800 | [diff] [blame] | 30 | fi |