summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/device/device_util.c11
-rw-r--r--src/include/device/device.h2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 45dbccc28d..1e13bca151 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -957,3 +957,14 @@ void log_resource(const char *type, const struct device *dev, const struct resou
srcfile, line, type, dev_path(dev), res->index, res->base,
resource_end(res), res->size / KiB);
}
+
+bool is_cpu(const struct device *cpu)
+{
+ return cpu->path.type == DEVICE_PATH_APIC &&
+ cpu->bus->dev->path.type == DEVICE_PATH_CPU_CLUSTER;
+}
+
+bool is_enabled_cpu(const struct device *cpu)
+{
+ return is_cpu(cpu) && cpu->enabled;
+}
diff --git a/src/include/device/device.h b/src/include/device/device.h
index cd08f1db68..a375639d82 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -207,6 +207,8 @@ bool dev_is_active_bridge(struct device *dev);
void add_more_links(struct device *dev, unsigned int total_links);
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);
/* Returns whether there is a hotplug port on the path to the given device. */
extern bool dev_path_hotplug(const struct device *);