Duncan Laurie has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41441 )
Change subject: device: Probe fw_config and disable device if it is not found ......................................................................
device: Probe fw_config and disable device if it is not found
This change will set enabled=0 for a device that is not found in the fw_config if probing is enabled and there are probe entries in devicetree.cb.
The chip enable_dev() and device enable() handlers are still executed in case those functions need to take action if the device is not enabled.
BUG=b:147462631 TEST=boot with various fw_config values and check the boot log to see that the expected devices were disabled.
Signed-off-by: Duncan Laurie dlaurie@google.com Change-Id: Id3f1c7c600575096f09b23fcd07750cafc65872f --- M src/device/pci_device.c M src/device/root_device.c 2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/41441/1
diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 0584871..9e7a454 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -21,6 +21,7 @@ #include <device/pcix.h> #include <device/pciexp.h> #include <device/hypertransport.h> +#include <fw_config.h> #include <pc80/i8259.h> #include <security/vboot/vbnv.h> #include <timestamp.h> @@ -1195,6 +1196,12 @@ /* First thing setup the device structure. */ dev = pci_scan_get_dev(bus, devfn);
+ /* Probe fw_config if it is provided for this device. */ + if (dev && dev->probe_list && !fw_config_probe(dev->probe_list)) { + printk(BIOS_DEBUG, "%s disabled by fw_config\n", dev_path(dev)); + dev->enabled = 0; + } + /* See if a device is present and setup the device structure. */ dev = pci_probe_dev(dev, bus, devfn);
diff --git a/src/device/root_device.c b/src/device/root_device.c index 640ea50..6ab5176 100644 --- a/src/device/root_device.c +++ b/src/device/root_device.c @@ -3,6 +3,7 @@ #include <console/console.h> #include <device/device.h> #include <device/pci.h> +#include <fw_config.h> #include <reset.h>
const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_NUMBER; @@ -32,6 +33,12 @@
for (link = bus->link_list; link; link = link->next) { for (child = link->children; child; child = child->sibling) { + /* Probe fw_config if it is provided for this device */ + if (child->probe_list && !fw_config_probe(child->probe_list)) { + printk(BIOS_DEBUG, "%s disabled by fw_config\n", + dev_path(child)); + child->enabled = 0; + }
if (child->chip_ops && child->chip_ops->enable_dev) child->chip_ops->enable_dev(child); @@ -58,6 +65,12 @@ link->secondary = ++bus_max;
for (child = link->children; child; child = child->sibling) { + /* Probe fw_config if it is provided for this device */ + if (child->probe_list && !fw_config_probe(child->probe_list)) { + printk(BIOS_DEBUG, "%s disabled by fw_config\n", + dev_path(child)); + child->enabled = 0; + }
if (child->chip_ops && child->chip_ops->enable_dev) child->chip_ops->enable_dev(child);
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41441
to look at the new patch set (#6).
Change subject: device: Probe fw_config and disable device if it is not found ......................................................................
device: Probe fw_config and disable device if it is not found
This change will set enabled=0 for a device that is not found in the fw_config if probing is enabled and there are probe entries in devicetree.cb.
The chip enable_dev() and device enable() handlers are still executed in case those functions need to take action if the device is not enabled.
BUG=b:147462631 TEST=boot with various fw_config values and check the boot log to see that the expected devices were disabled.
Signed-off-by: Duncan Laurie dlaurie@google.com Change-Id: Id3f1c7c600575096f09b23fcd07750cafc65872f --- M src/device/pci_device.c M src/device/root_device.c 2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/41441/6
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41441
to look at the new patch set (#10).
Change subject: device: Probe fw_config and disable device if it is not found ......................................................................
device: Probe fw_config and disable device if it is not found
This change will set enabled=0 for a device that is not found in the fw_config if probing is enabled and there are probe entries in devicetree.cb.
The chip enable_dev() and device enable() handlers are still executed in case those functions need to take action if the device is not enabled.
BUG=b:147462631 TEST=boot with various fw_config values and check the boot log to see that the expected devices were disabled.
Signed-off-by: Duncan Laurie dlaurie@google.com Change-Id: Id3f1c7c600575096f09b23fcd07750cafc65872f --- M src/device/pci_device.c M src/device/root_device.c 2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/41/41441/10
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41441 )
Change subject: device: Probe fw_config and disable device if it is not found ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/41441/14/src/device/pci_device.c File src/device/pci_device.c:
https://review.coreboot.org/c/coreboot/+/41441/14/src/device/pci_device.c@12... PS14, Line 1267: fw_config_probe_device Should this instead be handled as a separate step in dev_enumerate() before scan_bus() is called i.e. loop through all devices in the tree and call fw_config_probe_device() for each device in the tree? That way we don't need to add this check in different scan bus callbacks.
The downside that I see with the approach is that fw_config_probe_device() wouldn't get called for any device that is added by scan_bus. But there is no way to actually add fw_config probe property if the device is not defined in the device tree statically. So, a check in dev_enumerate() should work?
Duncan Laurie has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41441 )
Change subject: device: Probe fw_config and disable device if it is not found ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/41441/14/src/device/pci_device.c File src/device/pci_device.c:
https://review.coreboot.org/c/coreboot/+/41441/14/src/device/pci_device.c@12... PS14, Line 1267: fw_config_probe_device
Should this instead be handled as a separate step in dev_enumerate() before scan_bus() is called i. […]
I thought about this more and realized I don't need to do this at all, I can just have a BOOT_STATE_INIT_ENTRY in lib/fw_config.c. So I'll update the first commit and abandon this one.
Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41441 )
Change subject: device: Probe fw_config and disable device if it is not found ......................................................................
Patch Set 14:
(1 comment)
https://review.coreboot.org/c/coreboot/+/41441/14/src/device/pci_device.c File src/device/pci_device.c:
https://review.coreboot.org/c/coreboot/+/41441/14/src/device/pci_device.c@12... PS14, Line 1267: fw_config_probe_device
I thought about this more and realized I don't need to do this at all, I can just have a BOOT_STATE_ […]
SGTM.
Duncan Laurie has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/41441 )
Change subject: device: Probe fw_config and disable device if it is not found ......................................................................
Abandoned