From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KlsmM-0002ow-Mr for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:42 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KlsmJ-0002oI-NB for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:42 -0400 Received: from [199.232.76.173] (port=51469 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KlsmJ-0002o5-FF for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:39 -0400 Received: from e33.co.us.ibm.com ([32.97.110.151]:36323) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KlsmI-0007LA-Oe for qemu-devel@nongnu.org; Fri, 03 Oct 2008 18:05:39 -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 m93M5b9s002208 for ; Fri, 3 Oct 2008 18:05:37 -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 m93M5bUY123012 for ; Fri, 3 Oct 2008 16:05:37 -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 m93M5aNh001141 for ; Fri, 3 Oct 2008 16:05:36 -0600 From: Ryan Harper Date: Fri, 3 Oct 2008 17:05:28 -0500 Message-Id: <1223071531-31817-2-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 1/4] lsi_queue_command: add dma direction parameter 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 changes lsi_queue_command to take a parameter indicating whether the queue'ed command is a read or write. This is needed because the lsi device may change phase we've recorded the type of operation. Signed-off-by: Ryan Harper diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 53a2add..5c161a1 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -494,7 +494,7 @@ static void lsi_do_dma(LSIState *s, int out) /* Add a command to the queue. */ -static void lsi_queue_command(LSIState *s) +static void lsi_queue_command(LSIState *s, int out) { lsi_queue *p; @@ -506,7 +506,9 @@ static void lsi_queue_command(LSIState *s) p = &s->queue[s->active_commands++]; p->tag = s->current_tag; p->pending = 0; - p->out = (s->sstat1 & PHASE_MASK) == PHASE_DO; + /* the device may change state before we can queue the command + * the caller knows if the command is input/output */ + p->out = out; } /* Queue a byte for a MSG IN phase. */ @@ -654,7 +656,7 @@ static void lsi_do_command(LSIState *s) /* wait data */ lsi_set_phase(s, PHASE_MI); s->msg_action = 1; - lsi_queue_command(s); + lsi_queue_command(s, 0); } else { /* wait command complete */ lsi_set_phase(s, PHASE_DI);