blob: a4c9abacd48e022de8fb2973ca543675d91e1eb2 [file] [log] [blame]
#!/bin/sh
# Setup Endpoint for NICs, using devmem to read GPIO value since
# the gpio pin is occupied by gpio-monitor, read the value from
# gpioget is not possible.
# shellcheck source=meta-facebook/meta-yosemite4/recipes-networking/mctp/files/nic-gpio-addrs
. /usr/libexec/mctp/nic-gpio-addrs
# Setup slot1 NIC
gpio_val=$(devmem "$PRSNT_NIC0" "$WIDTH")
if [ $((gpio_val & "$BITMASK_NIC0")) -eq 0 ]; then
systemctl start setup-nic-endpoint-slot@0.service
fi
# Setup slot2 NIC
gpio_val=$(devmem "$PRSNT_NIC1" "$WIDTH")
if [ $((gpio_val & "$BITMASK_NIC1")) -eq 0 ]; then
systemctl start setup-nic-endpoint-slot@1.service
fi
# Setup slot3 NIC
gpio_val=$(devmem "$PRSNT_NIC2" "$WIDTH")
if [ $((gpio_val & "$BITMASK_NIC2")) -eq 0 ]; then
systemctl start setup-nic-endpoint-slot@2.service
fi
# Setup slot4 NIC
gpio_val=$(devmem "$PRSNT_NIC3" "$WIDTH")
if [ $((gpio_val & "$BITMASK_NIC3")) -eq 0 ]; then
systemctl start setup-nic-endpoint-slot@3.service
fi