blob: cf128ac1b032fdb1dffb9c212368e80a1aac9653 [file] [log] [blame]
Alexander Gordeevf7f81c62016-11-07 11:14:44 +01001/*
2 * PCI bus operation test
3 *
4 * Copyright (C) 2016, Red Hat Inc, Alexander Gordeev <agordeev@redhat.com>
5 *
6 * This work is licensed under the terms of the GNU LGPL, version 2.
7 */
8#include <libcflat.h>
9#include <pci.h>
10
11#define NR_TESTS (PCI_TESTDEV_NUM_BARS * PCI_TESTDEV_NUM_TESTS)
12
13int main(void)
14{
15 int ret;
16
Andrew Jones24f588e2016-12-02 13:57:55 +010017 if (!pci_probe()) {
18 printf("PCI bus probing failed, skipping tests...\n");
19 return report_summary();
20 }
Alexander Gordeevf7f81c62016-11-07 11:14:44 +010021
22 pci_print();
23
24 ret = pci_testdev();
Andrew Jones24f588e2016-12-02 13:57:55 +010025 if (ret == -1)
26 report_skip("No PCI test device");
27 else
28 report("PCI test device passed %d/%d tests",
29 ret >= NR_TESTS, ret > 0 ? ret : 0, NR_TESTS);
Alexander Gordeevf7f81c62016-11-07 11:14:44 +010030
31 return report_summary();
32}