aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@ieee.org>2015-04-08 01:54:39 -0400
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-04-08 16:16:13 +1000
commit3e3ed2e52e27d9b3fff7eb3cac97f943a686359a (patch)
treed0aba37a61e831ce6aeff5551679468d90d651ab
parentaa9348f64d701e56868ff662204f83a163240605 (diff)
downloadskiboot-3e3ed2e52e27d9b3fff7eb3cac97f943a686359a.zip
skiboot-3e3ed2e52e27d9b3fff7eb3cac97f943a686359a.tar.gz
skiboot-3e3ed2e52e27d9b3fff7eb3cac97f943a686359a.tar.bz2
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 <ddstreet@ieee.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--hw/nx-842.c14
-rw-r--r--hw/nx-crypto.c24
2 files changed, 19 insertions, 19 deletions
diff --git a/hw/nx-842.c b/hw/nx-842.c
index b5a43cc..f462f7a 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);
}
diff --git a/hw/nx-crypto.c b/hw/nx-crypto.c
index 37b64f2..723c571 100644
--- a/hw/nx-crypto.c
+++ b/hw/nx-crypto.c
@@ -48,9 +48,9 @@
static int nx_cfg_sym(u32 gcid, u64 xcfg)
{
u64 cfg, ci, ct;
- int rc;
+ int rc, instance = gcid + 1;
- BUILD_ASSERT(MAX_CHIPS <= NX_SYM_CFG_CI_MAX);
+ BUILD_ASSERT(MAX_CHIPS < NX_SYM_CFG_CI_MAX);
rc = xscom_read(gcid, xcfg, &cfg);
if (rc)
@@ -73,14 +73,14 @@ static int nx_cfg_sym(u32 gcid, u64 xcfg)
*/
ci = GETFIELD(NX_SYM_CFG_CI, cfg) >> NX_SYM_CFG_CI_LSHIFT;
if (!ci)
- prlog(PR_INFO, "NX%d: SYM CI set to %d\n", gcid, gcid);
- else if (ci == gcid)
+ prlog(PR_INFO, "NX%d: SYM CI set to %d\n", gcid, instance);
+ else if (ci == instance)
prlog(PR_INFO, "NX%d: SYM CI already set to %u\n", gcid,
(unsigned int)ci);
else
prlog(PR_INFO, "NX%d: SYM 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_SYM_CFG_CI, cfg, ci << NX_SYM_CFG_CI_LSHIFT);
cfg = SETFIELD(NX_SYM_CFG_FC_ENABLE, cfg, CFG_SYM_FC_ENABLE);
@@ -101,9 +101,9 @@ static int nx_cfg_sym(u32 gcid, u64 xcfg)
static int nx_cfg_asym(u32 gcid, u64 xcfg)
{
u64 cfg, ci, ct;
- int rc;
+ int rc, instance = gcid + 1;
- BUILD_ASSERT(MAX_CHIPS <= NX_ASYM_CFG_CI_MAX);
+ BUILD_ASSERT(MAX_CHIPS < NX_ASYM_CFG_CI_MAX);
rc = xscom_read(gcid, xcfg, &cfg);
if (rc)
@@ -127,14 +127,14 @@ static int nx_cfg_asym(u32 gcid, u64 xcfg)
*/
ci = GETFIELD(NX_ASYM_CFG_CI, cfg) >> NX_ASYM_CFG_CI_LSHIFT;
if (!ci)
- prlog(PR_INFO, "NX%d: ASYM CI set to %d\n", gcid, gcid);
- else if (ci == gcid)
+ prlog(PR_INFO, "NX%d: ASYM CI set to %d\n", gcid, instance);
+ else if (ci == instance)
prlog(PR_INFO, "NX%d: ASYM CI already set to %u\n", gcid,
(unsigned int)ci);
else
prlog(PR_INFO, "NX%d: ASYM 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_ASYM_CFG_CI, cfg, ci << NX_ASYM_CFG_CI_LSHIFT);
cfg = SETFIELD(NX_ASYM_CFG_FC_ENABLE, cfg, CFG_ASYM_FC_ENABLE);