summaryrefslogtreecommitdiffstats
path: root/tests/reload.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reload.sh')
-rwxr-xr-xtests/reload.sh21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/reload.sh b/tests/reload.sh
index 62c6e22..13a8c63 100755
--- a/tests/reload.sh
+++ b/tests/reload.sh
@@ -1,25 +1,26 @@
#! /bin/bash
-
-device=`lspci -n | grep -m 1 "10ee:" | awk '{print $1}'`
-if [ -z "$device" ]; then
+devdir=`ls -d /sys/bus/pci/devices/*/driver/module/drivers/pci:pciDriver`
+if [ $? -ne 0 ]; then
echo "Xilinx device doesn't exist, rescanning..."
echo 1 > /sys/bus/pci/rescan
exit
else
+ device=`echo $devdir | head -n 1 | cut -c 27-33`
echo "Xilinx is located at: " $device
fi
-echo "remove driver"
-rmmod pciDriver
echo "remove devices"
echo 1 > /sys/bus/pci/devices/0000\:${device:0:2}\:${device:3:4}/remove
sleep 1
echo "rescan"
echo 1 > /sys/bus/pci/rescan
sleep 1
+echo "remove driver"
+rmmod pciDriver
+sleep 1
echo "instantiate driver"
modprobe pciDriver
-# for devices with different ID
-#echo "10ee 6028" > /sys/bus/pci/drivers/pciDriver/new_id
-pci -i
-#echo Enabling bus mastering on device $dev
-#setpci -s $device 4.w=0x07
+sleep 1
+echo "set bus master dma"
+dev=$device
+echo Enabling bus mastering on device $dev
+setpci -s $dev 4.w=0x07