From patchwork Fri Feb 20 07:01:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 441841 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 AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4873B14017C for ; Fri, 20 Feb 2015 18:02:29 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 28BCA1A0EA4 for ; Fri, 20 Feb 2015 18:02:29 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id C207F1A0310 for ; Fri, 20 Feb 2015 18:02:25 +1100 (AEDT) Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Feb 2015 17:02:22 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 20 Feb 2015 17:02:21 +1000 Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 737172CE804E for ; Fri, 20 Feb 2015 18:02:20 +1100 (EST) Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t1K72CFL35717328 for ; Fri, 20 Feb 2015 18:02:20 +1100 Received: from d23av02.au.ibm.com (localhost [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t1K71klp005040 for ; Fri, 20 Feb 2015 18:01:46 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av02.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t1K71koD004571; Fri, 20 Feb 2015 18:01:46 +1100 Received: from localhost (haven.au.ibm.com [9.192.253.15]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id 7B32AA016E; Fri, 20 Feb 2015 18:01:23 +1100 (AEDT) From: Alistair Popple To: skiboot@lists.ozlabs.org Date: Fri, 20 Feb 2015 18:01:19 +1100 Message-Id: <1424415680-21726-1-git-send-email-alistair@popple.id.au> X-Mailer: git-send-email 1.8.3.2 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15022007-0029-0000-0000-00000125F987 Subject: [Skiboot] [PATCH 1/2] bt: Improve error messages X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.18 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" Most of the error messages in the bt layer don't report enough information to assist with debugging. This patch standardises the information reported when the bt layer encounters an error such as a timeout. It also fixes a problem where expired messages would produce a spurious warning about an incorrect netfn. Signed-off-by: Alistair Popple --- hw/bt.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/bt.c b/hw/bt.c index 3adcd85..3278896 100644 --- a/hw/bt.c +++ b/hw/bt.c @@ -66,6 +66,10 @@ #define BT_QUEUE_DEBUG 0 +#define BT_ERR(msg, fmt, args...) \ + do { prerror("BT seq 0x%02x cmd 0x%02x: " fmt "\n", \ + (msg)->seq, (msg)->ipmi_msg.cmd, ##args); } while(0) + enum bt_states { BT_STATE_IDLE = 0, BT_STATE_RESP_WAIT, @@ -133,7 +137,7 @@ static void bt_msg_del(struct bt_msg *bt_msg) { list_del(&bt_msg->link); bt.queue_len--; - ipmi_cmd_done(bt_msg->ipmi_msg.cmd, bt_msg->ipmi_msg.netfn + 1, + ipmi_cmd_done(bt_msg->ipmi_msg.cmd, bt_msg->ipmi_msg.netfn + (1 << 2), IPMI_TIMEOUT_ERR, &bt_msg->ipmi_msg); } @@ -169,7 +173,7 @@ static void bt_send_msg(void) ipmi_msg = &bt_msg->ipmi_msg; if (!bt_idle()) { - prerror("BT: Interface in an unexpected state, attempting reset\n"); + BT_ERR(bt_msg, "Interface in unexpected state, attempting reset\n"); bt_reset_interface(); unlock(&bt.lock); return; @@ -262,7 +266,7 @@ static void bt_get_resp(void) * bt_inb(BT_HOST2BMC) < BT_MIN_RESP_LEN (which should never occur). */ if (resp_len > ipmi_msg->resp_size) { - prerror("BT: Invalid resp_len %d for ipmi_msg->cmd = 0x%02x\n", resp_len, ipmi_msg->cmd); + BT_ERR(bt_msg, "Invalid resp_len %d", resp_len); resp_len = ipmi_msg->resp_size; cc = IPMI_ERR_MSG_TRUNCATED; } @@ -301,7 +305,7 @@ static void bt_expire_old_msg(void) bt_msg = list_top(&bt.msgq, struct bt_msg, link); if (bt_msg && bt_msg->tb > 0 && (bt_msg->tb + BT_MSG_TIMEOUT) < tb) { - prerror("BT: Expiring old messsage number 0x%02x\n", bt_msg->seq); + BT_ERR(bt_msg, "Timeout sending message"); bt_msg_del(bt_msg); /* Timing out a message is inherently racy as the BMC @@ -391,9 +395,10 @@ static void bt_add_msg(struct bt_msg *bt_msg) if (bt.queue_len > BT_MAX_QUEUE_LEN) { /* Maximum ueue lenght exceeded - remove the oldest message from the queue. */ - prerror("BT: Maximum queue length exceeded\n"); + BT_ERR(bt_msg, "Maximum queue length exceeded"); bt_msg = list_tail(&bt.msgq, struct bt_msg, link); assert(bt_msg); + BT_ERR(bt_msg, "Removed from queue"); bt_msg_del(bt_msg); } }