NX: Print read xscom config failures.

Submitted by ppaidipe@linux.vnet.ibm.com on Feb. 21, 2017, 1:51 p.m.

Details

Message ID 1487685073-23269-1-git-send-email-ppaidipe@linux.vnet.ibm.com
State New
Headers show

Commit Message

ppaidipe@linux.vnet.ibm.com Feb. 21, 2017, 1:51 p.m.
From: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>

Currently in NX, only write xscom config failures are tracing.
Add trace statements for read xscom config failures too.
No functional changes.

Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
---
 hw/nx-842.c    | 17 +++++++++++++----
 hw/nx-crypto.c | 25 ++++++++++++++++++++-----
 hw/nx-rng.c    | 23 ++++++++++++++++++-----
 3 files changed, 51 insertions(+), 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/hw/nx-842.c b/hw/nx-842.c
index f462f7a..6622bd5 100644
--- a/hw/nx-842.c
+++ b/hw/nx-842.c
@@ -44,8 +44,11 @@  static int nx_cfg_842(u32 gcid, u64 xcfg)
 	BUILD_ASSERT(MAX_CHIPS < NX_842_CFG_CI_MAX);
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM 842 config read failure %d\n",
+                 gcid, rc);
 		return rc;
+	}
 
 	ct = GETFIELD(NX_842_CFG_CT, cfg);
 	if (!ct)
@@ -96,8 +99,11 @@  static int nx_cfg_dma(u32 gcid, u64 xcfg)
 	int rc;
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
-		return rc;
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM DMA config read failure %d\n",
+                 gcid, rc);
+                return rc;
+	}
 
 	if (proc_gen == proc_gen_p8) {
 		cfg = SETFIELD(NX_P8_DMA_CFG_842_COMPRESS_PREFETCH, cfg,
@@ -137,8 +143,11 @@  static int nx_cfg_ee(u32 gcid, u64 xcfg)
 	int rc;
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM EE config read failure %d\n",
+                 gcid, rc);
 		return rc;
+	}
 
 	cfg = SETFIELD(NX_EE_CFG_CH1, cfg, EE_1);
 	cfg = SETFIELD(NX_EE_CFG_CH0, cfg, EE_0);
diff --git a/hw/nx-crypto.c b/hw/nx-crypto.c
index 723c571..b247f19 100644
--- a/hw/nx-crypto.c
+++ b/hw/nx-crypto.c
@@ -53,8 +53,11 @@  static int nx_cfg_sym(u32 gcid, u64 xcfg)
 	BUILD_ASSERT(MAX_CHIPS < NX_SYM_CFG_CI_MAX);
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM SYM config read failure %d\n",
+		 gcid, rc);
 		return rc;
+	}
 
 	ct = GETFIELD(NX_SYM_CFG_CT, cfg);
 	if (!ct)
@@ -106,8 +109,11 @@  static int nx_cfg_asym(u32 gcid, u64 xcfg)
 	BUILD_ASSERT(MAX_CHIPS < NX_ASYM_CFG_CI_MAX);
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM ASYM config read failure %d\n",
+		 gcid, rc);
 		return rc;
+	}
 
 	ct = GETFIELD(NX_ASYM_CFG_CT, cfg);
 	if (!ct)
@@ -158,8 +164,11 @@  static int nx_cfg_dma(u32 gcid, u64 xcfg)
 	int rc;
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM DMA config read failure %d\n",
+		 gcid, rc);
 		return rc;
+	}
 
 	cfg = SETFIELD(NX_DMA_CFG_AES_SHA_MAX_RR, cfg,
 		       AES_SHA_MAX_RR);
@@ -199,8 +208,11 @@  static int nx_cfg_iq(u32 gcid, u64 xcfg)
 	int rc;
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM CRB IQ config read failure %d\n",
+		 gcid, rc);
 		return rc;
+	}
 
 	cfg = SETFIELD(NX_CRB_IQ_SYM, cfg, CFG_CRB_IQ_SYM);
 	cfg = SETFIELD(NX_CRB_IQ_ASYM, cfg, CFG_CRB_IQ_ASYM);
@@ -221,8 +233,11 @@  static int nx_cfg_ee(u32 gcid, u64 xcfg)
 	int rc;
 
 	rc = xscom_read(gcid, xcfg, &cfg);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM EE config read failure %d\n",
+		 gcid, rc);
 		return rc;
+	}
 
 	cfg = SETFIELD(NX_EE_CFG_CH7, cfg, EE_CH7);
 	cfg = SETFIELD(NX_EE_CFG_CH6, cfg, EE_CH6);
diff --git a/hw/nx-rng.c b/hw/nx-rng.c
index dc419cb..65ee594 100644
--- a/hw/nx-rng.c
+++ b/hw/nx-rng.c
@@ -49,12 +49,18 @@  void nx_create_rng_node(struct dt_node *node)
 	}
 
 	rc = xscom_read(gcid, xbar, &bar); /* Get RNG BAR */
-	if (rc)
-		return;	/* Hope xscom always prints error message */
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM RNG BAR read failure %d\n",
+			 gcid, rc);
+		return;
+	}
 
 	rc = xscom_read(gcid, xcfg, &cfg); /* Get RNG CFG */
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM RNG config read failure %d\n",
+			 gcid, rc);
 		return;
+	}
 
 	/*
 	 * We mask in-place rather than using GETFIELD for the base address
@@ -80,13 +86,20 @@  void nx_create_rng_node(struct dt_node *node)
 
 	/* RNG must be enabled before MMIO is enabled */
 	rc = xscom_write(gcid, xcfg, cfg | NX_RNG_CFG_ENABLE);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM RNG config enable failure %d\n",
+			 gcid, rc);
 		return;
+	}
 
 	/* The BAR needs to be enabled too */
 	rc = xscom_write(gcid, xbar, bar | NX_RNG_BAR_ENABLE);
-	if (rc)
+	if (rc) {
+                prerror("NX%d: ERROR: XSCOM RNG config enable failure %d\n",
+			 gcid, rc);
 		return;
+	}
+
 	rng = dt_new_addr(dt_root, "hwrng", rng_addr);
 	if (!rng)
 		return;