seabios: pci: introduce helper function to find device from table and initialize it.
authorIsaku Yamahata <yamahata@valinux.co.jp>
Tue, 20 Jul 2010 07:37:15 +0000 (16:37 +0900)
committerKevin O'Connor <kevin@koconnor.net>
Sat, 24 Jul 2010 17:30:03 +0000 (13:30 -0400)
introduce helper function to find device from table and initialize it.
pci_find_init_device(). This will be used later.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
src/pci.c
src/pci.h

index c54b084cfaf56bf8cac788f834385cb48f55e248..611d0e223598715774a2e0645ad07bdd0686c6e1 100644 (file)
--- a/src/pci.c
+++ b/src/pci.c
@@ -203,3 +203,15 @@ int pci_init_device(const struct pci_device_id *ids, u16 bdf, void *arg)
     }
     return -1;
 }
+
+int pci_find_init_device(const struct pci_device_id *ids, void *arg)
+{
+    int bdf, max;
+
+    foreachpci(bdf, max) {
+        if (pci_init_device(ids, bdf, arg) == 0) {
+            return bdf;
+        }
+    }
+    return -1;
+}
index fa6a32d8775dd8a6b114c81d1074cb0bbba1bc58..9c3108c8ac93c73aec51a2c72c96f8aebd0824c8 100644 (file)
--- a/src/pci.h
+++ b/src/pci.h
@@ -93,6 +93,7 @@ struct pci_device_id {
     }
 
 int pci_init_device(const struct pci_device_id *table, u16 bdf, void *arg);
+int pci_find_init_device(const struct pci_device_id *ids, void *arg);
 
 // pirtable.c
 void create_pirtable(void);