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

Daniel M Crowell dcrowell at us.ibm.com
Tue Jun 6 13:27:26 AEST 2017


Looks good to me.

--
Dan Crowell
Senior Software Engineer - Power Systems Enablement Firmware
IBM Rochester: t/l 553-2987
dcrowell at us.ibm.com



From:   Jeremy Kerr <jk at ozlabs.org>
To:     skiboot at lists.ozlabs.org
Cc:     Dan Crowell <dcrowell at us.ibm.com>, Frederic Bonnard 
<FREDERIC at fr.ibm.com>, Jeremy Kerr <jk at ozlabs.org>
Date:   06/05/2017 08:05 PM
Subject:        [PATCH v3 05/12] opal-prd: interpret log level prefixes 
from HBRT



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





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/skiboot/attachments/20170605/75a13102/attachment.html>


More information about the Skiboot mailing list