blob: e71e147a1f59ae84c273b54f564aa949042b8aed [file] [log] [blame]
Chris Wang062def22024-04-10 16:35:42 +08001#!/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
8gpio_val=$(devmem 0x1e780088 8)
9# PRSNT_NIC0 is at the 6th bit (GPIOU5), 0 means NIC is present
10if [ $((gpio_val & 0x20)) -eq 0 ]; then
Delphine CC Chiudb8c93a2024-05-08 14:18:23 +080011 systemctl start setup-nic-endpoint-slot@0.service
Chris Wang062def22024-04-10 16:35:42 +080012fi
13
14# Setup slot2 & 3 NIC
15gpio_val=$(devmem 0x1e780020 8)
16# PRSNT_NIC1 is at the 1th bit (GPIOE0), 0 means NIC is present
17if [ $((gpio_val & 0x01)) -eq 0 ]; then
Delphine CC Chiudb8c93a2024-05-08 14:18:23 +080018 systemctl start setup-nic-endpoint-slot@1.service
Chris Wang062def22024-04-10 16:35:42 +080019fi
20# PRSNT_NIC2 is at the 2th bit (GPIOE1), 0 means NIC is present
21if [ $((gpio_val & 0x02)) -eq 0 ]; then
Delphine CC Chiudb8c93a2024-05-08 14:18:23 +080022 systemctl start setup-nic-endpoint-slot@2.service
Chris Wang062def22024-04-10 16:35:42 +080023fi
24
25# Setup slot4 NIC
26gpio_val=$(devmem 0x1e780078 8)
27# PRSNT_NIC3 is at the 4th bit (GPIOM3), 0 means NIC is present
28if [ $((gpio_val & 0x08)) -eq 0 ]; then
Delphine CC Chiudb8c93a2024-05-08 14:18:23 +080029 systemctl start setup-nic-endpoint-slot@3.service
Chris Wang062def22024-04-10 16:35:42 +080030fi