summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/device/device_util.c11
-rw-r--r--src/device/root_device.c15
-rw-r--r--src/include/device/device.h2
-rw-r--r--src/include/device/path.h8
4 files changed, 36 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index a64b63ae23..aad3b4ba26 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -256,6 +256,9 @@ u32 dev_path_encode(const struct device *dev)
case DEVICE_PATH_SPI:
ret |= dev->path.spi.cs;
break;
+ case DEVICE_PATH_USB:
+ ret |= dev->path.usb.port_type << 8 || dev->path.usb.port_id;
+ break;
case DEVICE_PATH_NONE:
case DEVICE_PATH_MMIO: /* don't care */
default:
@@ -333,6 +336,10 @@ const char *dev_path(const struct device *dev)
snprintf(buffer, sizeof (buffer), "SPI: %02x",
dev->path.spi.cs);
break;
+ case DEVICE_PATH_USB:
+ snprintf(buffer, sizeof (buffer), "USB%u port %u",
+ dev->path.usb.port_type, dev->path.usb.port_id);
+ break;
case DEVICE_PATH_MMIO:
snprintf(buffer, sizeof (buffer), "MMIO: %08x",
dev->path.mmio.addr);
@@ -411,6 +418,10 @@ int path_eq(struct device_path *path1, struct device_path *path2)
case DEVICE_PATH_SPI:
equal = (path1->spi.cs == path2->spi.cs);
break;
+ case DEVICE_PATH_USB:
+ equal = (path1->usb.port_type == path2->usb.port_type) &&
+ (path1->usb.port_id == path2->usb.port_id);
+ break;
case DEVICE_PATH_MMIO:
equal = (path1->mmio.addr == path2->mmio.addr);
break;
diff --git a/src/device/root_device.c b/src/device/root_device.c
index a19028d43d..b0b6712ebb 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -72,6 +72,21 @@ void scan_lpc_bus(struct device *bus)
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
}
+void scan_usb_bus(struct device *bus)
+{
+ struct bus *link;
+
+ printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
+
+ scan_static_bus(bus);
+
+ /* Scan bridges in case this device is a hub */
+ for (link = bus->link_list; link; link = link->next)
+ scan_bridges(link);
+
+ printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
+}
+
void scan_generic_bus(struct device *bus)
{
struct device *child;
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 744836d9ed..f3afd60b2c 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -27,6 +27,7 @@ struct i2c_bus_operations;
struct smbus_bus_operations;
struct pnp_mode_ops;
struct spi_bus_operations;
+struct usb_bus_operations;
/* Chip operations */
struct chip_operations {
@@ -276,6 +277,7 @@ void scan_smbus(struct device *bus);
void scan_generic_bus(struct device *bus);
void scan_static_bus(struct device *bus);
void scan_lpc_bus(struct device *bus);
+void scan_usb_bus(struct device *bus);
#endif /* !defined(__ROMCC__) */
diff --git a/src/include/device/path.h b/src/include/device/path.h
index eaa9cc7d67..067a507166 100644
--- a/src/include/device/path.h
+++ b/src/include/device/path.h
@@ -15,6 +15,7 @@ enum device_path_type {
DEVICE_PATH_IOAPIC,
DEVICE_PATH_GENERIC,
DEVICE_PATH_SPI,
+ DEVICE_PATH_USB,
DEVICE_PATH_MMIO,
/*
@@ -37,6 +38,7 @@ enum device_path_type {
"DEVICE_PATH_IOAPIC", \
"DEVICE_PATH_GENERIC", \
"DEVICE_PATH_SPI", \
+ "DEVICE_PATH_USB", \
"DEVICE_PATH_MMIO", \
}
@@ -91,6 +93,11 @@ struct generic_path {
unsigned int subid;
};
+struct usb_path {
+ unsigned int port_type;
+ unsigned int port_id;
+};
+
struct mmio_path {
uintptr_t addr;
};
@@ -109,6 +116,7 @@ struct device_path {
struct cpu_bus_path cpu_bus;
struct generic_path generic;
struct spi_path spi;
+ struct usb_path usb;
struct mmio_path mmio;
};
};