From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=50851 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OW3yl-0004Uf-SB for qemu-devel@nongnu.org; Tue, 06 Jul 2010 04:58:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OW3yi-0004fP-02 for qemu-devel@nongnu.org; Tue, 06 Jul 2010 04:58:10 -0400 Received: from thoth.sbs.de ([192.35.17.2]:21690) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OW3yh-0004eu-Lr for qemu-devel@nongnu.org; Tue, 06 Jul 2010 04:58:07 -0400 Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by thoth.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id o668w3U9024576 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 6 Jul 2010 10:58:04 +0200 Received: from [139.25.109.167] (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail3.siemens.de (8.12.11.20060308/8.12.11) with ESMTP id o668w3SK007096 for ; Tue, 6 Jul 2010 10:58:03 +0200 Message-ID: <4C32F01B.7080101@siemens.com> Date: Tue, 06 Jul 2010 10:58:03 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH] scsi: Fix SCSI bus reset List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel When the controller raises the SCSI reset line, we have to perform the requested reset on all disks attached to the controller's bus. Moreover, reset is edge triggered, so avoid repeating it if the line was already high. Signed-off-by: Jan Kiszka --- hw/lsi53c895a.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c index 9a37fed..249c6bf 100644 --- a/hw/lsi53c895a.c +++ b/hw/lsi53c895a.c @@ -1590,8 +1590,19 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) BADF("Immediate Arbritration not implemented\n"); } if (val & LSI_SCNTL1_RST) { - s->sstat0 |= LSI_SSTAT0_RST; - lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0); + if (!(s->sstat0 & LSI_SSTAT0_RST)) { + DeviceState *dev; + int id; + + for (id = 0; id < s->bus.ndev; id++) { + if (s->bus.devs[id]) { + dev = &s->bus.devs[id]->qdev; + dev->info->reset(dev); + } + } + s->sstat0 |= LSI_SSTAT0_RST; + lsi_script_scsi_interrupt(s, LSI_SIST0_RST, 0); + } } else { s->sstat0 &= ~LSI_SSTAT0_RST; } -- 1.7.1