summaryrefslogtreecommitdiffstats
path: root/src/drivers/bus
diff options
context:
space:
mode:
authorMichael Brown2015-05-08 17:50:47 +0200
committerMichael Brown2015-05-09 21:09:08 +0200
commita66fd8920df1e0a534d0a8ed68adb6143a304a66 (patch)
tree8068a0cdaed2b181c35bfab53e5b1465fd93d920 /src/drivers/bus
parent[ehci] Poll child companion controllers after disowning port (diff)
downloadipxe-a66fd8920df1e0a534d0a8ed68adb6143a304a66.tar.gz
ipxe-a66fd8920df1e0a534d0a8ed68adb6143a304a66.tar.xz
ipxe-a66fd8920df1e0a534d0a8ed68adb6143a304a66.zip
[usb] Add find_usb_bus_by_location() helper function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/drivers/bus')
-rw-r--r--src/drivers/bus/usb.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/drivers/bus/usb.c b/src/drivers/bus/usb.c
index 16f18259..0fe6da20 100644
--- a/src/drivers/bus/usb.c
+++ b/src/drivers/bus/usb.c
@@ -1976,6 +1976,26 @@ void free_usb_bus ( struct usb_bus *bus ) {
free ( bus );
}
+/**
+ * Find USB bus by device location
+ *
+ * @v bus_type Bus type
+ * @v location Bus location
+ * @ret bus USB bus, or NULL
+ */
+struct usb_bus * find_usb_bus_by_location ( unsigned int bus_type,
+ unsigned int location ) {
+ struct usb_bus *bus;
+
+ for_each_usb_bus ( bus ) {
+ if ( ( bus->dev->desc.bus_type == bus_type ) &&
+ ( bus->dev->desc.location == location ) )
+ return bus;
+ }
+
+ return NULL;
+}
+
/******************************************************************************
*
* USB address assignment