diff mbox

[kvm-unit-tests,v7,11/13] arm/arm64: pci: Add PCI bus operation test

Message ID aa83d1a14a5bfab5c449b5e5c9c5885fb108f247.1471434672.git.agordeev@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Gordeev Aug. 17, 2016, 12:07 p.m. UTC
Cc: Thomas Huth <thuth@redhat.com>
Cc: Andrew Jones <drjones@redhat.com>
Reviewed-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
---
 arm/Makefile.common |  5 ++++-
 arm/pci-test.c      | 19 +++++++++++++++++++
 lib/arm/asm/pci.h   |  1 +
 lib/arm64/asm/pci.h |  1 +
 4 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 arm/pci-test.c
 create mode 100644 lib/arm/asm/pci.h
 create mode 100644 lib/arm64/asm/pci.h
diff mbox

Patch

diff --git a/arm/Makefile.common b/arm/Makefile.common
index ccb554d9251a..97179bbea4e7 100644
--- a/arm/Makefile.common
+++ b/arm/Makefile.common
@@ -11,7 +11,8 @@  endif
 
 tests-common = \
 	$(TEST_DIR)/selftest.flat \
-	$(TEST_DIR)/spinlock-test.flat
+	$(TEST_DIR)/spinlock-test.flat \
+	$(TEST_DIR)/pci-test.flat
 
 all: test_cases
 
@@ -33,6 +34,8 @@  include scripts/asm-offsets.mak
 cflatobjs += lib/util.o
 cflatobjs += lib/alloc.o
 cflatobjs += lib/devicetree.o
+cflatobjs += lib/pci.o
+cflatobjs += lib/pci-host-generic.o
 cflatobjs += lib/virtio.o
 cflatobjs += lib/virtio-mmio.o
 cflatobjs += lib/chr-testdev.o
diff --git a/arm/pci-test.c b/arm/pci-test.c
new file mode 100644
index 000000000000..daebdafceb60
--- /dev/null
+++ b/arm/pci-test.c
@@ -0,0 +1,19 @@ 
+/*
+ * PCI bus operation test
+ *
+ * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.
+ */
+#include <libcflat.h>
+#include <pci.h>
+
+int main(void)
+{
+	if (!pci_probe())
+		report_abort("PCI bus probing failed\n");
+
+	pci_print();
+
+	return report_summary();
+}
diff --git a/lib/arm/asm/pci.h b/lib/arm/asm/pci.h
new file mode 100644
index 000000000000..01ecafe2b6d8
--- /dev/null
+++ b/lib/arm/asm/pci.h
@@ -0,0 +1 @@ 
+#include "asm-generic/pci-host-bridge.h"
diff --git a/lib/arm64/asm/pci.h b/lib/arm64/asm/pci.h
new file mode 100644
index 000000000000..f70ef560e2ab
--- /dev/null
+++ b/lib/arm64/asm/pci.h
@@ -0,0 +1 @@ 
+#include "../../arm/asm/pci.h"