diff options
author | Felix Held <felix-coreboot@felixheld.de> | 2024-07-25 00:05:53 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2024-07-31 14:32:19 +0000 |
commit | 32c38ca221ff5956a81026fd0e5df330d569fcca (patch) | |
tree | 57a07c42f641a94c51d4f71496ca8b00ec79007d /src/soc/intel | |
parent | 2c31e86d6b7456d542ed96eeef7cc797ddd62a8b (diff) |
device: introduce and use dev_get_domain_id
To avoid having constructs like 'dev->path.domain.domain' in the SoC
code, create the 'dev_get_domain_id' helper function that returns the
domain ID of either that device if it's a domain device or the
corresponding domain device's domain ID, and use it in the code.
If this function is called with a device other than PCI or domain type,
it won't have a domain number. In order to not need to call 'die',
'dev_get_domain_id' will print an error and return 0 which is a valid
domain number. In that case, the calling code should be fixed.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I3d79f19846cea49609f848a4c42747ac1052c288
Reviewed-on: https://review.coreboot.org/c/coreboot/+/83644
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel')
-rw-r--r-- | src/soc/intel/xeon_sp/acpi.c | 2 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/chip_common.c | 6 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/chip_gen1.c | 2 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/chip_gen6.c | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/src/soc/intel/xeon_sp/acpi.c b/src/soc/intel/xeon_sp/acpi.c index f66f5e9e99..e5cf9076ec 100644 --- a/src/soc/intel/xeon_sp/acpi.c +++ b/src/soc/intel/xeon_sp/acpi.c @@ -95,7 +95,7 @@ const acpi_cstate_t *soc_get_cstate_map(size_t *entries) void iio_domain_set_acpi_name(struct device *dev, const char *prefix) { const union xeon_domain_path dn = { - .domain_path = dev->path.domain.domain + .domain_path = dev_get_domain_id(dev) }; assert(dn.socket < CONFIG_MAX_SOCKET); diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c index d0eab02972..011e1c3297 100644 --- a/src/soc/intel/xeon_sp/chip_common.c +++ b/src/soc/intel/xeon_sp/chip_common.c @@ -49,7 +49,7 @@ static int filter_device_on_stack(struct device *dev, uint8_t socket, uint8_t st return 0; union xeon_domain_path dn; - dn.domain_path = domain->path.domain.domain; + dn.domain_path = dev_get_domain_id(domain); if (socket != XEONSP_SOCKET_MAX && dn.socket != socket) return 0; @@ -140,7 +140,7 @@ int iio_pci_domain_socket_from_dev(const struct device *dev) if (!domain) return -1; - dn.domain_path = domain->path.domain.domain; + dn.domain_path = dev_get_domain_id(domain); return dn.socket; } @@ -162,7 +162,7 @@ int iio_pci_domain_stack_from_dev(const struct device *dev) if (!domain) return -1; - dn.domain_path = domain->path.domain.domain; + dn.domain_path = dev_get_domain_id(domain); return dn.stack; } diff --git a/src/soc/intel/xeon_sp/chip_gen1.c b/src/soc/intel/xeon_sp/chip_gen1.c index a68c764662..ee167e2a0e 100644 --- a/src/soc/intel/xeon_sp/chip_gen1.c +++ b/src/soc/intel/xeon_sp/chip_gen1.c @@ -17,7 +17,7 @@ static const STACK_RES *domain_to_stack_res(const struct device *dev) { assert(dev->path.type == DEVICE_PATH_DOMAIN); const union xeon_domain_path dn = { - .domain_path = dev->path.domain.domain + .domain_path = dev_get_domain_id(dev) }; const IIO_UDS *hob = get_iio_uds(); diff --git a/src/soc/intel/xeon_sp/chip_gen6.c b/src/soc/intel/xeon_sp/chip_gen6.c index 686b3e4dcf..d53b2319ec 100644 --- a/src/soc/intel/xeon_sp/chip_gen6.c +++ b/src/soc/intel/xeon_sp/chip_gen6.c @@ -16,7 +16,7 @@ static const UDS_PCIROOT_RES *domain_to_pciroot_res(const struct device *dev) { assert(dev->path.type == DEVICE_PATH_DOMAIN); const union xeon_domain_path dn = { - .domain_path = dev->path.domain.domain + .domain_path = dev_get_domain_id(dev) }; const IIO_UDS *hob = get_iio_uds(); |