summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/device/device_util.c15
-rw-r--r--src/include/device/device.h3
2 files changed, 18 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 0be6cfbf36..6919f4bb39 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -965,3 +965,18 @@ bool is_enabled_cpu(const struct device *cpu)
{
return is_cpu(cpu) && cpu->enabled;
}
+
+bool is_pci(const struct device *pci)
+{
+ return pci->path.type == DEVICE_PATH_PCI;
+}
+
+bool is_enabled_pci(const struct device *pci)
+{
+ return is_pci(pci) && pci->enabled;
+}
+
+bool is_pci_dev_on_bus(const struct device *pci, unsigned int bus)
+{
+ return is_pci(pci) && pci->bus->secondary == bus;
+}
diff --git a/src/include/device/device.h b/src/include/device/device.h
index a375639d82..0f9c39f17e 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -209,6 +209,9 @@ bool is_dev_enabled(const struct device *const dev);
bool is_devfn_enabled(unsigned int devfn);
bool is_cpu(const struct device *cpu);
bool is_enabled_cpu(const struct device *cpu);
+bool is_pci(const struct device *pci);
+bool is_enabled_pci(const struct device *pci);
+bool is_pci_dev_on_bus(const struct device *pci, unsigned int bus);
/* Returns whether there is a hotplug port on the path to the given device. */
extern bool dev_path_hotplug(const struct device *);