[Skiboot] [PATCH 1/3] hw/npu: Get number of links from NPU node property

Gavin Shan gwshan at linux.vnet.ibm.com
Wed Jul 6 13:20:01 AEST 2016


The NPU device node property "ibm,npu-links" indicates number of
NPU links supported. This retrieves the number of links from the
properties instead of counting its child device nodes.

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 hw/npu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/npu.c b/hw/npu.c
index 8eb8ab2..c1b1975 100644
--- a/hw/npu.c
+++ b/hw/npu.c
@@ -1089,7 +1089,7 @@ static void npu_probe_phb(struct dt_node *dn)
 	struct dt_node *np;
 	uint32_t gcid, index, phb_index, xscom;
 	uint64_t at_bar[2], mm_win[2], val;
-	uint32_t links = 0;
+	uint32_t links;
 	char *path;
 
 	/* Retrieve chip id */
@@ -1097,9 +1097,7 @@ static void npu_probe_phb(struct dt_node *dn)
 	gcid = dt_get_chip_id(dn);
 	index = dt_prop_get_u32(dn, "ibm,npu-index");
 	phb_index = dt_prop_get_u32(dn, "ibm,phb-index");
-	dt_for_each_compatible(dn, np, "ibm,npu-link")
-		links++;
-
+	links = dt_prop_get_u32(dn, "ibm,npu-links");
 	prlog(PR_INFO, "Chip %d Found NPU%d (%d links) at %s\n",
 	      gcid, index, links, path);
 	free(path);
-- 
2.1.0



More information about the Skiboot mailing list