[Skiboot] [PATCH v3 05/12] opal-prd: interpret log level prefixes from HBRT

Jeremy Kerr jk at ozlabs.org
Tue Jun 6 11:05:02 AEST 2017


Interpret the (optional) *_MRK log prefixes on HBRT messages, and set
the syslog log priority to suit.

Signed-off-by: Jeremy Kerr <jk at ozlabs.org>

---
v3:
  Parse priority from HBRT log prefixes

---
 external/opal-prd/opal-prd.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index d3c83b7..7113a35 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -270,7 +270,25 @@ extern int call_run_command(int argc, const char **argv, char **o_outString);
 
 void hservice_puts(const char *str)
 {
-	pr_log(LOG_INFO, "HBRT: %s", str);
+	int priority = LOG_INFO;
+
+	/* Interpret the 2-character ERR_MRK/FAIL_MRK/WARN_MRK prefixes that
+	 * may be present on HBRT log messages, and bump the log priority as
+	 * appropriate.
+	 */
+	if (strlen(str) >= 2 && str[1] == '>') {
+		switch (str[0]) {
+		case 'E':
+		case 'F':
+			priority = LOG_ERR;
+			break;
+		case 'W':
+			priority = LOG_WARNING;
+			break;
+		}
+	}
+
+	pr_log(priority, "HBRT: %s", str);
 }
 
 void hservice_assert(void)
-- 
2.7.4



More information about the Skiboot mailing list