From: Alexander Gordeev <agordeev@xxxxxxxxxx> Cc: Thomas Huth <thuth@xxxxxxxxxx> Cc: Andrew Jones <drjones@xxxxxxxxxx> Cc: Peter Xu <peterx@xxxxxxxxxx> Reviewed-by: Andrew Jones <drjones@xxxxxxxxxx> Signed-off-by: Alexander Gordeev <agordeev@xxxxxxxxxx> --- lib/pci.c | 6 ++++++ lib/pci.h | 1 + 2 files changed, 7 insertions(+) diff --git a/lib/pci.c b/lib/pci.c index 74936f3..42f47d9 100644 --- a/lib/pci.c +++ b/lib/pci.c @@ -7,6 +7,12 @@ #include "pci.h" #include "asm/pci.h" +bool pci_dev_exists(pcidevaddr_t dev) +{ + return (pci_config_readw(dev, PCI_VENDOR_ID) != 0xffff && + pci_config_readw(dev, PCI_DEVICE_ID) != 0xffff); +} + /* Scan bus look for a specific device. Only bus 0 scanned for now. */ pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id) { diff --git a/lib/pci.h b/lib/pci.h index 1c20308..1462aa2 100644 --- a/lib/pci.h +++ b/lib/pci.h @@ -15,6 +15,7 @@ enum { PCIDEVADDR_INVALID = 0xffff, }; +extern bool pci_dev_exists(pcidevaddr_t dev); extern pcidevaddr_t pci_find_dev(uint16_t vendor_id, uint16_t device_id); /* -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html