added xen-dom0-pci-hide

This commit is contained in:
Olaf Rempel 2006-09-16 22:42:32 +02:00
parent 5b772ba11f
commit 0a00d0cace
1 changed files with 39 additions and 0 deletions

39
xen-dom0-pci-hide.sh Normal file
View File

@ -0,0 +1,39 @@
#!/bin/sh -e
DEVICES="0000:00:0b.0 0000:00:0b.1 0000:01:06.0"
# check for xen pci backend
[ -d /sys/bus/pci/drivers/pciback ] || exit
for dev in $DEVICES; do
echo "Hiding pci-device [$dev] from dom0"
if [ -d /sys/bus/pci/devices/$dev/driver ]; then
driver=$(basename `readlink /sys/bus/pci/devices/$dev/driver`)
if [ "x$driver" = "xpciback" ]; then
echo " already hidden"
continue;
fi
echo -n " already bound to a driver ($driver), trying to unbind:"
echo -n $dev > /sys/bus/pci/devices/$dev/driver/unbind
count=5
while [ -d /sys/bus/pci/devices/$dev/driver ]; do
echo -n "."
echo -n $dev > /sys/bus/pci/devices/$dev/driver/unbind
sleep 1
count=$[$count -1]
[ "$count" = "0" ] && break;
done
if [ "$count" = "0" ]; then
echo " failed"
continue;
fi
fi
echo " ok"
echo -n $dev > /sys/bus/pci/drivers/pciback/new_slot
echo -n $dev > /sys/bus/pci/drivers/pciback/bind
done