Add -p parameter to list PCI device to pass through to the guest.

Reviewed by:	neel
This commit is contained in:
Gleb Smirnoff 2015-03-12 15:58:07 +00:00
parent e447efb4f1
commit e5a31fce25
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279925

View File

@ -62,6 +62,7 @@ usage() {
echo " -i: force boot of the Installation CDROM image"
echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})"
echo " -m: memory size (default is ${DEFAULT_MEMSIZE})"
echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)"
echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)"
echo ""
[ -n "$msg" ] && errmsg "$msg"
@ -89,8 +90,9 @@ disk_total=0
apic_opt=""
gdbport=0
loader_opt=""
pass_total=0
while getopts ac:C:d:e:g:hH:iI:m:t: c ; do
while getopts ac:C:d:e:g:hH:iI:m:p:t: c ; do
case $c in
a)
apic_opt="-a"
@ -123,6 +125,10 @@ while getopts ac:C:d:e:g:hH:iI:m:t: c ; do
m)
memsize=${OPTARG}
;;
p)
eval "pass_dev${pass_total}=\"${OPTARG}\""
pass_total=$(($pass_total + 1))
;;
t)
eval "tap_dev${tap_total}=\"${OPTARG}\""
tap_total=$(($tap_total + 1))
@ -237,6 +243,14 @@ while [ 1 ]; do
i=$(($i + 1))
done
i=0
while [ $i -lt $pass_total ] ; do
eval "pass=\$pass_dev${i}"
devargs="$devargs -s $nextslot:0,passthru,${pass} "
nextslot=$(($nextslot + 1))
i=$(($i + 1))
done
${FBSDRUN} -c ${cpus} -m ${memsize} ${apic_opt} -A -H -P \
-g ${gdbport} \
-s 0:0,hostbridge \