@@ -36,6 +36,7 @@ cflatobjs += lib/alloc.o
cflatobjs += lib/devicetree.o
cflatobjs += lib/pci.o
cflatobjs += lib/pci-host-generic.o
+cflatobjs += lib/pci-testdev.o
cflatobjs += lib/virtio.o
cflatobjs += lib/virtio-mmio.o
cflatobjs += lib/chr-testdev.o
@@ -8,12 +8,20 @@
#include <libcflat.h>
#include <pci.h>
+#define NR_TESTS (PCI_TESTDEV_NUM_BARS * PCI_TESTDEV_NUM_TESTS)
+
int main(void)
{
+ int ret;
+
if (!pci_probe())
report_abort("PCI bus probing failed\n");
pci_print();
+ ret = pci_testdev();
+ report("PCI test device passed %d/%d tests",
+ ret >= NR_TESTS, ret > 0 ? ret : 0, NR_TESTS);
+
return report_summary();
}
@@ -67,8 +67,13 @@ fi
chr_testdev='-device virtio-serial-device'
chr_testdev+=' -device virtconsole,chardev=ctd -chardev testdev,id=ctd'
+pci_testdev=
+if $qemu $M -device '?' 2>&1 | grep pci-testdev > /dev/null; then
+ pci_testdev="-device pci-testdev"
+fi
+
M+=",accel=$ACCEL"
-command="$qemu $M -cpu $processor $chr_testdev"
+command="$qemu $M -cpu $processor $chr_testdev $pci_testdev"
command+=" -display none -serial stdio -kernel"
command="$(timeout_cmd) $command"
echo $command "$@"
@@ -51,3 +51,7 @@ file = selftest.flat
smp = $MAX_SMP
extra_params = -append 'smp'
groups = selftest
+
+[pci-test]
+file = pci-test.flat
+groups = pci