2016-10-11 15:34:24 +03:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
removed=
|
|
|
|
|
|
|
|
# Unbind user-mode PCI drivers
|
|
|
|
pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci`
|
|
|
|
for d in $pci_dirs; do
|
|
|
|
for f in ${d}/*; do
|
|
|
|
[ -e "${f}/config" ] || continue
|
2017-02-23 14:28:49 +00:00
|
|
|
echo ${f##*/} > ${d}/unbind
|
2016-10-11 15:34:24 +03:00
|
|
|
basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}`
|
|
|
|
removed=y
|
|
|
|
done
|
|
|
|
done
|
|
|
|
if [ -n "${removed}" ]; then
|
|
|
|
echo "There are changes in PCI drivers, rescaning"
|
|
|
|
echo 1 > /sys/bus/pci/rescan
|
|
|
|
else
|
|
|
|
echo "There weren't PCI devices binded"
|
|
|
|
fi
|
|
|
|
|