diff mbox

[kvm-unit-tests,1/8] pci: introduce pci_intx_line()

Message ID 1483088160-6714-2-git-send-email-peterx@redhat.com
State New
Headers show

Commit Message

Peter Xu Dec. 30, 2016, 8:55 a.m. UTC
To fetch INTx irq line number.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 lib/pci.c | 5 +++++
 lib/pci.h | 1 +
 2 files changed, 6 insertions(+)
diff mbox

Patch

diff --git a/lib/pci.c b/lib/pci.c
index 6416191..a7cfacb 100644
--- a/lib/pci.c
+++ b/lib/pci.c
@@ -327,6 +327,11 @@  void pci_scan_bars(struct pci_dev *dev)
 	}
 }
 
+uint8_t pci_intx_line(struct pci_dev *dev)
+{
+	return pci_config_readb(dev->bdf, PCI_INTERRUPT_LINE);
+}
+
 void pci_enable_defaults(struct pci_dev *dev)
 {
 	pci_scan_bars(dev);
diff --git a/lib/pci.h b/lib/pci.h
index e71a05d..df86951 100644
--- a/lib/pci.h
+++ b/lib/pci.h
@@ -64,6 +64,7 @@  extern bool pci_bar_is_memory(struct pci_dev *dev, int bar_num);
 extern bool pci_bar_is_valid(struct pci_dev *dev, int bar_num);
 extern void pci_bar_print(struct pci_dev *dev, int bar_num);
 extern void pci_dev_print_id(pcidevaddr_t dev);
+extern uint8_t pci_intx_line(struct pci_dev *dev);
 
 extern int pci_testdev(void);