Spdk/scripts/gen_nvme.sh
Ben Walker 0829424e19 conf: No longer allow wildcard claiming of NVMe devices
All devices must be specified by BDF. Add support for scripts
to use lspci to grab the available NVMe device BDFs for the
current machine.

Change-Id: I4a53b335e3d516629f050ae1b2ab7aff8dd7f568
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
2017-03-14 08:38:04 -07:00

23 lines
502 B
Bash
Executable File

#!/usr/bin/env bash
set -e
case `uname` in
FreeBSD)
bdfs=$(pciconf -l | grep "class=0x010802" | awk -F: ' {printf "0000:%02X:%02X.%X\n", $2, $3, $4}')
;;
Linux)
bdfs=$(lspci -mm -n | grep 0108 | tr -d '"' | awk -F " " '{print "0000:"$1}')
;;
*)
exit 1
;;
esac
echo "[Nvme]"
i=0
for bdf in $bdfs; do
echo " TransportID \"trtype:PCIe traddr:$bdf\""
let i=i+1
done