summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/device/device_const.c14
-rw-r--r--src/include/device/device.h6
2 files changed, 15 insertions, 5 deletions
diff --git a/src/device/device_const.c b/src/device/device_const.c
index 2ce76c61e5..20afe7e445 100644
--- a/src/device/device_const.c
+++ b/src/device/device_const.c
@@ -7,6 +7,7 @@
#include <device/pci.h>
#include <device/pci_def.h>
#include <device/resource.h>
+#include <fw_config.h>
/** Linked list of ALL devices */
DEVTREE_CONST struct device *DEVTREE_CONST all_devices = &dev_root;
@@ -383,3 +384,16 @@ DEVTREE_CONST struct device *dev_bus_each_child(const struct bus *parent,
return dev;
}
+
+bool is_dev_enabled(const struct device *dev)
+{
+ if (!dev)
+ return false;
+
+ /* For stages with immutable device tree, first check if device is disabled because of
+ fw_config probing. In these stages, dev->enabled does not reflect the true state of a
+ device that uses fw_config probing. */
+ if (DEVTREE_EARLY && !fw_config_probe_dev(dev, NULL))
+ return false;
+ return dev->enabled;
+}
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 88b5310055..623d337601 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -191,11 +191,7 @@ void dev_set_enabled(struct device *dev, int enable);
void disable_children(struct bus *bus);
bool dev_is_active_bridge(struct device *dev);
void add_more_links(struct device *dev, unsigned int total_links);
-
-static inline bool is_dev_enabled(const struct device *const dev)
-{
- return dev && dev->enabled;
-}
+bool is_dev_enabled(const struct device *const dev);
/* Option ROM helper functions */
void run_bios(struct device *dev, unsigned long addr);