summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNico Huber <nico.huber@secunet.com>2017-09-14 15:40:28 +0200
committerNico Huber <nico.h@gmx.de>2019-10-08 12:59:37 +0000
commita89c82e40210f4b61445bffdfec13cc08ea57f1f (patch)
tree63e5f5f95adff5c4e0f638bf61eb974152f008fa
parentc70af6530cc01cf1761543ed516ba7b60c349966 (diff)
downloadcoreboot-a89c82e40210f4b61445bffdfec13cc08ea57f1f.tar.xz
device/root_device: Consolidate common _scan_bus() functions
scan_usb_bus() and root_dev_scan_bus() had the very same implementation. So rename the latter to scan_static_bus() and use that for both cases. Change-Id: If0aba9c690b23e3716f2d47ff7a8c3e8f6d82679 Signed-off-by: Nico Huber <nico.huber@secunet.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/31901 Reviewed-by: Felix Held <felix-coreboot@felixheld.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/device/root_device.c30
-rw-r--r--src/drivers/usb/acpi/usb_acpi.c2
-rw-r--r--src/include/device/device.h2
-rw-r--r--src/soc/amd/picasso/usb.c2
-rw-r--r--src/soc/amd/stoneyridge/usb.c2
-rw-r--r--src/soc/intel/common/block/xhci/xhci.c2
6 files changed, 14 insertions, 26 deletions
diff --git a/src/device/root_device.c b/src/device/root_device.c
index 0580914480..84d3ba6fc2 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -65,21 +65,6 @@ 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));
-
- enable_static_devices(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;
@@ -116,14 +101,17 @@ void scan_smbus(struct device *bus)
scan_generic_bus(bus);
}
-/**
- * Scan root bus for generic systems.
+/*
+ * Default scan_bus() implementation
*
- * This function is the default scan_bus() method of the root device.
+ * This is the default implementation for buses that can't
+ * be probed at runtime. It simply walks through the topology
+ * given by the mainboard's `devicetree.cb`.
*
- * @param root The root device structure.
+ * First, all direct descendants of the given device are
+ * enabled. Then, downstream buses are scanned.
*/
-static void root_dev_scan_bus(struct device *bus)
+void scan_static_bus(struct device *bus)
{
struct bus *link;
@@ -162,7 +150,7 @@ struct device_operations default_dev_ops_root = {
.set_resources = DEVICE_NOOP,
.enable_resources = DEVICE_NOOP,
.init = DEVICE_NOOP,
- .scan_bus = root_dev_scan_bus,
+ .scan_bus = scan_static_bus,
.reset_bus = root_dev_reset,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = root_dev_acpi_name,
diff --git a/src/drivers/usb/acpi/usb_acpi.c b/src/drivers/usb/acpi/usb_acpi.c
index 31a7a7f30b..2f2ad32633 100644
--- a/src/drivers/usb/acpi/usb_acpi.c
+++ b/src/drivers/usb/acpi/usb_acpi.c
@@ -85,7 +85,7 @@ static struct device_operations usb_acpi_ops = {
.read_resources = DEVICE_NOOP,
.set_resources = DEVICE_NOOP,
.enable_resources = DEVICE_NOOP,
- .scan_bus = scan_usb_bus,
+ .scan_bus = scan_static_bus,
.acpi_fill_ssdt_generator = usb_acpi_fill_ssdt_generator,
};
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 96fc837b58..a7ba5a9a5b 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -331,7 +331,7 @@ void enable_static_devices(struct device *bus);
void scan_smbus(struct device *bus);
void scan_generic_bus(struct device *bus);
void scan_lpc_bus(struct device *bus);
-void scan_usb_bus(struct device *bus);
+void scan_static_bus(struct device *bus);
#endif /* !defined(__ROMCC__) */
diff --git a/src/soc/amd/picasso/usb.c b/src/soc/amd/picasso/usb.c
index 66c8266cd3..831b470036 100644
--- a/src/soc/amd/picasso/usb.c
+++ b/src/soc/amd/picasso/usb.c
@@ -60,7 +60,7 @@ static struct device_operations usb_ops = {
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = set_usb_over_current,
- .scan_bus = scan_usb_bus,
+ .scan_bus = scan_static_bus,
.acpi_name = soc_acpi_name,
.ops_pci = &lops_pci,
};
diff --git a/src/soc/amd/stoneyridge/usb.c b/src/soc/amd/stoneyridge/usb.c
index 00f82375e8..3c621910e2 100644
--- a/src/soc/amd/stoneyridge/usb.c
+++ b/src/soc/amd/stoneyridge/usb.c
@@ -63,7 +63,7 @@ static struct device_operations usb_ops = {
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = set_usb_over_current,
- .scan_bus = scan_usb_bus,
+ .scan_bus = scan_static_bus,
.acpi_name = soc_acpi_name,
.ops_pci = &lops_pci,
};
diff --git a/src/soc/intel/common/block/xhci/xhci.c b/src/soc/intel/common/block/xhci/xhci.c
index c5c5e6c6d6..293fd36464 100644
--- a/src/soc/intel/common/block/xhci/xhci.c
+++ b/src/soc/intel/common/block/xhci/xhci.c
@@ -113,7 +113,7 @@ static struct device_operations usb_xhci_ops = {
.enable_resources = pci_dev_enable_resources,
.init = soc_xhci_init,
.ops_pci = &pci_dev_ops_pci,
- .scan_bus = scan_usb_bus,
+ .scan_bus = scan_static_bus,
#if CONFIG(HAVE_ACPI_TABLES)
.acpi_name = soc_acpi_name,
#endif