3e5fe6f602
Change-Id: I5e6a6ca6751d77aed48bedc2e59f97139dd8ef00 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
29 lines
558 B
Bash
Executable File
29 lines
558 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
function cleanup_linux() {
|
|
# detach pci devices from uio driver
|
|
grep -q "^uio_pci_generic" /proc/modules && rmmod uio_pci_generic
|
|
|
|
# bind NVMe devices to NVMe driver if no kernel device
|
|
if [ -d "/sys/bus/pci/drivers/nvme" ]; then
|
|
device=`find /sys/bus/pci/drivers/nvme -name "0000*" -print`
|
|
if [ -z "$device" ]; then
|
|
rmmod nvme
|
|
modprobe nvme
|
|
fi
|
|
fi
|
|
}
|
|
|
|
function cleanup_freebsd {
|
|
kldunload contigmem.ko || true
|
|
kldunload nic_uio.ko || true
|
|
}
|
|
|
|
if [ `uname` = Linux ]; then
|
|
cleanup_linux
|
|
else
|
|
cleanup_freebsd
|
|
fi
|