]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
Convert virtio detection to use struct pci_device.
authorKevin O'Connor <kevin@koconnor.net>
Tue, 21 Jun 2011 02:22:08 +0000 (22:22 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Tue, 21 Jun 2011 03:52:24 +0000 (23:52 -0400)
src/virtio-blk.c

index ad80c24af01dabd151c1c2649955aec39bec2c05..4e3ef0632eab512c54324e8a549c6e3f979e7895 100644 (file)
@@ -8,7 +8,7 @@
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
 #include "util.h" // dprintf
-#include "pci.h" // foreachbdf
+#include "pci.h" // foreachpci
 #include "config.h" // CONFIG_*
 #include "biosvar.h" // GET_GLOBAL
 #include "pci_ids.h" // PCI_DEVICE_ID_VIRTIO_BLK
@@ -173,12 +173,11 @@ virtio_blk_setup(void)
 
     dprintf(3, "init virtio-blk\n");
 
-    int bdf, max;
-    u32 id = PCI_VENDOR_ID_REDHAT_QUMRANET | (PCI_DEVICE_ID_VIRTIO_BLK << 16);
-    foreachbdf(bdf, max) {
-        u32 v = pci_config_readl(bdf, PCI_VENDOR_ID);
-        if (v != id)
+    struct pci_device *pci;
+    foreachpci(pci) {
+        if (pci->vendor != PCI_VENDOR_ID_REDHAT_QUMRANET
+            || pci->device != PCI_DEVICE_ID_VIRTIO_BLK)
             continue;
-        init_virtio_blk(bdf);
+        init_virtio_blk(pci->bdf);
     }
 }