From patchwork Tue Jan 24 19:56:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jack Miller X-Patchwork-Id: 719359 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v7Jqb0nrpz9sxN for ; Wed, 25 Jan 2017 06:57:15 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3v7JqZ71Y2zDq9d for ; Wed, 25 Jan 2017 06:57:14 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3v7JqT4XRczDq9m for ; Wed, 25 Jan 2017 06:57:09 +1100 (AEDT) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v0OJrixp071167 for ; Tue, 24 Jan 2017 14:57:07 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0b-001b2d01.pphosted.com with ESMTP id 28667mwdyk-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 24 Jan 2017 14:57:06 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 24 Jan 2017 12:57:05 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 24 Jan 2017 12:57:02 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 1006A3E4003E; Tue, 24 Jan 2017 12:57:02 -0700 (MST) Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v0OJv29i12059118; Tue, 24 Jan 2017 12:57:02 -0700 Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E33D66E03D; Tue, 24 Jan 2017 12:57:01 -0700 (MST) Received: from localhost (unknown [9.24.25.178]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP id CCF026E040; Tue, 24 Jan 2017 12:57:01 -0700 (MST) From: Jack Miller To: skiboot@lists.ozlabs.org Date: Tue, 24 Jan 2017 13:56:49 -0600 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170124195649.7741-1-jack@codezen.org> References: <20170124195649.7741-1-jack@codezen.org> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17012419-0028-0000-0000-000006DE55B8 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006491; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000200; SDB=6.00812143; UDB=6.00396041; IPR=6.00589560; BA=6.00005085; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014031; XFM=3.00000011; UTC=2017-01-24 19:57:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17012419-0029-0000-0000-000032FE1AD8 Message-Id: <20170124195649.7741-2-jack@codezen.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-01-24_14:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701240123 Subject: [Skiboot] [PATCH] external/opal-prd: Split HBRT puts() into separate log file X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Simple patch to keep excessive hostboot noise out of syslog. Signed-off-by: Jack Miller --- external/opal-prd/opal-prd.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c index 1723924..26efa22 100644 --- a/external/opal-prd/opal-prd.c +++ b/external/opal-prd/opal-prd.c @@ -78,6 +78,7 @@ struct opal_prd_ctx { bool debug; struct pnor pnor; char *hbrt_file_name; + int hbrt_log_fd; bool use_syslog; bool expert_mode; void (*vlog)(int, const char *, va_list); @@ -117,6 +118,8 @@ static const int ipmi_timeout_ms = 5000; static const char *devicetree_base = "/sys/firmware/devicetree/base"; +static const char *hbrt_log_path = "/var/log/hbrt.log"; + /* Memory error handling */ static const char *mem_offline_soft = "/sys/devices/system/memory/soft_offline_page"; @@ -259,7 +262,21 @@ 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 len, rc; + + if (ctx->hbrt_log_fd < 0) { + pr_log(LOG_INFO, "HBRT: %s", str); + return; + } + + len = strlen(str); + rc = write(ctx->hbrt_log_fd, str, len); + + if (len != rc) + pr_log(LOG_WARNING, "Failed to write to HBRT log: %s\n", strerror(errno)); + + write(ctx->hbrt_log_fd, "\n", 1); + fsync(ctx->hbrt_log_fd); } void hservice_assert(void) @@ -1588,6 +1605,7 @@ static int run_prd_daemon(struct opal_prd_ctx *ctx) ctx->fd = -1; ctx->socket = -1; + ctx->hbrt_log_fd = -1; i2c_init(); @@ -1618,7 +1636,6 @@ static int run_prd_daemon(struct opal_prd_ctx *ctx) goto out_close; } - if (ctx->hbrt_file_name) { rc = map_hbrt_file(ctx, ctx->hbrt_file_name); if (rc) { @@ -1639,6 +1656,10 @@ static int run_prd_daemon(struct opal_prd_ctx *ctx) pr_debug("IMAGE: hbrt map at %p, size 0x%zx", ctx->code_addr, ctx->code_size); + ctx->hbrt_log_fd = open(hbrt_log_path, O_WRONLY | O_CREAT | O_APPEND); + if (ctx->hbrt_log_fd < 0) + pr_log(LOG_WARNING, "Failed to open HBRT log file: %s\n", strerror(errno)); + fixup_hinterface_table(); rc = pnor_init(&ctx->pnor); @@ -1676,6 +1697,8 @@ out_close: close(ctx->fd); if (ctx->socket != -1) close(ctx->socket); + if (ctx->hbrt_log_fd != -1) + close(ctx->hbrt_log_fd); return rc; }