summaryrefslogtreecommitdiffstats
path: root/tests/reload.sh
blob: 13a8c63dd94d365c85a12c90327ee0f079c85d81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /bin/bash
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 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
sleep 1
echo "set bus master dma"
dev=$device  
echo Enabling bus mastering on device $dev
setpci -s $dev 4.w=0x07