/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool
266 by Suren A. Chilingaryan
Add forgotten ipe_benchmark.c
1
#! /bin/bash
370 by Suren A. Chilingaryan
RPM generation
2
devdir=`ls -d /sys/bus/pci/devices/*/driver/module/drivers/pci:pciDriver`
3
if [ $? -ne 0 ]; then
266 by Suren A. Chilingaryan
Add forgotten ipe_benchmark.c
4
    echo "Xilinx device doesn't exist, rescanning..."
5
    echo 1 > /sys/bus/pci/rescan
6
    exit
7
else
370 by Suren A. Chilingaryan
RPM generation
8
    device=`echo $devdir | head -n 1 | cut -c 27-33`
266 by Suren A. Chilingaryan
Add forgotten ipe_benchmark.c
9
    echo "Xilinx is located at: " $device
10
fi
11
echo "remove devices"
12
echo  1 > /sys/bus/pci/devices/0000\:${device:0:2}\:${device:3:4}/remove
13
sleep 1
14
echo "rescan"
15
echo 1 > /sys/bus/pci/rescan
16
sleep 1
370 by Suren A. Chilingaryan
RPM generation
17
echo "remove driver"
18
rmmod pciDriver 
19
sleep 1
266 by Suren A. Chilingaryan
Add forgotten ipe_benchmark.c
20
echo "instantiate driver"
21
modprobe pciDriver
370 by Suren A. Chilingaryan
RPM generation
22
sleep 1
23
echo "set bus master dma"
24
dev=$device  
25
echo Enabling bus mastering on device $dev
26
setpci -s $dev 4.w=0x07