summaryrefslogtreecommitdiffstats
path: root/src/device/device_util.c
diff options
context:
space:
mode:
authorFabio Aiuto <fabioaiuto83@gmail.com>2022-09-10 14:23:38 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-09-29 16:46:41 +0000
commitc5573d62b7b5179cb48144b71f91955464873e6e (patch)
tree7149cd9cfd35823189eb3906c6ceac1384d999af /src/device/device_util.c
parent712c70b35739c9eb75bd6e6847710f14b0940ec2 (diff)
downloadcoreboot-c5573d62b7b5179cb48144b71f91955464873e6e.tar.gz
coreboot-c5573d62b7b5179cb48144b71f91955464873e6e.tar.bz2
coreboot-c5573d62b7b5179cb48144b71f91955464873e6e.zip
include/device/path.h: use functions for enabled cpu selection
Add function defs and prototypes of functions checking whether a device is {a cpu,an enabled cpu} TEST: compile test and qemu executed successfully with coreinfo payload Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com> Change-Id: Iabc0e59d604ae4572921518a8dad47dc3d149f81 Reviewed-on: https://review.coreboot.org/c/coreboot/+/67502 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/device/device_util.c')
-rw-r--r--src/device/device_util.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 45dbccc28d67..1e13bca151ab 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;
+}