blob: a4c9abacd48e022de8fb2973ca543675d91e1eb2 [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
Patrick Williams78c198b2024-08-26 14:51:26 -04007# shellcheck source=meta-facebook/meta-yosemite4/recipes-networking/mctp/files/nic-gpio-addrs
8. /usr/libexec/mctp/nic-gpio-addrs
Delphine CC Chiu5c7dabe2023-12-15 17:58:13 +08009
Chris Wang062def22024-04-10 16:35:42 +080010# Setup slot1 NIC
Delphine CC Chiu5c7dabe2023-12-15 17:58:13 +080011gpio_val=$(devmem "$PRSNT_NIC0" "$WIDTH")
12if [ $((gpio_val & "$BITMASK_NIC0")) -eq 0 ]; then
13 systemctl start setup-nic-endpoint-slot@0.service
Chris Wang062def22024-04-10 16:35:42 +080014fi
15
Delphine CC Chiu5c7dabe2023-12-15 17:58:13 +080016# Setup slot2 NIC
17gpio_val=$(devmem "$PRSNT_NIC1" "$WIDTH")
18if [ $((gpio_val & "$BITMASK_NIC1")) -eq 0 ]; then
19 systemctl start setup-nic-endpoint-slot@1.service
Chris Wang062def22024-04-10 16:35:42 +080020fi
Delphine CC Chiu5c7dabe2023-12-15 17:58:13 +080021
22# Setup slot3 NIC
23gpio_val=$(devmem "$PRSNT_NIC2" "$WIDTH")
24if [ $((gpio_val & "$BITMASK_NIC2")) -eq 0 ]; then
25 systemctl start setup-nic-endpoint-slot@2.service
Chris Wang062def22024-04-10 16:35:42 +080026fi
27
28# Setup slot4 NIC
Delphine CC Chiu5c7dabe2023-12-15 17:58:13 +080029gpio_val=$(devmem "$PRSNT_NIC3" "$WIDTH")
30if [ $((gpio_val & "$BITMASK_NIC3")) -eq 0 ]; then
31 systemctl start setup-nic-endpoint-slot@3.service
Chris Wang062def22024-04-10 16:35:42 +080032fi