Duncan Laurie has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/46541 )
Change subject: device: Export enable_static_device() function ......................................................................
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 --- M src/device/root_device.c M src/include/device/device.h 2 files changed, 15 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/46541/1
diff --git a/src/device/root_device.c b/src/device/root_device.c index 640ea50..1f51786 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 @@
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 @@ 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"); } }
diff --git a/src/include/device/device.h b/src/include/device/device.h index 031091a..3a0795e 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -358,6 +358,7 @@ return config_of(pcidev_on_root(0, 0)); }
+void enable_static_device(struct device *dev); void enable_static_devices(struct device *bus); void scan_smbus(struct device *bus); void scan_generic_bus(struct device *bus);
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/46541 )
Change subject: device: Export enable_static_device() function ......................................................................
Patch Set 1: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/46541/1/src/include/device/device.h File src/include/device/device.h:
https://review.coreboot.org/c/coreboot/+/46541/1/src/include/device/device.h... PS1, Line 362: enable_static_devices The two names are very close to each other, but I don't really have a recommendation for a different name either.
Hello build bot (Jenkins), Furquan Shaikh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/46541
to look at the new patch set (#2).
Change subject: device: Export enable_static_device() function ......................................................................
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 --- M src/device/root_device.c M src/include/device/device.h 2 files changed, 15 insertions(+), 19 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/46541/2
Duncan Laurie has submitted this change. ( https://review.coreboot.org/c/coreboot/+/46541 )
Change subject: device: Export enable_static_device() function ......................................................................
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 --- M src/device/root_device.c M src/include/device/device.h 2 files changed, 15 insertions(+), 19 deletions(-)
Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved
diff --git a/src/device/root_device.c b/src/device/root_device.c index 640ea50..1f51786 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 @@
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 @@ 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"); } }
diff --git a/src/include/device/device.h b/src/include/device/device.h index 031091a..3a0795e 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -358,6 +358,7 @@ return config_of(pcidev_on_root(0, 0)); }
+void enable_static_device(struct device *dev); void enable_static_devices(struct device *bus); void scan_smbus(struct device *bus); void scan_generic_bus(struct device *bus);