From patchwork Tue May 5 05:01:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 467924 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 8AA5D140A98 for ; Tue, 5 May 2015 15:02:42 +1000 (AEST) Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 766471A07BD for ; Tue, 5 May 2015 15:02:42 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e23smtp03.au.ibm.com (e23smtp03.au.ibm.com [202.81.31.145]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 59EFE1A066D for ; Tue, 5 May 2015 15:02:37 +1000 (AEST) Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 May 2015 15:02:35 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 May 2015 15:02:33 +1000 Received: from d23relay07.au.ibm.com (d23relay07.au.ibm.com [9.190.26.37]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id 08C5E3578048 for ; Tue, 5 May 2015 15:02:33 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay07.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t4552KdZ20840562 for ; Tue, 5 May 2015 15:02:28 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t4551ucE012577 for ; Tue, 5 May 2015 15:01:56 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t4551uBD011892; Tue, 5 May 2015 15:01:56 +1000 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 3327BA01A8; Tue, 5 May 2015 15:01:32 +1000 (AEST) From: Alistair Popple To: skiboot@lists.ozlabs.org Date: Tue, 5 May 2015 15:01:30 +1000 Message-Id: <1430802090-28445-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: 15050505-0009-0000-0000-000001574658 Subject: [Skiboot] [PATCH] bt: Remove B_BUSY state 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" The bt layer used to cache the value of B_BUSY in the state machine, assuming that once B_BUSY was cleared by the BMC that it would never be set by the BMC again unless a message was sent to the bt interface. This was mostly true for the AMI firmware except when the BMC reboots which causes B_BUSY to be set. There may also be additional circumstances which set B_BUSY. Therefore the bt layer must check B_BUSY is clear before sending a message making the B_BUSY state superfluous. Signed-off-by: Alistair Popple --- hw/bt.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/hw/bt.c b/hw/bt.c index 8bb44cd..9f84e55 100644 --- a/hw/bt.c +++ b/hw/bt.c @@ -78,7 +78,6 @@ enum bt_states { BT_STATE_IDLE = 0, BT_STATE_RESP_WAIT, - BT_STATE_B_BUSY, }; struct bt_msg { @@ -149,7 +148,7 @@ static void bt_init_interface(void) /* Take care of a stable H_BUSY if any */ bt_set_h_busy(false); - bt_set_state(BT_STATE_B_BUSY); + bt_set_state(BT_STATE_IDLE); } static void bt_reset_interface(void) @@ -172,13 +171,6 @@ static void bt_send_msg(void) ipmi_msg = &bt_msg->ipmi_msg; - if (!bt_idle()) { - BT_ERR(bt_msg, "Interface in unexpected state, attempting reset\n"); - bt_reset_interface(); - unlock(&bt.lock); - return; - } - /* Send the message */ bt_outb(BT_CTRL_CLR_WR_PTR, BT_CTRL); @@ -253,7 +245,7 @@ static void bt_get_resp(void) /* A response to a message we no longer care about. */ prlog(PR_INFO, "BT: Nobody cared about a response to an BT/IPMI message\n"); bt_flush_msg(); - bt_set_state(BT_STATE_B_BUSY); + bt_set_state(BT_STATE_IDLE); return; } @@ -276,7 +268,7 @@ static void bt_get_resp(void) ipmi_msg->data[i] = bt_inb(BT_HOST2BMC); bt_set_h_busy(false); - bt_set_state(BT_STATE_B_BUSY); + bt_set_state(BT_STATE_IDLE); list_del(&bt_msg->link); bt.queue_len--; @@ -350,8 +342,8 @@ static void print_debug_queue_info(void) {} static void bt_send_and_unlock(void) { - if (lpc_ok() && - bt.state == BT_STATE_IDLE && !list_empty(&bt.msgq)) + if (lpc_ok() && bt_idle() && !list_empty(&bt.msgq) + && bt.state == BT_STATE_IDLE) bt_send_msg(); unlock(&bt.lock); @@ -379,10 +371,6 @@ static void bt_poll(struct timer *t __unused, void *data __unused) (bt_ctrl & BT_CTRL_B2H_ATN)) bt_get_resp(); - /* We need to wait for B_BUSY to clear */ - if (bt.state == BT_STATE_B_BUSY && bt_idle()) - bt_set_state(BT_STATE_IDLE); - /* Check for sms_atn */ if (bt_inb(BT_CTRL) & BT_CTRL_SMS_ATN) { bt_outb(BT_CTRL_SMS_ATN, BT_CTRL); @@ -540,7 +528,7 @@ void bt_init(void) * The iBT interface comes up in the busy state until the daemon has * initialised it. */ - bt_set_state(BT_STATE_B_BUSY); + bt_set_state(BT_STATE_IDLE); list_head_init(&bt.msgq); bt.queue_len = 0;