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);