[v2,14/15] opal/hmi: Generate hmi event for recovered HDEC parity error.

Message ID 152390006973.2566.12036488100857139008.stgit@jupiter.in.ibm.com
State Accepted
Headers show
Series
  • opal/hmi: Rework HMI handling.
Related show

Commit Message

Mahesh J Salgaonkar April 16, 2018, 5:34 p.m.
From: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
---
 core/hmi.c        |    5 ++---
 hw/chiptod.c      |   11 +++++++----
 include/chiptod.h |    2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)

Patch

diff --git a/core/hmi.c b/core/hmi.c
index 9b98fbd98..53cb84712 100644
--- a/core/hmi.c
+++ b/core/hmi.c
@@ -1019,10 +1019,9 @@  static int handle_all_core_tfac_error(uint64_t tfmr, uint64_t *out_flags)
 	hmi_rendez_vous(2);
 
 	/* We can now clear the error conditions in the core. */
-	if (!tfmr_clear_core_errors(tfmr)) {
-		recover = 0;
+	recover = tfmr_clear_core_errors(tfmr);
+	if (recover == 0)
 		goto error_out;
-	}
 
 	/* Third rendez-vous. We could in theory do the timebase resync as
 	 * part of the previous one, but I prefer having all the error
diff --git a/hw/chiptod.c b/hw/chiptod.c
index 28ed8973a..df1274ca8 100644
--- a/hw/chiptod.c
+++ b/hw/chiptod.c
@@ -1491,18 +1491,21 @@  void tfmr_cleanup_core_errors(uint64_t tfmr)
 	}
 }
 
-bool tfmr_clear_core_errors(uint64_t tfmr)
+int tfmr_clear_core_errors(uint64_t tfmr)
 {
 	uint64_t tfmr_reset_errors = 0;
 
-	if (tfmr & SPR_TFMR_HDEC_PARITY_ERROR)
-		tfmr_reset_errors |= SPR_TFMR_HDEC_PARITY_ERROR;
+	/* return -1 if there is nothing to be fixed. */
+	if (!(tfmr & SPR_TFMR_HDEC_PARITY_ERROR))
+		return -1;
+
+	tfmr_reset_errors |= SPR_TFMR_HDEC_PARITY_ERROR;
 
 	/* Write TFMR twice to clear the error */
 	mtspr(SPR_TFMR, base_tfmr | tfmr_reset_errors);
 	mtspr(SPR_TFMR, base_tfmr | tfmr_reset_errors);
 
-	return true;
+	return 1;
 }
 
 /*
diff --git a/include/chiptod.h b/include/chiptod.h
index 5860e34d2..3717e6674 100644
--- a/include/chiptod.h
+++ b/include/chiptod.h
@@ -33,7 +33,7 @@  extern int chiptod_recover_tb_errors(bool *out_resynced);
 extern bool tfmr_recover_local_errors(uint64_t tfmr);
 extern bool recover_corrupt_tfmr(void);
 extern void tfmr_cleanup_core_errors(uint64_t tfmr);
-extern bool tfmr_clear_core_errors(uint64_t tfmr);
+extern int tfmr_clear_core_errors(uint64_t tfmr);
 extern void chiptod_reset_tb(void);
 extern bool chiptod_adjust_topology(enum chiptod_topology topo, bool enable);
 extern bool chiptod_capp_timebase_sync(unsigned int chip_id, uint32_t tfmr_addr,