aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2010-07-20 16:37:15 +0900
committerKevin O'Connor <kevin@koconnor.net>2010-07-24 13:30:03 -0400
commit23173ac5d77f8087e0aab05cd7fc4700951de48b (patch)
treee910c461fe9f717bfaf035f8b9dc71d7d133915c
parent17d3e46511aeedc9f09a8216d194d749187b80aa (diff)
downloadseabios-23173ac5d77f8087e0aab05cd7fc4700951de48b.tar.gz
seabios: pci: introduce helper function to find device from table and initialize it.
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>
-rw-r--r--src/pci.c12
-rw-r--r--src/pci.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/src/pci.c b/src/pci.c
index c54b084c..611d0e22 100644
--- 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;
+}
diff --git a/src/pci.h b/src/pci.h
index fa6a32d8..9c3108c8 100644
--- 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);