From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KlsmP-0002pv-4A for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:45 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KlsmL-0002ob-Ca for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:42 -0400 Received: from [199.232.76.173] (port=51471 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlsmL-0002oY-3C for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:41 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:36342) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KlsmK-0007Lq-GC for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:40 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e33.co.us.ibm.com (8.13.8/8.13.8) with ESMTP id m93M5dAq002224 for ; Fri, 3 Oct 2008 18:05:39 -0400 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m93M5caD077988 for ; Fri, 3 Oct 2008 16:05:38 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m93M5cV7001250 for ; Fri, 3 Oct 2008 16:05:38 -0600 From: Ryan Harper Date: Fri, 3 Oct 2008 17:05:29 -0500 Message-Id: <1223071531-31817-3-git-send-email-ryanh@us.ibm.com> In-Reply-To: <1223071531-31817-1-git-send-email-ryanh@us.ibm.com> References: <1223071531-31817-1-git-send-email-ryanh@us.ibm.com> Subject: [Qemu-devel] [PATCH 2/4] Refactor lsi_do_command to queue read and write ops Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Ryan Harper , kvm@vger.kernel.org The patch refactors lsi_do_command to queue both read and write operations where previously the code only queue'ed read operations. Signed-off-by: Ryan Harper diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 5c161a1..5c0535c 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -649,18 +649,23 @@ static void lsi_do_command(LSIState *s) } if (!s->command_complete) { - if (n) { - /* Command did not complete immediately so disconnect. */ - lsi_add_msg_byte(s, 2); /* SAVE DATA POINTER */ - lsi_add_msg_byte(s, 4); /* DISCONNECT */ - /* wait data */ - lsi_set_phase(s, PHASE_MI); - s->msg_action = 1; - lsi_queue_command(s, 0); - } else { - /* wait command complete */ + if (n == 0) { + /* not a read or write command, just wait on completion */ lsi_set_phase(s, PHASE_DI); + return; } + + /* read or write command that did not complete immediately so + * inject a disconnect message, and queue the command */ + lsi_add_msg_byte(s, 2); /* SAVE DATA POINTER */ + lsi_add_msg_byte(s, 4); /* DISCONNECT */ + /* wait data */ + lsi_set_phase(s, PHASE_MI); + s->msg_action = 1; + if (n > 0) /* read operation */ + lsi_queue_command(s, 0); + else /* write operation */ + lsi_queue_command(s, 1); } }