Felix Held submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
device_util: Handle domain device in dev_get_domain

When the input device pointer pointing to a domain device,
dev_get_domain returns the input device itself.

TEST=Build and boot on intel/archercity CRB

Change-Id: I3a278a8f573de95406ee256fba17767def4ad75d
Signed-off-by: Shuo Liu <shuo.liu@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/81957
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Nico Huber <nico.h@gmx.de>
---
M src/device/device_util.c
M src/soc/intel/xeon_sp/chip_common.c
2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/device/device_util.c b/src/device/device_util.c
index 5e353c2..7dcf081 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -252,9 +252,9 @@
{
/* Walk up the tree up to the domain */
while (dev && dev->upstream && !is_root_device(dev)) {
- dev = dev->upstream->dev;
if (dev->path.type == DEVICE_PATH_DOMAIN)
return dev;
+ dev = dev->upstream->dev;
}

return NULL;
diff --git a/src/soc/intel/xeon_sp/chip_common.c b/src/soc/intel/xeon_sp/chip_common.c
index d8e7d14..d0eab02 100644
--- a/src/soc/intel/xeon_sp/chip_common.c
+++ b/src/soc/intel/xeon_sp/chip_common.c
@@ -136,11 +136,7 @@
const struct device *domain;
union xeon_domain_path dn;

- if (dev->path.type == DEVICE_PATH_DOMAIN)
- domain = dev;
- else
- domain = dev_get_domain(dev);
-
+ domain = dev_get_domain(dev);
if (!domain)
return -1;

@@ -162,11 +158,7 @@
const struct device *domain;
union xeon_domain_path dn;

- if (dev->path.type == DEVICE_PATH_DOMAIN)
- domain = dev;
- else
- domain = dev_get_domain(dev);
-
+ domain = dev_get_domain(dev);
if (!domain)
return -1;


To view, visit change 81957. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: I3a278a8f573de95406ee256fba17767def4ad75d
Gerrit-Change-Number: 81957
Gerrit-PatchSet: 4
Gerrit-Owner: Shuo Liu <shuo.liu@intel.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Christian Walter <christian.walter@9elements.com>
Gerrit-Reviewer: Felix Held <felix-coreboot@felixheld.de>
Gerrit-Reviewer: Johnny Lin <Johnny_Lin@wiwynn.com>
Gerrit-Reviewer: Jonathan Zhang <jon.zhixiong.zhang@gmail.com>
Gerrit-Reviewer: Lean Sheng Tan <sheng.tan@9elements.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Rudolph <patrick.rudolph@9elements.com>
Gerrit-Reviewer: Tim Chu <Tim.Chu@quantatw.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged