From patchwork Sat Jan 8 20:20:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 77988 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E46D5B6EF1 for ; Sun, 9 Jan 2011 07:35:49 +1100 (EST) Received: from localhost ([127.0.0.1]:46732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbfVq-000511-Jf for incoming@patchwork.ozlabs.org; Sat, 08 Jan 2011 15:35:46 -0500 Received: from [140.186.70.92] (port=59565 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbfMH-0006UM-VM for qemu-devel@nongnu.org; Sat, 08 Jan 2011 15:26:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbfHx-00032M-6T for qemu-devel@nongnu.org; Sat, 08 Jan 2011 15:21:30 -0500 Received: from mtagate4.uk.ibm.com ([194.196.100.164]:42945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbfHw-00031t-RK for qemu-devel@nongnu.org; Sat, 08 Jan 2011 15:21:25 -0500 Received: from d06nrmr1806.portsmouth.uk.ibm.com (d06nrmr1806.portsmouth.uk.ibm.com [9.149.39.193]) by mtagate4.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p08KLKBU032167 for ; Sat, 8 Jan 2011 20:21:20 GMT Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p08KLGEJ3670058 for ; Sat, 8 Jan 2011 20:21:23 GMT Received: from d06av06.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p08KLDvl014208 for ; Sat, 8 Jan 2011 13:21:14 -0700 Received: from stefanha-thinkpad.ibm.com (sig-9-145-244-153.de.ibm.com [9.145.244.153]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p08KLDku014199; Sat, 8 Jan 2011 13:21:13 -0700 From: Stefan Hajnoczi To: Date: Sat, 8 Jan 2011 20:20:59 +0000 Message-Id: <1294518059-8102-1-git-send-email-stefanha@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.2.3 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Paul Brook , Stefan Hajnoczi Subject: [Qemu-devel] [RFC][PATCH] lsi53c895a: Update dnad when skipping MSGOUT bytes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Update not only dbc but also dnad when skipping bytes during the MSGOUT phase. Previously only dbc was updated which is probably wrong and could lead to bogus message codes being read. Signed-off-by: Stefan Hajnoczi Reviewed-by: Nicholas A. Bellinger --- I don't know the LSI SCSI code well but it seems odd that only dbc is updated but the actual address isn't bumped when skipping bytes. Unfortunately I cannot test this because I don't know how to trigger SDTR/WDTR extended messages. Any ideas? Came across this issue while looking into the following bug report: https://bugs.launchpad.net/qemu/+bug/697510 hw/lsi53c895a.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 0129ae3..c73f60a 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -842,6 +842,13 @@ static uint8_t lsi_get_msgbyte(LSIState *s) return data; } +/* Skip the next n bytes during a MSGOUT phase. */ +static void lsi_skip_msgbytes(LSIState *s, unsigned int n) +{ + s->dnad += n; + s->dbc -= n; +} + static void lsi_do_msgout(LSIState *s) { uint8_t msg; @@ -869,11 +876,11 @@ static void lsi_do_msgout(LSIState *s) switch (msg) { case 1: DPRINTF("SDTR (ignored)\n"); - s->dbc -= 2; + lsi_skip_msgbytes(s, 2); break; case 3: DPRINTF("WDTR (ignored)\n"); - s->dbc -= 1; + lsi_skip_msgbytes(s, 1); break; default: goto bad;