From 3e3ed2e52e27d9b3fff7eb3cac97f943a686359a Mon Sep 17 00:00:00 2001 From: Dan Streetman Date: Wed, 8 Apr 2015 01:54:39 -0400 Subject: nx: use gcid + 1 for CI In commit e077676 the nx CI's were changed to just use the chip id. That works fine, except CI 0 is reserved, so if there is a chip id of 0, the CI is set to 0, which is invalid. This doesn't currently affect the kernel driver, as it just uses the reserved CI of 0 for all requests, as CI == 0 tells the hw to auto-select which CI to send the request to. However, valid CI's should be assigned; we can use the chip id + 1 to ensure a valid CI. This commit fixes the CI assignment by setting each CI to the chip id + 1. Signed-off-by: Dan Streetman Signed-off-by: Stewart Smith --- hw/nx-842.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'hw/nx-842.c') diff --git a/hw/nx-842.c b/hw/nx-842.c index b5a43cc9..f462f7a4 100644 --- a/hw/nx-842.c +++ b/hw/nx-842.c @@ -39,9 +39,9 @@ static int nx_cfg_842(u32 gcid, u64 xcfg) { u64 cfg, ci, ct; - int rc; + int rc, instance = gcid + 1; - BUILD_ASSERT(MAX_CHIPS <= NX_842_CFG_CI_MAX); + BUILD_ASSERT(MAX_CHIPS < NX_842_CFG_CI_MAX); rc = xscom_read(gcid, xcfg, &cfg); if (rc) @@ -64,14 +64,14 @@ static int nx_cfg_842(u32 gcid, u64 xcfg) */ ci = GETFIELD(NX_842_CFG_CI, cfg) >> NX_842_CFG_CI_LSHIFT; if (!ci) - prlog(PR_INFO, "NX%d: 842 CI set to %d\n", gcid, gcid); - else if (ci == gcid) + prlog(PR_INFO, "NX%d: 842 CI set to %d\n", gcid, instance); + else if (ci == instance) prlog(PR_INFO, "NX%d: 842 CI already set to %u\n", gcid, (unsigned int)ci); else prlog(PR_INFO, "NX%d: 842 CI already set to %u, " - "changing to %d\n", gcid, (unsigned int)ci, gcid); - ci = gcid; + "changing to %d\n", gcid, (unsigned int)ci, instance); + ci = instance; cfg = SETFIELD(NX_842_CFG_CI, cfg, ci << NX_842_CFG_CI_LSHIFT); /* Enable all functions */ @@ -193,5 +193,5 @@ void nx_create_842_node(struct dt_node *node) prlog(PR_INFO, "NX%d: 842 Coprocessor Enabled\n", gcid); dt_add_property_cells(node, "ibm,842-coprocessor-type", NX_CT_842); - dt_add_property_cells(node, "ibm,842-coprocessor-instance", gcid); + dt_add_property_cells(node, "ibm,842-coprocessor-instance", gcid + 1); } -- cgit v1.2.1