mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
added some shell scripts for FPGA work
This commit is contained in:
parent
3f012c8575
commit
a2824d1cf6
2 changed files with 38 additions and 0 deletions
25
tools/rebind_device.sh
Normal file
25
tools/rebind_device.sh
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "usage: $0 BUS:DEV:FNC DRIVER"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BDF=$1
|
||||
DRIVER=$2
|
||||
|
||||
VENDOR=$(cut -b3- /sys/bus/pci/devices/${BDF}/vendor)
|
||||
DEVICE=$(cut -b3- /sys/bus/pci/devices/${BDF}/device)
|
||||
|
||||
SYSFS_DEVICE=/sys/bus/pci/devices/${BDF}
|
||||
SYSFS_DRIVER=/sys/bus/pci/drivers/${DRIVER}
|
||||
|
||||
echo "Device: $VENDOR $DEVICE $BDF"
|
||||
|
||||
if [ -L "${SYSFS_DEVICE}/driver" ] && [ -d "${SYSFS_DEVICE}/driver" ]; then
|
||||
echo ${BDF} > ${SYSFS_DEVICE}/driver/unbind
|
||||
fi
|
||||
|
||||
echo "${VENDOR} ${DEVICE}" > ${SYSFS_DRIVER}/new_id
|
||||
echo "${BDF}" > ${SYSFS_DRIVER}/bind
|
||||
echo "${VENDOR} ${DEVICE}" > ${SYSFS_DRIVER}/remove_id
|
13
tools/reset_pci_device.sh
Executable file
13
tools/reset_pci_device.sh
Executable file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "usage: $0 BUS:DEV:FNC"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BDF=$1
|
||||
|
||||
echo "1" > /sys/bus/pci/devices/$BDF/remove
|
||||
echo "1" > /sys/bus/pci/rescan
|
||||
echo "1" > /sys/bus/pci/devices/$BDF/enable
|
||||
|
Loading…
Add table
Reference in a new issue