summaryrefslogtreecommitdiff
path: root/src/device/root_device.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2020-10-18 15:04:41 -0700
committerDuncan Laurie <dlaurie@chromium.org>2020-10-21 15:35:24 +0000
commit3e4a14e153f6c77c257e03584364c58f1a2ae8dc (patch)
treec4dbeb42036d4d08aee04ae66c265e142f504d33 /src/device/root_device.c
parent2a507f734ed54bddd3381638bfc588bc84c301d1 (diff)
device: Export enable_static_device() function
The work done by enable_static_devices() and scan_generic_bus() is common and can be used by other device handlers to enable a single static device. Signed-off-by: Duncan Laurie <dlaurie@google.com> Change-Id: Ibfde9c4eb794714ebd9800e52b91169ceba15266 Reviewed-on: https://review.coreboot.org/c/coreboot/+/46541 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/device/root_device.c')
-rw-r--r--src/device/root_device.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/device/root_device.c b/src/device/root_device.c
index 640ea505d4..1f51786153 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -7,6 +7,18 @@
const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER;
+void enable_static_device(struct device *dev)
+{
+ if (dev->chip_ops && dev->chip_ops->enable_dev)
+ dev->chip_ops->enable_dev(dev);
+
+ if (dev->ops && dev->ops->enable)
+ dev->ops->enable(dev);
+
+ printk(BIOS_DEBUG, "%s %s\n", dev_path(dev),
+ dev->enabled ? "enabled" : "disabled");
+}
+
/**
* Enable devices on static buses.
*
@@ -32,15 +44,7 @@ void enable_static_devices(struct device *bus)
for (link = bus->link_list; link; link = link->next) {
for (child = link->children; child; child = child->sibling) {
-
- if (child->chip_ops && child->chip_ops->enable_dev)
- child->chip_ops->enable_dev(child);
-
- if (child->ops && child->ops->enable)
- child->ops->enable(child);
-
- printk(BIOS_DEBUG, "%s %s\n", dev_path(child),
- child->enabled ? "enabled" : "disabled");
+ enable_static_device(child);
}
}
}
@@ -58,18 +62,9 @@ void scan_generic_bus(struct device *bus)
link->secondary = ++bus_max;
for (child = link->children; child; child = child->sibling) {
-
- if (child->chip_ops && child->chip_ops->enable_dev)
- child->chip_ops->enable_dev(child);
-
- if (child->ops && child->ops->enable)
- child->ops->enable(child);
-
+ enable_static_device(child);
printk(BIOS_DEBUG, "bus: %s[%d]->", dev_path(child->bus->dev),
child->bus->link_num);
-
- printk(BIOS_DEBUG, "%s %s\n", dev_path(child),
- child->enabled ? "enabled" : "disabled");
}
}