diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2024-07-24 23:51:05 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-07-25 22:54:21 +0000 |
commit | a17d22e51aa5bd133fb53e78ab75c171113e9383 (patch) | |
tree | f43572a8e648dec255aaf4646fd4f921ac31e48d /src/device/device_util.c | |
parent | b133b7ae2327b8c73e384998faf9f059c3d7a4af (diff) |
device: move is_domain0 and is_dev_on_domain0 to common code
Move is_domain0 and is_dev_on_domain0 from the Intel Xeon SP code to the
common coreboot code so that it can be used elsewhere in coreboot too,
and while moving also implement it as functions instead of macros which
is more in line with the rest of helper functions in that new file.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I954251ebc82802c77bf897dfa2db54aa10bc5ac4
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83642
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/device/device_util.c')
-rw-r--r-- | src/device/device_util.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c index 6a4577026c..2e97ece2a5 100644 --- a/src/device/device_util.c +++ b/src/device/device_util.c @@ -261,6 +261,16 @@ const struct device *dev_get_domain(const struct device *dev) return NULL; } +bool is_domain0(const struct device *dev) +{ + return dev && dev->path.type == DEVICE_PATH_DOMAIN && dev->path.domain.domain == 0; +} + +bool is_dev_on_domain0(const struct device *dev) +{ + return is_domain0(dev_get_domain(dev)); +} + /** * Allocate 64 more resources to the free list. * |